From 19268d7ad730b3b64bcbcd725d95828c0eea7e14 Mon Sep 17 00:00:00 2001 From: Cranken Date: Tue, 5 Sep 2017 23:54:45 +0200 Subject: [PATCH] Also added live check on startup. --- src/channel.cpp | 6 ++++++ src/channel.hpp | 7 +++---- src/ircmanager.cpp | 2 +- src/widgets/chatwidget.cpp | 3 +++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/channel.cpp b/src/channel.cpp index 76de2d168..af979c6a4 100644 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -63,6 +63,12 @@ const QString &Channel::getPopoutPlayerLink() const return _popoutPlayerLink; } +void Channel::setRoomID(std::string id) +{ + this->roomID = id; + this->roomIDchanged(); +} + messages::LimitedQueueSnapshot Channel::getMessageSnapshot() { return _messages.getSnapshot(); diff --git a/src/channel.hpp b/src/channel.hpp index 2284ee1a8..5d4c8cbce 100644 --- a/src/channel.hpp +++ b/src/channel.hpp @@ -39,10 +39,6 @@ public: const QString &getSubLink() const; const QString &getChannelLink() const; const QString &getPopoutPlayerLink() const; - bool getIsLive() const; - int getStreamViewerCount() const; - const QString &getStreamStatus() const; - const QString &getStreamGame() const; messages::LimitedQueueSnapshot getMessageSnapshot(); // methods @@ -59,6 +55,9 @@ public: QString streamGame; QString streamUptime; + void setRoomID(std::string id); + boost::signals2::signal roomIDchanged; + private: // variables messages::LimitedQueue _messages; diff --git a/src/ircmanager.cpp b/src/ircmanager.cpp index eff587d49..ca2d1a972 100644 --- a/src/ircmanager.cpp +++ b/src/ircmanager.cpp @@ -283,7 +283,7 @@ void IrcManager::handleRoomStateMessage(Communi::IrcMessage *message) std::string roomID = iterator.value().toString().toStdString(); auto channel = QString(message->toData()).split("#").at(1); - channelManager.getChannel(channel)->roomID = roomID; + channelManager.getChannel(channel)->setRoomID(roomID); this->resources.loadChannelData(roomID); } diff --git a/src/widgets/chatwidget.cpp b/src/widgets/chatwidget.cpp index 44970153e..22af801f7 100644 --- a/src/widgets/chatwidget.cpp +++ b/src/widgets/chatwidget.cpp @@ -91,6 +91,9 @@ std::shared_ptr &ChatWidget::getChannelRef() void ChatWidget::setChannel(std::shared_ptr _newChannel) { this->channel = _newChannel; + this->channel->roomIDchanged.connect([this](){ + this->header.checkLive(); + }); // on new message this->messageAppendedConnection =