Fix signal connection nodiscard warnings (#4818)

This commit is contained in:
pajlada
2023-09-16 13:52:51 +02:00
committed by GitHub
parent 2d5f078306
commit 8fe3af3522
40 changed files with 709 additions and 554 deletions
+32 -28
View File
@@ -94,25 +94,15 @@ TwitchChannel::TwitchChannel(const QString &name)
}));
this->refreshPubSub();
this->userStateChanged.connect([this] {
// We can safely ignore this signal connection since it's a private signal, meaning
// it will only ever be invoked by TwitchChannel itself
std::ignore = this->userStateChanged.connect([this] {
this->refreshPubSub();
});
// room id loaded -> refresh live status
this->roomIdChanged.connect([this]() {
this->refreshPubSub();
this->refreshBadges();
this->refreshCheerEmotes();
this->refreshFFZChannelEmotes(false);
this->refreshBTTVChannelEmotes(false);
this->refreshSevenTVChannelEmotes(false);
this->joinBttvChannel();
this->listenSevenTVCosmetics();
getIApp()->getTwitchLiveController()->add(
std::dynamic_pointer_cast<TwitchChannel>(shared_from_this()));
});
this->connected.connect([this]() {
// We can safely ignore this signal connection this has no external dependencies - once the signal
// is destroyed, it will no longer be able to fire
std::ignore = this->connected.connect([this]() {
if (this->roomId().isEmpty())
{
// If we get a reconnected event when the room id is not set, we
@@ -125,18 +115,7 @@ TwitchChannel::TwitchChannel(const QString &name)
this->loadRecentMessagesReconnect();
});
this->messageRemovedFromStart.connect([this](MessagePtr &msg) {
if (msg->replyThread)
{
if (msg->replyThread->liveCount(msg) == 0)
{
this->threads_.erase(msg->replyThread->rootId());
}
}
});
// timers
QObject::connect(&this->chattersListTimer_, &QTimer::timeout, [this] {
this->refreshChatters();
});
@@ -538,6 +517,20 @@ void TwitchChannel::showLoginMessage()
this->addMessage(builder.release());
}
void TwitchChannel::roomIdChanged()
{
this->refreshPubSub();
this->refreshBadges();
this->refreshCheerEmotes();
this->refreshFFZChannelEmotes(false);
this->refreshBTTVChannelEmotes(false);
this->refreshSevenTVChannelEmotes(false);
this->joinBttvChannel();
this->listenSevenTVCosmetics();
getIApp()->getTwitchLiveController()->add(
std::dynamic_pointer_cast<TwitchChannel>(shared_from_this()));
}
QString TwitchChannel::prepareMessage(const QString &message) const
{
auto app = getApp();
@@ -729,7 +722,7 @@ void TwitchChannel::setRoomId(const QString &id)
if (*this->roomID_.accessConst() != id)
{
*this->roomID_.access() = id;
this->roomIdChanged.invoke();
this->roomIdChanged();
this->loadRecentMessages();
}
}
@@ -1063,6 +1056,17 @@ bool TwitchChannel::tryReplaceLastLiveUpdateAddOrRemove(
return true;
}
void TwitchChannel::messageRemovedFromStart(const MessagePtr &msg)
{
if (msg->replyThread)
{
if (msg->replyThread->liveCount(msg) == 0)
{
this->threads_.erase(msg->replyThread->rootId());
}
}
}
const QString &TwitchChannel::subscriptionUrl()
{
return this->subscriptionUrl_;