aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSvetlana Abramenkova <sabramenkova@luxoft.com>2019-06-25 18:06:05 +0300
committerSvetlana Abramenkova <sabramenkova@luxoft.com>2019-07-10 17:17:05 +0200
commitda7cf9c419714f8d7d4c6a563c77a03ff06ff9b6 (patch)
tree2079c2d0142bfd291f8a218112b1f43ccc79cb07
parent01044934083fa1cadbf84117e738e54b22951907 (diff)
Fix version and revision string for console output
Change-Id: Ie50eba21a121dcf331ab726ee79d513449913b3c Fixes: AUTOSUITE-1073 Reviewed-by: Nikolay Zamotaev <nzamotaev@luxoft.com>
-rwxr-xr-xqmllive.pri11
-rw-r--r--src/bench/aboutdialog.cpp2
-rw-r--r--src/bench/main.cpp1
-rw-r--r--src/runtime/main.cpp2
4 files changed, 14 insertions, 2 deletions
diff --git a/qmllive.pri b/qmllive.pri
index 1494509..9af5e53 100755
--- a/qmllive.pri
+++ b/qmllive.pri
@@ -10,9 +10,18 @@ VERSIONS = $$split(VERSION, ".")
VERSION_MAJOR = $$member(VERSIONS, 0)
unset(VERSIONS)
+unix:exists($$SOURCE_DIR/.git):GIT_REVISION=$$system(cd "$$SOURCE_DIR" && git describe --tags --always 2>/dev/null)
+isEmpty(GIT_REVISION) {
+ GIT_REVISION="unknown revision"
+ GIT_COMMITTER_DATE="no date"
+} else {
+ GIT_COMMITTER_DATE=$$system(cd "$$SOURCE_DIR" && git show "$$GIT_REVISION" --pretty=format:"%ci" --no-patch 2>/dev/null)
+}
+
DEFINES += QMLLIVE_VERSION=$$VERSION
!isEmpty(QMLLIVE_VERSION_EXTRA): DEFINES += QMLLIVE_VERSION_EXTRA="\"$$QMLLIVE_VERSION_EXTRA\""
-!isEmpty(QMLLIVE_REVISION): DEFINES += QMLLIVE_REVISION=$$QMLLIVE_REVISION
+isEmpty(QMLLIVE_REVISION): QMLLIVE_REVISION=$$replace(GIT_REVISION," ","_")
+DEFINES += QMLLIVE_REVISION=$$QMLLIVE_REVISION
!isEmpty(QMLLIVE_SETTINGS_VARIANT): DEFINES += QMLLIVE_SETTINGS_VARIANT=$$QMLLIVE_SETTINGS_VARIANT
# from qtcreator.pri
diff --git a/src/bench/aboutdialog.cpp b/src/bench/aboutdialog.cpp
index c3072a9..35d566d 100644
--- a/src/bench/aboutdialog.cpp
+++ b/src/bench/aboutdialog.cpp
@@ -57,7 +57,7 @@ AboutDialog::AboutDialog(QWidget *parent)
buildInfo = tr("<p>Built on %1 %2 from revision %3.</p>")
.arg(QLatin1String(__DATE__),
QLatin1String(__TIME__),
- QString::fromLatin1(QMLLIVE_REVISION_STR).left(7));
+ QString::fromLatin1(QMLLIVE_REVISION_STR));
#endif
QString about = tr(
diff --git a/src/bench/main.cpp b/src/bench/main.cpp
index 8ca51c0..8f54f9c 100644
--- a/src/bench/main.cpp
+++ b/src/bench/main.cpp
@@ -102,6 +102,7 @@ Application *Application::create(int &argc, char **argv)
setApplicationName("QML Live Bench");
setOrganizationDomain(QLatin1String(QMLLIVE_ORGANIZATION_DOMAIN));
setOrganizationName(QLatin1String(QMLLIVE_ORGANIZATION_NAME));
+ setApplicationVersion(QString(QMLLIVE_VERSION_STR).append(" ").append(QMLLIVE_REVISION_STR));
// Cannot instantiate the actual application yet
parseArguments(QCoreApplication(argc, argv).arguments(), s_options = new Options);
diff --git a/src/runtime/main.cpp b/src/runtime/main.cpp
index fdda1e1..aa8ae95 100644
--- a/src/runtime/main.cpp
+++ b/src/runtime/main.cpp
@@ -187,6 +187,8 @@ private slots:
int main(int argc, char** argv)
{
QGuiApplication app(argc, argv);
+
+ app.setApplicationVersion(QString(QMLLIVE_VERSION_STR).append(" ").append(QMLLIVE_REVISION_STR));
app.setApplicationName("QML Live Runtime");
app.setOrganizationDomain(QLatin1String(QMLLIVE_ORGANIZATION_DOMAIN));
app.setOrganizationName(QLatin1String(QMLLIVE_ORGANIZATION_NAME));