From 44a10fc796fc6537d43724ee47810fe09361a89c Mon Sep 17 00:00:00 2001 From: Jaye Evins Date: Wed, 3 Dec 2025 20:43:37 -0500 Subject: [PATCH] Make detailed version information available to command line (#257) - Moved detailed version information from ReportBugDialog to Version::details() - Added QPA Platform information to verbose version information - Added Qt version to detailed version information - Added `-V` command line option to glabels-qt and glabels-batch-qt --- .github/workflows/build-tests.yml | 11 ++++-- glabels-batch/main.cpp | 9 +++++ glabels/ReportBugDialog.cpp | 17 +-------- glabels/main.cpp | 11 +++++- glabels/ui/ReportBugDialog.ui | 9 +++-- model/CMakeLists.txt | 1 + model/Version.cpp | 62 +++++++++++++++++++++++++++++++ model/Version.h.in | 5 +++ translations/glabels_C.ts | 4 ++ 9 files changed, 105 insertions(+), 24 deletions(-) create mode 100644 model/Version.cpp diff --git a/.github/workflows/build-tests.yml b/.github/workflows/build-tests.yml index 65f83cb..afd13d3 100644 --- a/.github/workflows/build-tests.yml +++ b/.github/workflows/build-tests.yml @@ -128,17 +128,22 @@ jobs: - name: Test (Ubuntu) if: startsWith( matrix.os, 'ubuntu-' ) working-directory: ${{ steps.strings.outputs.build-output-dir }} - run: xvfb-run ctest --build-config ${{ matrix.build_type }} + run: | + xvfb-run ./glabels/glabels-qt --Version + xvfb-run ctest --build-config ${{ matrix.build_type }} - name: Test (Windows) if: startsWith( matrix.os, 'windows-' ) working-directory: ${{ steps.strings.outputs.build-output-dir }} - run: ctest --build-config ${{ matrix.build_type }} + run: | + ctest --build-config ${{ matrix.build_type }} - name: Test (MacOS) if: startsWith( matrix.os, 'macos-' ) working-directory: ${{ steps.strings.outputs.build-output-dir }} - run: ctest --build-config ${{ matrix.build_type }} + run: | + ./glabels/glabels-qt --Version + ctest --build-config ${{ matrix.build_type }} # - name: Tmate # uses: mxschmitt/action-tmate@v3 diff --git a/glabels-batch/main.cpp b/glabels-batch/main.cpp index 1b38679..a15df4e 100644 --- a/glabels-batch/main.cpp +++ b/glabels-batch/main.cpp @@ -142,11 +142,20 @@ int main( int argc, char **argv ) parser.addOptions( options ); parser.addHelpOption(); parser.addVersionOption(); + parser.addOption( { { "V", "Version" }, QCoreApplication::translate( "main", "More detailed version information." ) } ); parser.addPositionalArgument( "file", QCoreApplication::translate( "main", "gLabels project file to print." ), "file" ); parser.process( app ); + // Handle verbose version option + if ( parser.isSet( "Version" ) ) + { + qInfo().noquote() << glabels::model::Version::details(); + return 0; + } + + // // Parse variable definitions from command line, if any // diff --git a/glabels/ReportBugDialog.cpp b/glabels/ReportBugDialog.cpp index 6daeeef..a88d8e6 100644 --- a/glabels/ReportBugDialog.cpp +++ b/glabels/ReportBugDialog.cpp @@ -23,9 +23,6 @@ #include "model/Version.h" #include -#include -#include -#include #include #include @@ -58,19 +55,7 @@ namespace glabels p2Label->setText( QString( "

%1

" ).arg( directionsP2 ) ); - infoText->append( "> GLABELS" ); - infoText->append( "> Version: " + model::Version::STRING ); - infoText->append( "> " ); - - infoText->append( "> SYSTEM INFO" ); - infoText->append( "> OS: " + QSysInfo::prettyProductName() ); - infoText->append( "> Kernel: " + QSysInfo::kernelType() + " " + QSysInfo::kernelVersion() ); - infoText->append( "> Build CPU Architecture: " + QSysInfo::buildCpuArchitecture() ); - infoText->append( "> Current CPU Architecture: " + QSysInfo::currentCpuArchitecture() ); - infoText->append( "> " ); - - infoText->append( "> LOCALE" ); - infoText->append( "> Name: " + QLocale::system().name() ); + infoText->append( model::Version::details() ); QString directionsP3 = tr( "Be sure to include a detailed description of the problem and how to " diff --git a/glabels/main.cpp b/glabels/main.cpp index f2e8d85..630bd68 100644 --- a/glabels/main.cpp +++ b/glabels/main.cpp @@ -31,11 +31,11 @@ #include #include +#include #include #include #include #include -#include int main( int argc, char **argv ) @@ -82,10 +82,19 @@ int main( int argc, char **argv ) parser.setApplicationDescription( QCoreApplication::translate( "main", "gLabels Label Designer" ) ); parser.addHelpOption(); parser.addVersionOption(); + parser.addOption( { { "V", "Version" }, QCoreApplication::translate( "main", "More detailed version information." ) } ); parser.addPositionalArgument( "files", QCoreApplication::translate( "main", "gLabels project files to open, optionally." ), "[files...]" ); parser.process( app ); + + // Handle verbose version option + if ( parser.isSet( "Version" ) ) + { + qInfo().noquote() << glabels::model::Version::details(); + return 0; + } + // // Initialize subsystems diff --git a/glabels/ui/ReportBugDialog.ui b/glabels/ui/ReportBugDialog.ui index 56d7930..520026a 100644 --- a/glabels/ui/ReportBugDialog.ui +++ b/glabels/ui/ReportBugDialog.ui @@ -7,7 +7,7 @@ 0 0 586 - 675 + 730 @@ -119,7 +119,7 @@ 400 - 250 + 290 @@ -151,7 +151,8 @@ Copy - + + .. @@ -200,7 +201,7 @@ 20 - 118 + 20 diff --git a/model/CMakeLists.txt b/model/CMakeLists.txt index f9384be..da36fb4 100644 --- a/model/CMakeLists.txt +++ b/model/CMakeLists.txt @@ -59,6 +59,7 @@ set (Model_sources Units.cpp Variable.cpp Variables.cpp + Version.cpp Vendor.cpp XmlCategoryParser.cpp XmlLabelCreator.cpp diff --git a/model/Version.cpp b/model/Version.cpp new file mode 100644 index 0000000..e84b15a --- /dev/null +++ b/model/Version.cpp @@ -0,0 +1,62 @@ +/* Version.cpp + * + * Copyright (C) 2025 Jaye Evins + * + * This file is part of gLabels-qt. + * + * gLabels-qt is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * gLabels-qt is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with gLabels-qt. If not, see . + */ + + +#include "Version.h" + +#include +#include +#include +#include +#include + + +namespace glabels +{ + namespace model + { + + QString Version::details() + { + QString s; + QTextStream ts( &s ); + + ts << "> GLABELS" << "\n" + << "> Version: " << STRING << "\n" + << "> " << "\n" + + << "> SYSTEM INFO" << "\n" + << "> OS: " << QSysInfo::prettyProductName() << "\n" + << "> Kernel: " << QSysInfo::kernelType() << " " << QSysInfo::kernelVersion() << "\n" + << "> Build CPU Architecture: " << QSysInfo::buildCpuArchitecture() << "\n" + << "> Current CPU Architecture: " << QSysInfo::currentCpuArchitecture() << "\n" + << "> Qt Version: " << QLibraryInfo::version().toString() << "\n" + << "> QPA Platform: " << QGuiApplication::platformName() << "\n" + << "> " << "\n" + + << "> LOCALE" << "\n" + << "> Name: " << QLocale::system().name(); + + return s; + } + + } + +} diff --git a/model/Version.h.in b/model/Version.h.in index 6a33e99..0578b86 100644 --- a/model/Version.h.in +++ b/model/Version.h.in @@ -22,6 +22,9 @@ #define model_Version_h +#include + + namespace glabels { namespace model @@ -42,6 +45,8 @@ namespace glabels const QString STRING = "@VERSION_STRING@"; const QString LONG_STRING = "@LONG_VERSION_STRING@"; + + QString details(); } } diff --git a/translations/glabels_C.ts b/translations/glabels_C.ts index 32ce9f8..7183443 100644 --- a/translations/glabels_C.ts +++ b/translations/glabels_C.ts @@ -2888,5 +2888,9 @@ gLabels project files to open, optionally. + + More detailed version information. + +