diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp index 2a09ae180..82848d5e3 100644 --- a/src/slic3r/GUI/AboutDialog.cpp +++ b/src/slic3r/GUI/AboutDialog.cpp @@ -244,10 +244,11 @@ AboutDialog::AboutDialog() // version { vesizer->Add(0, FromDIP(165), 1, wxEXPAND, FromDIP(5)); + auto version_text = GUI_App::format_display_version(); #if BBL_INTERNAL_TESTING - auto version_string = _L("Internal Version") + " " + std::string(SLIC3R_VERSION); + auto version_string = _L("Internal Version") + " " + std::string(version_text); #else - auto version_string = _L("Version") + " " + std::string(SLIC3R_VERSION); + auto version_string = _L("Version") + " " + std::string(version_text); #endif wxStaticText* version = new wxStaticText(this, wxID_ANY, version_string.c_str(), wxDefaultPosition, wxDefaultSize); wxFont version_font = GetFont(); @@ -416,7 +417,7 @@ void AboutDialog::onCopyrightBtn(wxEvent &) void AboutDialog::onCopyToClipboard(wxEvent&) { wxTheClipboard->Open(); - wxTheClipboard->SetData(new wxTextDataObject(_L("Version") + " " + std::string(SLIC3R_VERSION))); + wxTheClipboard->SetData(new wxTextDataObject(_L("Version") + " " + GUI_App::format_display_version())); wxTheClipboard->Close(); } diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index e3f686281..7d01ed576 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -386,7 +386,7 @@ private: title = wxGetApp().is_editor() ? SLIC3R_APP_FULL_NAME : GCODEVIEWER_APP_NAME; // dynamically get the version to display - version = _L("V") + " " + std::string(SLIC3R_VERSION); + version = _L("V") + " " + GUI_App::format_display_version(); // credits infornation credits = ""; @@ -554,10 +554,11 @@ private: title = wxGetApp().is_editor() ? SLIC3R_APP_FULL_NAME : GCODEVIEWER_APP_NAME; // dynamically get the version to display + auto version_text = GUI_App::format_display_version(); #if BBL_INTERNAL_TESTING - version = _L("Internal Version") + " " + std::string(SLIC3R_VERSION); + version = _L("Internal Version") + " " + std::string(version_text); #else - version = _L("Version") + " " + std::string(SLIC3R_VERSION); + version = _L("Version") + " " + std::string(version_text); #endif // credits infornation @@ -3619,6 +3620,25 @@ void GUI_App::no_new_version() GUI::wxGetApp().QueueEvent(evt); } +std::string GUI_App::version_display = ""; +std::string GUI_App::format_display_version() +{ + if (!version_display.empty()) return version_display; + + auto version_text = std::string(SLIC3R_VERSION); + int len = version_text.length(); + for (int i = 0, j = 0; i < len; ++i) { + if (!(version_text[i] == '0' && j == 0)) + version_display += version_text[i]; + + if (version_text[i] == '.') + j = 0; + else + ++j; + } + return version_display; +} + void GUI_App::show_dialog(wxString msg) { wxCommandEvent* evt = new wxCommandEvent(EVT_SHOW_DIALOG); diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index b77d3ec9e..868acb52c 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -266,6 +266,7 @@ private: std::shared_ptr m_upgrade_network_job; VersionInfo version_info; + static std::string version_display; HMSQuery *hms_query { nullptr }; boost::thread m_sync_update_thread; @@ -397,6 +398,7 @@ public: void enter_force_upgrade(); void set_skip_version(bool skip = true); void no_new_version(); + static std::string format_display_version(); void show_dialog(wxString msg); void reload_settings(); void remove_user_presets();