chore: remove Singleton & replace getIApp with getApp (#5514)

This commit is contained in:
pajlada
2024-07-21 15:09:59 +02:00
committed by GitHub
parent 21186df058
commit 5deec1f02f
145 changed files with 802 additions and 856 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ namespace chatterino {
BaseWidget::BaseWidget(QWidget *parent, Qt::WindowFlags f)
: QWidget(parent, f)
, theme(getIApp()->getThemes())
, theme(getApp()->getThemes())
{
this->signalHolder_.managedConnect(this->theme->updated, [this]() {
this->themeChangedEvent();
+3 -3
View File
@@ -712,7 +712,7 @@ void BaseWindow::resizeEvent(QResizeEvent *)
// Queue up save because: Window resized
if (!flags_.has(DisableLayoutSave))
{
getIApp()->getWindows()->queueSave();
getApp()->getWindows()->queueSave();
}
#ifdef USEWINSDK
@@ -727,7 +727,7 @@ void BaseWindow::moveEvent(QMoveEvent *event)
#ifdef CHATTERINO
if (!flags_.has(DisableLayoutSave))
{
getIApp()->getWindows()->queueSave();
getApp()->getWindows()->queueSave();
}
#endif
@@ -909,7 +909,7 @@ void BaseWindow::scaleChangedEvent(float scale)
#endif
this->setFont(
getIApp()->getFonts()->getFont(FontStyle::UiTabs, this->scale()));
getApp()->getFonts()->getFont(FontStyle::UiTabs, this->scale()));
}
void BaseWindow::paintEvent(QPaintEvent *)
+1 -1
View File
@@ -54,7 +54,7 @@ bool FramelessEmbedWindow::nativeEvent(const QByteArray &eventType,
auto channelName = root.value("channel-name").toString();
this->split_->setChannel(
getIApp()->getTwitchAbstract()->getOrAddChannel(
getApp()->getTwitchAbstract()->getOrAddChannel(
channelName));
}
}
+4 -4
View File
@@ -16,7 +16,7 @@ Label::Label(BaseWidget *parent, QString text, FontStyle style)
, text_(std::move(text))
, fontStyle_(style)
{
this->connections_.managedConnect(getIApp()->getFonts()->fontChanged,
this->connections_.managedConnect(getApp()->getFonts()->fontChanged,
[this] {
this->updateSize();
});
@@ -89,10 +89,10 @@ void Label::paintEvent(QPaintEvent *)
{
QPainter painter(this);
QFontMetrics metrics = getIApp()->getFonts()->getFontMetrics(
QFontMetrics metrics = getApp()->getFonts()->getFontMetrics(
this->getFontStyle(), this->scale());
painter.setFont(
getIApp()->getFonts()->getFont(this->getFontStyle(), this->scale()));
getApp()->getFonts()->getFont(this->getFontStyle(), this->scale()));
int offset = this->getOffset();
@@ -119,7 +119,7 @@ void Label::paintEvent(QPaintEvent *)
void Label::updateSize()
{
QFontMetrics metrics =
getIApp()->getFonts()->getFontMetrics(this->fontStyle_, this->scale());
getApp()->getFonts()->getFontMetrics(this->fontStyle_, this->scale());
int width =
metrics.horizontalAdvance(this->text_) + (2 * this->getOffset());
+17 -17
View File
@@ -97,7 +97,7 @@ NotebookTab *Notebook::addPageAt(QWidget *page, int position, QString title,
bool select)
{
// Queue up save because: Tab added
getIApp()->getWindows()->queueSave();
getApp()->getWindows()->queueSave();
auto *tab = new NotebookTab(this);
tab->page = page;
@@ -134,7 +134,7 @@ NotebookTab *Notebook::addPageAt(QWidget *page, int position, QString title,
void Notebook::removePage(QWidget *page)
{
// Queue up save because: Tab removed
getIApp()->getWindows()->queueSave();
getApp()->getWindows()->queueSave();
int removingIndex = this->indexOf(page);
assert(removingIndex != -1);
@@ -567,7 +567,7 @@ void Notebook::rearrangePage(QWidget *page, int index)
}
// Queue up save because: Tab rearranged
getIApp()->getWindows()->queueSave();
getApp()->getWindows()->queueSave();
this->items_.move(this->indexOf(page), index);
@@ -608,16 +608,16 @@ void Notebook::setShowTabs(bool value)
void Notebook::showTabVisibilityInfoPopup()
{
auto unhideSeq = getIApp()->getHotkeys()->getDisplaySequence(
auto unhideSeq = getApp()->getHotkeys()->getDisplaySequence(
HotkeyCategory::Window, "setTabVisibility", {std::vector<QString>()});
if (unhideSeq.isEmpty())
{
unhideSeq = getIApp()->getHotkeys()->getDisplaySequence(
unhideSeq = getApp()->getHotkeys()->getDisplaySequence(
HotkeyCategory::Window, "setTabVisibility", {{"toggle"}});
}
if (unhideSeq.isEmpty())
{
unhideSeq = getIApp()->getHotkeys()->getDisplaySequence(
unhideSeq = getApp()->getHotkeys()->getDisplaySequence(
HotkeyCategory::Window, "setTabVisibility", {{"on"}});
}
QString hotkeyInfo = "(currently unbound)";
@@ -670,7 +670,7 @@ void Notebook::updateTabVisibility()
void Notebook::updateTabVisibilityMenuAction()
{
const auto *hotkeys = getIApp()->getHotkeys();
const auto *hotkeys = getApp()->getHotkeys();
auto toggleSeq = hotkeys->getDisplaySequence(
HotkeyCategory::Window, "setTabVisibility", {std::vector<QString>()});
@@ -1400,7 +1400,7 @@ SplitNotebook::SplitNotebook(Window *parent)
this->signalHolder_, true);
this->signalHolder_.managedConnect(
getIApp()->getWindows()->selectSplit, [this](Split *split) {
getApp()->getWindows()->selectSplit, [this](Split *split) {
for (auto &&item : this->items())
{
if (auto *sc = dynamic_cast<SplitContainer *>(item.page))
@@ -1418,13 +1418,13 @@ SplitNotebook::SplitNotebook(Window *parent)
});
this->signalHolder_.managedConnect(
getIApp()->getWindows()->selectSplitContainer,
getApp()->getWindows()->selectSplitContainer,
[this](SplitContainer *sc) {
this->select(sc);
});
this->signalHolder_.managedConnect(
getIApp()->getWindows()->scrollToMessageSignal,
getApp()->getWindows()->scrollToMessageSignal,
[this](const MessagePtr &message) {
for (auto &&item : this->items())
{
@@ -1515,7 +1515,7 @@ void SplitNotebook::addCustomButtons()
settingsBtn->setIcon(NotebookButton::Settings);
QObject::connect(settingsBtn, &NotebookButton::leftClicked, [this] {
getIApp()->getWindows()->showSettingsDialog(this);
getApp()->getWindows()->showSettingsDialog(this);
});
// account
@@ -1529,7 +1529,7 @@ void SplitNotebook::addCustomButtons()
userBtn->setIcon(NotebookButton::User);
QObject::connect(userBtn, &NotebookButton::leftClicked, [this, userBtn] {
getIApp()->getWindows()->showAccountSelectPopup(
getApp()->getWindows()->showAccountSelectPopup(
this->mapToGlobal(userBtn->rect().bottomRight()));
});
@@ -1542,18 +1542,18 @@ void SplitNotebook::addCustomButtons()
this->streamerModeIcon_ = this->addCustomButton();
QObject::connect(this->streamerModeIcon_, &NotebookButton::leftClicked,
[this] {
getIApp()->getWindows()->showSettingsDialog(
getApp()->getWindows()->showSettingsDialog(
this, SettingsDialogPreference::StreamerMode);
});
QObject::connect(getIApp()->getStreamerMode(), &IStreamerMode::changed,
this, &SplitNotebook::updateStreamerModeIcon);
QObject::connect(getApp()->getStreamerMode(), &IStreamerMode::changed, this,
&SplitNotebook::updateStreamerModeIcon);
this->updateStreamerModeIcon();
}
void SplitNotebook::updateToggleOfflineTabsHotkey(
NotebookTabVisibility newTabVisibility)
{
auto *hotkeys = getIApp()->getHotkeys();
auto *hotkeys = getApp()->getHotkeys();
auto getKeySequence = [&](auto argument) {
return hotkeys->getDisplaySequence(HotkeyCategory::Window,
"setTabVisibility", {{argument}});
@@ -1606,7 +1606,7 @@ void SplitNotebook::updateStreamerModeIcon()
getResources().buttons.streamerModeEnabledDark);
}
this->streamerModeIcon_->setVisible(
getIApp()->getStreamerMode()->isEnabled());
getApp()->getStreamerMode()->isEnabled());
}
void SplitNotebook::themeChangedEvent()
+4 -4
View File
@@ -47,13 +47,13 @@ TooltipWidget::TooltipWidget(BaseWidget *parent)
this->setLayout(this->vLayout_);
this->currentStyle_ = TooltipStyle::Vertical;
this->connections_.managedConnect(getIApp()->getFonts()->fontChanged,
this->connections_.managedConnect(getApp()->getFonts()->fontChanged,
[this] {
this->updateFont();
});
this->updateFont();
auto *windows = getIApp()->getWindows();
auto *windows = getApp()->getWindows();
this->connections_.managedConnect(windows->gifRepaintRequested, [this] {
if (!this->isVisible())
{
@@ -300,8 +300,8 @@ void TooltipWidget::scaleChangedEvent(float)
void TooltipWidget::updateFont()
{
this->setFont(getIApp()->getFonts()->getFont(FontStyle::ChatMediumSmall,
this->scale()));
this->setFont(getApp()->getFonts()->getFont(FontStyle::ChatMediumSmall,
this->scale()));
}
void TooltipWidget::setWordWrap(bool wrap)
+25 -26
View File
@@ -64,7 +64,7 @@ Window::Window(WindowType type, QWidget *parent)
#endif
this->bSignals_.emplace_back(
getIApp()->getAccounts()->twitch.currentUserChanged.connect([this] {
getApp()->getAccounts()->twitch.currentUserChanged.connect([this] {
this->onAccountSelected();
}));
this->onAccountSelected();
@@ -78,7 +78,7 @@ Window::Window(WindowType type, QWidget *parent)
this->resize(int(300 * this->scale()), int(500 * this->scale()));
}
this->signalHolder_.managedConnect(getIApp()->getHotkeys()->onItemsUpdated,
this->signalHolder_.managedConnect(getApp()->getHotkeys()->onItemsUpdated,
[this]() {
this->clearShortcuts();
this->addShortcuts();
@@ -108,7 +108,7 @@ bool Window::event(QEvent *event)
switch (event->type())
{
case QEvent::WindowActivate: {
getIApp()->getWindows()->selectedWindow_ = this;
getApp()->getWindows()->selectedWindow_ = this;
break;
}
@@ -145,14 +145,14 @@ void Window::closeEvent(QCloseEvent *)
{
if (this->type_ == WindowType::Main)
{
getIApp()->getWindows()->save();
getIApp()->getWindows()->closeAll();
getApp()->getWindows()->save();
getApp()->getWindows()->closeAll();
}
// Ensure selectedWindow_ is never an invalid pointer.
// WindowManager will return the main window if no window is pointed to by
// `selectedWindow_`.
getIApp()->getWindows()->selectedWindow_ = nullptr;
getApp()->getWindows()->selectedWindow_ = nullptr;
this->closed.invoke();
@@ -189,7 +189,7 @@ void Window::addCustomTitlebarButtons()
// settings
this->addTitleBarButton(TitleBarButtonStyle::Settings, [this] {
getIApp()->getWindows()->showSettingsDialog(this);
getApp()->getWindows()->showSettingsDialog(this);
});
// updates
@@ -199,7 +199,7 @@ void Window::addCustomTitlebarButtons()
// account
this->userLabel_ = this->addTitleBarLabel([this] {
getIApp()->getWindows()->showAccountSelectPopup(
getApp()->getWindows()->showAccountSelectPopup(
this->userLabel_->mapToGlobal(
this->userLabel_->rect().bottomLeft()));
});
@@ -208,11 +208,11 @@ void Window::addCustomTitlebarButtons()
// streamer mode
this->streamerModeTitlebarIcon_ =
this->addTitleBarButton(TitleBarButtonStyle::StreamerMode, [this] {
getIApp()->getWindows()->showSettingsDialog(
getApp()->getWindows()->showSettingsDialog(
this, SettingsDialogPreference::StreamerMode);
});
QObject::connect(getIApp()->getStreamerMode(), &IStreamerMode::changed,
this, &Window::updateStreamerModeIcon);
QObject::connect(getApp()->getStreamerMode(), &IStreamerMode::changed, this,
&Window::updateStreamerModeIcon);
// Update initial state
this->updateStreamerModeIcon();
@@ -240,7 +240,7 @@ void Window::updateStreamerModeIcon()
getResources().buttons.streamerModeEnabledDark);
}
this->streamerModeTitlebarIcon_->setVisible(
getIApp()->getStreamerMode()->isEnabled());
getApp()->getStreamerMode()->isEnabled());
#else
// clang-format off
assert(false && "Streamer mode TitleBar icon should not exist on non-Windows OSes");
@@ -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()];
getIApp()->getTwitchAbstract()->addFakeMessage(msg);
getApp()->getTwitchAbstract()->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()];
getIApp()->getTwitchAbstract()->addFakeMessage(msg);
getApp()->getTwitchAbstract()->addFakeMessage(msg);
return "";
});
@@ -277,13 +277,12 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
const auto &messages = getSampleLinkMessages();
static int index = 0;
const auto &msg = messages[index++ % messages.size()];
getIApp()->getTwitchAbstract()->addFakeMessage(msg);
getApp()->getTwitchAbstract()->addFakeMessage(msg);
return "";
});
actions.emplace("addRewardMessage", [=](std::vector<QString>) -> QString {
rapidjson::Document doc;
auto app = getApp();
static bool alt = true;
if (alt)
{
@@ -293,9 +292,9 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
oMessage->toInner<PubSubMessageMessage>()
->toInner<PubSubCommunityPointsChannelV1Message>();
getIApp()->getTwitchAbstract()->addFakeMessage(
getApp()->getTwitchAbstract()->addFakeMessage(
getSampleChannelRewardIRCMessage());
getIApp()->getTwitchPubSub()->pointReward.redeemed.invoke(
getApp()->getTwitchPubSub()->pointReward.redeemed.invoke(
oInnerMessage->data.value("redemption").toObject());
alt = !alt;
}
@@ -306,7 +305,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
auto oInnerMessage =
oMessage->toInner<PubSubMessageMessage>()
->toInner<PubSubCommunityPointsChannelV1Message>();
getIApp()->getTwitchPubSub()->pointReward.redeemed.invoke(
getApp()->getTwitchPubSub()->pointReward.redeemed.invoke(
oInnerMessage->data.value("redemption").toObject());
alt = !alt;
}
@@ -317,7 +316,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
const auto &messages = getSampleEmoteTestMessages();
static int index = 0;
const auto &msg = messages[index++ % messages.size()];
getIApp()->getTwitchAbstract()->addFakeMessage(msg);
getApp()->getTwitchAbstract()->addFakeMessage(msg);
return "";
});
@@ -325,7 +324,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
const auto &messages = getSampleSubMessages();
static int index = 0;
const auto &msg = messages[index++ % messages.size()];
getIApp()->getTwitchAbstract()->addFakeMessage(msg);
getApp()->getTwitchAbstract()->addFakeMessage(msg);
return "";
});
#endif
@@ -488,7 +487,7 @@ void Window::addShortcuts()
splitContainer = this->notebook_->getOrAddSelectedPage();
}
Split *split = new Split(splitContainer);
split->setChannel(getIApp()->getTwitchAbstract()->getOrAddChannel(
split->setChannel(getApp()->getTwitchAbstract()->getOrAddChannel(
si.channelName));
split->setFilters(si.filters);
splitContainer->insertSplit(split);
@@ -499,7 +498,7 @@ void Window::addShortcuts()
{"toggleLocalR9K",
[](std::vector<QString>) -> QString {
getSettings()->hideSimilar.setValue(!getSettings()->hideSimilar);
getIApp()->getWindows()->forceLayoutChannelViews();
getApp()->getWindows()->forceLayoutChannelViews();
return "";
}},
{"openQuickSwitcher",
@@ -619,7 +618,7 @@ void Window::addShortcuts()
}
else if (mode == 2)
{
if (getIApp()->getStreamerMode()->isEnabled())
if (getApp()->getStreamerMode()->isEnabled())
{
getSettings()->enableStreamerMode.setValue(
StreamerModeSetting::Disabled);
@@ -685,7 +684,7 @@ void Window::addShortcuts()
this->addDebugStuff(actions);
this->shortcuts_ = getIApp()->getHotkeys()->shortcutsForCategory(
this->shortcuts_ = getApp()->getHotkeys()->shortcutsForCategory(
HotkeyCategory::Window, actions, this);
}
@@ -756,7 +755,7 @@ void Window::addMenuBar()
void Window::onAccountSelected()
{
auto user = getIApp()->getAccounts()->twitch.getCurrent();
auto user = getApp()->getAccounts()->twitch.getCurrent();
// update title (also append username on Linux and MacOS)
QString windowTitle = Version::instance().fullVersion();
+1 -1
View File
@@ -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)
+8 -9
View File
@@ -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)
+14 -20
View File
@@ -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)
+2 -2
View File
@@ -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;
}
+1 -1
View File
@@ -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);
+4 -4
View File
@@ -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());
+7 -7
View File
@@ -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);
}
+4 -4
View File
@@ -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();
+7 -7
View File
@@ -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;
+19 -19
View File
@@ -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);
+3 -3
View File
@@ -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());
}
+33 -38
View File
@@ -427,11 +427,11 @@ void ChannelView::initializeScrollbar()
void ChannelView::initializeSignals()
{
this->signalHolder_.managedConnect(
getIApp()->getWindows()->wordFlagsChanged, [this] {
this->queueLayout();
this->update();
});
this->signalHolder_.managedConnect(getApp()->getWindows()->wordFlagsChanged,
[this] {
this->queueLayout();
this->update();
});
getSettings()->showLastMessageIndicator.connect(
[this](auto, auto) {
@@ -440,7 +440,7 @@ void ChannelView::initializeSignals()
this->signalHolder_);
this->signalHolder_.managedConnect(
getIApp()->getWindows()->gifRepaintRequested, [&] {
getApp()->getWindows()->gifRepaintRequested, [&] {
if (!this->animationArea_.isEmpty())
{
this->queueUpdate(this->animationArea_);
@@ -448,7 +448,7 @@ void ChannelView::initializeSignals()
});
this->signalHolder_.managedConnect(
getIApp()->getWindows()->layoutRequested, [&](Channel *channel) {
getApp()->getWindows()->layoutRequested, [&](Channel *channel) {
if (this->isVisible() &&
(channel == nullptr ||
this->underlyingChannel_.get() == channel))
@@ -458,7 +458,7 @@ void ChannelView::initializeSignals()
});
this->signalHolder_.managedConnect(
getIApp()->getWindows()->invalidateBuffersRequested,
getApp()->getWindows()->invalidateBuffersRequested,
[this](Channel *channel) {
if (this->isVisible() &&
(channel == nullptr ||
@@ -468,7 +468,7 @@ void ChannelView::initializeSignals()
}
});
this->signalHolder_.managedConnect(getIApp()->getFonts()->fontChanged,
this->signalHolder_.managedConnect(getApp()->getFonts()->fontChanged,
[this] {
this->queueLayout();
});
@@ -622,7 +622,7 @@ void ChannelView::scaleChangedEvent(float scale)
0.01, this->logicalDpiX() * this->devicePixelRatioF());
#endif
this->goToBottom_->getLabel().setFont(
getIApp()->getFonts()->getFont(FontStyle::UiMedium, factor));
getApp()->getFonts()->getFont(FontStyle::UiMedium, factor));
}
}
@@ -1087,11 +1087,8 @@ bool ChannelView::shouldIncludeMessage(const MessagePtr &m) const
if (this->channelFilters_)
{
if (getSettings()->excludeUserMessagesFromFilter &&
getIApp()
->getAccounts()
->twitch.getCurrent()
->getUserName()
.compare(m->loginName, Qt::CaseInsensitive) == 0)
getApp()->getAccounts()->twitch.getCurrent()->getUserName().compare(
m->loginName, Qt::CaseInsensitive) == 0)
{
return true;
}
@@ -1377,19 +1374,19 @@ MessageElementFlags ChannelView::getFlags() const
flags.set(MessageElementFlag::ModeratorTools);
}
if (this->underlyingChannel_ ==
getIApp()->getTwitch()->getMentionsChannel() ||
getApp()->getTwitch()->getMentionsChannel() ||
this->underlyingChannel_ ==
getIApp()->getTwitch()->getLiveChannel() ||
getApp()->getTwitch()->getLiveChannel() ||
this->underlyingChannel_ ==
getIApp()->getTwitch()->getAutomodChannel())
getApp()->getTwitch()->getAutomodChannel())
{
flags.set(MessageElementFlag::ChannelName);
flags.unset(MessageElementFlag::ChannelPointReward);
}
}
if (this->sourceChannel_ == getIApp()->getTwitch()->getMentionsChannel() ||
this->sourceChannel_ == getIApp()->getTwitch()->getAutomodChannel())
if (this->sourceChannel_ == getApp()->getTwitch()->getMentionsChannel() ||
this->sourceChannel_ == getApp()->getTwitch()->getAutomodChannel())
{
flags.set(MessageElementFlag::ChannelName);
}
@@ -1446,7 +1443,7 @@ bool ChannelView::scrollToMessage(const MessagePtr &message)
this->scrollToMessageLayout(messagesSnapshot[messageIdx].get(), messageIdx);
if (this->split_)
{
getIApp()->getWindows()->select(this->split_);
getApp()->getWindows()->select(this->split_);
}
return true;
}
@@ -1478,7 +1475,7 @@ bool ChannelView::scrollToMessageId(const QString &messageId)
this->scrollToMessageLayout(messagesSnapshot[messageIdx].get(), messageIdx);
if (this->split_)
{
getIApp()->getWindows()->select(this->split_);
getApp()->getWindows()->select(this->split_);
}
return true;
}
@@ -1543,7 +1540,7 @@ void ChannelView::drawMessages(QPainter &painter, const QRect &area)
.canvasWidth = this->width(),
.isWindowFocused = this->window() == QApplication::activeWindow(),
.isMentions = this->underlyingChannel_ ==
getIApp()->getTwitch()->getMentionsChannel(),
getApp()->getTwitch()->getMentionsChannel(),
.y = int(-(messagesSnapshot[start]->getHeight() *
(fmod(this->scrollBar_->getRelativeCurrentValue(), 1)))),
@@ -1968,7 +1965,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
{
if (linkElement->linkInfo()->isPending())
{
getIApp()->getLinkResolver()->resolve(
getApp()->getLinkResolver()->resolve(
linkElement->linkInfo());
}
this->setLinkInfoTooltip(linkElement->linkInfo());
@@ -2479,7 +2476,7 @@ void ChannelView::addMessageContextMenuItems(QMenu *menu,
}
else if (isMentions || isAutomod)
{
getIApp()->getWindows()->scrollToMessage(messagePtr);
getApp()->getWindows()->scrollToMessage(messagePtr);
}
else if (isReplyOrUserCard)
{
@@ -2489,7 +2486,7 @@ void ChannelView::addMessageContextMenuItems(QMenu *menu,
if (type == Channel::Type::TwitchMentions ||
type == Channel::Type::TwitchAutomod)
{
getIApp()->getWindows()->scrollToMessage(messagePtr);
getApp()->getWindows()->scrollToMessage(messagePtr);
}
else
{
@@ -2570,7 +2567,7 @@ void ChannelView::addCommandExecutionContextMenuItems(
/* Get commands to be displayed in context menu;
* only those that had the showInMsgContextMenu check box marked in the Commands page */
std::vector<Command> cmds;
for (const auto &cmd : getIApp()->getCommands()->items)
for (const auto &cmd : getApp()->getCommands()->items)
{
if (cmd.showInMsgContextMenu)
{
@@ -2617,14 +2614,13 @@ void ChannelView::addCommandExecutionContextMenuItems(
}
// Execute command through right-clicking a message -> Execute command
QString value = getIApp()->getCommands()->execCustomCommand(
QString value = getApp()->getCommands()->execCustomCommand(
inputText.split(' '), cmd, true, channel, layout->getMessage(),
{
{"input.text", userText},
});
value =
getIApp()->getCommands()->execCommand(value, channel, false);
value = getApp()->getCommands()->execCommand(value, channel, false);
channel->sendMessage(value);
});
@@ -2703,7 +2699,7 @@ void ChannelView::showUserInfoPopup(const QString &userName,
auto *userPopup =
new UserInfoPopup(getSettings()->autoCloseUserPopup, this->split_);
auto contextChannel = getIApp()->getTwitchAbstract()->getChannelOrEmpty(
auto contextChannel = getApp()->getTwitchAbstract()->getChannelOrEmpty(
alternativePopoutChannel);
auto openingChannel = this->hasSourceChannel() ? this->sourceChannel_
: this->underlyingChannel_;
@@ -2790,25 +2786,24 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
}
// Execute command clicking a moderator button
value = getIApp()->getCommands()->execCustomCommand(
value = getApp()->getCommands()->execCustomCommand(
QStringList(), Command{"(modaction)", value}, true, channel,
layout->getMessage());
value =
getIApp()->getCommands()->execCommand(value, channel, false);
value = getApp()->getCommands()->execCommand(value, channel, false);
channel->sendMessage(value);
}
break;
case Link::AutoModAllow: {
getIApp()->getAccounts()->twitch.getCurrent()->autoModAllow(
getApp()->getAccounts()->twitch.getCurrent()->autoModAllow(
link.value, this->channel());
}
break;
case Link::AutoModDeny: {
getIApp()->getAccounts()->twitch.getCurrent()->autoModDeny(
getApp()->getAccounts()->twitch.getCurrent()->autoModDeny(
link.value, this->channel());
}
break;
@@ -2822,7 +2817,7 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const Link &link,
// Get all currently open pages
QList<SplitContainer *> openPages;
auto &nb = getIApp()->getWindows()->getMainWindow().getNotebook();
auto &nb = getApp()->getWindows()->getMainWindow().getNotebook();
for (int i = 0; i < nb.getPageCount(); ++i)
{
openPages.push_back(
@@ -3095,7 +3090,7 @@ void ChannelView::setLinkInfoTooltip(LinkInfo *info)
ImagePtr thumbnail;
if (info->hasThumbnail() && thumbnailSize > 0)
{
if (getIApp()->getStreamerMode()->isEnabled() &&
if (getApp()->getStreamerMode()->isEnabled() &&
getSettings()->streamerModeHideLinkThumbnails)
{
thumbnail = Image::fromResourcePixmap(getResources().streamerMode);
+6 -6
View File
@@ -86,8 +86,8 @@ NotebookTab::NotebookTab(Notebook *notebook)
[this]() {
this->notebook_->removePage(this->page);
},
getIApp()->getHotkeys()->getDisplaySequence(HotkeyCategory::Window,
"removeTab"));
getApp()->getHotkeys()->getDisplaySequence(HotkeyCategory::Window,
"removeTab"));
this->menu_.addAction(
"Popup Tab",
@@ -97,8 +97,8 @@ NotebookTab::NotebookTab(Notebook *notebook)
container->popup();
}
},
getIApp()->getHotkeys()->getDisplaySequence(HotkeyCategory::Window,
"popup", {{"window"}}));
getApp()->getHotkeys()->getDisplaySequence(HotkeyCategory::Window,
"popup", {{"window"}}));
this->menu_.addAction("Duplicate Tab", [this]() {
this->notebook_->duplicatePage(this->page);
@@ -199,7 +199,7 @@ int NotebookTab::normalTabWidthForHeight(int height) const
int width = 0;
QFontMetrics metrics =
getIApp()->getFonts()->getFontMetrics(FontStyle::UiTabs, scale);
getApp()->getFonts()->getFontMetrics(FontStyle::UiTabs, scale);
if (this->hasXButton())
{
@@ -291,7 +291,7 @@ const QString &NotebookTab::getTitle() const
void NotebookTab::titleUpdated()
{
// Queue up save because: Tab title changed
getIApp()->getWindows()->queueSave();
getApp()->getWindows()->queueSave();
this->notebook_->refresh();
this->updateSize();
this->update();
+2 -2
View File
@@ -103,7 +103,7 @@ void SearchPopup::addShortcuts()
{"scrollPage", nullptr},
};
this->shortcuts_ = getIApp()->getHotkeys()->shortcutsForCategory(
this->shortcuts_ = getApp()->getHotkeys()->shortcutsForCategory(
HotkeyCategory::PopupWindow, actions, this);
}
@@ -138,7 +138,7 @@ void SearchPopup::goToMessage(const MessagePtr &message)
if (type == Channel::Type::TwitchMentions ||
type == Channel::Type::TwitchAutomod)
{
getIApp()->getWindows()->scrollToMessage(message);
getApp()->getWindows()->scrollToMessage(message);
return;
}
+1 -1
View File
@@ -63,7 +63,7 @@ AccountsPage::AccountsPage()
// return;
// }
// getIApp()->getAccounts()->Twitch.removeUser(selectedUser);
// getApp()->getAccounts()->Twitch.removeUser(selectedUser);
// });
}
+3 -3
View File
@@ -87,7 +87,7 @@ CommandPage::CommandPage()
auto *view = layout
.emplace<EditableModelView>(
getIApp()->getCommands()->createModel(nullptr))
getApp()->getCommands()->createModel(nullptr))
.getElement();
view->setTitles({"Trigger", "Command", "Show In\nMessage Menu"});
@@ -95,7 +95,7 @@ CommandPage::CommandPage()
1, QHeaderView::Stretch);
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([] {
getIApp()->getCommands()->items.append(
getApp()->getCommands()->items.append(
Command{"/command", "I made a new command HeyGuys"});
});
@@ -114,7 +114,7 @@ CommandPage::CommandPage()
{
if (int index = line.indexOf(' '); index != -1)
{
getIApp()->getCommands()->items.insert(
getApp()->getCommands()->items.insert(
Command(line.mid(0, index), line.mid(index + 1)));
}
}
+16 -16
View File
@@ -122,7 +122,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
layout.addTitle("Interface");
{
auto *themes = getIApp()->getThemes();
auto *themes = getApp()->getThemes();
auto available = themes->availableThemes();
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
available.emplace_back("System", "System");
@@ -273,7 +273,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
layout.addCheckbox("Show message reply button", s.showReplyButton, false,
"Show a reply button next to every chat message");
auto removeTabSeq = getIApp()->getHotkeys()->getDisplaySequence(
auto removeTabSeq = getApp()->getHotkeys()->getDisplaySequence(
HotkeyCategory::Window, "removeTab");
QString removeTabShortcut = "an assigned hotkey (Window -> remove tab)";
if (!removeTabSeq.isEmpty())
@@ -294,7 +294,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
#endif
if (!BaseWindow::supportsCustomWindowFrame())
{
auto settingsSeq = getIApp()->getHotkeys()->getDisplaySequence(
auto settingsSeq = getApp()->getHotkeys()->getDisplaySequence(
HotkeyCategory::Window, "openSettings");
QString shortcut = " (no key bound to open them otherwise)";
// TODO: maybe prevent the user from locking themselves out of the settings?
@@ -570,7 +570,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
// as an official description from 7TV devs is best
s.showUnlistedSevenTVEmotes.connect(
[]() {
getIApp()->getTwitch()->forEachChannelAndSpecialChannels(
getApp()->getTwitch()->forEachChannelAndSpecialChannels(
[](const auto &c) {
if (c->isTwitchChannel())
{
@@ -824,9 +824,9 @@ void GeneralPage::initLayout(GeneralPageView &layout)
layout.addButton("Open AppData directory", [] {
#ifdef Q_OS_DARWIN
QDesktopServices::openUrl("file://" +
getIApp()->getPaths().rootAppDataDirectory);
getApp()->getPaths().rootAppDataDirectory);
#else
QDesktopServices::openUrl(getIApp()->getPaths().rootAppDataDirectory);
QDesktopServices::openUrl(getApp()->getPaths().rootAppDataDirectory);
#endif
});
@@ -838,7 +838,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
auto *cachePathLabel = layout.addDescription("placeholder :D");
getSettings()->cachePath.connect([cachePathLabel](const auto &,
auto) mutable {
QString newPath = getIApp()->getPaths().cacheDirectory();
QString newPath = getApp()->getPaths().cacheDirectory();
QString pathShortened = "Cache saved at <a href=\"file:///" + newPath +
"\"><span style=\"color: white;\">" +
@@ -866,9 +866,9 @@ void GeneralPage::initLayout(GeneralPageView &layout)
if (reply == QMessageBox::Yes)
{
auto cacheDir = QDir(getIApp()->getPaths().cacheDirectory());
auto cacheDir = QDir(getApp()->getPaths().cacheDirectory());
cacheDir.removeRecursively();
cacheDir.mkdir(getIApp()->getPaths().cacheDirectory());
cacheDir.mkdir(getApp()->getPaths().cacheDirectory());
}
}));
box->addStretch(1);
@@ -890,7 +890,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
"Show the stream title");
layout.addSubtitle("R9K");
auto toggleLocalr9kSeq = getIApp()->getHotkeys()->getDisplaySequence(
auto toggleLocalr9kSeq = getApp()->getHotkeys()->getDisplaySequence(
HotkeyCategory::Window, "toggleLocalR9K");
QString toggleLocalr9kShortcut =
"an assigned hotkey (Window -> Toggle local R9K)";
@@ -913,7 +913,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
s.shownSimilarTriggerHighlights);
s.hideSimilar.connect(
[]() {
getIApp()->getWindows()->forceLayoutChannelViews();
getApp()->getWindows()->forceLayoutChannelViews();
},
false);
layout.addDropdown<float>(
@@ -981,15 +981,15 @@ void GeneralPage::initLayout(GeneralPageView &layout)
layout.addCustomCheckbox(
"Restart on crash (requires restart)",
[] {
return getIApp()->getCrashHandler()->shouldRecover();
return getApp()->getCrashHandler()->shouldRecover();
},
[](bool on) {
return getIApp()->getCrashHandler()->saveShouldRecover(on);
return getApp()->getCrashHandler()->saveShouldRecover(on);
},
"When possible, restart Chatterino if the program crashes");
#if defined(Q_OS_LINUX) && !defined(NO_QTKEYCHAIN)
if (!getIApp()->getPaths().isPortable())
if (!getApp()->getPaths().isPortable())
{
layout.addCheckbox(
"Use libsecret/KWallet/Gnome keychain to secure passwords",
@@ -1196,7 +1196,7 @@ void GeneralPage::initExtra()
{
getSettings()->cachePath.connect(
[cachePath = this->cachePath_](const auto &, auto) mutable {
QString newPath = getIApp()->getPaths().cacheDirectory();
QString newPath = getApp()->getPaths().cacheDirectory();
QString pathShortened = "Current location: <a href=\"file:///" +
newPath + "\">" +
@@ -1216,7 +1216,7 @@ QString GeneralPage::getFont(const DropdownArgs &args) const
auto ok = bool();
auto previousFont =
getIApp()->getFonts()->getFont(FontStyle::ChatMedium, 1.);
getApp()->getFonts()->getFont(FontStyle::ChatMedium, 1.);
auto font = QFontDialog::getFont(&ok, previousFont, this->window());
if (ok)
@@ -197,7 +197,7 @@ ComboBox *GeneralPageView::addDropdown(
QObject::connect(combo, &QComboBox::currentTextChanged,
[&setting](const QString &newValue) {
setting = newValue;
getIApp()->getWindows()->forceLayoutChannelViews();
getApp()->getWindows()->forceLayoutChannelViews();
});
return combo;
@@ -204,7 +204,7 @@ public:
.index = combo->currentIndex(),
.combobox = combo,
});
getIApp()->getWindows()->forceLayoutChannelViews();
getApp()->getWindows()->forceLayoutChannelViews();
};
if (listenToActivated)
@@ -268,7 +268,7 @@ public:
setValue = std::move(setValue)](const int newIndex) {
setting = setValue(DropdownArgs{combo->itemText(newIndex),
combo->currentIndex(), combo});
getIApp()->getWindows()->forceLayoutChannelViews();
getApp()->getWindows()->forceLayoutChannelViews();
});
return combo;
@@ -312,7 +312,7 @@ public:
// Instead, it's up to the getters to make sure that the setting is legic - see the enum_cast above
// You could also use the settings `getEnum` function
setting = newText;
getIApp()->getWindows()->forceLayoutChannelViews();
getApp()->getWindows()->forceLayoutChannelViews();
});
return combo;
@@ -22,7 +22,7 @@ using namespace chatterino;
void tableCellClicked(const QModelIndex &clicked, EditableModelView *view,
HotkeyModel *model)
{
auto hotkey = getIApp()->getHotkeys()->getHotkeyByName(
auto hotkey = getApp()->getHotkeys()->getHotkeyByName(
clicked.siblingAtColumn(0).data(Qt::EditRole).toString());
if (!hotkey)
{
@@ -34,8 +34,8 @@ void tableCellClicked(const QModelIndex &clicked, EditableModelView *view,
if (wasAccepted)
{
auto newHotkey = dialog.data();
getIApp()->getHotkeys()->replaceHotkey(hotkey->name(), newHotkey);
getIApp()->getHotkeys()->save();
getApp()->getHotkeys()->replaceHotkey(hotkey->name(), newHotkey);
getApp()->getHotkeys()->save();
}
}
@@ -48,7 +48,7 @@ KeyboardSettingsPage::KeyboardSettingsPage()
LayoutCreator<KeyboardSettingsPage> layoutCreator(this);
auto layout = layoutCreator.emplace<QVBoxLayout>();
auto *model = getIApp()->getHotkeys()->createModel(nullptr);
auto *model = getApp()->getHotkeys()->createModel(nullptr);
EditableModelView *view =
layout.emplace<EditableModelView>(model).getElement();
@@ -68,8 +68,8 @@ KeyboardSettingsPage::KeyboardSettingsPage()
if (wasAccepted)
{
auto newHotkey = dialog.data();
getIApp()->getHotkeys()->hotkeys_.append(newHotkey);
getIApp()->getHotkeys()->save();
getApp()->getHotkeys()->hotkeys_.append(newHotkey);
getApp()->getHotkeys()->save();
}
});
@@ -87,7 +87,7 @@ KeyboardSettingsPage::KeyboardSettingsPage()
if (reply == QMessageBox::Yes)
{
getIApp()->getHotkeys()->resetToDefaults();
getApp()->getHotkeys()->resetToDefaults();
}
});
view->addCustomButton(resetEverything);
+13 -13
View File
@@ -58,7 +58,7 @@ QString formatSize(qint64 size)
QString fetchLogDirectorySize()
{
QString logsDirectoryPath = getSettings()->logPath.getValue().isEmpty()
? getIApp()->getPaths().messageLogDirectory
? getApp()->getPaths().messageLogDirectory
: getSettings()->logPath;
auto logsSize = dirSize(logsDirectoryPath);
@@ -83,20 +83,20 @@ ModerationPage::ModerationPage()
auto logsPathLabel = logs.emplace<QLabel>();
// Logs (copied from LoggingMananger)
getSettings()->logPath.connect([logsPathLabel](const QString &logPath,
auto) mutable {
QString pathOriginal =
logPath.isEmpty() ? getIApp()->getPaths().messageLogDirectory
: logPath;
getSettings()->logPath.connect(
[logsPathLabel](const QString &logPath, auto) mutable {
QString pathOriginal =
logPath.isEmpty() ? getApp()->getPaths().messageLogDirectory
: logPath;
QString pathShortened =
"Logs are saved at <a href=\"file:///" + pathOriginal +
"\"><span style=\"color: white;\">" +
shortenString(pathOriginal, 50) + "</span></a>";
QString pathShortened =
"Logs are saved at <a href=\"file:///" + pathOriginal +
"\"><span style=\"color: white;\">" +
shortenString(pathOriginal, 50) + "</span></a>";
logsPathLabel->setText(pathShortened);
logsPathLabel->setToolTip(pathOriginal);
});
logsPathLabel->setText(pathShortened);
logsPathLabel->setToolTip(pathOriginal);
});
logsPathLabel->setTextFormat(Qt::RichText);
logsPathLabel->setTextInteractionFlags(Qt::TextBrowserInteraction |
@@ -97,7 +97,7 @@ NotificationPage::NotificationPage()
EditableModelView *view =
twitchChannels
.emplace<EditableModelView>(
getIApp()->getNotifications()->createModel(
getApp()->getNotifications()->createModel(
nullptr, Platform::Twitch))
.getElement();
view->setTitles({"Twitch channels"});
+4 -4
View File
@@ -55,7 +55,7 @@ PluginsPage::PluginsPage()
auto *description =
new QLabel("You can load plugins by putting them into " +
formatRichNamedLink(
"file:///" + getIApp()->getPaths().pluginsDirectory,
"file:///" + getApp()->getPaths().pluginsDirectory,
"the Plugins directory") +
". Each one is a new directory.");
description->setOpenExternalLinks(true);
@@ -95,7 +95,7 @@ void PluginsPage::rebuildContent()
this->scrollAreaWidget_.append(this->dataFrame_);
auto layout = frame.setLayoutType<QVBoxLayout>();
layout->setParent(this->dataFrame_);
for (const auto &[id, plugin] : getIApp()->getPlugins()->plugins())
for (const auto &[id, plugin] : getApp()->getPlugins()->plugins())
{
auto groupHeaderText =
QString("%1 (%2, from %3)")
@@ -214,7 +214,7 @@ void PluginsPage::rebuildContent()
val.push_back(name);
}
getSettings()->enabledPlugins.setValue(val);
getIApp()->getPlugins()->reload(name);
getApp()->getPlugins()->reload(name);
this->rebuildContent();
});
pluginEntry->addRow(toggleButton);
@@ -223,7 +223,7 @@ void PluginsPage::rebuildContent()
auto *reloadButton = new QPushButton("Reload", this->dataFrame_);
QObject::connect(reloadButton, &QPushButton::pressed,
[name = id, this]() {
getIApp()->getPlugins()->reload(name);
getApp()->getPlugins()->reload(name);
this->rebuildContent();
});
pluginEntry->addRow(reloadButton);
+1 -1
View File
@@ -103,7 +103,7 @@ QCheckBox *SettingsPage::createCheckBox(
QObject::connect(checkbox, &QCheckBox::toggled, this,
[&setting](bool state) {
setting = state;
getIApp()->getWindows()->forceLayoutChannelViews();
getApp()->getWindows()->forceLayoutChannelViews();
});
return checkbox;
+22 -23
View File
@@ -242,7 +242,7 @@ Split::Split(QWidget *parent)
// update placeholder text on Twitch account change and channel change
this->bSignals_.emplace_back(
getIApp()->getAccounts()->twitch.currentUserChanged.connect([this] {
getApp()->getAccounts()->twitch.currentUserChanged.connect([this] {
this->updateInputPlaceholder();
}));
this->signalHolder_.managedConnect(channelChanged, [this] {
@@ -272,7 +272,7 @@ Split::Split(QWidget *parent)
std::ignore = this->view_->openChannelIn.connect(
[this](QString twitchChannel, FromTwitchLinkOpenChannelIn openIn) {
ChannelPtr channel =
getIApp()->getTwitchAbstract()->getOrAddChannel(twitchChannel);
getApp()->getTwitchAbstract()->getOrAddChannel(twitchChannel);
switch (openIn)
{
case FromTwitchLinkOpenChannelIn::Split:
@@ -387,7 +387,7 @@ Split::Split(QWidget *parent)
}
auto channel = this->getChannel();
auto *imageUploader = getIApp()->getImageUploader();
auto *imageUploader = getApp()->getImageUploader();
auto [images, imageProcessError] =
imageUploader->getImages(original);
@@ -452,7 +452,7 @@ Split::Split(QWidget *parent)
},
this->signalHolder_);
this->addShortcuts();
this->signalHolder_.managedConnect(getIApp()->getHotkeys()->onItemsUpdated,
this->signalHolder_.managedConnect(getApp()->getHotkeys()->onItemsUpdated,
[this]() {
this->clearShortcuts();
this->addShortcuts();
@@ -708,14 +708,14 @@ void Split::addShortcuts()
QString requestedText = arguments.at(0).replace('\n', ' ');
QString inputText = this->getInput().getInputText();
QString message = getIApp()->getCommands()->execCustomCommand(
QString message = getApp()->getCommands()->execCustomCommand(
requestedText.split(' '), Command{"(hotkey)", requestedText},
true, this->getChannel(), nullptr,
{
{"input.text", inputText},
});
message = getIApp()->getCommands()->execCommand(
message = getApp()->getCommands()->execCommand(
message, this->getChannel(), false);
this->getChannel()->sendMessage(message);
return "";
@@ -750,24 +750,24 @@ void Split::addShortcuts()
if (mode == 0)
{
getIApp()->getNotifications()->removeChannelNotification(
getApp()->getNotifications()->removeChannelNotification(
this->getChannel()->getName(), Platform::Twitch);
}
else if (mode == 1)
{
getIApp()->getNotifications()->addChannelNotification(
getApp()->getNotifications()->addChannelNotification(
this->getChannel()->getName(), Platform::Twitch);
}
else
{
getIApp()->getNotifications()->updateChannelNotification(
getApp()->getNotifications()->updateChannelNotification(
this->getChannel()->getName(), Platform::Twitch);
}
return "";
}},
};
this->shortcuts_ = getIApp()->getHotkeys()->shortcutsForCategory(
this->shortcuts_ = getApp()->getHotkeys()->shortcutsForCategory(
HotkeyCategory::Split, actions, this);
}
@@ -796,7 +796,7 @@ void Split::updateInputPlaceholder()
return;
}
auto user = getIApp()->getAccounts()->twitch.getCurrent();
auto user = getApp()->getAccounts()->twitch.getCurrent();
QString placeholderText;
if (user->isAnon())
@@ -806,7 +806,7 @@ void Split::updateInputPlaceholder()
else
{
placeholderText = QString("Send message as %1...")
.arg(getIApp()
.arg(getApp()
->getAccounts()
->twitch.getCurrent()
->getUserName());
@@ -817,7 +817,7 @@ void Split::updateInputPlaceholder()
void Split::joinChannelInNewTab(ChannelPtr channel)
{
auto &nb = getIApp()->getWindows()->getMainWindow().getNotebook();
auto &nb = getApp()->getWindows()->getMainWindow().getNotebook();
SplitContainer *container = nb.addPage(true);
Split *split = new Split(container);
@@ -907,7 +907,7 @@ void Split::setChannel(IndirectChannel newChannel)
this->actionRequested.invoke(Action::RefreshTab);
// Queue up save because: Split channel changed
getIApp()->getWindows()->queueSave();
getApp()->getWindows()->queueSave();
}
void Split::setModerationMode(bool value)
@@ -1001,7 +1001,7 @@ void Split::keyReleaseEvent(QKeyEvent *event)
void Split::resizeEvent(QResizeEvent *event)
{
// Queue up save because: Split resized
getIApp()->getWindows()->queueSave();
getApp()->getWindows()->queueSave();
BaseWidget::resizeEvent(event);
@@ -1122,8 +1122,7 @@ void Split::openInBrowser()
void Split::openWhispersInBrowser()
{
auto userName =
getIApp()->getAccounts()->twitch.getCurrent()->getUserName();
auto userName = getApp()->getAccounts()->twitch.getCurrent()->getUserName();
QDesktopServices::openUrl("https://twitch.tv/popout/moderator/" + userName +
"/whispers");
}
@@ -1211,7 +1210,7 @@ void Split::showChatterList()
auto *item = new QListWidgetItem();
item->setText(text);
item->setFont(
getIApp()->getFonts()->getFont(FontStyle::ChatMedium, 1.0));
getApp()->getFonts()->getFont(FontStyle::ChatMedium, 1.0));
return item;
};
@@ -1261,7 +1260,7 @@ void Split::showChatterList()
auto loadChatters = [=](auto modList, auto vipList, bool isBroadcaster) {
getHelix()->getChatters(
twitchChannel->roomId(),
getIApp()->getAccounts()->twitch.getCurrent()->getUserId(), 50000,
getApp()->getAccounts()->twitch.getCurrent()->getUserId(), 50000,
[=](auto chatters) {
auto broadcaster = channel->getName().toLower();
QStringList chatterList;
@@ -1426,8 +1425,8 @@ void Split::showChatterList()
}},
};
getIApp()->getHotkeys()->shortcutsForCategory(HotkeyCategory::PopupWindow,
actions, chatterDock);
getApp()->getHotkeys()->shortcutsForCategory(HotkeyCategory::PopupWindow,
actions, chatterDock);
dockVbox->addWidget(searchBar);
dockVbox->addWidget(loadingLabel);
@@ -1490,7 +1489,7 @@ void Split::showSearch(bool singleChannel)
}
// Pass every ChannelView for every Split across the app to the search popup
auto &notebook = getIApp()->getWindows()->getMainWindow().getNotebook();
auto &notebook = getApp()->getWindows()->getMainWindow().getNotebook();
for (int i = 0; i < notebook.getPageCount(); ++i)
{
auto *container = dynamic_cast<SplitContainer *>(notebook.getPageAt(i));
@@ -1509,7 +1508,7 @@ void Split::showSearch(bool singleChannel)
void Split::reloadChannelAndSubscriberEmotes()
{
auto channel = this->getChannel();
getIApp()->getAccounts()->twitch.getCurrent()->loadEmotes(channel);
getApp()->getAccounts()->twitch.getCurrent()->loadEmotes(channel);
if (auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
{
+13 -13
View File
@@ -134,7 +134,7 @@ Split *SplitContainer::appendNewSplit(bool openChannelNameDialog)
void SplitContainer::insertSplit(Split *split, InsertOptions &&options)
{
// Queue up save because: Split added
getIApp()->getWindows()->queueSave();
getApp()->getWindows()->queueSave();
assertInGuiThread();
@@ -348,7 +348,7 @@ SplitContainer::Position SplitContainer::releaseSplit(Split *split)
SplitContainer::Position SplitContainer::deleteSplit(Split *split)
{
// Queue up save because: Split removed
getIApp()->getWindows()->queueSave();
getApp()->getWindows()->queueSave();
assertInGuiThread();
assert(split != nullptr);
@@ -617,8 +617,8 @@ void SplitContainer::paintEvent(QPaintEvent * /*event*/)
painter.setPen(this->theme->splits.header.text);
const auto font = getIApp()->getFonts()->getFont(FontStyle::ChatMedium,
this->scale());
const auto font =
getApp()->getFonts()->getFont(FontStyle::ChatMedium, this->scale());
painter.setFont(font);
QString text = "Click to add a split";
@@ -637,7 +637,7 @@ void SplitContainer::paintEvent(QPaintEvent * /*event*/)
}
else
{
if (getIApp()->getThemes()->isLightTheme())
if (getApp()->getThemes()->isLightTheme())
{
painter.fillRect(rect(), QColor("#999"));
}
@@ -649,8 +649,8 @@ void SplitContainer::paintEvent(QPaintEvent * /*event*/)
for (DropRect &dropRect : this->dropRects_)
{
QColor border = getIApp()->getThemes()->splits.dropTargetRectBorder;
QColor background = getIApp()->getThemes()->splits.dropTargetRect;
QColor border = getApp()->getThemes()->splits.dropTargetRectBorder;
QColor background = getApp()->getThemes()->splits.dropTargetRect;
if (!dropRect.rect.contains(this->mouseOverPoint_))
{
@@ -782,7 +782,7 @@ void SplitContainer::applyFromDescriptor(const NodeDescriptor &rootNode)
void SplitContainer::popup()
{
Window &window = getIApp()->getWindows()->createWindow(WindowType::Popup);
Window &window = getApp()->getWindows()->createWindow(WindowType::Popup);
auto *popupContainer = window.getNotebook().getOrAddSelectedPage();
QJsonObject encodedTab;
@@ -1494,15 +1494,15 @@ void SplitContainer::DropOverlay::paintEvent(QPaintEvent * /*event*/)
{
if (!foundMover && rect.rect.contains(this->mouseOverPoint_))
{
painter.setBrush(getIApp()->getThemes()->splits.dropPreview);
painter.setPen(getIApp()->getThemes()->splits.dropPreviewBorder);
painter.setBrush(getApp()->getThemes()->splits.dropPreview);
painter.setPen(getApp()->getThemes()->splits.dropPreviewBorder);
foundMover = true;
}
else
{
painter.setBrush(QColor(0, 0, 0, 0));
painter.setPen(QColor(0, 0, 0, 0));
// painter.setPen(getIApp()->getThemes()->splits.dropPreviewBorder);
// painter.setPen(getApp()->getThemes()->splits.dropPreviewBorder);
}
painter.drawRect(rect.rect);
@@ -1584,10 +1584,10 @@ SplitContainer::ResizeHandle::ResizeHandle(SplitContainer *_parent)
void SplitContainer::ResizeHandle::paintEvent(QPaintEvent * /*event*/)
{
QPainter painter(this);
painter.setPen(QPen(getIApp()->getThemes()->splits.resizeHandle, 2));
painter.setPen(QPen(getApp()->getThemes()->splits.resizeHandle, 2));
painter.fillRect(this->rect(),
getIApp()->getThemes()->splits.resizeHandleBackground);
getApp()->getThemes()->splits.resizeHandleBackground);
if (this->vertical_)
{
+8 -8
View File
@@ -140,7 +140,7 @@ auto formatTooltip(const TwitchChannel::StreamStatus &s, QString thumbnail)
}();
auto extraStreamData = [&s]() -> QString {
if (getIApp()->getStreamerMode()->isEnabled() &&
if (getApp()->getStreamerMode()->isEnabled() &&
getSettings()->streamerModeHideViewerCountAndDuration)
{
return QStringLiteral(
@@ -246,7 +246,7 @@ SplitHeader::SplitHeader(Split *split)
});
this->bSignals_.emplace_back(
getIApp()->getAccounts()->twitch.currentUserChanged.connect([this] {
getApp()->getAccounts()->twitch.currentUserChanged.connect([this] {
this->updateIcons();
}));
@@ -311,7 +311,7 @@ void SplitHeader::initializeLayout()
case Qt::LeftButton:
if (getSettings()->moderationActions.empty())
{
getIApp()->getWindows()->showSettingsDialog(
getApp()->getWindows()->showSettingsDialog(
this, SettingsDialogPreference::
ModerationActions);
this->split_->setModerationMode(true);
@@ -329,7 +329,7 @@ void SplitHeader::initializeLayout()
case Qt::RightButton:
case Qt::MiddleButton:
getIApp()->getWindows()->showSettingsDialog(
getApp()->getWindows()->showSettingsDialog(
this,
SettingsDialogPreference::ModerationActions);
break;
@@ -379,7 +379,7 @@ void SplitHeader::initializeLayout()
std::unique_ptr<QMenu> SplitHeader::createMainMenu()
{
// top level menu
const auto &h = getIApp()->getHotkeys();
const auto &h = getApp()->getHotkeys();
auto menu = std::make_unique<QMenu>();
menu->addAction(
"Change channel", this->split_, &Split::changeChannel,
@@ -552,11 +552,11 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
action->setShortcut(notifySeq);
QObject::connect(moreMenu, &QMenu::aboutToShow, this, [action, this]() {
action->setChecked(getIApp()->getNotifications()->isChannelNotified(
action->setChecked(getApp()->getNotifications()->isChannelNotified(
this->split_->getChannel()->getName(), Platform::Twitch));
});
QObject::connect(action, &QAction::triggered, this, [this]() {
getIApp()->getNotifications()->updateChannelNotification(
getApp()->getNotifications()->updateChannelNotification(
this->split_->getChannel()->getName(), Platform::Twitch);
});
@@ -1078,7 +1078,7 @@ void SplitHeader::reloadSubscriberEmotes()
this->lastReloadedSubEmotes_ = now;
auto channel = this->split_->getChannel();
getIApp()->getAccounts()->twitch.getCurrent()->loadEmotes(channel);
getApp()->getAccounts()->twitch.getCurrent()->loadEmotes(channel);
}
void SplitHeader::reconnect()
+8 -8
View File
@@ -68,7 +68,7 @@ SplitInput::SplitInput(QWidget *parent, Split *_chatWidget,
this->hideCompletionPopup();
});
this->scaleChangedEvent(this->scale());
this->signalHolder_.managedConnect(getIApp()->getHotkeys()->onItemsUpdated,
this->signalHolder_.managedConnect(getApp()->getHotkeys()->onItemsUpdated,
[this]() {
this->clearShortcuts();
this->addShortcuts();
@@ -77,7 +77,7 @@ SplitInput::SplitInput(QWidget *parent, Split *_chatWidget,
void SplitInput::initLayout()
{
auto *app = getIApp();
auto *app = getApp();
LayoutCreator<SplitInput> layoutCreator(this);
auto layout =
@@ -219,7 +219,7 @@ void SplitInput::initLayout()
void SplitInput::scaleChangedEvent(float scale)
{
auto *app = getIApp();
auto *app = getApp();
// update the icon size of the buttons
this->updateEmoteButton();
this->updateCancelReplyButton();
@@ -352,7 +352,7 @@ QString SplitInput::handleSendMessage(const std::vector<QString> &arguments)
message = message.replace('\n', ' ');
QString sendMessage =
getIApp()->getCommands()->execCommand(message, c, false);
getApp()->getCommands()->execCommand(message, c, false);
c->sendMessage(sendMessage);
@@ -388,7 +388,7 @@ QString SplitInput::handleSendMessage(const std::vector<QString> &arguments)
message = message.replace('\n', ' ');
QString sendMessage =
getIApp()->getCommands()->execCommand(message, c, false);
getApp()->getCommands()->execCommand(message, c, false);
// Reply within TwitchChannel
tc->sendReply(sendMessage, this->replyTarget_->id);
@@ -413,7 +413,7 @@ QString SplitInput::handleSendMessage(const std::vector<QString> &arguments)
message = message.replace('\n', ' ');
QString sendMessage =
getIApp()->getCommands()->execCommand(message, c, false);
getApp()->getCommands()->execCommand(message, c, false);
// Reply within TwitchChannel
tc->sendReply(sendMessage, this->replyTarget_->id);
@@ -698,7 +698,7 @@ void SplitInput::addShortcuts()
}},
};
this->shortcuts_ = getIApp()->getHotkeys()->shortcutsForCategory(
this->shortcuts_ = getApp()->getHotkeys()->shortcutsForCategory(
HotkeyCategory::SplitInput, actions, this->parentWidget());
}
@@ -983,7 +983,7 @@ void SplitInput::setInputText(const QString &newInputText)
void SplitInput::editTextChanged()
{
auto *app = getIApp();
auto *app = getApp();
// set textLengthLabel value
QString text = this->ui_.textEdit->toPlainText();
+2 -2
View File
@@ -268,8 +268,8 @@ void SplitOverlay::paintEvent(QPaintEvent *event)
{
rect.setRight(rect.right() - 1);
rect.setBottom(rect.bottom() - 1);
painter.setPen(getIApp()->getThemes()->splits.dropPreviewBorder);
painter.setBrush(getIApp()->getThemes()->splits.dropPreview);
painter.setPen(getApp()->getThemes()->splits.dropPreviewBorder);
painter.setBrush(getApp()->getThemes()->splits.dropPreview);
painter.drawRect(rect);
}
}