diff --git a/resources/web/homepage/js/home.js b/resources/web/homepage/js/home.js index 8547954df2..d92f0db093 100644 --- a/resources/web/homepage/js/home.js +++ b/resources/web/homepage/js/home.js @@ -21,6 +21,7 @@ var RightBtnFilePath=''; var MousePosX=0; var MousePosY=0; +var sImages = {}; function Set_RecentFile_MouseRightBtn_Event() { @@ -183,10 +184,11 @@ function ShowRecentFileList( pList ) { let OneFile=pList[n]; - let sImg=OneFile["image"]; let sPath=OneFile['path']; + let sImg=OneFile["image"] || sImages[sPath]; let sTime=OneFile['time']; let sName=OneFile['project_name']; + sImages[sPath] = sImg; //let index=sPath.lastIndexOf('\\')>0?sPath.lastIndexOf('\\'):sPath.lastIndexOf('\/'); //let sShortName=sPath.substring(index+1,sPath.length); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 0f0ef83542..d9e290df98 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -3751,7 +3751,7 @@ std::string GUI_App::handle_web_request(std::string cmd) else if (command_str.compare("get_recent_projects") == 0) { if (mainframe) { if (mainframe->m_webview) { - mainframe->m_webview->SendRecentList(from_u8(sequence_id.value())); + mainframe->m_webview->SendRecentList(INT_MAX); } } } diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index f164579c26..186077f042 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -2615,7 +2615,7 @@ void MainFrame::set_max_recent_count(int max) } wxGetApp().app_config->set_recent_projects(recent_projects); wxGetApp().app_config->save(); - m_webview->SendRecentList(""); + m_webview->SendRecentList(-1); } } @@ -3082,7 +3082,7 @@ void MainFrame::add_to_recent_projects(const wxString& filename) } wxGetApp().app_config->set_recent_projects(recent_projects); wxGetApp().app_config->save(); - m_webview->SendRecentList(""); + m_webview->SendRecentList(0); } } @@ -3136,7 +3136,7 @@ inline void MainFrame::FileHistory::SetMaxFiles(int max) RemoveFileFromHistory(--numFiles); } -void MainFrame::get_recent_projects(boost::property_tree::wptree &tree) +void MainFrame::get_recent_projects(boost::property_tree::wptree &tree, int images) { for (size_t i = 0; i < m_recent_projects.GetCount(); ++i) { boost::property_tree::wptree item; @@ -3148,8 +3148,10 @@ void MainFrame::get_recent_projects(boost::property_tree::wptree &tree) if (!ec) { std::wstring time = wxDateTime(t).FormatISOCombined(' ').ToStdWstring(); item.put(L"time", time); - auto thumbnail = m_recent_projects.GetThumbnailUrl(i); - if (!thumbnail.empty()) item.put(L"image", thumbnail); + if (i <= images) { + auto thumbnail = m_recent_projects.GetThumbnailUrl(i); + if (!thumbnail.empty()) item.put(L"image", thumbnail); + } } else { item.put(L"time", _L("File is missing")); } @@ -3182,7 +3184,7 @@ void MainFrame::open_recent_project(size_t file_id, wxString const & filename) } wxGetApp().app_config->set_recent_projects(recent_projects); wxGetApp().app_config->save(); - m_webview->SendRecentList(""); + m_webview->SendRecentList(-1); } } } @@ -3206,7 +3208,7 @@ void MainFrame::remove_recent_project(size_t file_id, wxString const &filename) } wxGetApp().app_config->set_recent_projects(recent_projects); wxGetApp().app_config->save(); - m_webview->SendRecentList(""); + m_webview->SendRecentList(-1); } void MainFrame::load_url(wxString url) diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index d0742a335a..71eff94629 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -318,7 +318,7 @@ public: bool save_project_as(const wxString& filename = wxString()); void add_to_recent_projects(const wxString& filename); - void get_recent_projects(boost::property_tree::wptree & tree); + void get_recent_projects(boost::property_tree::wptree &tree, int images); void open_recent_project(size_t file_id, wxString const & filename); void remove_recent_project(size_t file_id, wxString const &filename); diff --git a/src/slic3r/GUI/WebViewDialog.cpp b/src/slic3r/GUI/WebViewDialog.cpp index 3ab93b5325..4a9a1eb11d 100644 --- a/src/slic3r/GUI/WebViewDialog.cpp +++ b/src/slic3r/GUI/WebViewDialog.cpp @@ -414,12 +414,12 @@ void WebViewPanel::OnFreshLoginStatus(wxTimerEvent &event) Slic3r::GUI::wxGetApp().get_login_info(); } -void WebViewPanel::SendRecentList(wxString const &sequence_id) +void WebViewPanel::SendRecentList(int images) { boost::property_tree::wptree req; boost::property_tree::wptree data; - wxGetApp().mainframe->get_recent_projects(data); - req.put(L"sequence_id", sequence_id); + wxGetApp().mainframe->get_recent_projects(data, images); + req.put(L"sequence_id", ""); req.put(L"command", L"get_recent_projects"); req.put_child(L"response", data); std::wostringstream oss; diff --git a/src/slic3r/GUI/WebViewDialog.hpp b/src/slic3r/GUI/WebViewDialog.hpp index 5fa3a0ede5..0470a7b644 100644 --- a/src/slic3r/GUI/WebViewDialog.hpp +++ b/src/slic3r/GUI/WebViewDialog.hpp @@ -93,7 +93,7 @@ public: void OnFreshLoginStatus(wxTimerEvent &event); public: - void SendRecentList(wxString const &sequence_id); + void SendRecentList(int images); void SendDesignStaffpick(NetworkAgent *agent); void SendLoginInfo(); void ShowNetpluginTip();