Added stream titles to windows toast notifications (#2044)
Co-authored-by: 23rd <23rd@vivaldi.net> Co-authored-by: David Myers <dave-myers@outlook.com> Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -67,6 +67,7 @@
|
|||||||
- Minor: Migrated /vips to Helix API. Chat command will continue to be used until February 11th 2023. (#4053)
|
- 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 /uniquechat and /r9kbeta to Helix API. (#4057)
|
||||||
- Minor: Migrated /uniquechatoff and /r9kbetaoff 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: Make menus and placeholders display appropriate custom key combos. (#4045)
|
||||||
- Minor: Add settings tooltips. (#3437)
|
- Minor: Add settings tooltips. (#3437)
|
||||||
- Bugfix: Connection to Twitch PubSub now recovers more reliably. (#3643, #3716)
|
- Bugfix: Connection to Twitch PubSub now recovers more reliably. (#3643, #3716)
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ void NotificationController::checkStream(bool live, QString channelName)
|
|||||||
|
|
||||||
if (Toasts::isEnabled())
|
if (Toasts::isEnabled())
|
||||||
{
|
{
|
||||||
getApp()->toasts->sendChannelNotification(channelName,
|
getApp()->toasts->sendChannelNotification(channelName, QString(),
|
||||||
Platform::Twitch);
|
Platform::Twitch);
|
||||||
}
|
}
|
||||||
if (getSettings()->notificationPlaySound &&
|
if (getSettings()->notificationPlaySound &&
|
||||||
|
|||||||
@@ -640,7 +640,7 @@ void TwitchChannel::setLive(bool newLiveStatus)
|
|||||||
if (Toasts::isEnabled())
|
if (Toasts::isEnabled())
|
||||||
{
|
{
|
||||||
getApp()->toasts->sendChannelNotification(
|
getApp()->toasts->sendChannelNotification(
|
||||||
this->getName(), Platform::Twitch);
|
this->getName(), guard->title, Platform::Twitch);
|
||||||
}
|
}
|
||||||
if (getSettings()->notificationPlaySound)
|
if (getSettings()->notificationPlaySound)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -66,11 +66,12 @@ QString Toasts::findStringFromReaction(
|
|||||||
return Toasts::findStringFromReaction(static_cast<ToastReaction>(i));
|
return Toasts::findStringFromReaction(static_cast<ToastReaction>(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Toasts::sendChannelNotification(const QString &channelName, Platform p)
|
void Toasts::sendChannelNotification(const QString &channelName,
|
||||||
|
const QString &channelTitle, Platform p)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
auto sendChannelNotification = [this, channelName, p] {
|
auto sendChannelNotification = [this, channelName, channelTitle, p] {
|
||||||
this->sendWindowsNotification(channelName, p);
|
this->sendWindowsNotification(channelName, channelTitle, p);
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
auto sendChannelNotification = [] {
|
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 templ = WinToastLib::WinToastTemplate(
|
||||||
WinToastLib::WinToastTemplate::ImageAndText03);
|
WinToastLib::WinToastTemplate::ImageAndText03);
|
||||||
@@ -180,7 +182,10 @@ void Toasts::sendWindowsNotification(const QString &channelName, Platform p)
|
|||||||
Toasts::findStringFromReaction(getSettings()->openFromToast);
|
Toasts::findStringFromReaction(getSettings()->openFromToast);
|
||||||
mode = mode.toLower();
|
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);
|
WinToastLib::WinToastTemplate::SecondLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ enum class ToastReaction {
|
|||||||
class Toasts final : public Singleton
|
class Toasts final : public Singleton
|
||||||
{
|
{
|
||||||
public:
|
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 ToastReaction &reaction);
|
||||||
static QString findStringFromReaction(
|
static QString findStringFromReaction(
|
||||||
const pajlada::Settings::Setting<int> &reaction);
|
const pajlada::Settings::Setting<int> &reaction);
|
||||||
@@ -29,7 +30,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
void sendWindowsNotification(const QString &channelName, Platform p);
|
void sendWindowsNotification(const QString &channelName,
|
||||||
|
const QString &channelTitle, Platform p);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
Reference in New Issue
Block a user