Skip to content

Commit

Permalink
Merge pull request #609 from GriffinRichards/commit-version
Browse files Browse the repository at this point in the history
Include latest commit hash in version info
  • Loading branch information
GriffinRichards authored Dec 23, 2024
2 parents 298306c + 01e586b commit 9efbe53
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 108 deletions.
176 changes: 74 additions & 102 deletions forms/aboutporymap.ui
Original file line number Diff line number Diff line change
@@ -1,117 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutPorymap</class>
<widget class="QMainWindow" name="AboutPorymap">
<widget class="QDialog" name="AboutPorymap">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>582</width>
<height>438</height>
<width>383</width>
<height>121</height>
</rect>
</property>
<property name="windowTitle">
<string>About Porymap</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_Title">
<property name="font">
<font>
<family>Arial</family>
<pointsize>22</pointsize>
<weight>75</weight>
<bold>true</bold>
<underline>false</underline>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Porymap</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Version">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Description">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>Map editor for pokeemerald, pokefirered and pokeruby.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Manual">
<property name="text">
<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>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</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"/>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_Title">
<property name="font">
<font>
<family>Arial</family>
<pointsize>22</pointsize>
<bold>true</bold>
<underline>false</underline>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>Porymap</string>
</property>
<property name="textFormat">
<enum>Qt::TextFormat::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Version">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Description">
<property name="font">
<font>
<family>Arial</family>
</font>
</property>
<property name="text">
<string>Map editor for pokeemerald, pokefirered and pokeruby.</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Manual">
<property name="text">
<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>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
Expand Down
4 changes: 2 additions & 2 deletions include/ui/aboutporymap.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

#include <QString>
#include <QRegularExpression>
#include <QMainWindow>
#include <QDialog>

namespace Ui {
class AboutPorymap;
}

class AboutPorymap : public QMainWindow
class AboutPorymap : public QDialog
{
public:
explicit AboutPorymap(QWidget *parent = nullptr);
Expand Down
10 changes: 10 additions & 0 deletions porymap.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ 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).
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
DEFINES += PORYMAP_VERSION=\\\"$$VERSION\\\"

Expand Down
15 changes: 11 additions & 4 deletions src/ui/aboutporymap.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
#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);

this->ui->label_Version->setText(QString("Version %1 - %2").arg(QCoreApplication::applicationVersion()).arg(QStringLiteral(__DATE__)));
this->ui->textBrowser->setSource(QUrl("qrc:/CHANGELOG.md"));
static const QString commitHash = PORYMAP_LATEST_COMMIT;
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()
Expand Down

0 comments on commit 9efbe53

Please sign in to comment.