ENH: remove placeholder '0' in version display
Change-Id: I6c0ffdd229a630a48a676c12a8f124f7a6e39f09
This commit is contained in:
parent
99eee4a2d6
commit
e22115bf9c
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -266,6 +266,7 @@ private:
|
|||
std::shared_ptr<UpgradeNetworkJob> 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();
|
||||
|
|
Loading…
Reference in New Issue