Skip to content

Commit 3d3827a

Browse files
committed
Version in the Ui use git tag
1 parent 03a4c49 commit 3d3827a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Savestate2snes.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ QT += core gui websockets
88

99
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
1010

11+
GIT_TAG_VERSION=$$system(git describe --always --tags)
12+
DEFINES += GIT_TAG_VERSION=\\\"$$GIT_TAG_VERSION\\\"
13+
1114
TARGET = Savestate2snes
1215
TEMPLATE = app
1316

main.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ int main(int argc, char *argv[])
101101
QTranslator translator;
102102
QString locale = QLocale::system().name().split('_').first();
103103
translator.load(a.applicationDirPath() + "/i18n/savestate2snes_" + locale + ".qm");
104-
QApplication::setApplicationVersion("0.6");
104+
// This is only defined in the PRO file
105+
#ifdef GIT_TAG_VERSION
106+
QString plop(GIT_TAG_VERSION);
107+
plop.remove(0, 1); // Remove the v
108+
QApplication::setApplicationVersion(QVersionNumber::fromString(plop).toString());
109+
#else
110+
QApplication::setApplicationVersion("0.99");
111+
#endif
105112
a.installTranslator(&translator);
106113
if (!settings.contains("lastSaveStateDir"))
107114
{

0 commit comments

Comments
 (0)