mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-29 01:53:54 -07:00
Reload card db and notify enabled sets change on "Manage Sets" dialog save (#6837)
* Reload card db and notify enabled sets change on "Manage Sets" dialog save Took 1 hour 18 minutes Took 6 seconds * Extract to method, also notify on "Reload db" and "new sets found" Took 3 minutes Took 4 seconds * Add an "always enable new sets" fuse to "new sets found" dialog Took 11 minutes * Always debounce modelDirty() with dirty() timer. Took 29 minutes Took 3 minutes * Performance improvements for settings by not constructing a new settings object on every single set() call (this forced a sync to/from fs but it seems fine to just rely on Qts own periodic sync?) Took 23 minutes Took 3 seconds --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
ac2e995f15
commit
d30690236a
12 changed files with 84 additions and 37 deletions
|
|
@ -211,6 +211,7 @@ SettingsCache::SettingsCache()
|
|||
startupCardUpdateCheckAlwaysUpdate = settings->value("personal/startupCardUpdateCheckAlwaysUpdate", false).toBool();
|
||||
cardUpdateCheckInterval = settings->value("personal/cardUpdateCheckInterval", 7).toInt();
|
||||
lastCardUpdateCheck = settings->value("personal/lastCardUpdateCheck", QDateTime::currentDateTime().date()).toDate();
|
||||
alwaysEnableNewSets = settings->value("personal/alwaysEnableNewSets", false).toBool();
|
||||
notifyAboutUpdates = settings->value("personal/updatenotification", true).toBool();
|
||||
notifyAboutNewVersion = settings->value("personal/newversionnotification", true).toBool();
|
||||
|
||||
|
|
@ -1246,6 +1247,12 @@ void SettingsCache::setLastCardUpdateCheck(QDate value)
|
|||
settings->setValue("personal/lastCardUpdateCheck", lastCardUpdateCheck);
|
||||
}
|
||||
|
||||
void SettingsCache::setAlwaysEnableNewSets(bool value)
|
||||
{
|
||||
alwaysEnableNewSets = value;
|
||||
settings->setValue("personal/alwaysEnableNewSets", alwaysEnableNewSets);
|
||||
}
|
||||
|
||||
void SettingsCache::setRememberGameSettings(const bool _rememberGameSettings)
|
||||
{
|
||||
rememberGameSettings = _rememberGameSettings;
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ private:
|
|||
bool checkCardUpdatesOnStartup;
|
||||
int cardUpdateCheckInterval;
|
||||
QDate lastCardUpdateCheck;
|
||||
bool alwaysEnableNewSets;
|
||||
bool notifyAboutUpdates;
|
||||
bool notifyAboutNewVersion;
|
||||
bool showTipsOnStartup;
|
||||
|
|
@ -502,6 +503,10 @@ public:
|
|||
return getLastCardUpdateCheck().daysTo(QDateTime::currentDateTime().date()) >= getCardUpdateCheckInterval() &&
|
||||
getLastCardUpdateCheck() != QDateTime::currentDateTime().date();
|
||||
}
|
||||
[[nodiscard]] bool getAlwaysEnableNewSets() const
|
||||
{
|
||||
return alwaysEnableNewSets;
|
||||
}
|
||||
[[nodiscard]] bool getNotifyAboutUpdates() const override
|
||||
{
|
||||
return notifyAboutUpdates;
|
||||
|
|
@ -1125,6 +1130,7 @@ public slots:
|
|||
void setStartupCardUpdateCheckAlwaysUpdate(bool value);
|
||||
void setCardUpdateCheckInterval(int value);
|
||||
void setLastCardUpdateCheck(QDate value);
|
||||
void setAlwaysEnableNewSets(bool value);
|
||||
void setNotifyAboutUpdate(QT_STATE_CHANGED_T _notifyaboutupdate);
|
||||
void setNotifyAboutNewVersion(QT_STATE_CHANGED_T _notifyaboutnewversion);
|
||||
void setUpdateReleaseChannelIndex(int value);
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ 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)
|
||||
|
|
@ -38,7 +36,7 @@ QColor CardCounterSettings::color(int counterId) const
|
|||
defaultColor = QColor::fromHsv(h, s, v);
|
||||
}
|
||||
|
||||
return getSettings().value(QString("cards/counters/%1/color").arg(counterId), defaultColor).value<QColor>();
|
||||
return settings.value(QString("cards/counters/%1/color").arg(counterId), defaultColor).value<QColor>();
|
||||
}
|
||||
|
||||
QString CardCounterSettings::displayName(int counterId) const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue