Skip to content

Commit

Permalink
Hook up existing folder notification size checkbox in general settings
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Jul 4, 2023
1 parent 90da00e commit 9522539
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions src/gui/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ GeneralSettings::GeneralSettings(QWidget *parent)
connect(_ui->crashreporterCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
connect(_ui->newFolderLimitCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
connect(_ui->newFolderLimitSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &GeneralSettings::saveMiscSettings);
connect(_ui->existingFolderLimitCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
connect(_ui->newExternalStorage, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);

#ifndef WITH_CRASHREPORTER
Expand Down Expand Up @@ -255,6 +256,8 @@ void GeneralSettings::loadMiscSettings()
auto newFolderLimit = cfgFile.newBigFolderSizeLimit();
_ui->newFolderLimitCheckBox->setChecked(newFolderLimit.first);
_ui->newFolderLimitSpinBox->setValue(newFolderLimit.second);
_ui->existingFolderLimitCheckBox->setEnabled(newFolderLimit.first);
_ui->existingFolderLimitCheckBox->setChecked(newFolderLimit.first && cfgFile.notifyExistingFoldersOverLimit());
_ui->newExternalStorage->setChecked(cfgFile.confirmExternalStorage());
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
}
Expand All @@ -270,8 +273,12 @@ void GeneralSettings::slotUpdateInfo()
}

if (updater) {
connect(_ui->updateButton, &QAbstractButton::clicked, this,
&GeneralSettings::slotUpdateCheckNow, Qt::UniqueConnection);
connect(_ui->updateButton,
&QAbstractButton::clicked,
this,

&GeneralSettings::slotUpdateCheckNow,
Qt::UniqueConnection);
connect(_ui->autoCheckForUpdatesCheckBox, &QAbstractButton::toggled, this,
&GeneralSettings::slotToggleAutoUpdateCheck, Qt::UniqueConnection);
_ui->autoCheckForUpdatesCheckBox->setChecked(ConfigFile().autoUpdateCheck());
Expand Down Expand Up @@ -406,17 +413,20 @@ void GeneralSettings::slotToggleAutoUpdateCheck()

void GeneralSettings::saveMiscSettings()
{
if (_currentlyLoading)
if (_currentlyLoading) {
return;
}

ConfigFile cfgFile;
bool isChecked = _ui->monoIconsCheckBox->isChecked();
cfgFile.setMonoIcons(isChecked);
Theme::instance()->setSystrayUseMonoIcons(isChecked);
cfgFile.setCrashReporter(_ui->crashreporterCheckBox->isChecked());

cfgFile.setNewBigFolderSizeLimit(_ui->newFolderLimitCheckBox->isChecked(),
_ui->newFolderLimitSpinBox->value());
const auto useMonoIcons = _ui->monoIconsCheckBox->isChecked();
Theme::instance()->setSystrayUseMonoIcons(useMonoIcons);

cfgFile.setMonoIcons(useMonoIcons);
cfgFile.setCrashReporter(_ui->crashreporterCheckBox->isChecked());
cfgFile.setNewBigFolderSizeLimit(_ui->newFolderLimitCheckBox->isChecked(), _ui->newFolderLimitSpinBox->value());
cfgFile.setConfirmExternalStorage(_ui->newExternalStorage->isChecked());
cfgFile.setNotifyExistingFoldersOverLimit(_ui->existingFolderLimitCheckBox->isChecked());
}

void GeneralSettings::slotToggleLaunchOnStartup(bool enable)
Expand Down

0 comments on commit 9522539

Please sign in to comment.