chore: refactor TwitchIrcServer (#5421)

This commit is contained in:
pajlada
2024-06-01 14:56:40 +02:00
committed by GitHub
parent 2a46ee708e
commit b6dc5d9e03
28 changed files with 373 additions and 163 deletions
+6 -8
View File
@@ -375,35 +375,33 @@ IndirectChannel SelectChannelDialog::getSelectedChannel() const
return this->selectedChannel_;
}
auto *app = getApp();
switch (this->ui_.notebook->getSelectedIndex())
{
case TAB_TWITCH: {
if (this->ui_.twitch.channel->isChecked())
{
return app->twitch->getOrAddChannel(
return getIApp()->getTwitchAbstract()->getOrAddChannel(
this->ui_.twitch.channelName->text().trimmed());
}
else if (this->ui_.twitch.watching->isChecked())
{
return app->twitch->watchingChannel;
return getIApp()->getTwitch()->getWatchingChannel();
}
else if (this->ui_.twitch.mentions->isChecked())
{
return app->twitch->mentionsChannel;
return getIApp()->getTwitch()->getMentionsChannel();
}
else if (this->ui_.twitch.whispers->isChecked())
{
return app->twitch->whispersChannel;
return getIApp()->getTwitch()->getWhispersChannel();
}
else if (this->ui_.twitch.live->isChecked())
{
return app->twitch->liveChannel;
return getIApp()->getTwitch()->getLiveChannel();
}
else if (this->ui_.twitch.automod->isChecked())
{
return app->twitch->automodChannel;
return getIApp()->getTwitch()->getAutomodChannel();
}
}
break;
+7 -5
View File
@@ -298,21 +298,23 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
menu->addAction(
"Open channel in a new popup window", this,
[loginName] {
auto *app = getApp();
auto *app = getIApp();
auto &window = app->getWindows()->createWindow(
WindowType::Popup, true);
auto *split = window.getNotebook()
.getOrAddSelectedPage()
->appendNewSplit(false);
split->setChannel(app->twitch->getOrAddChannel(
loginName.toLower()));
split->setChannel(
app->getTwitchAbstract()->getOrAddChannel(
loginName.toLower()));
});
menu->addAction(
"Open channel in a new tab", this, [loginName] {
ChannelPtr channel =
getApp()->twitch->getOrAddChannel(
loginName);
getIApp()
->getTwitchAbstract()
->getOrAddChannel(loginName);
auto &nb = getApp()
->getWindows()
->getMainWindow()
@@ -21,7 +21,8 @@ NewPopupItem::NewPopupItem(const QString &channelName)
void NewPopupItem::action()
{
auto channel = getApp()->twitch->getOrAddChannel(this->channelName_);
auto channel =
getIApp()->getTwitchAbstract()->getOrAddChannel(this->channelName_);
getIApp()->getWindows()->openInPopup(channel);
}
+2 -1
View File
@@ -26,7 +26,8 @@ void NewTabItem::action()
SplitContainer *container = nb.addPage(true);
Split *split = new Split(container);
split->setChannel(getApp()->twitch->getOrAddChannel(this->channelName_));
split->setChannel(
getIApp()->getTwitchAbstract()->getOrAddChannel(this->channelName_));
container->insertSplit(split);
}