From f0a484590bea864c546969390314a48596c8c43f Mon Sep 17 00:00:00 2001 From: Kunlong Ma Date: Tue, 26 Dec 2023 17:22:38 +0800 Subject: [PATCH] NEW: add buried point at the open method JIRA: NONE Signed-off-by: Kunlong Ma Change-Id: I2bf4269afc48b53b119a5bda24421d6a7a010379 --- src/slic3r/GUI/GUI_App.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index e978e9ccd..d87938871 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1028,6 +1028,7 @@ void GUI_App::post_init() BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " sync_user_preset: false"; } + std::string open_method = "studio"; bool switch_to_3d = false; 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://")) { 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()) { m_download_file_url = from_u8(download_url); } - + open_method = "makerworld"; } else { switch_to_3d = true; @@ -1061,6 +1061,7 @@ void GUI_App::post_init() mainframe->select_tab(size_t(MainFrame::tp3DEditor)); plater_->select_view_3D("3D"); this->plater()->load_gcode(from_u8(this->init_params->input_files.front())); + open_method = "gcode"; } else { mainframe->select_tab(size_t(MainFrame::tp3DEditor)); @@ -1071,10 +1072,31 @@ void GUI_App::post_init() } this->plater()->set_project_filename(_L("Untitled")); 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 bool slow_bootup = false; if (app_config->get("slow_bootup") == "true") {