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

#include <download_settings.h>

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

Signals

void picDownloadChanged ()
void downloadSpoilerStatusChanged ()
void hostRequestLimitsChanged ()

Public Member Functions

 DownloadSettings (const QString &, QObject *)
QStringList getAllURLs () const
void setDownloadUrls (const QStringList &downloadURLs)
void resetToDefaultURLs ()
bool addLocalizedScryfallUrl ()
bool getPicDownload () const
void setPicDownload (bool _picDownload)
bool getDownloadSpoilersStatus () const
void setDownloadSpoilerStatus (bool _spoilerStatus)
QHash< QString, int > getHostRequestLimits () const
 User-set per-host request allowances (requests/second). Missing hosts use the developer default.
void setHostRequestLimits (const QHash< QString, int > &hostRequestLimits)
int clampHostRequestLimit (const QString &host, int requested) const
 Clamps the user's requested allowance for a host against its developer cap.
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 ()

Static Public Member Functions

static const QHash< QString, int > & getDeveloperHostCaps ()
 Developer-set per-host allowance ceilings (requests/second), keyed by host.

Static Public Attributes

static constexpr int DEFAULT_HOST_REQUEST_LIMIT = 10
 Per-host request allowance (requests/second) when no developer cap applies.
static constexpr int MIN_HOST_REQUEST_LIMIT = 1
 Floor for any per-host request allowance.
static constexpr int UNLOCKED_HOST_LIMIT_MAX = 50
 Upper bound offered to the user when lowering an unlocked host's allowance.
static constexpr int UNLIMITED_HOST_QUOTA = -1
 Developer cap marking a host as never throttled per host or by the dispatch pacing.

Static Private Attributes

static const QStringList DEFAULT_DOWNLOAD_URLS
static const QString SCRYFALL_NAMED_LOCALIZED_URL
static const QHash< QString, int > DEVELOPER_HOST_CAPS

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

◆ DownloadSettings()

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

Member Function Documentation

◆ addLocalizedScryfallUrl()

bool DownloadSettings::addLocalizedScryfallUrl ( )
nodiscard
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clampHostRequestLimit()

int DownloadSettings::clampHostRequestLimit ( const QString & host,
int requested ) const
nodiscard

Clamps the user's requested allowance for a host against its developer cap.

Parameters
hostThe host to clamp for
requestedThe user-requested allowance in requests/second
Returns
The effective allowance. Users may lower a host's allowance but never raise it above the developer cap; hosts with UNLIMITED_HOST_QUOTA have no upper bound.
Here is the caller graph for this function:

◆ downloadSpoilerStatusChanged

void DownloadSettings::downloadSpoilerStatusChanged ( )
signal
Here is the caller graph for this function:

◆ getAllURLs()

QStringList DownloadSettings::getAllURLs ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDeveloperHostCaps()

const QHash< QString, int > & DownloadSettings::getDeveloperHostCaps ( )
static

Developer-set per-host allowance ceilings (requests/second), keyed by host.

Hosts not present default to DEFAULT_HOST_REQUEST_LIMIT. An entry of UNLIMITED_HOST_QUOTA marks a host that users may still lower, but that is never throttled per host by default. Users can never raise a host's allowance above its developer cap.

Here is the caller graph for this function:

◆ getDownloadSpoilersStatus()

bool DownloadSettings::getDownloadSpoilersStatus ( ) const
nodiscard
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHostRequestLimits()

QHash< QString, int > DownloadSettings::getHostRequestLimits ( ) const

User-set per-host request allowances (requests/second). Missing hosts use the developer default.

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

◆ getPicDownload()

bool DownloadSettings::getPicDownload ( ) const
nodiscard
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hostRequestLimitsChanged

void DownloadSettings::hostRequestLimitsChanged ( )
signal
Here is the caller graph for this function:

◆ picDownloadChanged

void DownloadSettings::picDownloadChanged ( )
signal
Here is the caller graph for this function:

◆ resetToDefaultURLs()

void DownloadSettings::resetToDefaultURLs ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDownloadSpoilerStatus()

void DownloadSettings::setDownloadSpoilerStatus ( bool _spoilerStatus)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDownloadUrls()

void DownloadSettings::setDownloadUrls ( const QStringList & downloadURLs)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setHostRequestLimits()

void DownloadSettings::setHostRequestLimits ( const QHash< QString, int > & hostRequestLimits)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPicDownload()

void DownloadSettings::setPicDownload ( bool _picDownload)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SettingsCache

friend class SettingsCache
friend

Member Data Documentation

◆ DEFAULT_DOWNLOAD_URLS

const QStringList DownloadSettings::DEFAULT_DOWNLOAD_URLS
staticprivate
Initial value:
= {
"https://cards.scryfall.io/large/!prop:side!/!set:uuid_substr_0_1!/!set:uuid_substr_1_1!/!set:uuid!.jpg",
"https://api.scryfall.com/cards/!set:uuid!?format=image&face=!prop:side!&lang=!sflang!",
"https://api.scryfall.com/cards/multiverse/!set:muid!?format=image&lang=!sflang!",
"https://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!set:muid!&type=card",
"https://gatherer.wizards.com/Handlers/Image.ashx?name=!name!&type=card"}

◆ DEFAULT_HOST_REQUEST_LIMIT

int DownloadSettings::DEFAULT_HOST_REQUEST_LIMIT = 10
staticconstexpr

Per-host request allowance (requests/second) when no developer cap applies.

◆ DEVELOPER_HOST_CAPS

const QHash< QString, int > DownloadSettings::DEVELOPER_HOST_CAPS
staticprivate
Initial value:
= {
{"api.scryfall.com", 9},
{"cards.scryfall.io", UNLIMITED_HOST_QUOTA},
}
static constexpr int UNLIMITED_HOST_QUOTA
Developer cap marking a host as never throttled per host or by the dispatch pacing.
Definition download_settings.h:43

◆ MIN_HOST_REQUEST_LIMIT

int DownloadSettings::MIN_HOST_REQUEST_LIMIT = 1
staticconstexpr

Floor for any per-host request allowance.

◆ SCRYFALL_NAMED_LOCALIZED_URL

const QString DownloadSettings::SCRYFALL_NAMED_LOCALIZED_URL
staticprivate
Initial value:
=
"https://api.scryfall.com/cards/named?fuzzy=!localizedName!&lang=!sflang!&format=image&face=!prop:side!"

◆ UNLIMITED_HOST_QUOTA

int DownloadSettings::UNLIMITED_HOST_QUOTA = -1
staticconstexpr

Developer cap marking a host as never throttled per host or by the dispatch pacing.

◆ UNLOCKED_HOST_LIMIT_MAX

int DownloadSettings::UNLOCKED_HOST_LIMIT_MAX = 50
staticconstexpr

Upper bound offered to the user when lowering an unlocked host's allowance.

Unlocked hosts have no developer cap, so clampHostRequestLimit puts no upper bound on them; this only bounds what the settings dialog offers, and matches the widest paced allowance a user is documented to be able to hand-edit in downloads.ini. Choosing 0 below this restores the "unlimited" fast path.


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