mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-23 07:03:54 -07:00
* 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>
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
/**
|
|
* @file settings_manager.h
|
|
* @ingroup Settings
|
|
* @brief TODO: Document this.
|
|
*/
|
|
|
|
#ifndef SETTINGSMANAGER_H
|
|
#define SETTINGSMANAGER_H
|
|
|
|
#include <QSettings>
|
|
#include <QStringList>
|
|
#include <QVariant>
|
|
|
|
class SettingsManager : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit SettingsManager(const QString &settingPath,
|
|
const QString &defaultGroup = QString(),
|
|
const QString &defaultSubGroup = QString(),
|
|
QObject *parent = nullptr);
|
|
|
|
QVariant getValue(const QString &name) const;
|
|
QVariant getValue(const QString &name, const QString &group, const QString &subGroup = QString()) const;
|
|
|
|
void sync();
|
|
|
|
protected:
|
|
QString defaultGroup;
|
|
QString defaultSubGroup;
|
|
|
|
mutable QSettings settings;
|
|
|
|
void setValue(const QVariant &value, const QString &name);
|
|
|
|
void
|
|
setValue(const QVariant &value, const QString &name, const QString &group, const QString &subGroup = QString());
|
|
|
|
void deleteValue(const QString &name);
|
|
|
|
void deleteValue(const QString &name, const QString &group, const QString &subGroup = QString());
|
|
};
|
|
|
|
#endif // SETTINGSMANAGER_H
|