move default urls to static const

This commit is contained in:
RickyRister 2024-11-24 17:10:02 -08:00
parent 54bcab4f0a
commit 1036aa21fc
2 changed files with 9 additions and 6 deletions

View file

@ -2,6 +2,12 @@
#include "settings_manager.h" #include "settings_manager.h"
const QStringList DownloadSettings::DEFAULT_DOWNLOAD_URLS = {
"https://api.scryfall.com/cards/!set:uuid!?format=image&face=!prop:side!",
"https://api.scryfall.com/cards/multiverse/!set:muid!?format=image",
"https://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!set:muid!&type=card",
"https://gatherer.wizards.com/Handlers/Image.ashx?name=!name!&type=card"};
DownloadSettings::DownloadSettings(const QString &settingPath, QObject *parent = nullptr) DownloadSettings::DownloadSettings(const QString &settingPath, QObject *parent = nullptr)
: SettingsManager(settingPath + "downloads.ini", parent) : SettingsManager(settingPath + "downloads.ini", parent)
{ {
@ -19,10 +25,5 @@ QStringList DownloadSettings::getAllURLs()
void DownloadSettings::resetToDefaultURLs() void DownloadSettings::resetToDefaultURLs()
{ {
auto downloadURLs = QStringList(); setValue(QVariant::fromValue(DEFAULT_DOWNLOAD_URLS), "urls", "downloads");
downloadURLs.append("https://api.scryfall.com/cards/!set:uuid!?format=image&face=!prop:side!");
downloadURLs.append("https://api.scryfall.com/cards/multiverse/!set:muid!?format=image");
downloadURLs.append("https://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!set:muid!&type=card");
downloadURLs.append("https://gatherer.wizards.com/Handlers/Image.ashx?name=!name!&type=card");
setValue(QVariant::fromValue(downloadURLs), "urls", "downloads");
} }

View file

@ -10,6 +10,8 @@ class DownloadSettings : public SettingsManager
Q_OBJECT Q_OBJECT
friend class SettingsCache; friend class SettingsCache;
static const QStringList DEFAULT_DOWNLOAD_URLS;
public: public:
explicit DownloadSettings(const QString &, QObject *); explicit DownloadSettings(const QString &, QObject *);