Merge pull request #609 from GriffinRichards/commit-version

Include latest commit hash in version info
This commit is contained in:
GriffinR 2024-12-23 14:58:06 -05:00 committed by GitHub
commit 9efbe53238
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 97 additions and 108 deletions

View file

@ -1,117 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>AboutPorymap</class> <class>AboutPorymap</class>
<widget class="QMainWindow" name="AboutPorymap"> <widget class="QDialog" name="AboutPorymap">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>582</width> <width>383</width>
<height>438</height> <height>121</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>About Porymap</string> <string>About Porymap</string>
</property> </property>
<widget class="QWidget" name="centralwidget"> <layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout"> <item>
<item> <widget class="QLabel" name="label_Title">
<widget class="QLabel" name="label_Title"> <property name="font">
<property name="font"> <font>
<font> <family>Arial</family>
<family>Arial</family> <pointsize>22</pointsize>
<pointsize>22</pointsize> <bold>true</bold>
<weight>75</weight> <underline>false</underline>
<bold>true</bold> <kerning>true</kerning>
<underline>false</underline> </font>
<kerning>true</kerning> </property>
</font> <property name="text">
</property> <string>Porymap</string>
<property name="text"> </property>
<string>Porymap</string> <property name="textFormat">
</property> <enum>Qt::TextFormat::RichText</enum>
<property name="textFormat"> </property>
<enum>Qt::RichText</enum> <property name="alignment">
</property> <set>Qt::AlignmentFlag::AlignCenter</set>
<property name="alignment"> </property>
<set>Qt::AlignCenter</set> </widget>
</property> </item>
</widget> <item>
</item> <widget class="QLabel" name="label_Version">
<item> <property name="sizePolicy">
<widget class="QLabel" name="label_Version"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<property name="sizePolicy"> <horstretch>0</horstretch>
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <verstretch>0</verstretch>
<horstretch>0</horstretch> </sizepolicy>
<verstretch>0</verstretch> </property>
</sizepolicy> <property name="font">
</property> <font>
<property name="font"> <family>Arial</family>
<font> <pointsize>12</pointsize>
<family>Arial</family> </font>
<pointsize>12</pointsize> </property>
</font> <property name="alignment">
</property> <set>Qt::AlignmentFlag::AlignCenter</set>
<property name="alignment"> </property>
<set>Qt::AlignCenter</set> </widget>
</property> </item>
</widget> <item>
</item> <widget class="QLabel" name="label_Description">
<item> <property name="font">
<widget class="QLabel" name="label_Description"> <font>
<property name="font"> <family>Arial</family>
<font> </font>
<family>Arial</family> </property>
</font> <property name="text">
</property> <string>Map editor for pokeemerald, pokefirered and pokeruby.</string>
<property name="text"> </property>
<string>Map editor for pokeemerald, pokefirered and pokeruby.</string> <property name="alignment">
</property> <set>Qt::AlignmentFlag::AlignCenter</set>
<property name="alignment"> </property>
<set>Qt::AlignCenter</set> </widget>
</property> </item>
</widget> <item>
</item> <widget class="QLabel" name="label_Manual">
<item> <property name="text">
<widget class="QLabel" name="label_Manual"> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Official Documentation: &lt;a href=&quot;https://huderlem.github.io/porymap/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0069d9;&quot;&gt;https://huderlem.github.io/porymap/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<property name="text"> </property>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Official Documentation: &lt;a href=&quot;https://huderlem.github.io/porymap/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0069d9;&quot;&gt;https://huderlem.github.io/porymap/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <property name="alignment">
</property> <set>Qt::AlignmentFlag::AlignCenter</set>
<property name="alignment"> </property>
<set>Qt::AlignCenter</set> <property name="openExternalLinks">
</property> <bool>true</bool>
<property name="openExternalLinks"> </property>
<bool>true</bool> </widget>
</property> </item>
</widget> </layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="textBrowser">
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>582</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>

View file

@ -3,13 +3,13 @@
#include <QString> #include <QString>
#include <QRegularExpression> #include <QRegularExpression>
#include <QMainWindow> #include <QDialog>
namespace Ui { namespace Ui {
class AboutPorymap; class AboutPorymap;
} }
class AboutPorymap : public QMainWindow class AboutPorymap : public QDialog
{ {
public: public:
explicit AboutPorymap(QWidget *parent = nullptr); explicit AboutPorymap(QWidget *parent = nullptr);

View file

@ -20,6 +20,16 @@ RC_ICONS = resources/icons/porymap-icon-2.ico
ICON = resources/icons/porymap.icns ICON = resources/icons/porymap.icns
QMAKE_CXXFLAGS += -std=c++17 -Wall QMAKE_CXXFLAGS += -std=c++17 -Wall
QMAKE_TARGET_BUNDLE_PREFIX = com.pret QMAKE_TARGET_BUNDLE_PREFIX = com.pret
# Get latest commit hash if we can (to display alongside version information).
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 VERSION = 5.4.1
DEFINES += PORYMAP_VERSION=\\\"$$VERSION\\\" DEFINES += PORYMAP_VERSION=\\\"$$VERSION\\\"

View file

@ -1,16 +1,23 @@
#include "aboutporymap.h" #include "aboutporymap.h"
#include "ui_aboutporymap.h" #include "ui_aboutporymap.h"
#include "log.h"
AboutPorymap::AboutPorymap(QWidget *parent) : AboutPorymap::AboutPorymap(QWidget *parent) :
QMainWindow(parent), QDialog(parent),
ui(new Ui::AboutPorymap) ui(new Ui::AboutPorymap)
{ {
ui->setupUi(this); ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
this->ui->label_Version->setText(QString("Version %1 - %2").arg(QCoreApplication::applicationVersion()).arg(QStringLiteral(__DATE__))); static const QString commitHash = PORYMAP_LATEST_COMMIT;
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__))
);
layout()->setSizeConstraint(QLayout::SetFixedSize);
} }
AboutPorymap::~AboutPorymap() AboutPorymap::~AboutPorymap()