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 <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2020-01-23 13:32:41 +01:00
parent bf7b16d9ca
commit ae9fbd04dd
3 changed files with 10 additions and 1 deletions

View File

@@ -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

View File

@@ -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}";

View File

@@ -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("<br/>From revision %1<br/>").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("<br/>From revision %1<br/>")
.arg(revUrl.isEmpty() ? revStr.left(10)
: QString::fromLatin1("<a href=\"%1\">%2</a>")
.arg(revUrl.arg(revStr), revStr.left(10)));
#endif
QString buildDateInfo;
#ifdef QTC_SHOW_BUILD_DATE