mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
fix: remove deprecated Application::getTwitchAbstract
(#5560)
This commit is contained in:
parent
3e510fd9e9
commit
ac88730563
|
@ -70,6 +70,7 @@
|
|||
- Dev: Refactored 7TV/BTTV definitions out of `TwitchIrcServer` into `Application`. (#5532)
|
||||
- Dev: Refactored code that's responsible for deleting old update files. (#5535)
|
||||
- Dev: Cleanly exit on shutdown. (#5537)
|
||||
- Dev: Removed the `getTwitchAbstract` method in `Application`. (#5560)
|
||||
- Dev: Renamed threads created by Chatterino on Linux and Windows. (#5538, #5539, #5544)
|
||||
- Dev: Refactored a few `#define`s into `const(expr)` and cleaned includes. (#5527)
|
||||
- Dev: Added `FlagsEnum::isEmpty`. (#5550)
|
||||
|
|
|
@ -133,13 +133,6 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ITwitchIrcServer *getTwitchAbstract() override
|
||||
{
|
||||
assert(false && "EmptyApplication::getTwitchAbstract was called "
|
||||
"without being initialized");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PubSub *getTwitchPubSub() override
|
||||
{
|
||||
assert(false && "getTwitchPubSub was called without being initialized");
|
||||
|
|
|
@ -512,13 +512,6 @@ ITwitchIrcServer *Application::getTwitch()
|
|||
return this->twitch.get();
|
||||
}
|
||||
|
||||
ITwitchIrcServer *Application::getTwitchAbstract()
|
||||
{
|
||||
assertInGuiThread();
|
||||
|
||||
return this->twitch.get();
|
||||
}
|
||||
|
||||
PubSub *Application::getTwitchPubSub()
|
||||
{
|
||||
assertInGuiThread();
|
||||
|
|
|
@ -83,7 +83,6 @@ public:
|
|||
virtual HighlightController *getHighlights() = 0;
|
||||
virtual NotificationController *getNotifications() = 0;
|
||||
virtual ITwitchIrcServer *getTwitch() = 0;
|
||||
virtual ITwitchIrcServer *getTwitchAbstract() = 0;
|
||||
virtual PubSub *getTwitchPubSub() = 0;
|
||||
virtual ILogging *getChatLogger() = 0;
|
||||
virtual IChatterinoBadges *getChatterinoBadges() = 0;
|
||||
|
@ -194,8 +193,6 @@ public:
|
|||
NotificationController *getNotifications() override;
|
||||
HighlightController *getHighlights() override;
|
||||
ITwitchIrcServer *getTwitch() override;
|
||||
[[deprecated("use getTwitch()")]] ITwitchIrcServer *getTwitchAbstract()
|
||||
override;
|
||||
PubSub *getTwitchPubSub() override;
|
||||
ILogging *getChatLogger() override;
|
||||
FfzBadges *getFfzBadges() override;
|
||||
|
|
|
@ -388,7 +388,7 @@ QString popup(const CommandContext &ctx)
|
|||
}
|
||||
|
||||
// Open channel passed as argument in a popup
|
||||
auto targetChannel = getApp()->getTwitchAbstract()->getOrAddChannel(target);
|
||||
auto targetChannel = getApp()->getTwitch()->getOrAddChannel(target);
|
||||
getApp()->getWindows()->openInPopup(targetChannel);
|
||||
|
||||
return "";
|
||||
|
@ -530,8 +530,7 @@ QString sendRawMessage(const CommandContext &ctx)
|
|||
|
||||
if (ctx.channel->isTwitchChannel())
|
||||
{
|
||||
getApp()->getTwitchAbstract()->sendRawMessage(
|
||||
ctx.words.mid(1).join(" "));
|
||||
getApp()->getTwitch()->sendRawMessage(ctx.words.mid(1).join(" "));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -564,7 +563,7 @@ QString injectFakeMessage(const CommandContext &ctx)
|
|||
}
|
||||
|
||||
auto ircText = ctx.words.mid(1).join(" ");
|
||||
getApp()->getTwitchAbstract()->addFakeMessage(ircText);
|
||||
getApp()->getTwitch()->addFakeMessage(ircText);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
@ -663,7 +662,7 @@ QString openUsercard(const CommandContext &ctx)
|
|||
stripChannelName(channelName);
|
||||
|
||||
ChannelPtr channelTemp =
|
||||
getApp()->getTwitchAbstract()->getChannelOrEmpty(channelName);
|
||||
getApp()->getTwitch()->getChannelOrEmpty(channelName);
|
||||
|
||||
if (channelTemp->isEmpty())
|
||||
{
|
||||
|
|
|
@ -182,10 +182,9 @@ bool appendWhisperMessageWordsLocally(const QStringList &words)
|
|||
!(getSettings()->streamerModeSuppressInlineWhispers &&
|
||||
getApp()->getStreamerMode()->isEnabled()))
|
||||
{
|
||||
app->getTwitchAbstract()->forEachChannel(
|
||||
[&messagexD](ChannelPtr _channel) {
|
||||
_channel->addMessage(messagexD, MessageContext::Repost);
|
||||
});
|
||||
app->getTwitch()->forEachChannel([&messagexD](ChannelPtr _channel) {
|
||||
_channel->addMessage(messagexD, MessageContext::Repost);
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -179,7 +179,7 @@ void NotificationController::fetchFakeChannels()
|
|||
for (size_t i = 0; i < channelMap[Platform::Twitch].raw().size(); i++)
|
||||
{
|
||||
const auto &name = channelMap[Platform::Twitch].raw()[i];
|
||||
auto chan = getApp()->getTwitchAbstract()->getChannelOrEmpty(name);
|
||||
auto chan = getApp()->getTwitch()->getChannelOrEmpty(name);
|
||||
if (chan->isEmpty())
|
||||
{
|
||||
channels.push_back(name);
|
||||
|
|
|
@ -300,7 +300,7 @@ int ChannelRef::get_by_name(lua_State *L)
|
|||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
auto chn = getApp()->getTwitchAbstract()->getChannelOrEmpty(name);
|
||||
auto chn = getApp()->getTwitch()->getChannelOrEmpty(name);
|
||||
lua::push(L, chn);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -732,7 +732,7 @@ void IrcMessageHandler::handleRoomStateMessage(Communi::IrcMessage *message)
|
|||
{
|
||||
return;
|
||||
}
|
||||
auto chan = getApp()->getTwitchAbstract()->getChannelOrEmpty(chanName);
|
||||
auto chan = getApp()->getTwitch()->getChannelOrEmpty(chanName);
|
||||
|
||||
auto *twitchChannel = dynamic_cast<TwitchChannel *>(chan.get());
|
||||
if (!twitchChannel)
|
||||
|
@ -794,7 +794,7 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message)
|
|||
}
|
||||
|
||||
// get channel
|
||||
auto chan = getApp()->getTwitchAbstract()->getChannelOrEmpty(chanName);
|
||||
auto chan = getApp()->getTwitch()->getChannelOrEmpty(chanName);
|
||||
|
||||
if (chan->isEmpty())
|
||||
{
|
||||
|
@ -839,7 +839,7 @@ void IrcMessageHandler::handleClearMessageMessage(Communi::IrcMessage *message)
|
|||
}
|
||||
|
||||
// get channel
|
||||
auto chan = getApp()->getTwitchAbstract()->getChannelOrEmpty(chanName);
|
||||
auto chan = getApp()->getTwitch()->getChannelOrEmpty(chanName);
|
||||
|
||||
if (chan->isEmpty())
|
||||
{
|
||||
|
@ -887,7 +887,7 @@ void IrcMessageHandler::handleUserStateMessage(Communi::IrcMessage *message)
|
|||
return;
|
||||
}
|
||||
|
||||
auto c = getApp()->getTwitchAbstract()->getChannelOrEmpty(channelName);
|
||||
auto c = getApp()->getTwitch()->getChannelOrEmpty(channelName);
|
||||
if (c->isEmpty())
|
||||
{
|
||||
return;
|
||||
|
@ -976,8 +976,8 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *ircMessage)
|
|||
!(getSettings()->streamerModeSuppressInlineWhispers &&
|
||||
getApp()->getStreamerMode()->isEnabled()))
|
||||
{
|
||||
getApp()->getTwitchAbstract()->forEachChannel([&message, overrideFlags](
|
||||
ChannelPtr channel) {
|
||||
getApp()->getTwitch()->forEachChannel([&message, overrideFlags](
|
||||
ChannelPtr channel) {
|
||||
channel->addMessage(message, MessageContext::Repost, overrideFlags);
|
||||
});
|
||||
}
|
||||
|
@ -1119,8 +1119,7 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
|
|||
return;
|
||||
}
|
||||
|
||||
auto channel =
|
||||
getApp()->getTwitchAbstract()->getChannelOrEmpty(channelName);
|
||||
auto channel = getApp()->getTwitch()->getChannelOrEmpty(channelName);
|
||||
|
||||
if (channel->isEmpty())
|
||||
{
|
||||
|
@ -1202,7 +1201,7 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
|
|||
|
||||
void IrcMessageHandler::handleJoinMessage(Communi::IrcMessage *message)
|
||||
{
|
||||
auto channel = getApp()->getTwitchAbstract()->getChannelOrEmpty(
|
||||
auto channel = getApp()->getTwitch()->getChannelOrEmpty(
|
||||
message->parameter(0).remove(0, 1));
|
||||
|
||||
auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());
|
||||
|
@ -1225,7 +1224,7 @@ void IrcMessageHandler::handleJoinMessage(Communi::IrcMessage *message)
|
|||
|
||||
void IrcMessageHandler::handlePartMessage(Communi::IrcMessage *message)
|
||||
{
|
||||
auto channel = getApp()->getTwitchAbstract()->getChannelOrEmpty(
|
||||
auto channel = getApp()->getTwitch()->getChannelOrEmpty(
|
||||
message->parameter(0).remove(0, 1));
|
||||
|
||||
auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());
|
||||
|
|
|
@ -725,7 +725,7 @@ bool TwitchChannel::canReconnect() const
|
|||
|
||||
void TwitchChannel::reconnect()
|
||||
{
|
||||
getApp()->getTwitchAbstract()->connect();
|
||||
getApp()->getTwitch()->connect();
|
||||
}
|
||||
|
||||
QString TwitchChannel::getCurrentStreamID() const
|
||||
|
|
|
@ -254,7 +254,7 @@ void NativeMessagingServer::ReceiverThread::handleSelect(
|
|||
postToThread([=] {
|
||||
if (!name.isEmpty())
|
||||
{
|
||||
auto channel = getApp()->getTwitchAbstract()->getOrAddChannel(name);
|
||||
auto channel = getApp()->getTwitch()->getOrAddChannel(name);
|
||||
if (getApp()->getTwitch()->getWatchingChannel().get() != channel)
|
||||
{
|
||||
getApp()->getTwitch()->setWatchingChannel(channel);
|
||||
|
@ -268,7 +268,7 @@ void NativeMessagingServer::ReceiverThread::handleSelect(
|
|||
if (!name.isEmpty())
|
||||
{
|
||||
window->setChannel(
|
||||
getApp()->getTwitchAbstract()->getOrAddChannel(name));
|
||||
getApp()->getTwitch()->getOrAddChannel(name));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -319,8 +319,7 @@ void NativeMessagingServer::syncChannels(const QJsonArray &twitchChannels)
|
|||
continue;
|
||||
}
|
||||
// the deduping is done on the extension side
|
||||
updated.emplace_back(
|
||||
getApp()->getTwitchAbstract()->getOrAddChannel(name));
|
||||
updated.emplace_back(getApp()->getTwitch()->getOrAddChannel(name));
|
||||
}
|
||||
|
||||
// This will destroy channels that aren't used anymore.
|
||||
|
|
|
@ -74,7 +74,7 @@ bool isBroadcasterSoftwareActive()
|
|||
shouldShowTimeoutWarning = false;
|
||||
|
||||
postToThread([] {
|
||||
getApp()->getTwitchAbstract()->addGlobalSystemMessage(
|
||||
getApp()->getTwitch()->addGlobalSystemMessage(
|
||||
"Streamer Mode is set to Automatic, but pgrep timed "
|
||||
"out. This can happen if your system lagged at the "
|
||||
"wrong moment. If Streamer Mode continues to not work, "
|
||||
|
@ -94,7 +94,7 @@ bool isBroadcasterSoftwareActive()
|
|||
shouldShowWarning = false;
|
||||
|
||||
postToThread([] {
|
||||
getApp()->getTwitchAbstract()->addGlobalSystemMessage(
|
||||
getApp()->getTwitch()->addGlobalSystemMessage(
|
||||
"Streamer Mode is set to Automatic, but pgrep is "
|
||||
"missing. "
|
||||
"Install it to fix the issue or set Streamer Mode to "
|
||||
|
|
|
@ -668,8 +668,7 @@ IndirectChannel WindowManager::decodeChannel(const SplitDescriptor &descriptor)
|
|||
|
||||
if (descriptor.type_ == "twitch")
|
||||
{
|
||||
return getApp()->getTwitchAbstract()->getOrAddChannel(
|
||||
descriptor.channelName_);
|
||||
return getApp()->getTwitch()->getOrAddChannel(descriptor.channelName_);
|
||||
}
|
||||
else if (descriptor.type_ == "mentions")
|
||||
{
|
||||
|
@ -693,7 +692,7 @@ IndirectChannel WindowManager::decodeChannel(const SplitDescriptor &descriptor)
|
|||
}
|
||||
else if (descriptor.type_ == "misc")
|
||||
{
|
||||
return getApp()->getTwitchAbstract()->getChannelOrEmpty(
|
||||
return getApp()->getTwitch()->getChannelOrEmpty(
|
||||
descriptor.channelName_);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,7 @@ bool FramelessEmbedWindow::nativeEvent(const QByteArray &eventType,
|
|||
auto channelName = root.value("channel-name").toString();
|
||||
|
||||
this->split_->setChannel(
|
||||
getApp()->getTwitchAbstract()->getOrAddChannel(
|
||||
channelName));
|
||||
getApp()->getTwitch()->getOrAddChannel(channelName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
|
|||
const auto &messages = getSampleMiscMessages();
|
||||
static int index = 0;
|
||||
const auto &msg = messages[index++ % messages.size()];
|
||||
getApp()->getTwitchAbstract()->addFakeMessage(msg);
|
||||
getApp()->getTwitch()->addFakeMessage(msg);
|
||||
return "";
|
||||
});
|
||||
|
||||
|
@ -269,7 +269,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
|
|||
const auto &messages = getSampleCheerMessages();
|
||||
static int index = 0;
|
||||
const auto &msg = messages[index++ % messages.size()];
|
||||
getApp()->getTwitchAbstract()->addFakeMessage(msg);
|
||||
getApp()->getTwitch()->addFakeMessage(msg);
|
||||
return "";
|
||||
});
|
||||
|
||||
|
@ -277,7 +277,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
|
|||
const auto &messages = getSampleLinkMessages();
|
||||
static int index = 0;
|
||||
const auto &msg = messages[index++ % messages.size()];
|
||||
getApp()->getTwitchAbstract()->addFakeMessage(msg);
|
||||
getApp()->getTwitch()->addFakeMessage(msg);
|
||||
return "";
|
||||
});
|
||||
|
||||
|
@ -292,7 +292,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
|
|||
oMessage->toInner<PubSubMessageMessage>()
|
||||
->toInner<PubSubCommunityPointsChannelV1Message>();
|
||||
|
||||
getApp()->getTwitchAbstract()->addFakeMessage(
|
||||
getApp()->getTwitch()->addFakeMessage(
|
||||
getSampleChannelRewardIRCMessage());
|
||||
getApp()->getTwitchPubSub()->pointReward.redeemed.invoke(
|
||||
oInnerMessage->data.value("redemption").toObject());
|
||||
|
@ -316,7 +316,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
|
|||
const auto &messages = getSampleEmoteTestMessages();
|
||||
static int index = 0;
|
||||
const auto &msg = messages[index++ % messages.size()];
|
||||
getApp()->getTwitchAbstract()->addFakeMessage(msg);
|
||||
getApp()->getTwitch()->addFakeMessage(msg);
|
||||
return "";
|
||||
});
|
||||
|
||||
|
@ -324,7 +324,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
|
|||
const auto &messages = getSampleSubMessages();
|
||||
static int index = 0;
|
||||
const auto &msg = messages[index++ % messages.size()];
|
||||
getApp()->getTwitchAbstract()->addFakeMessage(msg);
|
||||
getApp()->getTwitch()->addFakeMessage(msg);
|
||||
return "";
|
||||
});
|
||||
#endif
|
||||
|
@ -487,8 +487,8 @@ void Window::addShortcuts()
|
|||
splitContainer = this->notebook_->getOrAddSelectedPage();
|
||||
}
|
||||
Split *split = new Split(splitContainer);
|
||||
split->setChannel(getApp()->getTwitchAbstract()->getOrAddChannel(
|
||||
si.channelName));
|
||||
split->setChannel(
|
||||
getApp()->getTwitch()->getOrAddChannel(si.channelName));
|
||||
split->setFilters(si.filters);
|
||||
splitContainer->insertSplit(split);
|
||||
splitContainer->setSelected(split);
|
||||
|
|
|
@ -262,7 +262,7 @@ IndirectChannel SelectChannelDialog::getSelectedChannel() const
|
|||
case TAB_TWITCH: {
|
||||
if (this->ui_.twitch.channel->isChecked())
|
||||
{
|
||||
return getApp()->getTwitchAbstract()->getOrAddChannel(
|
||||
return getApp()->getTwitch()->getOrAddChannel(
|
||||
this->ui_.twitch.channelName->text().trimmed());
|
||||
}
|
||||
else if (this->ui_.twitch.watching->isChecked())
|
||||
|
|
|
@ -305,16 +305,15 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
|
|||
.getOrAddSelectedPage()
|
||||
->appendNewSplit(false);
|
||||
split->setChannel(
|
||||
app->getTwitchAbstract()->getOrAddChannel(
|
||||
app->getTwitch()->getOrAddChannel(
|
||||
loginName.toLower()));
|
||||
});
|
||||
|
||||
menu->addAction(
|
||||
"Open channel in a new tab", this, [loginName] {
|
||||
ChannelPtr channel =
|
||||
getApp()
|
||||
->getTwitchAbstract()
|
||||
->getOrAddChannel(loginName);
|
||||
getApp()->getTwitch()->getOrAddChannel(
|
||||
loginName);
|
||||
auto &nb = getApp()
|
||||
->getWindows()
|
||||
->getMainWindow()
|
||||
|
|
|
@ -21,8 +21,7 @@ NewPopupItem::NewPopupItem(const QString &channelName)
|
|||
|
||||
void NewPopupItem::action()
|
||||
{
|
||||
auto channel =
|
||||
getApp()->getTwitchAbstract()->getOrAddChannel(this->channelName_);
|
||||
auto channel = getApp()->getTwitch()->getOrAddChannel(this->channelName_);
|
||||
getApp()->getWindows()->openInPopup(channel);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ void NewTabItem::action()
|
|||
|
||||
Split *split = new Split(container);
|
||||
split->setChannel(
|
||||
getApp()->getTwitchAbstract()->getOrAddChannel(this->channelName_));
|
||||
getApp()->getTwitch()->getOrAddChannel(this->channelName_));
|
||||
container->insertSplit(split);
|
||||
}
|
||||
|
||||
|
|
|
@ -2763,8 +2763,8 @@ void ChannelView::showUserInfoPopup(const QString &userName,
|
|||
auto *userPopup =
|
||||
new UserInfoPopup(getSettings()->autoCloseUserPopup, this->split_);
|
||||
|
||||
auto contextChannel = getApp()->getTwitchAbstract()->getChannelOrEmpty(
|
||||
alternativePopoutChannel);
|
||||
auto contextChannel =
|
||||
getApp()->getTwitch()->getChannelOrEmpty(alternativePopoutChannel);
|
||||
auto openingChannel = this->hasSourceChannel() ? this->sourceChannel_
|
||||
: this->underlyingChannel_;
|
||||
userPopup->setData(userName, contextChannel, openingChannel);
|
||||
|
|
|
@ -271,7 +271,7 @@ Split::Split(QWidget *parent)
|
|||
std::ignore = this->view_->openChannelIn.connect(
|
||||
[this](QString twitchChannel, FromTwitchLinkOpenChannelIn openIn) {
|
||||
ChannelPtr channel =
|
||||
getApp()->getTwitchAbstract()->getOrAddChannel(twitchChannel);
|
||||
getApp()->getTwitch()->getOrAddChannel(twitchChannel);
|
||||
switch (openIn)
|
||||
{
|
||||
case FromTwitchLinkOpenChannelIn::Split:
|
||||
|
|
Loading…
Reference in a new issue