chore: replace usages of obsolete twitch struct with backing field (#3614)

Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
This commit is contained in:
James Upjohn
2022-03-20 00:02:29 +13:00
committed by GitHub
parent 4c275cb183
commit 67c10fafc7
23 changed files with 120 additions and 142 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ bool FramelessEmbedWindow::nativeEvent(const QByteArray &eventType,
auto channelName = root.value("channel-name").toString();
this->split_->setChannel(
getApp()->twitch2->getOrAddChannel(channelName));
getApp()->twitch->getOrAddChannel(channelName));
}
}
}
+8 -8
View File
@@ -254,7 +254,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
static int index = 0;
auto app = getApp();
const auto &msg = messages[index++ % messages.size()];
app->twitch.server->addFakeMessage(msg);
app->twitch->addFakeMessage(msg);
return "";
});
@@ -262,7 +262,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
const auto &messages = cheerMessages;
static int index = 0;
const auto &msg = messages[index++ % messages.size()];
getApp()->twitch.server->addFakeMessage(msg);
getApp()->twitch->addFakeMessage(msg);
return "";
});
@@ -271,7 +271,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
static int index = 0;
auto app = getApp();
const auto &msg = messages[index++ % messages.size()];
app->twitch.server->addFakeMessage(msg);
app->twitch->addFakeMessage(msg);
return "";
});
@@ -282,15 +282,15 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
if (alt)
{
doc.Parse(channelRewardMessage);
app->twitch.server->addFakeMessage(channelRewardIRCMessage);
app->twitch.pubsub->signals_.pointReward.redeemed.invoke(
app->twitch->addFakeMessage(channelRewardIRCMessage);
app->twitch->pubsub->signals_.pointReward.redeemed.invoke(
doc["data"]["message"]["data"]["redemption"]);
alt = !alt;
}
else
{
doc.Parse(channelRewardMessage2);
app->twitch.pubsub->signals_.pointReward.redeemed.invoke(
app->twitch->pubsub->signals_.pointReward.redeemed.invoke(
doc["data"]["message"]["data"]["redemption"]);
alt = !alt;
}
@@ -301,7 +301,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
const auto &messages = emoteTestMessages;
static int index = 0;
const auto &msg = messages[index++ % messages.size()];
getApp()->twitch.server->addFakeMessage(msg);
getApp()->twitch->addFakeMessage(msg);
return "";
});
#endif
@@ -466,7 +466,7 @@ void Window::addShortcuts()
this->notebook_->select(splitContainer);
Split *split = new Split(splitContainer);
split->setChannel(
getApp()->twitch.server->getOrAddChannel(si.channelName));
getApp()->twitch->getOrAddChannel(si.channelName));
split->setFilters(si.filters);
splitContainer->appendSplit(split);
return "";
+4 -4
View File
@@ -341,9 +341,9 @@ void EmotePopup::loadChannel(ChannelPtr channel)
*globalChannel, *subChannel, this->channel_->getName());
// global
addEmotes(*globalChannel, *getApp()->twitch2->getBttvEmotes().emotes(),
addEmotes(*globalChannel, *getApp()->twitch->getBttvEmotes().emotes(),
"BetterTTV", MessageElementFlag::BttvEmote);
addEmotes(*globalChannel, *getApp()->twitch2->getFfzEmotes().emotes(),
addEmotes(*globalChannel, *getApp()->twitch->getFfzEmotes().emotes(),
"FrankerFaceZ", MessageElementFlag::FfzEmote);
// channel
@@ -406,9 +406,9 @@ void EmotePopup::filterTwitchEmotes(std::shared_ptr<Channel> searchChannel,
}
auto bttvGlobalEmotes = this->filterEmoteMap(
searchText, getApp()->twitch2->getBttvEmotes().emotes());
searchText, getApp()->twitch->getBttvEmotes().emotes());
auto ffzGlobalEmotes = this->filterEmoteMap(
searchText, getApp()->twitch2->getFfzEmotes().emotes());
searchText, getApp()->twitch->getFfzEmotes().emotes());
// twitch
addEmoteSets(twitchGlobalEmotes, *searchChannel, *searchChannel,
+5 -5
View File
@@ -350,24 +350,24 @@ IndirectChannel SelectChannelDialog::getSelectedChannel() const
case TAB_TWITCH: {
if (this->ui_.twitch.channel->isChecked())
{
return app->twitch.server->getOrAddChannel(
return app->twitch->getOrAddChannel(
this->ui_.twitch.channelName->text().trimmed());
}
else if (this->ui_.twitch.watching->isChecked())
{
return app->twitch.server->watchingChannel;
return app->twitch->watchingChannel;
}
else if (this->ui_.twitch.mentions->isChecked())
{
return app->twitch.server->mentionsChannel;
return app->twitch->mentionsChannel;
}
else if (this->ui_.twitch.whispers->isChecked())
{
return app->twitch.server->whispersChannel;
return app->twitch->whispersChannel;
}
else if (this->ui_.twitch.live->isChecked())
{
return app->twitch.server->liveChannel;
return app->twitch->liveChannel;
}
}
break;
+1 -1
View File
@@ -301,7 +301,7 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent)
auto split = window.getNotebook()
.getOrAddSelectedPage()
->appendNewSplit(false);
split->setChannel(app->twitch2->getOrAddChannel(
split->setChannel(app->twitch->getOrAddChannel(
loginName.toLower()));
});
+1 -2
View File
@@ -25,8 +25,7 @@ void NewTabItem::action()
SplitContainer *container = nb.addPage(true);
Split *split = new Split(container);
split->setChannel(
getApp()->twitch.server->getOrAddChannel(this->channelName_));
split->setChannel(getApp()->twitch->getOrAddChannel(this->channelName_));
container->appendSplit(split);
}
+4 -5
View File
@@ -1016,15 +1016,15 @@ MessageElementFlags ChannelView::getFlags() const
{
flags.set(MessageElementFlag::ModeratorTools);
}
if (this->underlyingChannel_ == app->twitch.server->mentionsChannel ||
this->underlyingChannel_ == app->twitch.server->liveChannel)
if (this->underlyingChannel_ == app->twitch->mentionsChannel ||
this->underlyingChannel_ == app->twitch->liveChannel)
{
flags.set(MessageElementFlag::ChannelName);
flags.unset(MessageElementFlag::ChannelPointReward);
}
}
if (this->sourceChannel_ == app->twitch.server->mentionsChannel)
if (this->sourceChannel_ == app->twitch->mentionsChannel)
flags.set(MessageElementFlag::ChannelName);
return flags;
@@ -1071,8 +1071,7 @@ void ChannelView::drawMessages(QPainter &painter)
bool windowFocused = this->window() == QApplication::activeWindow();
auto app = getApp();
bool isMentions =
this->underlyingChannel_ == app->twitch.server->mentionsChannel;
bool isMentions = this->underlyingChannel_ == app->twitch->mentionsChannel;
for (size_t i = start; i < messagesSnapshot.size(); ++i)
{
+2 -2
View File
@@ -106,9 +106,9 @@ void InputCompletionPopup::updateEmotes(const QString &text, ChannelPtr channel)
addEmotes(emotes, *ffz, text, "Channel FrankerFaceZ");
}
if (auto bttvG = getApp()->twitch2->getBttvEmotes().emotes())
if (auto bttvG = getApp()->twitch->getBttvEmotes().emotes())
addEmotes(emotes, *bttvG, text, "Global BetterTTV");
if (auto ffzG = getApp()->twitch2->getFfzEmotes().emotes())
if (auto ffzG = getApp()->twitch->getFfzEmotes().emotes())
addEmotes(emotes, *ffzG, text, "Global FrankerFaceZ");
addEmojis(emotes, getApp()->emotes->emojis.emojis, text);
+1 -2
View File
@@ -125,8 +125,7 @@ Split::Split(QWidget *parent)
this->view_->openChannelIn.connect([this](
QString twitchChannel,
FromTwitchLinkOpenChannelIn openIn) {
ChannelPtr channel =
getApp()->twitch.server->getOrAddChannel(twitchChannel);
ChannelPtr channel = getApp()->twitch->getOrAddChannel(twitchChannel);
switch (openIn)
{
case FromTwitchLinkOpenChannelIn::Split:
+1 -1
View File
@@ -687,7 +687,7 @@ void SplitInput::editTextChanged()
if (text.startsWith("/r ", Qt::CaseInsensitive) &&
this->split_->getChannel()->isTwitchChannel())
{
QString lastUser = app->twitch.server->lastUserThatWhisperedMe.get();
QString lastUser = app->twitch->lastUserThatWhisperedMe.get();
if (!lastUser.isEmpty())
{
this->ui_.textEdit->setPlainText("/w " + lastUser + text.mid(2));