moved cache and appdata settings up

This commit is contained in:
fourtf 2020-08-13 16:59:42 +02:00
parent a50e95d9f8
commit b2ae2e598f

View file

@ -508,6 +508,44 @@ void GeneralPage::initLayout(SettingsLayout &layout)
s.attachExtensionToAnyProcess);
#endif
layout.addTitle("Cache");
layout.addDescription(
"Files that are used often (such as emotes) are saved to disk to "
"reduce bandwidth usage and to 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 <a href=\"file:///" + newPath +
"\"><span style=\"color: white;\">" +
shortenString(newPath, 50) + "</span></a>";
cachePathLabel->setText(pathShortened);
cachePathLabel->setToolTip(newPath);
});
// Choose and reset buttons
{
auto box = new QHBoxLayout;
box->addWidget(layout.makeButton("Choose cache path", [this]() {
getSettings()->cachePath = QFileDialog::getExistingDirectory(this);
}));
box->addWidget(layout.makeButton(
"Reset", []() { getSettings()->cachePath = ""; }));
box->addStretch(1);
layout.addLayout(box);
}
layout.addTitle("AppData");
layout.addDescription("All local files like settings and cache files are "
"store in this directory.");
layout.addButton("Open AppData directory", [] {
QDesktopServices::openUrl(getPaths()->rootAppDataDirectory);
});
layout.addTitle("Miscellaneous");
if (supportsIncognitoLinks())
@ -629,44 +667,6 @@ void GeneralPage::initLayout(SettingsLayout &layout)
"Ask for confirmation when uploading an image to i.nuuls.com",
s.askOnImageUpload);
layout.addTitle("Cache");
layout.addDescription(
"Files that are used often (such as emotes) are saved to disk to "
"reduce bandwidth usage and to 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 <a href=\"file:///" + newPath +
"\"><span style=\"color: white;\">" +
shortenString(newPath, 50) + "</span></a>";
cachePathLabel->setText(pathShortened);
cachePathLabel->setToolTip(newPath);
});
// Choose and reset buttons
{
auto box = new QHBoxLayout;
box->addWidget(layout.makeButton("Choose cache path", [this]() {
getSettings()->cachePath = QFileDialog::getExistingDirectory(this);
}));
box->addWidget(layout.makeButton(
"Reset", []() { getSettings()->cachePath = ""; }));
box->addStretch(1);
layout.addLayout(box);
}
layout.addTitle("AppData");
layout.addDescription("All local files like settings and cache files are "
"store in this directory.");
layout.addButton("Open AppData directory", [] {
QDesktopServices::openUrl(getPaths()->rootAppDataDirectory);
});
// invisible element for width
auto inv = new BaseWidget(this);
inv->setScaleIndependantWidth(500);