From 9eceb46739803bb7482e9017cd79df92203ecbad Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 19 Mar 2020 16:02:44 +0100 Subject: [PATCH] Fix link on commit sha in about dialog Passing a URL via defines breaks when trying to "stringify" it. It would always stop at the first slash. Instead use a qmake variable directly. That has the additional advantage that the value isn't passed on each and every compiler command line. Change-Id: I97a297fbcdee5ea03eb6fa08181c95b1ad2de767 Reviewed-by: Cristian Adam --- .github/workflows/build_cmake.yml | 2 +- CMakeLists.txt | 4 ++-- scripts/build.py | 2 +- src/app/app_version.h.cmakein | 2 +- src/app/app_version.h.in | 6 +----- src/plugins/coreplugin/versiondialog.cpp | 3 +-- 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 5722143c046..f409216afb7 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -333,7 +333,7 @@ jobs: -D WITH_TESTS=ON -D IDE_REVISION=TRUE -D IDE_REVISION_STR=$ENV{GITHUB_SHA} - -D IDE_REVISION_URL_STR=https://github.com/$ENV{GITHUB_REPOSITORY}/commits/$ENV{GITHUB_SHA} + -D IDE_REVISION_URL=https://github.com/$ENV{GITHUB_REPOSITORY}/commits/$ENV{GITHUB_SHA} RESULT_VARIABLE result COMMAND_ECHO STDOUT ) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb79a450f09..9cf66c74aa7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,9 +8,9 @@ include(QtCreatorIDEBranding) set(IDE_REVISION FALSE CACHE BOOL "Marks the presence of IDE revision string.") set(IDE_REVISION_STR "" CACHE STRING "The IDE revision string.") -set(IDE_REVISION_URL_STR "" CACHE STRING "The IDE revision Url string.") +set(IDE_REVISION_URL "" CACHE STRING "The IDE revision Url string.") -mark_as_advanced(IDE_REVISION IDE_REVISION_STR IDE_REVISION_URL_STR) +mark_as_advanced(IDE_REVISION IDE_REVISION_STR IDE_REVISION_URL) project(QtCreator VERSION ${IDE_VERSION}) diff --git a/scripts/build.py b/scripts/build.py index ec50a21b8e6..3c481362395 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -131,7 +131,7 @@ def build_qtcreator(args, paths): if ide_revision: cmake_args += ['-DIDE_REVISION=ON', '-DIDE_REVISION_STR=' + ide_revision, - '-DIDE_REVISION_URL_STR=https://code.qt.io/cgit/qt-creator/qt-creator.git/log/?id=' + ide_revision] + '-DIDE_REVISION_URL=https://code.qt.io/cgit/qt-creator/qt-creator.git/log/?id=' + ide_revision] common.check_print_call(cmake_args + [paths.src], paths.build) common.check_print_call(['cmake', '--build', '.'], paths.build) diff --git a/src/app/app_version.h.cmakein b/src/app/app_version.h.cmakein index 6d69f0d5dea..49abfc4ec88 100644 --- a/src/app/app_version.h.cmakein +++ b/src/app/app_version.h.cmakein @@ -45,7 +45,7 @@ const char IDE_CASED_ID[] = "${IDE_CASED_ID}"; const char IDE_VERSION_DISPLAY[] = "${IDE_VERSION_DISPLAY}"; const char IDE_VERSION_COMPAT[] = "${IDE_VERSION_COMPAT}"; const char IDE_REVISION_STR[] = "${IDE_REVISION_STR}"; -const char IDE_REVISION_URL_STR[] = "${IDE_REVISION_URL_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/app/app_version.h.in b/src/app/app_version.h.in index 4682d282efb..7a525bf211f 100644 --- a/src/app/app_version.h.in +++ b/src/app/app_version.h.in @@ -56,11 +56,7 @@ const char IDE_REVISION_STR[] = STRINGIFY(IDE_REVISION); const char IDE_REVISION_STR[] = \"\"; #endif -#ifdef IDE_REVISION_URL -const char IDE_REVISION_URL_STR[] = STRINGIFY(IDE_REVISION_URL); -#else -const char IDE_REVISION_URL_STR[] = \"\"; -#endif +const char IDE_REVISION_URL[] = \"$${IDE_REVISION_URL}\"; // changes the path where the settings are saved to #ifdef IDE_SETTINGSVARIANT diff --git a/src/plugins/coreplugin/versiondialog.cpp b/src/plugins/coreplugin/versiondialog.cpp index 3ef40cb8199..3730a8b8c2b 100644 --- a/src/plugins/coreplugin/versiondialog.cpp +++ b/src/plugins/coreplugin/versiondialog.cpp @@ -57,8 +57,7 @@ VersionDialog::VersionDialog(QWidget *parent) QString ideRev; #ifdef IDE_REVISION - //: This gets conditionally inserted as argument %8 into the description string. - const QString revUrl = QString::fromLatin1(Constants::IDE_REVISION_URL_STR); + const QString revUrl = QString::fromLatin1(Constants::IDE_REVISION_URL); const QString rev = QString::fromLatin1(Constants::IDE_REVISION_STR).left(10); ideRev = tr("
From revision %1
") .arg(revUrl.isEmpty() ? rev