From 570b43941e1bcf797840bd2ecc7bd21dfe0995db Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 17 Jun 2022 12:40:13 +0200 Subject: [PATCH] Fixed title label when run as G-Code Viewer: Builds that were not tagged and contained number of commits since last tag showed "-UNKNOWN" in the title bar, even when they went through the build server --- src/libslic3r/libslic3r.h | 1 - src/slic3r/GUI/MainFrame.cpp | 4 +++- src/slic3r/GUI/SysInfoDialog.cpp | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/libslic3r.h b/src/libslic3r/libslic3r.h index 06cad840e5..3ee8acfc39 100644 --- a/src/libslic3r/libslic3r.h +++ b/src/libslic3r/libslic3r.h @@ -4,7 +4,6 @@ #include "libslic3r_version.h" #define GCODEVIEWER_APP_NAME "PrusaSlicer G-code Viewer" #define GCODEVIEWER_APP_KEY "PrusaSlicerGcodeViewer" -#define GCODEVIEWER_BUILD_ID std::string("PrusaSlicer G-code Viewer-") + std::string(SLIC3R_VERSION) + std::string("-UNKNOWN") // this needs to be included early for MSVC (listing it in Build.PL is not enough) #include diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index cde7a05a22..ab96c69fc5 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -637,7 +637,9 @@ void MainFrame::update_title() } } - std::string build_id = wxGetApp().is_editor() ? SLIC3R_BUILD_ID : GCODEVIEWER_BUILD_ID; + std::string build_id = SLIC3R_BUILD_ID; + if (! wxGetApp().is_editor()) + boost::replace_first(build_id, SLIC3R_APP_NAME, GCODEVIEWER_APP_NAME); 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. diff --git a/src/slic3r/GUI/SysInfoDialog.cpp b/src/slic3r/GUI/SysInfoDialog.cpp index 06cf2b73dd..92868cd4e0 100644 --- a/src/slic3r/GUI/SysInfoDialog.cpp +++ b/src/slic3r/GUI/SysInfoDialog.cpp @@ -40,7 +40,12 @@ std::string get_main_info(bool format_as_html) if (!format_as_html) out << b_start << (wxGetApp().is_editor() ? SLIC3R_APP_NAME : GCODEVIEWER_APP_NAME) << b_end << line_end; out << b_start << "Version: " << b_end << SLIC3R_VERSION << line_end; - out << b_start << "Build: " << b_end << (wxGetApp().is_editor() ? SLIC3R_BUILD_ID : GCODEVIEWER_BUILD_ID) << line_end; + + std::string build_id = SLIC3R_BUILD_ID; + if (! wxGetApp().is_editor()) + boost::replace_first(build_id, SLIC3R_APP_NAME, GCODEVIEWER_APP_NAME); + out << b_start << "Build: " << b_end << build_id << line_end; + out << line_end; out << b_start << "Operating System: " << b_end << wxPlatformInfo::Get().GetOperatingSystemFamilyName() << line_end; out << b_start << "System Architecture: " << b_end << wxPlatformInfo::Get().GetArchName() << line_end;