mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-26 16:43:55 -07:00
[SettingsManager] Properly handle multithreaded access again (#6844)
* [SettingsManager] Properly handle multithreaded access again * Add comment * Add batch write function --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
7c9fbe2be0
commit
19dbb17fb9
10 changed files with 88 additions and 12 deletions
|
|
@ -34,3 +34,17 @@ bool CardDatabaseSettings::isKnown(QString shortName) const
|
|||
{
|
||||
return getValue("isknown", "sets", std::move(shortName)).toBool();
|
||||
}
|
||||
|
||||
void CardDatabaseSettings::saveSets(const QVector<ICardSetPriorityController::SetSaveData> &data)
|
||||
{
|
||||
batchWrite([&](QSettings &s) {
|
||||
s.beginGroup("sets");
|
||||
for (const auto &entry : data) {
|
||||
s.beginGroup(entry.shortName);
|
||||
s.setValue("sortkey", entry.sortKey);
|
||||
s.setValue("enabled", entry.enabled);
|
||||
s.endGroup();
|
||||
}
|
||||
s.endGroup();
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue