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
This commit is contained in:
Jaye Evins
2025-12-03 20:43:37 -05:00
committed by GitHub
parent 98b3e32bfd
commit 44a10fc796
9 changed files with 105 additions and 24 deletions
+8 -3
View File
@@ -128,17 +128,22 @@ jobs:
- name: Test (Ubuntu) - name: Test (Ubuntu)
if: startsWith( matrix.os, 'ubuntu-' ) if: startsWith( matrix.os, 'ubuntu-' )
working-directory: ${{ steps.strings.outputs.build-output-dir }} 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) - name: Test (Windows)
if: startsWith( matrix.os, 'windows-' ) if: startsWith( matrix.os, 'windows-' )
working-directory: ${{ steps.strings.outputs.build-output-dir }} 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) - name: Test (MacOS)
if: startsWith( matrix.os, 'macos-' ) if: startsWith( matrix.os, 'macos-' )
working-directory: ${{ steps.strings.outputs.build-output-dir }} 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 # - name: Tmate
# uses: mxschmitt/action-tmate@v3 # uses: mxschmitt/action-tmate@v3
+9
View File
@@ -142,11 +142,20 @@ int main( int argc, char **argv )
parser.addOptions( options ); parser.addOptions( options );
parser.addHelpOption(); parser.addHelpOption();
parser.addVersionOption(); parser.addVersionOption();
parser.addOption( { { "V", "Version" }, QCoreApplication::translate( "main", "More detailed version information." ) } );
parser.addPositionalArgument( "file", parser.addPositionalArgument( "file",
QCoreApplication::translate( "main", "gLabels project file to print." ), QCoreApplication::translate( "main", "gLabels project file to print." ),
"file" ); "file" );
parser.process( app ); 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 // Parse variable definitions from command line, if any
// //
+1 -16
View File
@@ -23,9 +23,6 @@
#include "model/Version.h" #include "model/Version.h"
#include <QDesktopServices> #include <QDesktopServices>
#include <QGuiApplication>
#include <QLocale>
#include <QSysInfo>
#include <QUrl> #include <QUrl>
#include <QtDebug> #include <QtDebug>
@@ -58,19 +55,7 @@ namespace glabels
p2Label->setText( QString( "<p>%1</p>" ).arg( directionsP2 ) ); p2Label->setText( QString( "<p>%1</p>" ).arg( directionsP2 ) );
infoText->append( "> GLABELS" ); infoText->append( model::Version::details() );
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() );
QString directionsP3 = QString directionsP3 =
tr( "Be sure to include a detailed description of the problem and how to " tr( "Be sure to include a detailed description of the problem and how to "
+10 -1
View File
@@ -31,11 +31,11 @@
#include <QApplication> #include <QApplication>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QDebug>
#include <QIcon> #include <QIcon>
#include <QLibraryInfo> #include <QLibraryInfo>
#include <QLocale> #include <QLocale>
#include <QTranslator> #include <QTranslator>
#include <QtDebug>
int main( int argc, char **argv ) int main( int argc, char **argv )
@@ -82,11 +82,20 @@ int main( int argc, char **argv )
parser.setApplicationDescription( QCoreApplication::translate( "main", "gLabels Label Designer" ) ); parser.setApplicationDescription( QCoreApplication::translate( "main", "gLabels Label Designer" ) );
parser.addHelpOption(); parser.addHelpOption();
parser.addVersionOption(); parser.addVersionOption();
parser.addOption( { { "V", "Version" }, QCoreApplication::translate( "main", "More detailed version information." ) } );
parser.addPositionalArgument( "files", parser.addPositionalArgument( "files",
QCoreApplication::translate( "main", "gLabels project files to open, optionally." ), QCoreApplication::translate( "main", "gLabels project files to open, optionally." ),
"[files...]" ); "[files...]" );
parser.process( app ); parser.process( app );
// Handle verbose version option
if ( parser.isSet( "Version" ) )
{
qInfo().noquote() << glabels::model::Version::details();
return 0;
}
// //
// Initialize subsystems // Initialize subsystems
// //
+5 -4
View File
@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>586</width> <width>586</width>
<height>675</height> <height>730</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@@ -119,7 +119,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>400</width> <width>400</width>
<height>250</height> <height>290</height>
</size> </size>
</property> </property>
<property name="acceptRichText"> <property name="acceptRichText">
@@ -151,7 +151,8 @@
<string>Copy</string> <string>Copy</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="glabels-edit-copy"/> <iconset theme="glabels-edit-copy">
<normaloff>.</normaloff>.</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@@ -200,7 +201,7 @@
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>118</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
+1
View File
@@ -59,6 +59,7 @@ set (Model_sources
Units.cpp Units.cpp
Variable.cpp Variable.cpp
Variables.cpp Variables.cpp
Version.cpp
Vendor.cpp Vendor.cpp
XmlCategoryParser.cpp XmlCategoryParser.cpp
XmlLabelCreator.cpp XmlLabelCreator.cpp
+62
View File
@@ -0,0 +1,62 @@
/* Version.cpp
*
* Copyright (C) 2025 Jaye Evins <evins@snaught.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "Version.h"
#include <QGuiApplication>
#include <QLibraryInfo>
#include <QLocale>
#include <QSysInfo>
#include <QTextStream>
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;
}
}
}
+5
View File
@@ -22,6 +22,9 @@
#define model_Version_h #define model_Version_h
#include <QString>
namespace glabels namespace glabels
{ {
namespace model namespace model
@@ -42,6 +45,8 @@ namespace glabels
const QString STRING = "@VERSION_STRING@"; const QString STRING = "@VERSION_STRING@";
const QString LONG_STRING = "@LONG_VERSION_STRING@"; const QString LONG_STRING = "@LONG_VERSION_STRING@";
QString details();
} }
} }
+4
View File
@@ -2888,5 +2888,9 @@
<source>gLabels project files to open, optionally.</source> <source>gLabels project files to open, optionally.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>More detailed version information.</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>