mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-28 11:36:26 -05:00
use common version function for splash and about screen
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -13,6 +13,8 @@ class AboutPorymap : public QDialog
|
||||
public:
|
||||
explicit AboutPorymap(QWidget *parent = nullptr);
|
||||
~AboutPorymap();
|
||||
|
||||
static QString getVersionString();
|
||||
private:
|
||||
Ui::AboutPorymap *ui;
|
||||
};
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user