From 5a0f9ff4f086fd0efb995e4cd67c48189a5aef8c Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Thu, 27 Jul 2023 13:28:54 +0800 Subject: [PATCH] FIX: default thumbnail type jpeg Change-Id: I3f911b74b646241c3b2449eaefe532071218af70 --- src/slic3r/GUI/Printer/PrinterFileSystem.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp index e95ae83763..5fc347dec9 100644 --- a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp +++ b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp @@ -844,6 +844,7 @@ void PrinterFileSystem::UpdateFocusThumbnail2(std::shared_ptr> } auto n = type == ModelMetadata ? std::string::npos : path.find_last_of('#'); // ModelMetadata is zipped without subpath auto path2 = n == std::string::npos ? path : path.substr(0, n); + auto subpath = n == std::string::npos ? path : path.substr(n + 1); auto iter = std::find_if(files->begin(), files->end(), [&path2](auto &f) { return f.path == path2; }); if (cont) { if (iter != files->end()) @@ -858,10 +859,12 @@ void PrinterFileSystem::UpdateFocusThumbnail2(std::shared_ptr> ParseThumbnail(file); } else { if (mimetype.empty()) { - if (!path.empty()) thumbnail = path; - auto n = thumbnail.find_last_of('.'); + if (subpath.empty()) subpath = thumbnail; + auto n = subpath.find_last_of('.'); if (n != std::string::npos) - mimetype = "image/" + thumbnail.substr(n + 1); + mimetype = "image/" + subpath.substr(n + 1); + else if (subpath == "thumbnail") + mimetype = "image/jpeg"; // default jpg } if (iter != files->end() && !iter->local_path.empty()) { iter->local_path += std::string((char *) data, size); @@ -1258,7 +1261,7 @@ void PrinterFileSystem::Reconnect(boost::unique_lock &l, int resul #ifdef PRINTER_FILE_SYSTEM_TEST PostCallback([this] { SendChangedEvent(EVT_FILE_CHANGED); }); #else - PostCallback([this] { ListAllFiles(); }); + PostCallback([this] { m_task_flags = 0; ListAllFiles(); }); #endif }