From f19318fbd13984af19cd062caccc71dec090272c Mon Sep 17 00:00:00 2001 From: "moneromooo.monero" Date: Tue, 20 Dec 2016 21:13:42 +0000 Subject: [PATCH] Add git version to the settings page Useful for bug reports --- build.sh | 4 ++++ pages/Settings.qml | 9 +++++++++ qml.qrc | 1 + utils.sh | 27 +++++++++++++++++++++++++++ 4 files changed, 41 insertions(+) diff --git a/build.sh b/build.sh index 98261b83..c962a7a2 100755 --- a/build.sh +++ b/build.sh @@ -45,6 +45,10 @@ elif [ "$platform" == "mingw64" ] || [ "$platform" == "mingw32" ]; then MONEROD_EXEC=monerod.exe fi +# force version update +get_tag +echo "var VERSION = \"$VERSIONTAG\"" > version.js + cd build qmake ../monero-wallet-gui.pro "$CONFIG" make diff --git a/pages/Settings.qml b/pages/Settings.qml index 0231dc57..52dc4496 100644 --- a/pages/Settings.qml +++ b/pages/Settings.qml @@ -31,6 +31,7 @@ import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.1 import QtQuick.Dialogs 1.2 +import "../version.js" as Version import "../components" @@ -345,6 +346,14 @@ Rectangle { } } + Label { + id: guiVersion + Layout.topMargin: 8 + color: "#4A4949" + text: qsTr("GUI version: ") + Version.VERSION + translationManager.emptyString + fontSize: 16 + } + } // Daemon console diff --git a/qml.qrc b/qml.qrc index 7501dfd1..a952af0f 100644 --- a/qml.qrc +++ b/qml.qrc @@ -121,5 +121,6 @@ components/StandardDialog.qml pages/Sign.qml components/DaemonManagerDialog.qml + version.js diff --git a/utils.sh b/utils.sh index f04a485c..27304a7d 100755 --- a/utils.sh +++ b/utils.sh @@ -21,6 +21,33 @@ function get_platform { } +function get_tag() +{ + COMMIT=$(git rev-parse --short HEAD | sed -e 's/[\t ]*//') + if test $? -ne 0 + then + echo "Cannot determine current commit. Make sure that you are building either from a Git working tree or from a source archive." + VERSIONTAG="unknown" + else + echo "You are currently on commit ${COMMIT}" + TAGGEDCOMMIT=$(git rev-list --tags --max-count=1 --abbrev-commit | sed -e 's/[\t ]*//') + if test -z "$TAGGEDCOMMIT" + then + echo "Cannot determine most recent tag. Make sure that you are building either from a Git working tree or from a source archive." + VERSIONTAG=$COMMIT + else + echo "The most recent tag was at ${TAGGEDCOMMIT}" + if test "$TAGGEDCOMMIT" = "$COMMIT" + then + echo "You are building a tagged release" + VERSIONTAG="release" + else + echo "You are ahead of or behind a tagged release" + VERSIONTAG="$COMMIT" + fi + fi + fi +}