mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-13 20:17:49 +00:00
feature add web version on bury point
This commit is contained in:
@@ -21,7 +21,7 @@ long long get_time_timestamp()
|
|||||||
{
|
{
|
||||||
auto now = std::chrono::system_clock::now();
|
auto now = std::chrono::system_clock::now();
|
||||||
|
|
||||||
auto timestamp = std::chrono::duration_cast<std::chrono::seconds>(now.time_since_epoch()).count();
|
auto timestamp = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
|
||||||
|
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,5 +296,13 @@ void sentryReportLog(SENTRY_LOG_LEVEL logLevel,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_sentry_tags(const std::string& tag_key, const std::string& tag_value)
|
||||||
|
{
|
||||||
|
#ifdef SLIC3R_SENTRY
|
||||||
|
if (!tag_key.empty())
|
||||||
|
sentry_set_tag(tag_key.c_str(), tag_value.c_str());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ namespace Slic3r {
|
|||||||
const std::string& logTagKey = "",
|
const std::string& logTagKey = "",
|
||||||
const std::string& logTagValue = "",
|
const std::string& logTagValue = "",
|
||||||
const std::string& logTraceId = "");
|
const std::string& logTraceId = "");
|
||||||
|
|
||||||
|
void set_sentry_tags(const std::string& tag_key,const std::string& tag_value);
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
||||||
#endif // slic3r_SentryWrapper_hpp_
|
#endif // slic3r_SentryWrapper_hpp_
|
||||||
|
|||||||
@@ -1008,6 +1008,39 @@ void MainFrame::show_option(bool show)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void MainFrame::get_local_webview_version()
|
||||||
|
{
|
||||||
|
std::string versionFilePath = "";
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
wchar_t appDataPath[MAX_PATH] = {0};
|
||||||
|
auto hr = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appDataPath);
|
||||||
|
char* path = new char[MAX_PATH];
|
||||||
|
size_t pathLength;
|
||||||
|
wcstombs_s(&pathLength, path, MAX_PATH, appDataPath, MAX_PATH);
|
||||||
|
std::string filePath = path;
|
||||||
|
versionFilePath = filePath + "\\" + std::string("Snapmaker_Orca\\web\\flutter_web\\version.json");
|
||||||
|
#elif __APPLE__
|
||||||
|
const char* home_env = getenv("HOME");
|
||||||
|
versionFilePath = home_env;
|
||||||
|
versionFilePath = versionFilePath + "/Library/Application Support/Snapmaker_Orca/web/flutter_web/version.json";
|
||||||
|
#else
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
std::ifstream json_file(versionFilePath);
|
||||||
|
if (!json_file.is_open()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
nlohmann::json json_data;
|
||||||
|
json_file >> json_data;
|
||||||
|
std::string str_version = json_data["version"];
|
||||||
|
std::string str_build_number = json_data["build_number"];
|
||||||
|
|
||||||
|
std::string tag = std::string("flutter_version: ") + str_version + std::string(" ") + std::string("build_number: ") + str_build_number;
|
||||||
|
set_sentry_tags("flutter_version", tag);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void MainFrame::init_tabpanel() {
|
void MainFrame::init_tabpanel() {
|
||||||
// wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on
|
// wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on
|
||||||
@@ -1089,8 +1122,9 @@ void MainFrame::init_tabpanel() {
|
|||||||
});
|
});
|
||||||
m_tabpanel->AddPage(m_webview, "", "tab_home_active", "tab_home_active", false);
|
m_tabpanel->AddPage(m_webview, "", "tab_home_active", "tab_home_active", false);
|
||||||
m_param_panel = new ParamsPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
|
m_param_panel = new ParamsPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
get_local_webview_version();
|
||||||
m_plater = new Plater(this, this);
|
m_plater = new Plater(this, this);
|
||||||
m_plater->SetBackgroundColour(*wxWHITE);
|
m_plater->SetBackgroundColour(*wxWHITE);
|
||||||
m_plater->Hide();
|
m_plater->Hide();
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ public:
|
|||||||
void update_title_colour_after_set_title();
|
void update_title_colour_after_set_title();
|
||||||
void show_option(bool show);
|
void show_option(bool show);
|
||||||
void init_tabpanel();
|
void init_tabpanel();
|
||||||
|
void get_local_webview_version();
|
||||||
void create_preset_tabs();
|
void create_preset_tabs();
|
||||||
//BBS: GUI refactor
|
//BBS: GUI refactor
|
||||||
void add_created_tab(Tab* panel, const std::string& bmp_name = "");
|
void add_created_tab(Tab* panel, const std::string& bmp_name = "");
|
||||||
|
|||||||
Reference in New Issue
Block a user