From 42002d80b73d67f6cba9a9f0655e6d6516d36f77 Mon Sep 17 00:00:00 2001 From: Leon Richardt Date: Fri, 7 Jan 2022 17:25:57 +0100 Subject: [PATCH] fix: re-add build date to "About" page (#3464) Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com> --- CHANGELOG.md | 1 + src/CMakeLists.txt | 8 ++++++++ src/common/Version.cpp | 10 +++------- src/widgets/settingspages/AboutPage.cpp | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ba25b4f3..c396ff64e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ - Bugfix: Fixed character counter changing fonts after going over the limit. (#3422) - Bugfix: Fixed crash that could occur if the user opens/closes ChannelViews (e.g. EmotePopup, or Splits) then modifies the showLastMessageIndicator setting. (#3444) - Bugfix: Removed ability to reload emotes really fast (#3450) +- Bugfix: Re-add date of build to the "About" page on nightly versions. (#3464) - Dev: Batch checking live status for channels with live notifications that aren't connected. (#3442) - Dev: Add GitHub action to test builds without precompiled headers enabled. (#3327) - Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 561983d37..390fc1f0d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -593,6 +593,12 @@ set_target_properties(${LIBRARY_PROJECT} AUTOUIC ON ) +# Used to provide a date of build in the About page (for nightly builds). Getting the actual time of +# compilation in CMake is a more involved, as documented in https://stackoverflow.com/q/24292898. +# For CI runs, however, the date of build file generation should be consistent with the date of +# compilation so this approximation is "good enough" for our purpose. +string(TIMESTAMP cmake_gen_date "%Y-%m-%d") + target_compile_definitions(${LIBRARY_PROJECT} PUBLIC CHATTERINO UNICODE @@ -604,6 +610,8 @@ target_compile_definitions(${LIBRARY_PROJECT} PUBLIC CHATTERINO_GIT_HASH=\"${GIT_HASH}\" CHATTERINO_GIT_RELEASE=\"${GIT_RELEASE}\" CHATTERINO_GIT_COMMIT=\"${GIT_COMMIT}\" + + CHATTERINO_CMAKE_GEN_DATE=\"${cmake_gen_date}\" ) if (USE_SYSTEM_QTKEYCHAIN) target_compile_definitions(${LIBRARY_PROJECT} PUBLIC diff --git a/src/common/Version.cpp b/src/common/Version.cpp index b678fe48a..76dc42704 100644 --- a/src/common/Version.cpp +++ b/src/common/Version.cpp @@ -11,19 +11,15 @@ namespace chatterino { Version::Version() { - // Version this->version_ = CHATTERINO_VERSION; - // Commit hash this->commitHash_ = QString(FROM_EXTERNAL_DEFINE(CHATTERINO_GIT_HASH)).remove('"'); - // Date of build, this is depended on the format not changing -#ifdef CHATTERINO_NIGHTLY_VERSION_STRING + // Date of build file generation (≈ date of build) +#ifdef CHATTERINO_CMAKE_GEN_DATE this->dateOfBuild_ = - QString(FROM_EXTERNAL_DEFINE(CHATTERINO_NIGHTLY_VERSION_STRING)) - .remove('"') - .split(' ')[0]; + QString(FROM_EXTERNAL_DEFINE(CHATTERINO_CMAKE_GEN_DATE)).remove('"'); #endif // "Full" version string, as displayed in window title diff --git a/src/widgets/settingspages/AboutPage.cpp b/src/widgets/settingspages/AboutPage.cpp index 81b9b54fc..de6534825 100644 --- a/src/widgets/settingspages/AboutPage.cpp +++ b/src/widgets/settingspages/AboutPage.cpp @@ -93,7 +93,7 @@ AboutPage::AboutPage() version.commitHash() + "\">" + version.commitHash() + "") .arg(Modes::instance().isNightly - ? ", " + version.dateOfBuild() + ? ", built on " + version.dateOfBuild() : ""); auto versionLabel = versionInfo.emplace(text);