remove settings and paths from Application
This commit is contained in:
@@ -47,7 +47,7 @@ CommandPage::CommandPage()
|
||||
|
||||
layout.append(
|
||||
this->createCheckBox("Also match the trigger at the end of the message",
|
||||
app->settings->allowCommandsAtEnd));
|
||||
getSettings()->allowCommandsAtEnd));
|
||||
|
||||
QLabel *text = layout.emplace<QLabel>(TEXT).getElement();
|
||||
text->setWordWrap(true);
|
||||
|
||||
@@ -57,22 +57,22 @@ ExternalToolsPage::ExternalToolsPage()
|
||||
auto customPathCb =
|
||||
this->createCheckBox("Use custom path (Enable if using "
|
||||
"non-standard streamlink installation path)",
|
||||
app->settings->streamlinkUseCustomPath);
|
||||
getSettings()->streamlinkUseCustomPath);
|
||||
groupLayout->setWidget(2, QFormLayout::SpanningRole, customPathCb);
|
||||
|
||||
auto customPath = this->createLineEdit(app->settings->streamlinkPath);
|
||||
auto customPath = this->createLineEdit(getSettings()->streamlinkPath);
|
||||
customPath->setPlaceholderText(
|
||||
"Path to folder where Streamlink executable can be found");
|
||||
groupLayout->addRow("Custom streamlink path:", customPath);
|
||||
groupLayout->addRow(
|
||||
"Preferred quality:",
|
||||
this->createComboBox({STREAMLINK_QUALITY},
|
||||
app->settings->preferredQuality));
|
||||
getSettings()->preferredQuality));
|
||||
groupLayout->addRow(
|
||||
"Additional options:",
|
||||
this->createLineEdit(app->settings->streamlinkOpts));
|
||||
this->createLineEdit(getSettings()->streamlinkOpts));
|
||||
|
||||
app->settings->streamlinkUseCustomPath.connect(
|
||||
getSettings()->streamlinkUseCustomPath.connect(
|
||||
[=](const auto &value, auto) {
|
||||
customPath->setEnabled(value); //
|
||||
},
|
||||
|
||||
@@ -20,7 +20,6 @@ namespace chatterino {
|
||||
FeelPage::FeelPage()
|
||||
: SettingsPage("Feel", ":/settings/behave.svg")
|
||||
{
|
||||
auto app = getApp();
|
||||
LayoutCreator<FeelPage> layoutCreator(this);
|
||||
|
||||
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
|
||||
@@ -37,20 +36,20 @@ FeelPage::FeelPage()
|
||||
form->addRow(
|
||||
"", this->createCheckBox(
|
||||
"Show which users joined the channel (up to 1000 chatters)",
|
||||
app->settings->showJoins));
|
||||
getSettings()->showJoins));
|
||||
form->addRow(
|
||||
"", this->createCheckBox(
|
||||
"Show which users parted the channel (up to 1000 chatters)",
|
||||
app->settings->showParts));
|
||||
getSettings()->showParts));
|
||||
|
||||
form->addRow("Pause chat:",
|
||||
this->createCheckBox(PAUSE_HOVERING,
|
||||
app->settings->pauseChatHover));
|
||||
getSettings()->pauseChatHover));
|
||||
|
||||
form->addRow("Mouse scroll speed:", this->createMouseScrollSlider());
|
||||
form->addRow("Links:",
|
||||
this->createCheckBox("Open links only on double click",
|
||||
app->settings->linksDoubleClickOnly));
|
||||
getSettings()->linksDoubleClickOnly));
|
||||
}
|
||||
|
||||
layout->addSpacing(16);
|
||||
@@ -61,11 +60,11 @@ FeelPage::FeelPage()
|
||||
groupLayout->addRow(
|
||||
LIMIT_CHATTERS_FOR_SMALLER_STREAMERS,
|
||||
this->createCheckBox(
|
||||
"", app->settings->onlyFetchChattersForSmallerStreamers));
|
||||
"", getSettings()->onlyFetchChattersForSmallerStreamers));
|
||||
|
||||
groupLayout->addRow(
|
||||
"What viewer count counts as a \"smaller streamer\"",
|
||||
this->createSpinBox(app->settings->smallStreamerLimit, 10, 50000));
|
||||
this->createSpinBox(getSettings()->smallStreamerLimit, 10, 50000));
|
||||
}
|
||||
|
||||
{
|
||||
@@ -73,7 +72,7 @@ FeelPage::FeelPage()
|
||||
auto groupLayout = group.setLayoutType<QVBoxLayout>();
|
||||
|
||||
groupLayout.append(this->createCheckBox("Show whispers inline",
|
||||
app->settings->inlineWhispers));
|
||||
getSettings()->inlineWhispers));
|
||||
}
|
||||
|
||||
layout->addStretch(1);
|
||||
@@ -81,17 +80,16 @@ FeelPage::FeelPage()
|
||||
|
||||
QSlider *FeelPage::createMouseScrollSlider()
|
||||
{
|
||||
auto app = getApp();
|
||||
auto slider = new QSlider(Qt::Horizontal);
|
||||
|
||||
float currentValue = app->settings->mouseScrollMultiplier;
|
||||
float currentValue = getSettings()->mouseScrollMultiplier;
|
||||
int sliderValue = int(((currentValue - 0.1f) / 2.f) * 99.f);
|
||||
slider->setValue(sliderValue);
|
||||
|
||||
QObject::connect(slider, &QSlider::valueChanged, [=](int newValue) {
|
||||
float mul = static_cast<float>(newValue) / 99.f;
|
||||
float newSliderValue = (mul * 2.1f) + 0.1f;
|
||||
app->settings->mouseScrollMultiplier = newSliderValue;
|
||||
getSettings()->mouseScrollMultiplier = newSliderValue;
|
||||
});
|
||||
|
||||
return slider;
|
||||
|
||||
@@ -39,7 +39,7 @@ HighlightingPage::HighlightingPage()
|
||||
{
|
||||
// GENERAL
|
||||
// layout.append(this->createCheckBox(ENABLE_HIGHLIGHTS,
|
||||
// app->settings->enableHighlights));
|
||||
// getSettings()->enableHighlights));
|
||||
|
||||
// TABS
|
||||
auto tabs = layout.emplace<QTabWidget>();
|
||||
@@ -135,7 +135,7 @@ HighlightingPage::HighlightingPage()
|
||||
auto customSound = layout.emplace<QHBoxLayout>().withoutMargin();
|
||||
{
|
||||
customSound.append(this->createCheckBox(
|
||||
"Custom sound", app->settings->customHighlightSound));
|
||||
"Custom sound", getSettings()->customHighlightSound));
|
||||
auto selectFile =
|
||||
customSound.emplace<QPushButton>("Select custom sound file");
|
||||
QObject::connect(selectFile.getElement(), &QPushButton::clicked,
|
||||
@@ -143,12 +143,12 @@ HighlightingPage::HighlightingPage()
|
||||
auto fileName = QFileDialog::getOpenFileName(
|
||||
this, tr("Open Sound"), "",
|
||||
tr("Audio Files (*.mp3 *.wav)"));
|
||||
app->settings->pathHighlightSound = fileName;
|
||||
getSettings()->pathHighlightSound = fileName;
|
||||
});
|
||||
}
|
||||
|
||||
layout.append(createCheckBox(ALWAYS_PLAY,
|
||||
app->settings->highlightAlwaysPlaySound));
|
||||
getSettings()->highlightAlwaysPlaySound));
|
||||
}
|
||||
|
||||
// ---- misc
|
||||
|
||||
@@ -71,7 +71,7 @@ void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> users,
|
||||
{
|
||||
users.append(
|
||||
page.createCheckBox("Enable twitch ignored users",
|
||||
getApp()->settings->enableTwitchIgnoredUsers));
|
||||
getSettings()->enableTwitchIgnoredUsers));
|
||||
|
||||
auto anyways = users.emplace<QHBoxLayout>().withoutMargin();
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
// LayoutCreator<LogsPage> layoutCreator(this);
|
||||
// auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
|
||||
|
||||
// auto logPath = app->paths->logsFolderPath;
|
||||
// auto logPath = getPaths()->logsFolderPath;
|
||||
|
||||
// auto created = layout.emplace<QLabel>();
|
||||
// created->setText("Logs are saved to " + CreateLink(logPath, true));
|
||||
@@ -43,7 +43,7 @@
|
||||
// Qt::LinksAccessibleByKeyboard);
|
||||
// created->setOpenExternalLinks(true);
|
||||
// layout.append(this->createCheckBox("Enable logging",
|
||||
// app->settings->enableLogging));
|
||||
// getSettings()->enableLogging));
|
||||
|
||||
// layout->addStretch(1);
|
||||
//}
|
||||
|
||||
@@ -208,13 +208,13 @@ void LookPage::addEmoteTab(LayoutCreator<QVBoxLayout> layout)
|
||||
/*
|
||||
emotes.append(
|
||||
this->createCheckBox("Enable Twitch emotes",
|
||||
app->settings->enableTwitchEmotes));
|
||||
getSettings()->enableTwitchEmotes));
|
||||
emotes.append(this->createCheckBox("Enable BetterTTV emotes for Twitch",
|
||||
app->settings->enableBttvEmotes));
|
||||
getSettings()->enableBttvEmotes));
|
||||
emotes.append(this->createCheckBox("Enable FrankerFaceZ emotes for Twitch",
|
||||
app->settings->enableFfzEmotes));
|
||||
getSettings()->enableFfzEmotes));
|
||||
emotes.append(this->createCheckBox("Enable emojis",
|
||||
app->settings->enableEmojis));
|
||||
getSettings()->enableEmojis));
|
||||
*/
|
||||
layout.append(
|
||||
this->createCheckBox("Animations", getSettings()->enableGifAnimations));
|
||||
@@ -285,7 +285,7 @@ void LookPage::addLastReadMessageIndicatorPatternSelector(
|
||||
combo->addItems({"Dotted line", "Solid line"});
|
||||
|
||||
const auto currentIndex = []() -> int {
|
||||
switch (getApp()->settings->lastMessagePattern.getValue()) {
|
||||
switch (getSettings()->lastMessagePattern.getValue()) {
|
||||
case Qt::SolidLine:
|
||||
return 1;
|
||||
case Qt::VerPattern:
|
||||
|
||||
@@ -69,12 +69,11 @@ QString formatSize(qint64 size)
|
||||
|
||||
QString fetchLogDirectorySize()
|
||||
{
|
||||
auto app = getApp();
|
||||
QString logPathDirectory;
|
||||
if (app->settings->logPath == "") {
|
||||
logPathDirectory = app->paths->messageLogDirectory;
|
||||
if (getSettings()->logPath == "") {
|
||||
logPathDirectory = getPaths()->messageLogDirectory;
|
||||
} else {
|
||||
logPathDirectory = app->settings->logPath;
|
||||
logPathDirectory = getSettings()->logPath;
|
||||
}
|
||||
qint64 logsSize = dirSize(logPathDirectory);
|
||||
QString logsSizeLabel = "Your logs currently take up ";
|
||||
@@ -101,12 +100,12 @@ ModerationPage::ModerationPage()
|
||||
QtConcurrent::run([] { return fetchLogDirectorySize(); }));
|
||||
|
||||
// Logs (copied from LoggingMananger)
|
||||
app->settings->logPath.connect(
|
||||
getSettings()->logPath.connect(
|
||||
[app, logsPathLabel](const QString &logPath, auto) mutable {
|
||||
QString pathOriginal;
|
||||
|
||||
if (logPath == "") {
|
||||
pathOriginal = app->paths->messageLogDirectory;
|
||||
pathOriginal = getPaths()->messageLogDirectory;
|
||||
} else {
|
||||
pathOriginal = logPath;
|
||||
}
|
||||
@@ -136,7 +135,7 @@ ModerationPage::ModerationPage()
|
||||
Qt::LinksAccessibleByKeyboard);
|
||||
logsPathLabel->setOpenExternalLinks(true);
|
||||
logs.append(this->createCheckBox("Enable logging",
|
||||
app->settings->enableLogging));
|
||||
getSettings()->enableLogging));
|
||||
|
||||
logs->addStretch(1);
|
||||
auto selectDir = logs.emplace<QPushButton>("Set custom logpath");
|
||||
@@ -145,10 +144,9 @@ ModerationPage::ModerationPage()
|
||||
QObject::connect(
|
||||
selectDir.getElement(), &QPushButton::clicked, this,
|
||||
[this, logsPathSizeLabel]() mutable {
|
||||
auto app = getApp();
|
||||
auto dirName = QFileDialog::getExistingDirectory(this);
|
||||
|
||||
app->settings->logPath = dirName;
|
||||
getSettings()->logPath = dirName;
|
||||
|
||||
// Refresh: Show how big (size-wise) the logs are
|
||||
logsPathSizeLabel->setText(
|
||||
@@ -159,8 +157,7 @@ ModerationPage::ModerationPage()
|
||||
auto resetDir = logs.emplace<QPushButton>("Reset logpath");
|
||||
QObject::connect(resetDir.getElement(), &QPushButton::clicked, this,
|
||||
[logsPathSizeLabel]() mutable {
|
||||
auto app = getApp();
|
||||
app->settings->logPath = "";
|
||||
getSettings()->logPath = "";
|
||||
|
||||
// Refresh: Show how big (size-wise) the logs are
|
||||
logsPathSizeLabel->setText(QtConcurrent::run(
|
||||
@@ -183,7 +180,7 @@ ModerationPage::ModerationPage()
|
||||
// form->addRow("Action on timed out messages
|
||||
// (unimplemented):",
|
||||
// this->createComboBox({"Disable", "Hide"},
|
||||
// app->settings->timeoutAction));
|
||||
// getSettings()->timeoutAction));
|
||||
// }
|
||||
|
||||
EditableModelView *view =
|
||||
|
||||
@@ -13,8 +13,6 @@ namespace chatterino {
|
||||
SpecialChannelsPage::SpecialChannelsPage()
|
||||
: SettingsPage("Special channels", "")
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
LayoutCreator<SpecialChannelsPage> layoutCreator(this);
|
||||
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user