use common version function for splash and about screen

This commit is contained in:
garak
2025-04-29 15:50:55 -04:00
committed by t
parent 9a0a7865fb
commit 7fb657376d
4 changed files with 18 additions and 6 deletions

View File

@@ -47,7 +47,7 @@
</font>
</property>
<property name="text">
<string>Version 6.0.0</string>
<string>Version X.x.x</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>

View File

@@ -13,6 +13,8 @@ class AboutPorymap : public QDialog
public:
explicit AboutPorymap(QWidget *parent = nullptr);
~AboutPorymap();
static QString getVersionString();
private:
Ui::AboutPorymap *ui;
};

View File

@@ -9,15 +9,19 @@ AboutPorymap::AboutPorymap(QWidget *parent) :
setAttribute(Qt::WA_DeleteOnClose);
static const QString commitHash = PORYMAP_LATEST_COMMIT;
this->ui->label_Version->setText(QString("Version %1%2\nQt %3 (%4)\n%5")
this->ui->label_Version->setText(getVersionString());
layout()->setSizeConstraint(QLayout::SetFixedSize);
}
QString AboutPorymap::getVersionString() {
static const QString commitHash = PORYMAP_LATEST_COMMIT;
return QString("Version %1%2\nQt %3 (%4)\n%5")
.arg(QCoreApplication::applicationVersion())
.arg(commitHash.isEmpty() ? "" : QString(" (%1)").arg(commitHash))
.arg(QStringLiteral(QT_VERSION_STR))
.arg(QSysInfo::buildCpuArchitecture())
.arg(QStringLiteral(__DATE__))
);
layout()->setSizeConstraint(QLayout::SetFixedSize);
.arg(QStringLiteral(__DATE__));
}
AboutPorymap::~AboutPorymap()

View File

@@ -1,5 +1,6 @@
#include "loadingscreen.h"
#include "aboutporymap.h"
#include "ui_loadingscreen.h"
#include "qgifimage.h"
@@ -25,6 +26,11 @@ PorymapLoadingScreen::PorymapLoadingScreen(QWidget *parent) : QWidget(parent), u
}
void PorymapLoadingScreen::start() {
static bool shownVersion = false;
if (!shownVersion) {
this->ui->labelVersion->setText(AboutPorymap::getVersionString());
shownVersion = true;
}
this->timer.start(120);
this->show();
}