feat: add build option for freestanding text in about page (#6766)
Example usage: ``` cmake -DCHATTERINO_EXTRA_BUILD_STRING="hi im <a href=\"https://forsen.tv\">forsen</a>" .. ```
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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.<br>Report bugs <a href...>here</a>")
|
||||
void generateExtraString();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
std::wstring appUserModelID_;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user