diff options
| author | Christoph Berg <myon@debian.org> | 2026-06-22 12:03:44 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-06-22 12:03:44 +0200 |
| commit | d83a420f0517d7fc47aeb288a6a0cf4891784fcc (patch) | |
| tree | 6d9c83527c56458a8360ba080bf5f4ca73d526dc /revision_utils.cpp | |
| parent | 4b089ae3f7e9e2d5662f718f663b26a4e8ee63ca (diff) | |
New upstream version 3.0.2+dfsgupstream/3.0.2+dfsg
Diffstat (limited to 'revision_utils.cpp')
| -rw-r--r-- | revision_utils.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/revision_utils.cpp b/revision_utils.cpp index 2406288e..9c8f6964 100644 --- a/revision_utils.cpp +++ b/revision_utils.cpp @@ -4,6 +4,7 @@ #include <QCoreApplication> #include <QRegularExpression> +#include <QSysInfo> #include "scs_version.h" @@ -64,6 +65,25 @@ QString revision (QString const& scs_rev_string) return result.trimmed (); } +QString display_revision () +{ + auto build_revision = revision (); + +#if defined (CMAKE_BUILD) && defined (WSJT_SOURCE_REVISION) + QString source_revision {WSJT_SOURCE_REVISION}; + if (!source_revision.isEmpty ()) + { + source_revision = source_revision.left (6); + if (source_revision != build_revision.left (6)) + { + return QString {"source %1 (build %2)"}.arg (source_revision, build_revision); + } + } +#endif + + return build_revision; +} + QString version (bool include_patch) { #if defined (CMAKE_BUILD) @@ -83,3 +103,15 @@ QString program_title (QString const& revision) QString id {QCoreApplication::applicationName () + " v" + QCoreApplication::applicationVersion ()}; return id + " " + revision ; } + +QString http_user_agent () +{ + // See User-Agent format definition https://www.rfc-editor.org/rfc/rfc9110#name-user-agent + QString const platform { + "(" + QSysInfo::prettyProductName () + "; " + + QSysInfo::productType () + " " + QSysInfo::productVersion () + "; " + + QSysInfo::currentCpuArchitecture () + "; " + + QString {"rv:%1"}.arg (QSysInfo::kernelVersion ()) + ")"}; + + return QString {"WSJT-X/" + version () + "_" + revision ()}.simplified () + " " + platform; +} |
