From ae9fbd04dd932707e8538676343ec6c6d5bcd250 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 23 Jan 2020 13:32:41 +0100 Subject: [PATCH] Core: Make the revision sha in VersionDialog a clickable link The base URL can be defined via the IDE branding mechanism. If omitted, the revision is plain text, like before this change. Change-Id: If1a74707a10c76e15d3d25b8e6b0c302219fb91d Reviewed-by: Cristian Adam Reviewed-by: Eike Ziller --- cmake/QtCreatorIDEBranding.cmake | 3 +++ src/app/app_version.h.cmakein | 1 + src/plugins/coreplugin/versiondialog.cpp | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cmake/QtCreatorIDEBranding.cmake b/cmake/QtCreatorIDEBranding.cmake index 23b0d236150..95106b1cd4d 100644 --- a/cmake/QtCreatorIDEBranding.cmake +++ b/cmake/QtCreatorIDEBranding.cmake @@ -12,3 +12,6 @@ set(IDE_DISPLAY_NAME "Qt Creator") # The IDE display name. set(IDE_ID "qtcreator") # The IDE id (no spaces, lowercase!) set(IDE_CASED_ID "QtCreator") # The cased IDE id (no spaces!) set(IDE_BUNDLE_IDENTIFIER "org.qt-project.${IDE_ID}") # The macOS application bundle identifier. + +set(IDE_REVISION_URL "https://code.qt.io/cgit/qt-creator/qt-creator.git/commit/?id=%1") + # The revision url in the version dialog diff --git a/src/app/app_version.h.cmakein b/src/app/app_version.h.cmakein index 86074a22e97..79ac4397ce2 100644 --- a/src/app/app_version.h.cmakein +++ b/src/app/app_version.h.cmakein @@ -44,6 +44,7 @@ const char IDE_CASED_ID[] = "${IDE_CASED_ID}"; const char IDE_VERSION_DISPLAY[] = "${IDE_VERSION_DISPLAY}"; const char IDE_REVISION_STR[] = "${IDE_REVISION_STR}"; +const char IDE_REVISION_URL[] = "${IDE_REVISION_URL}"; // changes the path where the settings are saved to const char IDE_SETTINGSVARIANT_STR[] = "${IDE_SETTINGSVARIANT}"; diff --git a/src/plugins/coreplugin/versiondialog.cpp b/src/plugins/coreplugin/versiondialog.cpp index 045bc60da38..90897ddb1fb 100644 --- a/src/plugins/coreplugin/versiondialog.cpp +++ b/src/plugins/coreplugin/versiondialog.cpp @@ -59,7 +59,12 @@ VersionDialog::VersionDialog(QWidget *parent) QString ideRev; #ifdef IDE_REVISION //: This gets conditionally inserted as argument %8 into the description string. - ideRev = tr("
From revision %1
").arg(QString::fromLatin1(Constants::IDE_REVISION_STR).left(10)); + const QString revUrl = QString::fromLatin1(Constants::IDE_REVISION_URL); + const QString revStr = QString::fromLatin1(Constants::IDE_REVISION_STR); + ideRev = tr("
From revision %1
") + .arg(revUrl.isEmpty() ? revStr.left(10) + : QString::fromLatin1("%2") + .arg(revUrl.arg(revStr), revStr.left(10))); #endif QString buildDateInfo; #ifdef QTC_SHOW_BUILD_DATE