[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:
RickyRister 2026-05-05 12:03:01 -07:00 committed by GitHub
parent 7c9fbe2be0
commit 19dbb17fb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 88 additions and 12 deletions

View file

@ -11,6 +11,8 @@ CardCounterSettings::CardCounterSettings(const QString &settingsPath, QObject *p
void CardCounterSettings::setColor(int counterId, const QColor &color)
{
QSettings settings = getSettings();
QString key = QString("cards/counters/%1/color").arg(counterId);
if (settings.value(key).value<QColor>() == color)
@ -36,7 +38,7 @@ QColor CardCounterSettings::color(int counterId) const
defaultColor = QColor::fromHsv(h, s, v);
}
return settings.value(QString("cards/counters/%1/color").arg(counterId), defaultColor).value<QColor>();
return getSettings().value(QString("cards/counters/%1/color").arg(counterId), defaultColor).value<QColor>();
}
QString CardCounterSettings::displayName(int counterId) const