Fixed live status not updating when channel is online. (#319)

* Fixed live status not updating when channel is online.
This commit is contained in:
Cranken 2018-04-08 14:45:47 +02:00 committed by pajlada
parent 10f0aadb6c
commit 2b3fa06539
3 changed files with 7 additions and 8 deletions

View file

@ -184,15 +184,14 @@ void TwitchChannel::setLive(bool newLiveStatus)
{ {
{ {
std::lock_guard<std::mutex> lock(this->streamStatusMutex); std::lock_guard<std::mutex> lock(this->streamStatusMutex);
if (this->streamStatus.live == newLiveStatus) { if (this->streamStatus.live != newLiveStatus) {
// Nothing changed this->streamStatus.live = newLiveStatus;
return;
} }
this->streamStatus.live = newLiveStatus;
} }
this->onlineStatusChanged.invoke(); if (newLiveStatus) {
this->updateLiveInfo.invoke();
}
} }
void TwitchChannel::refreshLiveStatus() void TwitchChannel::refreshLiveStatus()

View file

@ -54,7 +54,7 @@ public:
void setRoomID(const QString &_roomID); void setRoomID(const QString &_roomID);
pajlada::Signals::NoArgSignal roomIDchanged; pajlada::Signals::NoArgSignal roomIDchanged;
pajlada::Signals::NoArgSignal onlineStatusChanged; pajlada::Signals::NoArgSignal updateLiveInfo;
pajlada::Signals::NoArgBoltSignal fetchMessages; pajlada::Signals::NoArgBoltSignal fetchMessages;
pajlada::Signals::NoArgSignal userStateChanged; pajlada::Signals::NoArgSignal userStateChanged;

View file

@ -136,7 +136,7 @@ void SplitHeader::initializeChannelSignals()
TwitchChannel *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()); TwitchChannel *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());
if (twitchChannel) { if (twitchChannel) {
twitchChannel->onlineStatusChanged.connect([this]() { twitchChannel->updateLiveInfo.connect([this]() {
this->updateChannelText(); // this->updateChannelText(); //
}); });
} }