Include latest commit hash in version info

This commit is contained in:
GriffinR 2024-09-09 14:49:18 -04:00
parent 11bd41d000
commit 7c8d5d0d63
2 changed files with 15 additions and 1 deletions

View file

@ -18,6 +18,14 @@ RC_ICONS = resources/icons/porymap-icon-2.ico
ICON = resources/icons/porymap.icns
QMAKE_CXXFLAGS += -std=c++17 -Wall
QMAKE_TARGET_BUNDLE_PREFIX = com.pret
# Get latest commit hash if we can (to display alongside version information).
GIT_PATH = $$system(which git)
!isEmpty(GIT_PATH) {
LATEST_COMMIT = $$system($$GIT_PATH rev-parse --short HEAD)
}
DEFINES += PORYMAP_LATEST_COMMIT=\\\"$$LATEST_COMMIT\\\"
VERSION = 5.4.1
DEFINES += PORYMAP_VERSION=\\\"$$VERSION\\\"

View file

@ -9,7 +9,13 @@ AboutPorymap::AboutPorymap(QWidget *parent) :
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
this->ui->label_Version->setText(QString("Version %1 - %2").arg(QCoreApplication::applicationVersion()).arg(QStringLiteral(__DATE__)));
QString versionInfo = QString("Version %1 - %2").arg(QCoreApplication::applicationVersion()).arg(QStringLiteral(__DATE__));
static const QString commitHash = PORYMAP_LATEST_COMMIT;
if (!commitHash.isEmpty())
versionInfo.append(QString("\nCommit %1").arg(commitHash));
this->ui->label_Version->setText(versionInfo);
this->ui->textBrowser->setSource(QUrl("qrc:/CHANGELOG.md"));
}