Add git version to About

This commit is contained in:
woblight
2018-06-21 14:56:01 +02:00
parent cfc9693b8b
commit fc9033eb56
3 changed files with 18 additions and 2 deletions
+7 -1
View File
@@ -37,9 +37,15 @@ HEADERS += \
LIBS += -lgit2
win32 {
DEFINES += "_WIN32_WINNT=0x06010000"
DEFINES += _WIN32_WINNT=0x06010000
}
GIT_TAG = $$system(git describe --tags)
GIT_SHA = $$system(git rev-parse --short HEAD)
DEFINES += GIT_TAG=\\\"$$GIT_TAG\\\" \
GIT_SHA=\\\"$$GIT_SHA\\\"
DISTFILES += \
README.md
+2
View File
@@ -19,6 +19,7 @@
#include "control.h"
#include "addon.h"
#include <QIcon>
#include <QQmlContext>
int main(int argc, char *argv[])
{
@@ -35,6 +36,7 @@ int main(int argc, char *argv[])
return Control::instance();
});
qmlRegisterUncreatableType<Addon>("GitAddonsManager.engine",1,0,"Addon","");
engine.rootContext()->setContextProperty("gitVersion", QString("%1 (%2)").arg(GIT_TAG, GIT_SHA));
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
+9 -1
View File
@@ -133,12 +133,20 @@ ApplicationWindow {
Label {
text: "Author: woblight <woblight@gmail.com>"
}
Label {
text: "Source code: <a href=https://gitlab.com/woblight/GitAddonsManager>GitLab</a>"
onLinkActivated: Qt.openUrlExternally(link)
textFormat: Text.RichText
}
RowLayout {
Label {
text: "Version:"
}
TextArea {
readOnly: true
text: gitVersion
}
}
}
}
}