chore: factor out AUMID creation (#6321)
This commit is contained in:
@@ -71,6 +71,7 @@
|
||||
- Dev: Emoji style / set is now stored lowercase (and matched case-insensitively). Changing emoji style from this point on and then running an old version might mean you will use the Twitter emoji style by default. (#6300)
|
||||
- Dev: Refactored `OnceFlag`. (#6237, #6316)
|
||||
- Dev: Bumped clang-format requirement to 19. (#6236)
|
||||
- Dev: Factored out AUMID to `Version`. (#6321)
|
||||
|
||||
## 2.5.3
|
||||
|
||||
|
||||
@@ -36,6 +36,11 @@ Version::Version()
|
||||
|
||||
this->generateBuildString();
|
||||
this->generateRunningString();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
// keep in sync with .CI/chatterino-installer.iss
|
||||
this->appUserModelID_ = L"ChatterinoTeam.Chatterino";
|
||||
#endif
|
||||
}
|
||||
|
||||
const Version &Version::instance()
|
||||
@@ -165,4 +170,11 @@ void Version::generateRunningString()
|
||||
this->runningString_ = s;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
const std::wstring &Version::appUserModelID() const
|
||||
{
|
||||
return this->appUserModelID_;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <string>
|
||||
#endif
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
/**
|
||||
@@ -52,6 +56,13 @@ public:
|
||||
// Returns a string about the current running system
|
||||
const QString &runningString() const;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
/// Chatterino's App ID on Windows
|
||||
///
|
||||
/// See https://learn.microsoft.com/en-us/windows/win32/shell/appids
|
||||
const std::wstring &appUserModelID() const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
Version();
|
||||
|
||||
@@ -69,6 +80,10 @@ private:
|
||||
QString runningString_;
|
||||
// Generate a running string (e.g. Running on Arch Linux, kernel 5.14.3) and store it in runningString_ for future use
|
||||
void generateRunningString();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
std::wstring appUserModelID_;
|
||||
#endif
|
||||
};
|
||||
|
||||
}; // namespace chatterino
|
||||
|
||||
+2
-1
@@ -40,7 +40,8 @@ int main(int argc, char **argv)
|
||||
QCoreApplication::setApplicationVersion(CHATTERINO_VERSION);
|
||||
QCoreApplication::setOrganizationDomain("chatterino.com");
|
||||
#ifdef Q_OS_WIN
|
||||
SetCurrentProcessExplicitAppUserModelID(L"ChatterinoTeam.Chatterino");
|
||||
SetCurrentProcessExplicitAppUserModelID(
|
||||
Version::instance().appUserModelID().c_str());
|
||||
#endif
|
||||
|
||||
std::unique_ptr<Paths> paths;
|
||||
|
||||
@@ -285,8 +285,7 @@ void Toasts::ensureInitialized()
|
||||
|
||||
auto *instance = WinToast::instance();
|
||||
instance->setAppName(L"Chatterino");
|
||||
instance->setAppUserModelId(
|
||||
WinToast::configureAUMI(L"ChatterinoTeam", L"Chatterino", L"", L""));
|
||||
instance->setAppUserModelId(Version::instance().appUserModelID());
|
||||
if (!getSettings()->createShortcutForToasts)
|
||||
{
|
||||
instance->setShortcutPolicy(WinToast::SHORTCUT_POLICY_IGNORE);
|
||||
|
||||
Reference in New Issue
Block a user