NEW: add buried point at the open method

JIRA: NONE

Signed-off-by: Kunlong Ma <kunlong.ma@bambulab.com>
Change-Id: I2bf4269afc48b53b119a5bda24421d6a7a010379
This commit is contained in:
Kunlong Ma 2023-12-26 17:22:38 +08:00 committed by lane.wei
parent 590dce9d61
commit f0a484590b

View File

@ -1028,6 +1028,7 @@ void GUI_App::post_init()
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " sync_user_preset: false"; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " sync_user_preset: false";
} }
std::string open_method = "studio";
bool switch_to_3d = false; bool switch_to_3d = false;
if (!this->init_params->input_files.empty()) { if (!this->init_params->input_files.empty()) {
@ -1045,15 +1046,14 @@ void GUI_App::post_init()
if ( boost::starts_with(input_str, "http://") || boost::starts_with(input_str, "https://")) { if ( boost::starts_with(input_str, "http://") || boost::starts_with(input_str, "https://")) {
download_url = input_str; download_url = input_str;
} }
} }
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("download_url %1%") % download_url; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", download_url %1%") % download_url;
if (!download_url.empty()) { if (!download_url.empty()) {
m_download_file_url = from_u8(download_url); m_download_file_url = from_u8(download_url);
} }
open_method = "makerworld";
} }
else { else {
switch_to_3d = true; switch_to_3d = true;
@ -1061,6 +1061,7 @@ void GUI_App::post_init()
mainframe->select_tab(size_t(MainFrame::tp3DEditor)); mainframe->select_tab(size_t(MainFrame::tp3DEditor));
plater_->select_view_3D("3D"); plater_->select_view_3D("3D");
this->plater()->load_gcode(from_u8(this->init_params->input_files.front())); this->plater()->load_gcode(from_u8(this->init_params->input_files.front()));
open_method = "gcode";
} }
else { else {
mainframe->select_tab(size_t(MainFrame::tp3DEditor)); mainframe->select_tab(size_t(MainFrame::tp3DEditor));
@ -1071,9 +1072,30 @@ void GUI_App::post_init()
} }
this->plater()->set_project_filename(_L("Untitled")); this->plater()->set_project_filename(_L("Untitled"));
this->plater()->load_files(input_files); this->plater()->load_files(input_files);
try {
if (!input_files.empty()) {
std::string file_path = input_files.front().ToStdString();
std::filesystem::path path(file_path);
open_method = "file_" + path.extension().string();
}
}
catch (...) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ", file path exception!";
open_method = "file";
} }
} }
} }
}
try {
NetworkAgent* agent = wxGetApp().getAgent();
json j;
j["open_method"] = open_method;
if (agent) {
agent->track_event("open_method", j.dump());
}
}
catch (...) {}
//#if BBL_HAS_FIRST_PAGE //#if BBL_HAS_FIRST_PAGE
bool slow_bootup = false; bool slow_bootup = false;