diff --git a/.github/ISSUE_TEMPLATE/a_make_a_report.yml b/.github/ISSUE_TEMPLATE/a_make_a_report.yml index 73314f8a..dafa67bd 100644 --- a/.github/ISSUE_TEMPLATE/a_make_a_report.yml +++ b/.github/ISSUE_TEMPLATE/a_make_a_report.yml @@ -42,7 +42,7 @@ body: description: While optional, it's highly encouraged to include screenshots or videos to illustrate what you mean. placeholder: You can upload them using the text editor's dedicated button. - - type: input + - type: textarea id: versions validations: required: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 613ca40b..05d70ddf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,6 +86,7 @@ - Dev: Added Clazy linting in CI. (#6623) - Dev: Added custom clang-tidy module linting in CI. (#6626) - Dev: CMake option `USE_ALTERNATE_LINKER` now errors if the given linker can't be found. (#6692) +- Dev: Added a CMake option `CHATTERINO_EXTRA_BUILD_STRING` which allows the packager to provide an optional freestanding Qt-HTML string that shows up in the About page under the Chatterino version. (#6766) - Dev: Enable C++ 23. (#6693) - Dev: Prefer `std::expected` over `nonstd::expected_lite`. (#6693) - Dev: Moved Twitch PubSub to liveupdates. (#6638) diff --git a/CMakeLists.txt b/CMakeLists.txt index 39cb1577..13698e33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,8 @@ add_feature_info("Chatterino code sanitizer support" CHATTERINO_SANITIZER_SUPPOR option(CHATTERINO_UPDATER "Enable update checks" ON) mark_as_advanced(CHATTERINO_UPDATER) +set(CHATTERINO_EXTRA_BUILD_STRING "" CACHE STRING "Provide an extra string to show in the about page under the Chatterino version. This string allows the use of Qt's HTML subset.") + set(USE_ALTERNATE_LINKER "" CACHE STRING "Use alternate linker. Leave empty for system default. CMake 3.29 users can use CMAKE_LINKER_TYPE instead.") if(CHATTERINO_SANITIZER_SUPPORT) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5027f394..8fb11f62 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1111,6 +1111,7 @@ set_target_properties(${LIBRARY_PROJECT} set(VERSION_SOURCE_FILES common/Version.cpp common/Version.hpp) add_library(${VERSION_PROJECT} STATIC ${VERSION_SOURCE_FILES}) target_compile_definitions(${VERSION_PROJECT} PRIVATE + CHATTERINO_EXTRA_BUILD_STRING=${CHATTERINO_EXTRA_BUILD_STRING} $<$:USEWINSDK> $<$:CHATTERINO_WITH_CRASHPAD> ) diff --git a/src/common/Version.cpp b/src/common/Version.cpp index ba3d1e5e..a3c6c4c1 100644 --- a/src/common/Version.cpp +++ b/src/common/Version.cpp @@ -40,6 +40,7 @@ Version::Version() this->generateBuildString(); this->generateRunningString(); + this->generateExtraString(); #ifdef Q_OS_WIN // keep in sync with .CI/chatterino-installer.iss @@ -123,6 +124,11 @@ const QString &Version::runningString() const return this->runningString_; } +const QString &Version::extraString() const +{ + return this->extraString_; +} + void Version::generateBuildString() { // e.g. Chatterino 2.3.5 or Chatterino Nightly 2.3.5 @@ -174,6 +180,19 @@ void Version::generateRunningString() this->runningString_ = s; } +#define STRINGIFY(x) #x +// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +#define STRINGIFY2(x) STRINGIFY(x) + +void Version::generateExtraString() +{ + this->extraString_ = + QStringLiteral(STRINGIFY2(CHATTERINO_EXTRA_BUILD_STRING)).trimmed(); +} + +#undef STRINGIFY2 +#undef STRINGIFY + #ifdef Q_OS_WIN const std::wstring &Version::appUserModelID() const { diff --git a/src/common/Version.hpp b/src/common/Version.hpp index bebb027b..1b794813 100644 --- a/src/common/Version.hpp +++ b/src/common/Version.hpp @@ -60,6 +60,9 @@ public: // Returns a string about the current running system const QString &runningString() const; + // Returns an extra string about this specific build + const QString &extraString() const; + #ifdef Q_OS_WIN /// Chatterino's App ID on Windows /// @@ -85,6 +88,10 @@ private: // Generate a running string (e.g. Running on Arch Linux, kernel 5.14.3) and store it in runningString_ for future use void generateRunningString(); + QString extraString_; + // Generate an extra string (e.g. "Built for Fedora 42.
Report bugs here") + void generateExtraString(); + #ifdef Q_OS_WIN std::wstring appUserModelID_; #endif diff --git a/src/widgets/settingspages/AboutPage.cpp b/src/widgets/settingspages/AboutPage.cpp index a108fac4..866cf8f6 100644 --- a/src/widgets/settingspages/AboutPage.cpp +++ b/src/widgets/settingspages/AboutPage.cpp @@ -56,10 +56,17 @@ AboutPage::AboutPage() auto versionInfo = layout.emplace("Version"); { auto vbox = versionInfo.emplace(); - auto version = Version::instance(); + const auto &version = Version::instance(); - auto label = vbox.emplace(version.buildString() + "
" + - version.runningString()); + QString string = + version.buildString() % "
" % version.runningString(); + + if (!version.extraString().isEmpty()) + { + string += "
" % version.extraString(); + } + + auto label = vbox.emplace(string); label->setWordWrap(true); label->setOpenExternalLinks(true); label->setTextInteractionFlags(Qt::TextBrowserInteraction);