Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
CardDatabaseSettings Class Reference

#include <card_database_settings.h>

Inheritance diagram for CardDatabaseSettings:
[legend]
Collaboration diagram for CardDatabaseSettings:
[legend]

Public Member Functions

void setSortKey (QString shortName, unsigned int sortKey) override
void setEnabled (QString shortName, bool enabled) override
void setIsKnown (QString shortName, bool isknown) override
unsigned int getSortKey (QString shortName) const override
bool isEnabled (QString shortName) const override
bool isKnown (QString shortName) const override
SetOptions getSetOptions (QString shortName) const override
 Returns the bundled priority options for a set in a single call.
QStringList getEnabledSetNames () const override
 Returns the short names of every set currently marked as enabled.
void saveSets (const QVector< SetSaveData > &data) override
 Persists per-set options for every entry in a single settings flush.
Public Member Functions inherited from SettingsManager
 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
QVariant getValue (const QString &name, const QString &group, const QString &subGroup, const QVariant &defaultValue) const
void batchWrite (std::function< void(QSettings &)> batchWriteFunction)
void sync ()
Public Member Functions inherited from ICardSetPriorityController
virtual ~ICardSetPriorityController ()=default

Private Member Functions

 CardDatabaseSettings (const QString &settingPath, QObject *parent=nullptr)
void ensureSetOptionsLoaded () const

Private Attributes

QMutex setOptionsMutex
QHash< QString, SetOptions > setOptionsCache
bool setOptionsLoaded = false

Friends

class SettingsCache

Additional Inherited Members

Protected Member Functions inherited from SettingsManager
QSettings getSettings () const
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())
Protected Attributes inherited from SettingsManager
QString settingPath
QString defaultGroup
QString defaultSubGroup

Constructor & Destructor Documentation

◆ CardDatabaseSettings()

CardDatabaseSettings::CardDatabaseSettings ( const QString & settingPath,
QObject * parent = nullptr )
explicitprivate
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ ensureSetOptionsLoaded()

void CardDatabaseSettings::ensureSetOptionsLoaded ( ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEnabledSetNames()

QStringList CardDatabaseSettings::getEnabledSetNames ( ) const
overridevirtual

Returns the short names of every set currently marked as enabled.

Callers fold this into the card database cache source hash so that toggling set enablement invalidates the cache.

Returns
The enabled set short names, sorted alphabetically.

Implements ICardSetPriorityController.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSetOptions()

ICardSetPriorityController::SetOptions CardDatabaseSettings::getSetOptions ( QString shortName) const
overridevirtual

Returns the bundled priority options for a set in a single call.

Parameters
shortNameThe set's short name.
Returns
The sort key, enabled and known flags for the set.

Implements ICardSetPriorityController.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSortKey()

unsigned int CardDatabaseSettings::getSortKey ( QString shortName) const
overridevirtual

Implements ICardSetPriorityController.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEnabled()

bool CardDatabaseSettings::isEnabled ( QString shortName) const
overridevirtual

Implements ICardSetPriorityController.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isKnown()

bool CardDatabaseSettings::isKnown ( QString shortName) const
overridevirtual

Implements ICardSetPriorityController.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveSets()

void CardDatabaseSettings::saveSets ( const QVector< SetSaveData > & data)
overridevirtual

Persists per-set options for every entry in a single settings flush.

Each individual setSortKey/setEnabled/setIsKnown call re-opens and re-syncs the whole .ini when backed by QSettings, so persisting hundreds of sets one option at a time freezes the GUI thread for seconds. Callers that touch more than a handful of sets must bundle the records and call this once.

Implements ICardSetPriorityController.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setEnabled()

void CardDatabaseSettings::setEnabled ( QString shortName,
bool enabled )
overridevirtual

Implements ICardSetPriorityController.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setIsKnown()

void CardDatabaseSettings::setIsKnown ( QString shortName,
bool isknown )
overridevirtual

Implements ICardSetPriorityController.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSortKey()

void CardDatabaseSettings::setSortKey ( QString shortName,
unsigned int sortKey )
overridevirtual

Implements ICardSetPriorityController.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SettingsCache

friend class SettingsCache
friend

Member Data Documentation

◆ setOptionsCache

QHash<QString, SetOptions> CardDatabaseSettings::setOptionsCache
mutableprivate

◆ setOptionsLoaded

bool CardDatabaseSettings::setOptionsLoaded = false
mutableprivate

◆ setOptionsMutex

QMutex CardDatabaseSettings::setOptionsMutex
mutableprivate

The documentation for this class was generated from the following files: