Cleaner flashing code (#774)

This commit is contained in:
apa420 2018-10-07 12:55:44 +02:00 committed by pajlada
parent 767197ab48
commit bb6c2b6135
5 changed files with 15 additions and 22 deletions

View file

@ -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;

View file

@ -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");

View file

@ -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();
}
}
}

View file

@ -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()) {

View file

@ -61,6 +61,8 @@ public:
pajlada::Signals::NoArgSignal wordFlagsChanged;
void sendAlert();
private:
void encodeNodeRecusively(SplitContainer::Node *node, QJsonObject &obj);