diff --git a/src/controllers/notifications/NotificationController.cpp b/src/controllers/notifications/NotificationController.cpp index 653db98c9..277e5ac6c 100644 --- a/src/controllers/notifications/NotificationController.cpp +++ b/src/controllers/notifications/NotificationController.cpp @@ -180,13 +180,7 @@ void NotificationController::getFakeTwitchChannelLiveStatus( getApp()->notifications->playSound(); } if (getSettings()->notificationFlashTaskbar) { - if (getSettings()->longAlerts) { - QApplication::alert( - getApp()->windows->getMainWindow().window(), 0); - } else { - QApplication::alert( - getApp()->windows->getMainWindow().window(), 2500); - } + getApp()->windows->sendAlert(); } } return Success; diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index 55d9b6506..f3523ffba 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -408,14 +408,7 @@ void TwitchChannel::setLive(bool newLiveStatus) getApp()->notifications->playSound(); } if (getSettings()->notificationFlashTaskbar) { - if (getSettings()->longAlerts) { - QApplication::alert( - getApp()->windows->getMainWindow().window(), 0); - } else { - QApplication::alert( - getApp()->windows->getMainWindow().window(), - 2500); - } + getApp()->windows->sendAlert(); } } auto live = makeSystemMessage(this->getName() + " is live"); diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index 16c967b1a..35e7b1503 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -788,13 +788,7 @@ void TwitchMessageBuilder::parseHighlights(bool isPastMsg) } if (doAlert) { - if (getSettings()->longAlerts) { - QApplication::alert( - getApp()->windows->getMainWindow().window(), 0); - } else { - QApplication::alert( - getApp()->windows->getMainWindow().window(), 2500); - } + getApp()->windows->sendAlert(); } } } diff --git a/src/singletons/WindowManager.cpp b/src/singletons/WindowManager.cpp index 853baa8e8..7e8d7dcde 100644 --- a/src/singletons/WindowManager.cpp +++ b/src/singletons/WindowManager.cpp @@ -444,6 +444,16 @@ void WindowManager::save() file.flush(); } +void WindowManager::sendAlert() +{ + int flashDuration = 2500; + if (getSettings()->longAlerts) { + flashDuration = 0; + } + QApplication::alert(getApp()->windows->getMainWindow().window(), + flashDuration); +} + void WindowManager::encodeNodeRecusively(SplitNode *node, QJsonObject &obj) { switch (node->getType()) { diff --git a/src/singletons/WindowManager.hpp b/src/singletons/WindowManager.hpp index 74149876e..db2f71ae2 100644 --- a/src/singletons/WindowManager.hpp +++ b/src/singletons/WindowManager.hpp @@ -61,6 +61,8 @@ public: pajlada::Signals::NoArgSignal wordFlagsChanged; + void sendAlert(); + private: void encodeNodeRecusively(SplitContainer::Node *node, QJsonObject &obj);