#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") { auto app = getApp(); 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