fix: save settings less often (#6620)
Reviewed-by: James Upjohn <jupjohn@jammeh.co.nz>
This commit is contained in:
@@ -157,8 +157,12 @@ Settings::Settings(const Args &args, const QString &settingsDirectory)
|
||||
|
||||
settingsInstance->setBackupEnabled(true);
|
||||
settingsInstance->setBackupSlots(9);
|
||||
settingsInstance->saveMethod =
|
||||
pajlada::Settings::SettingManager::SaveMethod::SaveManually;
|
||||
settingsInstance->saveMethod = static_cast<
|
||||
pajlada::Settings::SettingManager::SaveMethod>(
|
||||
static_cast<uint64_t>(
|
||||
pajlada::Settings::SettingManager::SaveMethod::SaveManually) |
|
||||
static_cast<uint64_t>(
|
||||
pajlada::Settings::SettingManager::SaveMethod::OnlySaveIfChanged));
|
||||
|
||||
initializeSignalVector(this->signalHolder, this->highlightedMessagesSetting,
|
||||
this->highlightedMessages);
|
||||
@@ -198,14 +202,14 @@ Settings::~Settings()
|
||||
Settings::instance_ = this->prevInstance_;
|
||||
}
|
||||
|
||||
void Settings::requestSave() const
|
||||
pajlada::Settings::SettingManager::SaveResult Settings::requestSave() const
|
||||
{
|
||||
if (this->disableSaving)
|
||||
{
|
||||
return;
|
||||
return pajlada::Settings::SettingManager::SaveResult::Skipped;
|
||||
}
|
||||
|
||||
pajlada::Settings::SettingManager::gSave();
|
||||
return pajlada::Settings::SettingManager::gSave();
|
||||
}
|
||||
|
||||
void Settings::saveSnapshot()
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <pajlada/settings/setting.hpp>
|
||||
#include <pajlada/settings/settinglistener.hpp>
|
||||
#include <pajlada/settings/settingmanager.hpp>
|
||||
#include <pajlada/signals/signalholder.hpp>
|
||||
|
||||
#include <optional>
|
||||
@@ -130,7 +131,9 @@ public:
|
||||
/// Request the settings to be saved to file
|
||||
///
|
||||
/// Depending on the launch options, a save might end up not happening
|
||||
void requestSave() const;
|
||||
///
|
||||
/// Returns the result from the save, or Skipped if disableSave has been called
|
||||
pajlada::Settings::SettingManager::SaveResult requestSave() const;
|
||||
|
||||
void saveSnapshot();
|
||||
void restoreSnapshot();
|
||||
|
||||
Reference in New Issue
Block a user