diff --git a/GitAddonsManager.pro b/GitAddonsManager.pro index f7b9042..f5320cc 100644 --- a/GitAddonsManager.pro +++ b/GitAddonsManager.pro @@ -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 diff --git a/main.cpp b/main.cpp index 45304b5..66bc26f 100644 --- a/main.cpp +++ b/main.cpp @@ -19,6 +19,7 @@ #include "control.h" #include "addon.h" #include +#include int main(int argc, char *argv[]) { @@ -35,6 +36,7 @@ int main(int argc, char *argv[]) return Control::instance(); }); qmlRegisterUncreatableType("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; diff --git a/main.qml b/main.qml index 0fd65b0..385764b 100644 --- a/main.qml +++ b/main.qml @@ -133,12 +133,20 @@ ApplicationWindow { Label { text: "Author: woblight " } - Label { text: "Source code: GitLab" onLinkActivated: Qt.openUrlExternally(link) textFormat: Text.RichText } + RowLayout { + Label { + text: "Version:" + } + TextArea { + readOnly: true + text: gitVersion + } + } } } }