mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
FIX: [STUDIO-2865] only send changed thubmails to home page
Change-Id: I88ae0dd3a47c4cf02bf97978a22fd72ed0ef0299
This commit is contained in:
parent
1cde1ebaed
commit
dfd049374c
6 changed files with 18 additions and 14 deletions
|
@ -21,6 +21,7 @@ var RightBtnFilePath='';
|
||||||
|
|
||||||
var MousePosX=0;
|
var MousePosX=0;
|
||||||
var MousePosY=0;
|
var MousePosY=0;
|
||||||
|
var sImages = {};
|
||||||
|
|
||||||
function Set_RecentFile_MouseRightBtn_Event()
|
function Set_RecentFile_MouseRightBtn_Event()
|
||||||
{
|
{
|
||||||
|
@ -183,10 +184,11 @@ function ShowRecentFileList( pList )
|
||||||
{
|
{
|
||||||
let OneFile=pList[n];
|
let OneFile=pList[n];
|
||||||
|
|
||||||
let sImg=OneFile["image"];
|
|
||||||
let sPath=OneFile['path'];
|
let sPath=OneFile['path'];
|
||||||
|
let sImg=OneFile["image"] || sImages[sPath];
|
||||||
let sTime=OneFile['time'];
|
let sTime=OneFile['time'];
|
||||||
let sName=OneFile['project_name'];
|
let sName=OneFile['project_name'];
|
||||||
|
sImages[sPath] = sImg;
|
||||||
|
|
||||||
//let index=sPath.lastIndexOf('\\')>0?sPath.lastIndexOf('\\'):sPath.lastIndexOf('\/');
|
//let index=sPath.lastIndexOf('\\')>0?sPath.lastIndexOf('\\'):sPath.lastIndexOf('\/');
|
||||||
//let sShortName=sPath.substring(index+1,sPath.length);
|
//let sShortName=sPath.substring(index+1,sPath.length);
|
||||||
|
|
|
@ -3751,7 +3751,7 @@ std::string GUI_App::handle_web_request(std::string cmd)
|
||||||
else if (command_str.compare("get_recent_projects") == 0) {
|
else if (command_str.compare("get_recent_projects") == 0) {
|
||||||
if (mainframe) {
|
if (mainframe) {
|
||||||
if (mainframe->m_webview) {
|
if (mainframe->m_webview) {
|
||||||
mainframe->m_webview->SendRecentList(from_u8(sequence_id.value()));
|
mainframe->m_webview->SendRecentList(INT_MAX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2615,7 +2615,7 @@ void MainFrame::set_max_recent_count(int max)
|
||||||
}
|
}
|
||||||
wxGetApp().app_config->set_recent_projects(recent_projects);
|
wxGetApp().app_config->set_recent_projects(recent_projects);
|
||||||
wxGetApp().app_config->save();
|
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->set_recent_projects(recent_projects);
|
||||||
wxGetApp().app_config->save();
|
wxGetApp().app_config->save();
|
||||||
m_webview->SendRecentList("");
|
m_webview->SendRecentList(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3136,7 +3136,7 @@ inline void MainFrame::FileHistory::SetMaxFiles(int max)
|
||||||
RemoveFileFromHistory(--numFiles);
|
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) {
|
for (size_t i = 0; i < m_recent_projects.GetCount(); ++i) {
|
||||||
boost::property_tree::wptree item;
|
boost::property_tree::wptree item;
|
||||||
|
@ -3148,8 +3148,10 @@ void MainFrame::get_recent_projects(boost::property_tree::wptree &tree)
|
||||||
if (!ec) {
|
if (!ec) {
|
||||||
std::wstring time = wxDateTime(t).FormatISOCombined(' ').ToStdWstring();
|
std::wstring time = wxDateTime(t).FormatISOCombined(' ').ToStdWstring();
|
||||||
item.put(L"time", time);
|
item.put(L"time", time);
|
||||||
auto thumbnail = m_recent_projects.GetThumbnailUrl(i);
|
if (i <= images) {
|
||||||
if (!thumbnail.empty()) item.put(L"image", thumbnail);
|
auto thumbnail = m_recent_projects.GetThumbnailUrl(i);
|
||||||
|
if (!thumbnail.empty()) item.put(L"image", thumbnail);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
item.put(L"time", _L("File is missing"));
|
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->set_recent_projects(recent_projects);
|
||||||
wxGetApp().app_config->save();
|
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->set_recent_projects(recent_projects);
|
||||||
wxGetApp().app_config->save();
|
wxGetApp().app_config->save();
|
||||||
m_webview->SendRecentList("");
|
m_webview->SendRecentList(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainFrame::load_url(wxString url)
|
void MainFrame::load_url(wxString url)
|
||||||
|
|
|
@ -318,7 +318,7 @@ public:
|
||||||
bool save_project_as(const wxString& filename = wxString());
|
bool save_project_as(const wxString& filename = wxString());
|
||||||
|
|
||||||
void add_to_recent_projects(const wxString& filename);
|
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 open_recent_project(size_t file_id, wxString const & filename);
|
||||||
void remove_recent_project(size_t file_id, wxString const &filename);
|
void remove_recent_project(size_t file_id, wxString const &filename);
|
||||||
|
|
||||||
|
|
|
@ -414,12 +414,12 @@ void WebViewPanel::OnFreshLoginStatus(wxTimerEvent &event)
|
||||||
Slic3r::GUI::wxGetApp().get_login_info();
|
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 req;
|
||||||
boost::property_tree::wptree data;
|
boost::property_tree::wptree data;
|
||||||
wxGetApp().mainframe->get_recent_projects(data);
|
wxGetApp().mainframe->get_recent_projects(data, images);
|
||||||
req.put(L"sequence_id", sequence_id);
|
req.put(L"sequence_id", "");
|
||||||
req.put(L"command", L"get_recent_projects");
|
req.put(L"command", L"get_recent_projects");
|
||||||
req.put_child(L"response", data);
|
req.put_child(L"response", data);
|
||||||
std::wostringstream oss;
|
std::wostringstream oss;
|
||||||
|
|
|
@ -93,7 +93,7 @@ public:
|
||||||
void OnFreshLoginStatus(wxTimerEvent &event);
|
void OnFreshLoginStatus(wxTimerEvent &event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void SendRecentList(wxString const &sequence_id);
|
void SendRecentList(int images);
|
||||||
void SendDesignStaffpick(NetworkAgent *agent);
|
void SendDesignStaffpick(NetworkAgent *agent);
|
||||||
void SendLoginInfo();
|
void SendLoginInfo();
|
||||||
void ShowNetpluginTip();
|
void ShowNetpluginTip();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue