From 2b3fa06539e281219e3d3ce50a620e47cf5e6cfb Mon Sep 17 00:00:00 2001 From: Cranken Date: Sun, 8 Apr 2018 14:45:47 +0200 Subject: [PATCH] Fixed live status not updating when channel is online. (#319) * Fixed live status not updating when channel is online. --- src/providers/twitch/twitchchannel.cpp | 11 +++++------ src/providers/twitch/twitchchannel.hpp | 2 +- src/widgets/helper/splitheader.cpp | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/providers/twitch/twitchchannel.cpp b/src/providers/twitch/twitchchannel.cpp index 729612d49..d47b7f667 100644 --- a/src/providers/twitch/twitchchannel.cpp +++ b/src/providers/twitch/twitchchannel.cpp @@ -184,15 +184,14 @@ void TwitchChannel::setLive(bool newLiveStatus) { { std::lock_guard lock(this->streamStatusMutex); - if (this->streamStatus.live == newLiveStatus) { - // Nothing changed - return; + if (this->streamStatus.live != newLiveStatus) { + this->streamStatus.live = newLiveStatus; } - - this->streamStatus.live = newLiveStatus; } - this->onlineStatusChanged.invoke(); + if (newLiveStatus) { + this->updateLiveInfo.invoke(); + } } void TwitchChannel::refreshLiveStatus() diff --git a/src/providers/twitch/twitchchannel.hpp b/src/providers/twitch/twitchchannel.hpp index 718b7b3cb..9ba0ae0f0 100644 --- a/src/providers/twitch/twitchchannel.hpp +++ b/src/providers/twitch/twitchchannel.hpp @@ -54,7 +54,7 @@ public: void setRoomID(const QString &_roomID); pajlada::Signals::NoArgSignal roomIDchanged; - pajlada::Signals::NoArgSignal onlineStatusChanged; + pajlada::Signals::NoArgSignal updateLiveInfo; pajlada::Signals::NoArgBoltSignal fetchMessages; pajlada::Signals::NoArgSignal userStateChanged; diff --git a/src/widgets/helper/splitheader.cpp b/src/widgets/helper/splitheader.cpp index b6c198ab1..77ccd8d70 100644 --- a/src/widgets/helper/splitheader.cpp +++ b/src/widgets/helper/splitheader.cpp @@ -136,7 +136,7 @@ void SplitHeader::initializeChannelSignals() TwitchChannel *twitchChannel = dynamic_cast(channel.get()); if (twitchChannel) { - twitchChannel->onlineStatusChanged.connect([this]() { + twitchChannel->updateLiveInfo.connect([this]() { this->updateChannelText(); // }); }