mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-06 13:33:55 -07:00
Add batch write function
Took 24 minutes Took 5 seconds Took 26 seconds
This commit is contained in:
parent
21d8e6b9ad
commit
8f9dad8966
9 changed files with 61 additions and 7 deletions
|
|
@ -159,6 +159,15 @@ QVariant SettingsManager::getValue(const QString &name, const QString &group, co
|
|||
return value;
|
||||
}
|
||||
|
||||
void SettingsManager::batchWrite(std::function<void(QSettings &)> batchWriteFunction)
|
||||
{
|
||||
auto settings = getSettings();
|
||||
settings.setAtomicSyncRequired(false);
|
||||
batchWriteFunction(settings);
|
||||
settings.sync(); // single flush
|
||||
settings.setAtomicSyncRequired(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls sync on the underlying QSettings object
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue