From 15e9e3e64291ea224db05c48975d71836d55e5f1 Mon Sep 17 00:00:00 2001 From: apa420 Date: Fri, 17 Aug 2018 21:19:15 +0200 Subject: [PATCH] Added functionality of colored splits when live --- src/messages/Message.hpp | 1 + src/providers/twitch/TwitchChannel.cpp | 7 +++++-- src/widgets/helper/ChannelView.cpp | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/messages/Message.hpp b/src/messages/Message.hpp index 76039ec41..06b995b5a 100644 --- a/src/messages/Message.hpp +++ b/src/messages/Message.hpp @@ -26,6 +26,7 @@ enum class MessageFlag : uint16_t { Untimeout = (1 << 9), PubSub = (1 << 10), Subscription = (1 << 11), + Notification = (1 << 12), }; using MessageFlags = FlagsEnum; diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index dcc083161..a26927967 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -38,6 +38,8 @@ TwitchChannel::TwitchChannel(const QString &name) // this->refreshChannelEmotes(); // this->refreshViewerList(); + this->tabHighlightRequested.connect([](HighlightState state) {}); + this->managedConnect(getApp()->accounts->twitch.currentUserChanged, [=] { this->setMod(false); }); @@ -326,9 +328,10 @@ void TwitchChannel::setLive(bool newLiveStatus) QApplication::alert( getApp()->windows->getMainWindow().window(), 2500); } - this->tabHighlightRequested.invoke( - HighlightState::Notification); } + auto live = makeSystemMessage(this->getName() + " is live"); + this->addMessage(live); + this->tabHighlightRequested.invoke(HighlightState::Notification); guard->live = newLiveStatus; } } diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 2dbf4d339..2ea32bb53 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -6,6 +6,7 @@ #include "messages/LimitedQueueSnapshot.hpp" #include "messages/Message.hpp" #include "messages/layouts/MessageLayout.hpp" +#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchServer.hpp" #include "singletons/Settings.hpp" #include "singletons/Theme.hpp" @@ -552,6 +553,14 @@ void ChannelView::setChannel(ChannelPtr newChannel) this->layoutMessages(); this->queueUpdate(); + + // Notifications + TwitchChannel *tc = dynamic_cast(newChannel.get()); + if (tc != nullptr) { + tc->tabHighlightRequested.connect([this](HighlightState state) { + this->tabHighlightRequested.invoke(HighlightState::Notification); + }); + } } void ChannelView::detachChannel()