From 34588f365d8814f3eab4df22ce2f3222d9fca385 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 6 Feb 2020 10:17:02 +0100 Subject: [PATCH] For the builds with a label assigned (no commit after the label), show just the label in the application title. For Win32, add the " 32 bit" indicator, so that we may see clearly if somebody is running a 32bit build on 64bit windows by a mistake. --- src/slic3r/GUI/MainFrame.cpp | 19 ++++++++++++++++--- src/slic3r/GUI/MainFrame.hpp | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index b05155ef2..b730dc823 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -145,8 +145,6 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S update_ui_from_settings(); // FIXME (?) } -MainFrame::~MainFrame() = default; - void MainFrame::update_title() { wxString title = wxEmptyString; @@ -158,7 +156,22 @@ void MainFrame::update_title() if (!project.empty()) title += (project + " - "); } - title += (wxString(SLIC3R_BUILD_ID) + " " + _(L("based on Slic3r"))); + + std::string build_id = SLIC3R_BUILD_ID; + size_t idx_plus = build_id.find('+'); + if (idx_plus != build_id.npos) { + // Parse what is behind the '+'. If there is a number, then it is a build number after the label, and full build ID is shown. + int commit_after_label; + if (! boost::starts_with(build_id.data() + idx_plus + 1, "UNKNOWN") && sscanf(build_id.data() + idx_plus + 1, "%d-", &commit_after_label) == 0) { + // It is a release build. + build_id.erase(build_id.begin() + idx_plus, build_id.end()); +#if defined(_WIN32) && ! defined(_WIN64) + // People are using 32bit slicer on a 64bit machine by mistake. Make it explicit. + build_id += " 32 bit" +#endif + } + } + title += (wxString(build_id) + " " + _(L("based on Slic3r"))); SetTitle(title); } diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index 3d4818eaf..a6d0749ab 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -96,7 +96,7 @@ protected: public: MainFrame(); - ~MainFrame(); + ~MainFrame() = default; Plater* plater() { return m_plater; }