chore: remove Singleton & replace getIApp with getApp (#5514)
This commit is contained in:
@@ -58,7 +58,7 @@ BadgePickerDialog::BadgePickerDialog(QList<DisplayBadge> badges,
|
||||
updateBadge(0);
|
||||
|
||||
// Set icons.
|
||||
getIApp()->getTwitchBadges()->getBadgeIcons(
|
||||
getApp()->getTwitchBadges()->getBadgeIcons(
|
||||
badges,
|
||||
[&dropdown = this->dropdown_](QString identifier, const QIconPtr icon) {
|
||||
if (!dropdown)
|
||||
|
||||
@@ -26,8 +26,7 @@ EditHotkeyDialog::EditHotkeyDialog(const std::shared_ptr<Hotkey> hotkey,
|
||||
this->ui_->easyArgsPicker->setVisible(false);
|
||||
this->ui_->easyArgsLabel->setVisible(false);
|
||||
// dynamically add category names to the category picker
|
||||
for (const auto &[_, hotkeyCategory] :
|
||||
getIApp()->getHotkeys()->categories())
|
||||
for (const auto &[_, hotkeyCategory] : getApp()->getHotkeys()->categories())
|
||||
{
|
||||
this->ui_->categoryPicker->addItem(hotkeyCategory.displayName,
|
||||
hotkeyCategory.name);
|
||||
@@ -154,7 +153,7 @@ void EditHotkeyDialog::afterEdit()
|
||||
auto arguments =
|
||||
parseHotkeyArguments(this->ui_->argumentsEdit->toPlainText());
|
||||
|
||||
auto category = getIApp()->getHotkeys()->hotkeyCategoryFromName(
|
||||
auto category = getApp()->getHotkeys()->hotkeyCategoryFromName(
|
||||
this->ui_->categoryPicker->currentData().toString());
|
||||
if (!category)
|
||||
{
|
||||
@@ -166,7 +165,7 @@ void EditHotkeyDialog::afterEdit()
|
||||
|
||||
// check if another hotkey with this name exists, accounts for editing a hotkey
|
||||
bool isEditing = bool(this->data_);
|
||||
if (getIApp()->getHotkeys()->getHotkeyByName(nameText))
|
||||
if (getApp()->getHotkeys()->getHotkeyByName(nameText))
|
||||
{
|
||||
// A hotkey with this name already exists
|
||||
if (isEditing && this->data()->name() == nameText)
|
||||
@@ -243,8 +242,8 @@ void EditHotkeyDialog::afterEdit()
|
||||
{
|
||||
if (keyComboWasEdited || nameWasEdited)
|
||||
{
|
||||
if (getIApp()->getHotkeys()->isDuplicate(hotkey,
|
||||
this->data()->name()))
|
||||
if (getApp()->getHotkeys()->isDuplicate(hotkey,
|
||||
this->data()->name()))
|
||||
{
|
||||
this->showEditError(
|
||||
"Keybinding needs to be unique in the category.");
|
||||
@@ -254,7 +253,7 @@ void EditHotkeyDialog::afterEdit()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (getIApp()->getHotkeys()->isDuplicate(hotkey, QString()))
|
||||
if (getApp()->getHotkeys()->isDuplicate(hotkey, QString()))
|
||||
{
|
||||
this->showEditError(
|
||||
"Keybinding needs to be unique in the category.");
|
||||
@@ -268,7 +267,7 @@ void EditHotkeyDialog::afterEdit()
|
||||
|
||||
void EditHotkeyDialog::updatePossibleActions()
|
||||
{
|
||||
const auto &hotkeys = getIApp()->getHotkeys();
|
||||
const auto &hotkeys = getApp()->getHotkeys();
|
||||
auto category = hotkeys->hotkeyCategoryFromName(
|
||||
this->ui_->categoryPicker->currentData().toString());
|
||||
if (!category)
|
||||
@@ -320,7 +319,7 @@ void EditHotkeyDialog::updateArgumentsInput()
|
||||
this->ui_->argumentsEdit->setEnabled(true);
|
||||
return;
|
||||
}
|
||||
const auto &hotkeys = getIApp()->getHotkeys();
|
||||
const auto &hotkeys = getApp()->getHotkeys();
|
||||
auto category = hotkeys->hotkeyCategoryFromName(
|
||||
this->ui_->categoryPicker->currentData().toString());
|
||||
if (!category)
|
||||
|
||||
@@ -129,7 +129,7 @@ void addTwitchEmoteSets(
|
||||
{
|
||||
builder
|
||||
.emplace<EmoteElement>(
|
||||
getIApp()->getEmotes()->getTwitchEmotes()->getOrCreateEmote(
|
||||
getApp()->getEmotes()->getTwitchEmotes()->getOrCreateEmote(
|
||||
emote.id, emote.name),
|
||||
MessageElementFlags{MessageElementFlag::AlwaysShow,
|
||||
MessageElementFlag::TwitchEmote})
|
||||
@@ -211,7 +211,7 @@ EmotePopup::EmotePopup(QWidget *parent)
|
||||
, notebook_(new Notebook(this))
|
||||
{
|
||||
// this->setStayInScreenRect(true);
|
||||
auto bounds = getIApp()->getWindows()->emotePopupBounds();
|
||||
auto bounds = getApp()->getWindows()->emotePopupBounds();
|
||||
if (bounds.size().isEmpty())
|
||||
{
|
||||
bounds.setSize(QSize{300, 500} * this->scale());
|
||||
@@ -282,7 +282,7 @@ EmotePopup::EmotePopup(QWidget *parent)
|
||||
loadEmojis(*this->viewEmojis_,
|
||||
getApp()->getEmotes()->getEmojis()->getEmojis());
|
||||
this->addShortcuts();
|
||||
this->signalHolder_.managedConnect(getIApp()->getHotkeys()->onItemsUpdated,
|
||||
this->signalHolder_.managedConnect(getApp()->getHotkeys()->onItemsUpdated,
|
||||
[this]() {
|
||||
this->clearShortcuts();
|
||||
this->addShortcuts();
|
||||
@@ -380,7 +380,7 @@ void EmotePopup::addShortcuts()
|
||||
}},
|
||||
};
|
||||
|
||||
this->shortcuts_ = getIApp()->getHotkeys()->shortcutsForCategory(
|
||||
this->shortcuts_ = getApp()->getHotkeys()->shortcutsForCategory(
|
||||
HotkeyCategory::PopupWindow, actions, this);
|
||||
}
|
||||
|
||||
@@ -403,12 +403,9 @@ void EmotePopup::loadChannel(ChannelPtr channel)
|
||||
auto channelChannel = std::make_shared<Channel>("", Channel::Type::None);
|
||||
|
||||
// twitch
|
||||
addTwitchEmoteSets(getIApp()
|
||||
->getAccounts()
|
||||
->twitch.getCurrent()
|
||||
->accessEmotes()
|
||||
->emoteSets,
|
||||
*globalChannel, *subChannel, this->channel_->getName());
|
||||
addTwitchEmoteSets(
|
||||
getApp()->getAccounts()->twitch.getCurrent()->accessEmotes()->emoteSets,
|
||||
*globalChannel, *subChannel, this->channel_->getName());
|
||||
|
||||
// global
|
||||
if (Settings::instance().enableBTTVGlobalEmotes)
|
||||
@@ -478,11 +475,8 @@ bool EmotePopup::eventFilter(QObject *object, QEvent *event)
|
||||
void EmotePopup::filterTwitchEmotes(std::shared_ptr<Channel> searchChannel,
|
||||
const QString &searchText)
|
||||
{
|
||||
auto twitchEmoteSets = getIApp()
|
||||
->getAccounts()
|
||||
->twitch.getCurrent()
|
||||
->accessEmotes()
|
||||
->emoteSets;
|
||||
auto twitchEmoteSets =
|
||||
getApp()->getAccounts()->twitch.getCurrent()->accessEmotes()->emoteSets;
|
||||
std::vector<std::shared_ptr<TwitchAccount::EmoteSet>> twitchGlobalEmotes{};
|
||||
|
||||
for (const auto &set : twitchEmoteSets)
|
||||
@@ -503,11 +497,11 @@ void EmotePopup::filterTwitchEmotes(std::shared_ptr<Channel> searchChannel,
|
||||
}
|
||||
|
||||
auto bttvGlobalEmotes =
|
||||
filterEmoteMap(searchText, getIApp()->getBttvEmotes()->emotes());
|
||||
filterEmoteMap(searchText, getApp()->getBttvEmotes()->emotes());
|
||||
auto ffzGlobalEmotes =
|
||||
filterEmoteMap(searchText, getIApp()->getFfzEmotes()->emotes());
|
||||
filterEmoteMap(searchText, getApp()->getFfzEmotes()->emotes());
|
||||
auto seventvGlobalEmotes = filterEmoteMap(
|
||||
searchText, getIApp()->getSeventvEmotes()->globalEmotes());
|
||||
searchText, getApp()->getSeventvEmotes()->globalEmotes());
|
||||
|
||||
// twitch
|
||||
addTwitchEmoteSets(twitchGlobalEmotes, *searchChannel, *searchChannel,
|
||||
@@ -580,7 +574,7 @@ void EmotePopup::filterEmotes(const QString &searchText)
|
||||
std::vector<EmojiPtr> filteredEmojis{};
|
||||
int emojiCount = 0;
|
||||
|
||||
const auto &emojis = getIApp()->getEmotes()->getEmojis()->getEmojis();
|
||||
const auto &emojis = getApp()->getEmotes()->getEmojis()->getEmojis();
|
||||
for (const auto &emoji : emojis)
|
||||
{
|
||||
if (emoji->shortCodes[0].contains(searchText, Qt::CaseInsensitive))
|
||||
@@ -603,7 +597,7 @@ void EmotePopup::filterEmotes(const QString &searchText)
|
||||
|
||||
void EmotePopup::saveBounds() const
|
||||
{
|
||||
getIApp()->getWindows()->setEmotePopupBounds(this->getBounds());
|
||||
getApp()->getWindows()->setEmotePopupBounds(this->getBounds());
|
||||
}
|
||||
|
||||
void EmotePopup::resizeEvent(QResizeEvent *event)
|
||||
|
||||
@@ -66,8 +66,8 @@ namespace {
|
||||
pajlada::Settings::Setting<QString>::set(basePath + "/oauthToken",
|
||||
oauthToken);
|
||||
|
||||
getIApp()->getAccounts()->twitch.reloadUsers();
|
||||
getIApp()->getAccounts()->twitch.currentUsername = username;
|
||||
getApp()->getAccounts()->twitch.reloadUsers();
|
||||
getApp()->getAccounts()->twitch.currentUsername = username;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ QualityPopup::QualityPopup(const QString &channelURL, QStringList options)
|
||||
BaseWindow::DisableLayoutSave,
|
||||
BaseWindow::BoundsCheckOnShow,
|
||||
},
|
||||
static_cast<QWidget *>(&(getIApp()->getWindows()->getMainWindow())))
|
||||
static_cast<QWidget *>(&(getApp()->getWindows()->getMainWindow())))
|
||||
, channelURL_(channelURL)
|
||||
{
|
||||
this->ui_.selector = new QComboBox(this);
|
||||
|
||||
@@ -77,7 +77,7 @@ ReplyThreadPopup::ReplyThreadPopup(bool closeAutomatically, Split *split)
|
||||
{"search", nullptr},
|
||||
};
|
||||
|
||||
this->shortcuts_ = getIApp()->getHotkeys()->shortcutsForCategory(
|
||||
this->shortcuts_ = getApp()->getHotkeys()->shortcutsForCategory(
|
||||
HotkeyCategory::PopupWindow, actions, this);
|
||||
|
||||
// initialize UI
|
||||
@@ -98,7 +98,7 @@ ReplyThreadPopup::ReplyThreadPopup(bool closeAutomatically, Split *split)
|
||||
new SplitInput(this, this->split_, this->ui_.threadView, false);
|
||||
|
||||
this->bSignals_.emplace_back(
|
||||
getIApp()->getAccounts()->twitch.currentUserChanged.connect([this] {
|
||||
getApp()->getAccounts()->twitch.currentUserChanged.connect([this] {
|
||||
this->updateInputUI();
|
||||
}));
|
||||
|
||||
@@ -287,7 +287,7 @@ void ReplyThreadPopup::updateInputUI()
|
||||
|
||||
this->ui_.replyInput->setVisible(channel->isWritable());
|
||||
|
||||
auto user = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
auto user = getApp()->getAccounts()->twitch.getCurrent();
|
||||
QString placeholderText;
|
||||
|
||||
if (user->isAnon())
|
||||
@@ -297,7 +297,7 @@ void ReplyThreadPopup::updateInputUI()
|
||||
else
|
||||
{
|
||||
placeholderText = QStringLiteral("Reply as %1...")
|
||||
.arg(getIApp()
|
||||
.arg(getApp()
|
||||
->getAccounts()
|
||||
->twitch.getCurrent()
|
||||
->getUserName());
|
||||
|
||||
@@ -380,28 +380,28 @@ IndirectChannel SelectChannelDialog::getSelectedChannel() const
|
||||
case TAB_TWITCH: {
|
||||
if (this->ui_.twitch.channel->isChecked())
|
||||
{
|
||||
return getIApp()->getTwitchAbstract()->getOrAddChannel(
|
||||
return getApp()->getTwitchAbstract()->getOrAddChannel(
|
||||
this->ui_.twitch.channelName->text().trimmed());
|
||||
}
|
||||
else if (this->ui_.twitch.watching->isChecked())
|
||||
{
|
||||
return getIApp()->getTwitch()->getWatchingChannel();
|
||||
return getApp()->getTwitch()->getWatchingChannel();
|
||||
}
|
||||
else if (this->ui_.twitch.mentions->isChecked())
|
||||
{
|
||||
return getIApp()->getTwitch()->getMentionsChannel();
|
||||
return getApp()->getTwitch()->getMentionsChannel();
|
||||
}
|
||||
else if (this->ui_.twitch.whispers->isChecked())
|
||||
{
|
||||
return getIApp()->getTwitch()->getWhispersChannel();
|
||||
return getApp()->getTwitch()->getWhispersChannel();
|
||||
}
|
||||
else if (this->ui_.twitch.live->isChecked())
|
||||
{
|
||||
return getIApp()->getTwitch()->getLiveChannel();
|
||||
return getApp()->getTwitch()->getLiveChannel();
|
||||
}
|
||||
else if (this->ui_.twitch.automod->isChecked())
|
||||
{
|
||||
return getIApp()->getTwitch()->getAutomodChannel();
|
||||
return getApp()->getTwitch()->getAutomodChannel();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -613,7 +613,7 @@ void SelectChannelDialog::addShortcuts()
|
||||
actions.emplace("openTab", nullptr);
|
||||
}
|
||||
|
||||
this->shortcuts_ = getIApp()->getHotkeys()->shortcutsForCategory(
|
||||
this->shortcuts_ = getApp()->getHotkeys()->shortcutsForCategory(
|
||||
HotkeyCategory::PopupWindow, actions, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ SettingsDialog::SettingsDialog(QWidget *parent)
|
||||
this->overrideBackgroundColor_ = QColor("#111111");
|
||||
|
||||
this->addShortcuts();
|
||||
this->signalHolder_.managedConnect(getIApp()->getHotkeys()->onItemsUpdated,
|
||||
this->signalHolder_.managedConnect(getApp()->getHotkeys()->onItemsUpdated,
|
||||
[this]() {
|
||||
this->clearShortcuts();
|
||||
this->addShortcuts();
|
||||
@@ -81,13 +81,13 @@ void SettingsDialog::addShortcuts()
|
||||
{"openTab", nullptr},
|
||||
};
|
||||
|
||||
this->shortcuts_ = getIApp()->getHotkeys()->shortcutsForCategory(
|
||||
this->shortcuts_ = getApp()->getHotkeys()->shortcutsForCategory(
|
||||
HotkeyCategory::PopupWindow, actions, this);
|
||||
}
|
||||
void SettingsDialog::setSearchPlaceholderText()
|
||||
{
|
||||
QString searchHotkey;
|
||||
auto searchSeq = getIApp()->getHotkeys()->getDisplaySequence(
|
||||
auto searchSeq = getApp()->getHotkeys()->getDisplaySequence(
|
||||
HotkeyCategory::PopupWindow, "search");
|
||||
if (!searchSeq.isEmpty())
|
||||
{
|
||||
@@ -434,7 +434,7 @@ void SettingsDialog::onOkClicked()
|
||||
{
|
||||
if (!getApp()->getArgs().dontSaveSettings)
|
||||
{
|
||||
getIApp()->getCommands()->save();
|
||||
getApp()->getCommands()->save();
|
||||
pajlada::Settings::SettingManager::gSave();
|
||||
}
|
||||
this->close();
|
||||
|
||||
@@ -27,7 +27,7 @@ UpdateDialog::UpdateDialog()
|
||||
auto *dismiss = buttons->addButton("Dismiss", QDialogButtonBox::RejectRole);
|
||||
|
||||
QObject::connect(install, &QPushButton::clicked, this, [this] {
|
||||
getIApp()->getUpdates().installUpdates();
|
||||
getApp()->getUpdates().installUpdates();
|
||||
this->close();
|
||||
});
|
||||
QObject::connect(dismiss, &QPushButton::clicked, this, [this] {
|
||||
@@ -35,8 +35,8 @@ UpdateDialog::UpdateDialog()
|
||||
this->close();
|
||||
});
|
||||
|
||||
this->updateStatusChanged(getIApp()->getUpdates().getStatus());
|
||||
this->connections_.managedConnect(getIApp()->getUpdates().statusUpdated,
|
||||
this->updateStatusChanged(getApp()->getUpdates().getStatus());
|
||||
this->connections_.managedConnect(getApp()->getUpdates().statusUpdated,
|
||||
[this](auto status) {
|
||||
this->updateStatusChanged(status);
|
||||
});
|
||||
@@ -53,17 +53,17 @@ void UpdateDialog::updateStatusChanged(Updates::Status status)
|
||||
{
|
||||
case Updates::UpdateAvailable: {
|
||||
this->ui_.label->setText((
|
||||
getIApp()->getUpdates().isDowngrade()
|
||||
getApp()->getUpdates().isDowngrade()
|
||||
? QString(
|
||||
"The version online (%1) seems to be\nlower than the "
|
||||
"current (%2).\nEither a version was reverted or "
|
||||
"you are\nrunning a newer build.\n\nDo you want to "
|
||||
"download and install it?")
|
||||
.arg(getIApp()->getUpdates().getOnlineVersion(),
|
||||
getIApp()->getUpdates().getCurrentVersion())
|
||||
.arg(getApp()->getUpdates().getOnlineVersion(),
|
||||
getApp()->getUpdates().getCurrentVersion())
|
||||
: QString("An update (%1) is available.\n\nDo you want to "
|
||||
"download and install it?")
|
||||
.arg(getIApp()->getUpdates().getOnlineVersion())));
|
||||
.arg(getApp()->getUpdates().getOnlineVersion())));
|
||||
this->updateGeometry();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace {
|
||||
{
|
||||
button.assign(copyButton);
|
||||
}
|
||||
button->setPixmap(getIApp()->getThemes()->buttons.copy);
|
||||
button->setPixmap(getApp()->getThemes()->buttons.copy);
|
||||
button->setScaleIndependantSize(18, 18);
|
||||
button->setDim(Button::Dim::Lots);
|
||||
button->setToolTip(tooltip);
|
||||
@@ -223,7 +223,7 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
|
||||
.arg(calculateTimeoutDuration(button));
|
||||
}
|
||||
|
||||
msg = getIApp()->getCommands()->execCommand(
|
||||
msg = getApp()->getCommands()->execCommand(
|
||||
msg, this->underlyingChannel_, false);
|
||||
|
||||
this->underlyingChannel_->sendMessage(msg);
|
||||
@@ -242,7 +242,7 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
|
||||
{"search", nullptr},
|
||||
};
|
||||
|
||||
this->shortcuts_ = getIApp()->getHotkeys()->shortcutsForCategory(
|
||||
this->shortcuts_ = getApp()->getHotkeys()->shortcutsForCategory(
|
||||
HotkeyCategory::PopupWindow, actions, this);
|
||||
|
||||
auto layers = LayoutCreator<QWidget>(this->getLayoutContainer())
|
||||
@@ -295,7 +295,7 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
|
||||
menu->addAction(
|
||||
"Open channel in a new popup window", this,
|
||||
[loginName] {
|
||||
auto *app = getIApp();
|
||||
auto *app = getApp();
|
||||
auto &window = app->getWindows()->createWindow(
|
||||
WindowType::Popup, true);
|
||||
auto *split = window.getNotebook()
|
||||
@@ -309,7 +309,7 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
|
||||
menu->addAction(
|
||||
"Open channel in a new tab", this, [loginName] {
|
||||
ChannelPtr channel =
|
||||
getIApp()
|
||||
getApp()
|
||||
->getTwitchAbstract()
|
||||
->getOrAddChannel(loginName);
|
||||
auto &nb = getApp()
|
||||
@@ -414,25 +414,25 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
|
||||
|
||||
QObject::connect(mod.getElement(), &Button::leftClicked, [this] {
|
||||
QString value = "/mod " + this->userName_;
|
||||
value = getIApp()->getCommands()->execCommand(
|
||||
value = getApp()->getCommands()->execCommand(
|
||||
value, this->underlyingChannel_, false);
|
||||
this->underlyingChannel_->sendMessage(value);
|
||||
});
|
||||
QObject::connect(unmod.getElement(), &Button::leftClicked, [this] {
|
||||
QString value = "/unmod " + this->userName_;
|
||||
value = getIApp()->getCommands()->execCommand(
|
||||
value = getApp()->getCommands()->execCommand(
|
||||
value, this->underlyingChannel_, false);
|
||||
this->underlyingChannel_->sendMessage(value);
|
||||
});
|
||||
QObject::connect(vip.getElement(), &Button::leftClicked, [this] {
|
||||
QString value = "/vip " + this->userName_;
|
||||
value = getIApp()->getCommands()->execCommand(
|
||||
value = getApp()->getCommands()->execCommand(
|
||||
value, this->underlyingChannel_, false);
|
||||
this->underlyingChannel_->sendMessage(value);
|
||||
});
|
||||
QObject::connect(unvip.getElement(), &Button::leftClicked, [this] {
|
||||
QString value = "/unvip " + this->userName_;
|
||||
value = getIApp()->getCommands()->execCommand(
|
||||
value = getApp()->getCommands()->execCommand(
|
||||
value, this->underlyingChannel_, false);
|
||||
this->underlyingChannel_->sendMessage(value);
|
||||
});
|
||||
@@ -450,7 +450,7 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
|
||||
if (twitchChannel)
|
||||
{
|
||||
bool isMyself =
|
||||
QString::compare(getIApp()
|
||||
QString::compare(getApp()
|
||||
->getAccounts()
|
||||
->twitch.getCurrent()
|
||||
->getUserName(),
|
||||
@@ -499,7 +499,7 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
|
||||
if (this->underlyingChannel_)
|
||||
{
|
||||
QString value = "/ban " + this->userName_;
|
||||
value = getIApp()->getCommands()->execCommand(
|
||||
value = getApp()->getCommands()->execCommand(
|
||||
value, this->underlyingChannel_, false);
|
||||
|
||||
this->underlyingChannel_->sendMessage(value);
|
||||
@@ -510,7 +510,7 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
|
||||
if (this->underlyingChannel_)
|
||||
{
|
||||
QString value = "/unban " + this->userName_;
|
||||
value = getIApp()->getCommands()->execCommand(
|
||||
value = getApp()->getCommands()->execCommand(
|
||||
value, this->underlyingChannel_, false);
|
||||
|
||||
this->underlyingChannel_->sendMessage(value);
|
||||
@@ -523,7 +523,7 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
|
||||
QString value = "/timeout " + this->userName_ + " " +
|
||||
QString::number(arg);
|
||||
|
||||
value = getIApp()->getCommands()->execCommand(
|
||||
value = getApp()->getCommands()->execCommand(
|
||||
value, this->underlyingChannel_, false);
|
||||
|
||||
this->underlyingChannel_->sendMessage(value);
|
||||
@@ -572,7 +572,7 @@ void UserInfoPopup::themeChangedEvent()
|
||||
for (auto &&child : this->findChildren<QCheckBox *>())
|
||||
{
|
||||
child->setFont(
|
||||
getIApp()->getFonts()->getFont(FontStyle::UiMedium, this->scale()));
|
||||
getApp()->getFonts()->getFont(FontStyle::UiMedium, this->scale()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,7 +597,7 @@ void UserInfoPopup::installEvents()
|
||||
QObject::connect(
|
||||
this->ui_.block, &QCheckBox::stateChanged,
|
||||
[this](int newState) mutable {
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
auto currentUser = getApp()->getAccounts()->twitch.getCurrent();
|
||||
|
||||
const auto reenableBlockCheckbox = [this] {
|
||||
this->ui_.block->setEnabled(true);
|
||||
@@ -614,7 +614,7 @@ void UserInfoPopup::installEvents()
|
||||
case Qt::CheckState::Unchecked: {
|
||||
this->ui_.block->setEnabled(false);
|
||||
|
||||
getIApp()->getAccounts()->twitch.getCurrent()->unblockUser(
|
||||
getApp()->getAccounts()->twitch.getCurrent()->unblockUser(
|
||||
this->userId_, this,
|
||||
[this, reenableBlockCheckbox, currentUser] {
|
||||
this->channel_->addSystemMessage(
|
||||
@@ -641,7 +641,7 @@ void UserInfoPopup::installEvents()
|
||||
case Qt::CheckState::Checked: {
|
||||
this->ui_.block->setEnabled(false);
|
||||
|
||||
getIApp()->getAccounts()->twitch.getCurrent()->blockUser(
|
||||
getApp()->getAccounts()->twitch.getCurrent()->blockUser(
|
||||
this->userId_, this,
|
||||
[this, reenableBlockCheckbox, currentUser] {
|
||||
this->channel_->addSystemMessage(
|
||||
@@ -798,7 +798,7 @@ void UserInfoPopup::updateLatestMessages()
|
||||
void UserInfoPopup::updateUserData()
|
||||
{
|
||||
std::weak_ptr<bool> hack = this->lifetimeHack_;
|
||||
auto currentUser = getIApp()->getAccounts()->twitch.getCurrent();
|
||||
auto currentUser = getApp()->getAccounts()->twitch.getCurrent();
|
||||
|
||||
const auto onUserFetchFailed = [this, hack] {
|
||||
if (!hack.lock())
|
||||
@@ -858,7 +858,7 @@ void UserInfoPopup::updateUserData()
|
||||
this->ui_.userIDLabel->setText(TEXT_USER_ID + user.id);
|
||||
this->ui_.userIDLabel->setProperty("copy-text", user.id);
|
||||
|
||||
if (getIApp()->getStreamerMode()->isEnabled() &&
|
||||
if (getApp()->getStreamerMode()->isEnabled() &&
|
||||
getSettings()->streamerModeHideUsercardAvatars)
|
||||
{
|
||||
this->ui_.avatarButton->setPixmap(getResources().streamerMode);
|
||||
|
||||
@@ -22,8 +22,8 @@ NewPopupItem::NewPopupItem(const QString &channelName)
|
||||
void NewPopupItem::action()
|
||||
{
|
||||
auto channel =
|
||||
getIApp()->getTwitchAbstract()->getOrAddChannel(this->channelName_);
|
||||
getIApp()->getWindows()->openInPopup(channel);
|
||||
getApp()->getTwitchAbstract()->getOrAddChannel(this->channelName_);
|
||||
getApp()->getWindows()->openInPopup(channel);
|
||||
}
|
||||
|
||||
void NewPopupItem::paint(QPainter *painter, const QRect &rect) const
|
||||
@@ -32,10 +32,10 @@ void NewPopupItem::paint(QPainter *painter, const QRect &rect) const
|
||||
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
painter->setPen(getIApp()->getThemes()->splits.header.text);
|
||||
painter->setPen(getApp()->getThemes()->splits.header.text);
|
||||
painter->setBrush(Qt::SolidPattern);
|
||||
painter->setFont(
|
||||
getIApp()->getFonts()->getFont(FontStyle::UiMediumBold, 1.0));
|
||||
getApp()->getFonts()->getFont(FontStyle::UiMediumBold, 1.0));
|
||||
|
||||
QRect iconRect(rect.topLeft(), ICON_SIZE);
|
||||
this->icon_.paint(painter, iconRect, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
|
||||
@@ -27,7 +27,7 @@ void NewTabItem::action()
|
||||
|
||||
Split *split = new Split(container);
|
||||
split->setChannel(
|
||||
getIApp()->getTwitchAbstract()->getOrAddChannel(this->channelName_));
|
||||
getApp()->getTwitchAbstract()->getOrAddChannel(this->channelName_));
|
||||
container->insertSplit(split);
|
||||
}
|
||||
|
||||
@@ -38,10 +38,10 @@ void NewTabItem::paint(QPainter *painter, const QRect &rect) const
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
// TODO(leon): Right pen/brush/font settings?
|
||||
painter->setPen(getIApp()->getThemes()->splits.header.text);
|
||||
painter->setPen(getApp()->getThemes()->splits.header.text);
|
||||
painter->setBrush(Qt::SolidPattern);
|
||||
painter->setFont(
|
||||
getIApp()->getFonts()->getFont(FontStyle::UiMediumBold, 1.0));
|
||||
getApp()->getFonts()->getFont(FontStyle::UiMediumBold, 1.0));
|
||||
|
||||
QRect iconRect(rect.topLeft(), ICON_SIZE);
|
||||
this->icon_.paint(painter, iconRect, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
|
||||
@@ -21,11 +21,11 @@ void SwitchSplitItem::action()
|
||||
{
|
||||
if (this->split_)
|
||||
{
|
||||
getIApp()->getWindows()->select(this->split_);
|
||||
getApp()->getWindows()->select(this->split_);
|
||||
}
|
||||
else if (this->container_)
|
||||
{
|
||||
getIApp()->getWindows()->select(this->container_);
|
||||
getApp()->getWindows()->select(this->container_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@ void SwitchSplitItem::paint(QPainter *painter, const QRect &rect) const
|
||||
painter->setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
// TODO(leon): Right pen/brush/font settings?
|
||||
painter->setPen(getIApp()->getThemes()->splits.header.text);
|
||||
painter->setPen(getApp()->getThemes()->splits.header.text);
|
||||
painter->setBrush(Qt::SolidPattern);
|
||||
painter->setFont(
|
||||
getIApp()->getFonts()->getFont(FontStyle::UiMediumBold, 1.0));
|
||||
getApp()->getFonts()->getFont(FontStyle::UiMediumBold, 1.0));
|
||||
|
||||
QRect iconRect(rect.topLeft(), ICON_SIZE);
|
||||
this->icon_.paint(painter, iconRect, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
@@ -60,7 +60,7 @@ void SwitchSplitItem::paint(QPainter *painter, const QRect &rect) const
|
||||
QSize(0.7 * availableTextWidth, iconRect.height()));
|
||||
|
||||
painter->setFont(
|
||||
getIApp()->getFonts()->getFont(FontStyle::UiMedium, 1.0));
|
||||
getApp()->getFonts()->getFont(FontStyle::UiMedium, 1.0));
|
||||
painter->drawText(rightTextRect, Qt::AlignRight | Qt::AlignVCenter,
|
||||
this->container_->getTab()->getTitle());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user