remove settings and paths from Application

This commit is contained in:
fourtf
2018-08-12 12:56:28 +02:00
parent 1ec1ecd52b
commit f6414c9d7e
35 changed files with 125 additions and 152 deletions
+9 -12
View File
@@ -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 =