refactor: Remove most raw accesses into Application (#5104)
This commit is contained in:
@@ -123,8 +123,8 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
layout.addTitle("Interface");
|
||||
|
||||
layout.addDropdown<QString>(
|
||||
"Theme", getApp()->themes->availableThemes(),
|
||||
getApp()->themes->themeName,
|
||||
"Theme", getIApp()->getThemes()->availableThemes(),
|
||||
getIApp()->getThemes()->themeName,
|
||||
[](const auto *combo, const auto &themeKey) {
|
||||
return combo->findData(themeKey, Qt::UserRole);
|
||||
},
|
||||
@@ -135,7 +135,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
|
||||
layout.addDropdown<QString>(
|
||||
"Font", {"Segoe UI", "Arial", "Choose..."},
|
||||
getApp()->fonts->chatFontFamily,
|
||||
getIApp()->getFonts()->chatFontFamily,
|
||||
[](auto val) {
|
||||
return val;
|
||||
},
|
||||
@@ -144,7 +144,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
});
|
||||
layout.addDropdown<int>(
|
||||
"Font size", {"9pt", "10pt", "12pt", "14pt", "16pt", "20pt"},
|
||||
getApp()->fonts->chatFontSize,
|
||||
getIApp()->getFonts()->chatFontSize,
|
||||
[](auto val) {
|
||||
return QString::number(val) + "pt";
|
||||
},
|
||||
@@ -241,7 +241,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 = getApp()->hotkeys->getDisplaySequence(
|
||||
auto removeTabSeq = getIApp()->getHotkeys()->getDisplaySequence(
|
||||
HotkeyCategory::Window, "removeTab");
|
||||
QString removeTabShortcut = "an assigned hotkey (Window -> remove tab)";
|
||||
if (!removeTabSeq.isEmpty())
|
||||
@@ -262,7 +262,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
#endif
|
||||
if (!BaseWindow::supportsCustomWindowFrame())
|
||||
{
|
||||
auto settingsSeq = getApp()->hotkeys->getDisplaySequence(
|
||||
auto settingsSeq = getIApp()->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?
|
||||
@@ -858,7 +858,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
"Show the stream title");
|
||||
|
||||
layout.addSubtitle("R9K");
|
||||
auto toggleLocalr9kSeq = getApp()->hotkeys->getDisplaySequence(
|
||||
auto toggleLocalr9kSeq = getIApp()->getHotkeys()->getDisplaySequence(
|
||||
HotkeyCategory::Window, "toggleLocalR9K");
|
||||
QString toggleLocalr9kShortcut =
|
||||
"an assigned hotkey (Window -> Toggle local R9K)";
|
||||
@@ -878,7 +878,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
s.shownSimilarTriggerHighlights);
|
||||
s.hideSimilar.connect(
|
||||
[]() {
|
||||
getApp()->windows->forceLayoutChannelViews();
|
||||
getIApp()->getWindows()->forceLayoutChannelViews();
|
||||
},
|
||||
false);
|
||||
layout.addDropdown<float>(
|
||||
@@ -940,10 +940,10 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
layout.addCustomCheckbox(
|
||||
"Restart on crash (requires restart)",
|
||||
[] {
|
||||
return getApp()->crashHandler->shouldRecover();
|
||||
return getIApp()->getCrashHandler()->shouldRecover();
|
||||
},
|
||||
[](bool on) {
|
||||
return getApp()->crashHandler->saveShouldRecover(on);
|
||||
return getIApp()->getCrashHandler()->saveShouldRecover(on);
|
||||
},
|
||||
"When possible, restart Chatterino if the program crashes");
|
||||
|
||||
@@ -1251,7 +1251,8 @@ QString GeneralPage::getFont(const DropdownArgs &args) const
|
||||
{
|
||||
args.combobox->setCurrentIndex(0);
|
||||
args.combobox->setEditText("Choosing...");
|
||||
QFontDialog dialog(getApp()->fonts->getFont(FontStyle::ChatMedium, 1.));
|
||||
QFontDialog dialog(
|
||||
getIApp()->getFonts()->getFont(FontStyle::ChatMedium, 1.));
|
||||
|
||||
auto ok = bool();
|
||||
auto font = dialog.getFont(&ok, this->window());
|
||||
|
||||
Reference in New Issue
Block a user