From 7c8d5d0d63710121f13edd3fc249f6ae603263ad Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 9 Sep 2024 14:49:18 -0400 Subject: [PATCH 1/5] Include latest commit hash in version info --- porymap.pro | 8 ++++++++ src/ui/aboutporymap.cpp | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/porymap.pro b/porymap.pro index f36f536f..c83dd1d7 100644 --- a/porymap.pro +++ b/porymap.pro @@ -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\\\" diff --git a/src/ui/aboutporymap.cpp b/src/ui/aboutporymap.cpp index 22c5fabc..24d76ce5 100644 --- a/src/ui/aboutporymap.cpp +++ b/src/ui/aboutporymap.cpp @@ -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")); } From 1e4ba6a668b22fdbac06c684d9f501bc1e2bfddb Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 9 Sep 2024 19:02:37 -0400 Subject: [PATCH 2/5] Silence error if build directory is not a git repository --- porymap.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/porymap.pro b/porymap.pro index c83dd1d7..69186288 100644 --- a/porymap.pro +++ b/porymap.pro @@ -22,7 +22,7 @@ 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) + LATEST_COMMIT = $$system($$GIT_PATH rev-parse --short HEAD 2>/dev/null) } DEFINES += PORYMAP_LATEST_COMMIT=\\\"$$LATEST_COMMIT\\\" From 12dba1a8b3283b5a150d57707a4494fae3b9724c Mon Sep 17 00:00:00 2001 From: GriffinR Date: Tue, 17 Dec 2024 22:02:46 -0500 Subject: [PATCH 3/5] Add Qt version to About, remove changelog --- forms/aboutporymap.ui | 176 ++++++++++++++++---------------------- include/ui/aboutporymap.h | 4 +- src/ui/aboutporymap.cpp | 17 ++-- 3 files changed, 84 insertions(+), 113 deletions(-) diff --git a/forms/aboutporymap.ui b/forms/aboutporymap.ui index f823396c..7a211e0a 100644 --- a/forms/aboutporymap.ui +++ b/forms/aboutporymap.ui @@ -1,117 +1,89 @@ AboutPorymap - + 0 0 - 582 - 438 + 383 + 121 About Porymap - - - - - - - Arial - 22 - 75 - true - false - true - - - - Porymap - - - Qt::RichText - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - Arial - 12 - - - - Qt::AlignCenter - - - - - - - - Arial - - - - Map editor for pokeemerald, pokefirered and pokeruby. - - - Qt::AlignCenter - - - - - - - <html><head/><body><p>Official Documentation: <a href="https://huderlem.github.io/porymap/"><span style=" text-decoration: underline; color:#0069d9;">https://huderlem.github.io/porymap/</span></a></p></body></html> - - - Qt::AlignCenter - - - true - - - - - - - Qt::Horizontal - - - - - - - true - - - - - - - - - 0 - 0 - 582 - 22 - - - - + + + + + + Arial + 22 + true + false + true + + + + Porymap + + + Qt::TextFormat::RichText + + + Qt::AlignmentFlag::AlignCenter + + + + + + + + 0 + 0 + + + + + Arial + 12 + + + + Qt::AlignmentFlag::AlignCenter + + + + + + + + Arial + + + + Map editor for pokeemerald, pokefirered and pokeruby. + + + Qt::AlignmentFlag::AlignCenter + + + + + + + <html><head/><body><p>Official Documentation: <a href="https://huderlem.github.io/porymap/"><span style=" text-decoration: underline; color:#0069d9;">https://huderlem.github.io/porymap/</span></a></p></body></html> + + + Qt::AlignmentFlag::AlignCenter + + + true + + + + diff --git a/include/ui/aboutporymap.h b/include/ui/aboutporymap.h index 28b06249..148fc8b1 100644 --- a/include/ui/aboutporymap.h +++ b/include/ui/aboutporymap.h @@ -3,13 +3,13 @@ #include #include -#include +#include namespace Ui { class AboutPorymap; } -class AboutPorymap : public QMainWindow +class AboutPorymap : public QDialog { public: explicit AboutPorymap(QWidget *parent = nullptr); diff --git a/src/ui/aboutporymap.cpp b/src/ui/aboutporymap.cpp index 24d76ce5..a422072f 100644 --- a/src/ui/aboutporymap.cpp +++ b/src/ui/aboutporymap.cpp @@ -1,22 +1,21 @@ #include "aboutporymap.h" #include "ui_aboutporymap.h" -#include "log.h" AboutPorymap::AboutPorymap(QWidget *parent) : - QMainWindow(parent), + QDialog(parent), ui(new Ui::AboutPorymap) { ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); - 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")); + this->ui->label_Version->setText(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__)) + ); } AboutPorymap::~AboutPorymap() From c2b27fd2a1124efddeb0ec4e13613c764582d7f6 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 18 Dec 2024 15:04:34 -0500 Subject: [PATCH 4/5] Find git on Windows --- porymap.pro | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/porymap.pro b/porymap.pro index 611b6179..6e117257 100644 --- a/porymap.pro +++ b/porymap.pro @@ -20,10 +20,12 @@ 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 2>/dev/null) +win32 { + LATEST_COMMIT = $$system(git rev-parse --short HEAD 2> nul) +} else { + LATEST_COMMIT = $$system(git rev-parse --short HEAD 2>/dev/null) } + DEFINES += PORYMAP_LATEST_COMMIT=\\\"$$LATEST_COMMIT\\\" VERSION = 5.4.1 From 01e586be626d567188ccc540b17c999c512f62a4 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 18 Dec 2024 15:57:23 -0500 Subject: [PATCH 5/5] Disable resizing the about window --- src/ui/aboutporymap.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ui/aboutporymap.cpp b/src/ui/aboutporymap.cpp index a422072f..07654e14 100644 --- a/src/ui/aboutporymap.cpp +++ b/src/ui/aboutporymap.cpp @@ -16,6 +16,8 @@ AboutPorymap::AboutPorymap(QWidget *parent) : .arg(QSysInfo::buildCpuArchitecture()) .arg(QStringLiteral(__DATE__)) ); + + layout()->setSizeConstraint(QLayout::SetFixedSize); } AboutPorymap::~AboutPorymap()