diff --git a/CHANGELOG.md b/CHANGELOG.md index 56daa4294..c0ae71c16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ - Minor: Migrated /vips to Helix API. Chat command will continue to be used until February 11th 2023. (#4053) - Minor: Migrated /uniquechat and /r9kbeta to Helix API. (#4057) - Minor: Migrated /uniquechatoff and /r9kbetaoff to Helix API. (#4057) +- Minor: Added stream titles to windows live toast notifications. (#1297) - Minor: Make menus and placeholders display appropriate custom key combos. (#4045) - Minor: Add settings tooltips. (#3437) - Bugfix: Connection to Twitch PubSub now recovers more reliably. (#3643, #3716) diff --git a/src/controllers/notifications/NotificationController.cpp b/src/controllers/notifications/NotificationController.cpp index 1eae5d9b3..d8215d64e 100644 --- a/src/controllers/notifications/NotificationController.cpp +++ b/src/controllers/notifications/NotificationController.cpp @@ -187,7 +187,7 @@ void NotificationController::checkStream(bool live, QString channelName) if (Toasts::isEnabled()) { - getApp()->toasts->sendChannelNotification(channelName, + getApp()->toasts->sendChannelNotification(channelName, QString(), Platform::Twitch); } if (getSettings()->notificationPlaySound && diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index be98364bd..81783e5f7 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -640,7 +640,7 @@ void TwitchChannel::setLive(bool newLiveStatus) if (Toasts::isEnabled()) { getApp()->toasts->sendChannelNotification( - this->getName(), Platform::Twitch); + this->getName(), guard->title, Platform::Twitch); } if (getSettings()->notificationPlaySound) { diff --git a/src/singletons/Toasts.cpp b/src/singletons/Toasts.cpp index c06df70a5..00a3285fe 100644 --- a/src/singletons/Toasts.cpp +++ b/src/singletons/Toasts.cpp @@ -66,11 +66,12 @@ QString Toasts::findStringFromReaction( return Toasts::findStringFromReaction(static_cast(i)); } -void Toasts::sendChannelNotification(const QString &channelName, Platform p) +void Toasts::sendChannelNotification(const QString &channelName, + const QString &channelTitle, Platform p) { #ifdef Q_OS_WIN - auto sendChannelNotification = [this, channelName, p] { - this->sendWindowsNotification(channelName, p); + auto sendChannelNotification = [this, channelName, channelTitle, p] { + this->sendWindowsNotification(channelName, channelTitle, p); }; #else auto sendChannelNotification = [] { @@ -164,7 +165,8 @@ public: } }; -void Toasts::sendWindowsNotification(const QString &channelName, Platform p) +void Toasts::sendWindowsNotification(const QString &channelName, + const QString &channelTitle, Platform p) { WinToastLib::WinToastTemplate templ = WinToastLib::WinToastTemplate( WinToastLib::WinToastTemplate::ImageAndText03); @@ -180,7 +182,10 @@ void Toasts::sendWindowsNotification(const QString &channelName, Platform p) Toasts::findStringFromReaction(getSettings()->openFromToast); mode = mode.toLower(); - templ.setTextField(L"Click here to " + mode.toStdWString(), + templ.setTextField(QString("%1 \nClick to %2") + .arg(channelTitle) + .arg(mode) + .toStdWString(), WinToastLib::WinToastTemplate::SecondLine); } diff --git a/src/singletons/Toasts.hpp b/src/singletons/Toasts.hpp index f32c0c4c4..b1a8eb44e 100644 --- a/src/singletons/Toasts.hpp +++ b/src/singletons/Toasts.hpp @@ -19,7 +19,8 @@ enum class ToastReaction { class Toasts final : public Singleton { public: - void sendChannelNotification(const QString &channelName, Platform p); + void sendChannelNotification(const QString &channelName, + const QString &channelTitle, Platform p); static QString findStringFromReaction(const ToastReaction &reaction); static QString findStringFromReaction( const pajlada::Settings::Setting &reaction); @@ -29,7 +30,8 @@ public: private: #ifdef Q_OS_WIN - void sendWindowsNotification(const QString &channelName, Platform p); + void sendWindowsNotification(const QString &channelName, + const QString &channelTitle, Platform p); #endif }; } // namespace chatterino