FIX: some bugs with media files

Change-Id: Ia5e0710a2979ae338902042e520ba9210e3a557d
This commit is contained in:
chunmao.guo 2022-08-30 18:39:29 +08:00 committed by Lane.Wei
parent 8eb9d6a863
commit 6b580d285c
2 changed files with 11 additions and 8 deletions

View File

@ -480,13 +480,13 @@ void ImageGrid::render(wxDC& dc)
if (file.IsDownload()) {
if (file.progress == -1) {
secondAction = _L("Cancel");
dc.DrawText(_L("Waiting"), pt + wxPoint{24, m_image_size.GetHeight() - 36});
dc.DrawText(_L("Waiting"), pt + wxPoint{24, m_image_size.GetHeight() - 64});
} else if (file.progress < 0) {
secondAction = _L("Retry");
dc.DrawText(_L("Failed"), pt + wxPoint{24, m_image_size.GetHeight() - 36});
dc.DrawText(_L("Failed"), pt + wxPoint{24, m_image_size.GetHeight() - 64});
} else if (file.progress >= 100) {
secondAction = _L("Open");
dc.DrawText(_L("Finished"), pt + wxPoint{24, m_image_size.GetHeight() - 36});
dc.DrawText(_L("Finished"), pt + wxPoint{24, m_image_size.GetHeight() - 64});
} else {
secondAction = _L("Cancel");
if (file.progress != m_background_progress) {
@ -567,7 +567,7 @@ void Slic3r::GUI::ImageGrid::renderButtons(wxDC &dc, wxStringList const &texts,
wxRect rect(rect2);
rect.SetWidth(rect.GetWidth() / texts.size());
int state = m_pressed ? StateColor::Pressed : StateColor::Hovered;
dc.SetFont(Label::Body_12);
dc.SetFont(Label::Body_14);
//mdc.SelectObject(m_button_background);
for (size_t i = 0; i < texts.size(); ++i) {
int states = hit == i ? state : 0;

View File

@ -290,6 +290,8 @@ void PrinterFileSystem::BuildGroups()
{
if (m_file_list.empty())
return;
m_group_year.clear();
m_group_month.clear();
wxDateTime t = wxDateTime((time_t) m_file_list.front().time);
m_group_year.push_back(0);
m_group_month.push_back(0);
@ -451,10 +453,11 @@ void PrinterFileSystem::UpdateFocusThumbnail()
wxString mimetype = resp.value("mimetype", "image/jpeg");
std::string thumbnail = resp["thumbnail"];
boost::uint32_t size = resp["size"];
wxMemoryInputStream mis(data, size);
wxImage image(mis, mimetype);
thumb.name = thumbnail;
thumb.thumbnail = image;
if (size > 0) {
wxMemoryInputStream mis(data, size);
thumb.thumbnail = wxImage(mis, mimetype);
}
return 0;
},
[this](int result, Thumbnail const &thumb) {