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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
//
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
#include "model/Version.h"
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QGuiApplication>
|
||||
#include <QLocale>
|
||||
#include <QSysInfo>
|
||||
#include <QUrl>
|
||||
#include <QtDebug>
|
||||
|
||||
@@ -58,19 +55,7 @@ namespace glabels
|
||||
|
||||
p2Label->setText( QString( "<p>%1</p>" ).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 "
|
||||
|
||||
+10
-1
@@ -31,11 +31,11 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QDebug>
|
||||
#include <QIcon>
|
||||
#include <QLibraryInfo>
|
||||
#include <QLocale>
|
||||
#include <QTranslator>
|
||||
#include <QtDebug>
|
||||
|
||||
|
||||
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.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
|
||||
//
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>586</width>
|
||||
<height>675</height>
|
||||
<height>730</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -119,7 +119,7 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>250</height>
|
||||
<height>290</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="acceptRichText">
|
||||
@@ -151,7 +151,8 @@
|
||||
<string>Copy</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="glabels-edit-copy"/>
|
||||
<iconset theme="glabels-edit-copy">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
@@ -200,7 +201,7 @@
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>118</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
|
||||
@@ -59,6 +59,7 @@ set (Model_sources
|
||||
Units.cpp
|
||||
Variable.cpp
|
||||
Variables.cpp
|
||||
Version.cpp
|
||||
Vendor.cpp
|
||||
XmlCategoryParser.cpp
|
||||
XmlLabelCreator.cpp
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,6 +22,9 @@
|
||||
#define model_Version_h
|
||||
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
namespace model
|
||||
@@ -42,6 +45,8 @@ namespace glabels
|
||||
|
||||
const QString STRING = "@VERSION_STRING@";
|
||||
const QString LONG_STRING = "@LONG_VERSION_STRING@";
|
||||
|
||||
QString details();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2888,5 +2888,9 @@
|
||||
<source>gLabels project files to open, optionally.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>More detailed version information.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
Reference in New Issue
Block a user