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
This commit is contained in:
Lukas Matena 2022-06-17 12:40:13 +02:00
parent 4079eac29a
commit 570b43941e
3 changed files with 9 additions and 3 deletions

View File

@ -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 <memory>

View File

@ -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.

View File

@ -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;