FIX:modify "load_project" api

jira: none
Change-Id: I41471a2f02dab3532621974a24693b019adb22bf
This commit is contained in:
zhou.xu 2024-12-10 12:32:32 +08:00 committed by lane.wei
parent 3a344fa934
commit 77922a9da4
2 changed files with 12 additions and 8 deletions

View File

@ -9081,7 +9081,7 @@ int Plater::new_project(bool skip_confirm, bool silent, const wxString &project_
// BBS: FIXME, missing resotre logic // BBS: FIXME, missing resotre logic
void Plater::load_project(wxString const& filename2, int Plater::load_project(wxString const &filename2,
wxString const& originfile) wxString const& originfile)
{ {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "filename is: " << filename2 << "and originfile is: " << originfile; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "filename is: " << filename2 << "and originfile is: " << originfile;
@ -9098,9 +9098,9 @@ void Plater::load_project(wxString const& filename2,
}; };
// BSS: save project, force close // BSS: save project, force close
int result; int wx_dlg_id = close_with_confirm(check);
if ((result = close_with_confirm(check)) == wxID_CANCEL) { if (wx_dlg_id == wxID_CANCEL) {
return; return wx_dlg_id;
} }
//BBS: add only gcode mode //BBS: add only gcode mode
@ -9111,7 +9111,7 @@ void Plater::load_project(wxString const& filename2,
//some error cases happens //some error cases happens
//return directly //return directly
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": current loading other project, return directly"); BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": current loading other project, return directly");
return; return wx_dlg_id;
} }
else else
m_loading_project = true; m_loading_project = true;
@ -9199,6 +9199,7 @@ void Plater::load_project(wxString const& filename2,
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " load project done"; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " load project done";
m_loading_project = false; m_loading_project = false;
return wx_dlg_id;
} }
// BBS: save logic // BBS: save logic
@ -9461,7 +9462,10 @@ void Plater::import_model_id(wxString download_info)
if (download_ok) { if (download_ok) {
BOOST_LOG_TRIVIAL(trace) << "import_model_id: target_path = " << target_path.string(); BOOST_LOG_TRIVIAL(trace) << "import_model_id: target_path = " << target_path.string();
/* load project */ /* load project */
this->load_project(target_path.wstring()); auto result = this->load_project(target_path.wstring());
if (result == (int)wxID_CANCEL) {
return;
}
/*BBS set project info after load project, project info is reset in load project */ /*BBS set project info after load project, project info is reset in load project */
//p->project.project_model_id = model_id; //p->project.project_model_id = model_id;
//p->project.project_design_id = design_id; //p->project.project_design_id = design_id;

View File

@ -235,7 +235,7 @@ public:
int new_project(bool skip_confirm = false, bool silent = false, const wxString &project_name = wxString()); int new_project(bool skip_confirm = false, bool silent = false, const wxString &project_name = wxString());
// BBS: save & backup // BBS: save & backup
void load_project(wxString const & filename = "", wxString const & originfile = "-"); int load_project(wxString const & filename = "", wxString const & originfile = "-");
int save_project(bool saveAs = false); int save_project(bool saveAs = false);
//BBS download project by project id //BBS download project by project id
void import_model_id(wxString download_info); void import_model_id(wxString download_info);