diff --git a/chatterino.pro b/chatterino.pro index d0036d2e6..d2db3dbc9 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -202,7 +202,6 @@ SOURCES += \ src/widgets/Scrollbar.cpp \ src/widgets/settingspages/AboutPage.cpp \ src/widgets/settingspages/AccountsPage.cpp \ - src/widgets/settingspages/AdvancedPage.cpp \ src/widgets/settingspages/CommandPage.cpp \ src/widgets/settingspages/ExternalToolsPage.cpp \ src/widgets/settingspages/GeneralPage.cpp \ @@ -382,7 +381,6 @@ HEADERS += \ src/widgets/Scrollbar.hpp \ src/widgets/settingspages/AboutPage.hpp \ src/widgets/settingspages/AccountsPage.hpp \ - src/widgets/settingspages/AdvancedPage.hpp \ src/widgets/settingspages/CommandPage.hpp \ src/widgets/settingspages/ExternalToolsPage.hpp \ src/widgets/settingspages/GeneralPage.hpp \ @@ -449,4 +447,4 @@ git_hash = $$str_member($$git_commit, 0, 8) # https://stackoverflow.com/questions/3348711/add-a-define-to-qmake-with-a-value/18343449#18343449 DEFINES += CHATTERINO_GIT_COMMIT=\\\"$$git_commit\\\" DEFINES += CHATTERINO_GIT_RELEASE=\\\"$$git_release\\\" -DEFINES += CHATTERINO_GIT_HASH=\\\"$$git_hash\\\" +DEFINES += CHATTERINO_GIT_HASH=\\\"$$git_hash\\\" diff --git a/src/autogenerated/ResourcesAutogen.hpp b/src/autogenerated/ResourcesAutogen.hpp index c6b3dc486..51a9a5734 100644 --- a/src/autogenerated/ResourcesAutogen.hpp +++ b/src/autogenerated/ResourcesAutogen.hpp @@ -3,7 +3,8 @@ namespace chatterino { -class Resources2 : public Singleton { +class Resources2 : public Singleton +{ public: Resources2(); diff --git a/src/widgets/dialogs/SettingsDialog.cpp b/src/widgets/dialogs/SettingsDialog.cpp index 3cbd6c61b..71dd56e4f 100644 --- a/src/widgets/dialogs/SettingsDialog.cpp +++ b/src/widgets/dialogs/SettingsDialog.cpp @@ -7,7 +7,6 @@ #include "widgets/helper/SettingsDialogTab.hpp" #include "widgets/settingspages/AboutPage.hpp" #include "widgets/settingspages/AccountsPage.hpp" -#include "widgets/settingspages/AdvancedPage.hpp" #include "widgets/settingspages/CommandPage.hpp" #include "widgets/settingspages/ExternalToolsPage.hpp" #include "widgets/settingspages/GeneralPage.hpp" @@ -27,6 +26,8 @@ SettingsDialog *SettingsDialog::handle = nullptr; SettingsDialog::SettingsDialog() : BaseWindow(nullptr, BaseWindow::DisableCustomScaling) { + this->setWindowTitle("Chatterino Settings"); + this->initUi(); this->addTabs(); @@ -173,7 +174,6 @@ void SettingsDialog::addTabs() this->addTab(this->ui_.moderationPage = new ModerationPage); this->addTab(new NotificationPage); this->addTab(new ExternalToolsPage); - this->addTab(new AdvancedPage); this->ui_.tabContainer->addStretch(1); this->addTab(new AboutPage, Qt::AlignBottom); diff --git a/src/widgets/settingspages/AdvancedPage.cpp b/src/widgets/settingspages/AdvancedPage.cpp deleted file mode 100644 index 739abd686..000000000 --- a/src/widgets/settingspages/AdvancedPage.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "AdvancedPage.hpp" - -#include "Application.hpp" -#include "controllers/taggedusers/TaggedUsersController.hpp" -#include "controllers/taggedusers/TaggedUsersModel.hpp" -#include "singletons/Logging.hpp" -#include "singletons/Paths.hpp" -#include "util/Helpers.hpp" -#include "util/LayoutCreator.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace chatterino { - -AdvancedPage::AdvancedPage() - : SettingsPage("Advanced", ":/settings/advanced.svg") -{ - LayoutCreator layoutCreator(this); - - auto tabs = layoutCreator.emplace(); - - { - auto layout = tabs.appendTab(new QVBoxLayout, "Cache"); - auto folderLabel = layout.emplace(); - - folderLabel->setTextFormat(Qt::RichText); - folderLabel->setTextInteractionFlags(Qt::TextBrowserInteraction | - Qt::LinksAccessibleByKeyboard | - Qt::LinksAccessibleByKeyboard); - folderLabel->setOpenExternalLinks(true); - - getSettings()->cachePath.connect([folderLabel](const auto &, - auto) mutable { - QString newPath = getPaths()->cacheDirectory(); - - QString pathShortened = "Cache saved at " + - shortenString(newPath, 50) + ""; - - folderLabel->setText(pathShortened); - folderLabel->setToolTip(newPath); - }); - - layout->addStretch(1); - - auto selectDir = layout.emplace("Set custom cache folder"); - - QObject::connect( - selectDir.getElement(), &QPushButton::clicked, this, [this] { - auto dirName = QFileDialog::getExistingDirectory(this); - - getSettings()->cachePath = dirName; - }); - - auto resetDir = - layout.emplace("Reset custom cache folder"); - QObject::connect(resetDir.getElement(), &QPushButton::clicked, this, - []() mutable { - getSettings()->cachePath = ""; // - }); - - // Logs end - } -} - -} // namespace chatterino diff --git a/src/widgets/settingspages/AdvancedPage.hpp b/src/widgets/settingspages/AdvancedPage.hpp deleted file mode 100644 index ecc3d629e..000000000 --- a/src/widgets/settingspages/AdvancedPage.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include "widgets/settingspages/SettingsPage.hpp" - -namespace chatterino { - -class AdvancedPage : public SettingsPage -{ -public: - AdvancedPage(); -}; - -} // namespace chatterino diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 06288fcd6..473c8e4dc 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -413,6 +413,29 @@ void GeneralPage::initLayout(SettingsLayout &layout) layout.addCheckbox("Load message history on connect", s.loadTwitchMessageHistoryOnConnect); + layout.addTitle("Cache"); + layout.addDescription( + "Files that are used often (such as emotes) are saved to disk to " + "reduce bandwidth usage and tho speed up loading."); + + auto cachePathLabel = layout.addDescription("placeholder :D"); + getSettings()->cachePath.connect([cachePathLabel](const auto &, + auto) mutable { + QString newPath = getPaths()->cacheDirectory(); + + QString pathShortened = "Cache saved at " + + shortenString(newPath, 50) + ""; + cachePathLabel->setText(pathShortened); + cachePathLabel->setToolTip(newPath); + }); + + layout.addButton("Choose", [this]() { + getSettings()->cachePath = QFileDialog::getExistingDirectory(this); + }); + + layout.addButton("Reset", []() { getSettings()->cachePath = ""; }); + layout.addTitle("AppData"); layout.addDescription("All local files like settings and cache files are " "store in this directory."); diff --git a/src/widgets/settingspages/GeneralPage.hpp b/src/widgets/settingspages/GeneralPage.hpp index 650ff9425..e1600a108 100644 --- a/src/widgets/settingspages/GeneralPage.hpp +++ b/src/widgets/settingspages/GeneralPage.hpp @@ -72,9 +72,12 @@ public: QPushButton *addButton(const QString &text, OnClick onClick) { auto button = new QPushButton(text); + auto layout = new QHBoxLayout(); + layout->addWidget(button); + layout->addStretch(1); this->groups_.back().widgets.push_back({button, {text}}); QObject::connect(button, &QPushButton::clicked, onClick); - this->addWidget(button); + this->addLayout(layout); return button; }