porymap/src/ui/aboutporymap.cpp

29 lines
824 B
C++
Raw Normal View History

#include "aboutporymap.h"
#include "ui_aboutporymap.h"
2022-09-05 04:41:42 +01:00
#include "log.h"
AboutPorymap::AboutPorymap(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::AboutPorymap)
{
ui->setupUi(this);
}
AboutPorymap::~AboutPorymap()
{
delete ui;
}
2022-08-31 18:38:07 +01:00
// Returns the Porymap version number as a list of ints with the order {major, minor, patch}
QList<int> AboutPorymap::getVersionNumbers()
{
// Get the version string "#.#.#"
static const QRegularExpression regex("Version (\\d+)\\.(\\d+)\\.(\\d+)");
2022-08-31 18:38:07 +01:00
QRegularExpressionMatch match = regex.match(ui->label_Version->text());
2022-09-05 04:41:42 +01:00
if (!match.hasMatch()) {
logError("Failed to locate Porymap version text");
2022-08-31 18:38:07 +01:00
return QList<int>({0, 0, 0});
2022-09-05 04:41:42 +01:00
}
2022-08-31 18:38:07 +01:00
return QList<int>({match.captured(1).toInt(), match.captured(2).toInt(), match.captured(3).toInt()});
}