mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
Support Picking Select Art per Card Basis (#5329)
This commit is contained in:
parent
024bef7ded
commit
c7ca55ceb5
13 changed files with 115 additions and 6 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include "cache_settings.h"
|
||||
|
||||
#include "../client/network/release_channel.h"
|
||||
#include "card_override_settings.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
|
|
@ -179,6 +180,7 @@ SettingsCache::SettingsCache()
|
|||
layoutsSettings = new LayoutsSettings(settingsPath, this);
|
||||
downloadSettings = new DownloadSettings(settingsPath, this);
|
||||
recentsSettings = new RecentsSettings(settingsPath, this);
|
||||
cardOverrideSettings = new CardOverrideSettings(settingsPath, this);
|
||||
|
||||
if (!QFile(settingsPath + "global.ini").exists())
|
||||
translateLegacySettings();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "../utility/macros.h"
|
||||
#include "card_database_settings.h"
|
||||
#include "card_override_settings.h"
|
||||
#include "download_settings.h"
|
||||
#include "game_filters_settings.h"
|
||||
#include "layouts_settings.h"
|
||||
|
|
@ -84,6 +85,7 @@ private:
|
|||
LayoutsSettings *layoutsSettings;
|
||||
DownloadSettings *downloadSettings;
|
||||
RecentsSettings *recentsSettings;
|
||||
CardOverrideSettings *cardOverrideSettings;
|
||||
|
||||
QByteArray mainWindowGeometry;
|
||||
QByteArray tokenDialogGeometry;
|
||||
|
|
@ -604,6 +606,10 @@ public:
|
|||
{
|
||||
return *recentsSettings;
|
||||
}
|
||||
CardOverrideSettings &cardOverrides() const
|
||||
{
|
||||
return *cardOverrideSettings;
|
||||
}
|
||||
bool getIsPortableBuild() const
|
||||
{
|
||||
return isPortableBuild;
|
||||
|
|
|
|||
21
cockatrice/src/settings/card_override_settings.cpp
Normal file
21
cockatrice/src/settings/card_override_settings.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "card_override_settings.h"
|
||||
|
||||
CardOverrideSettings::CardOverrideSettings(QString settingPath, QObject *parent)
|
||||
: SettingsManager(settingPath + "cardPreferenceOverrides.ini", parent)
|
||||
{
|
||||
}
|
||||
|
||||
void CardOverrideSettings::setCardPreferenceOverride(const QString &cardName, const QString &providerId)
|
||||
{
|
||||
setValue(providerId, cardName, "cards");
|
||||
}
|
||||
|
||||
void CardOverrideSettings::deleteCardPreferenceOverride(const QString &cardName)
|
||||
{
|
||||
deleteValue(cardName, "cards");
|
||||
}
|
||||
|
||||
QString CardOverrideSettings::getCardPreferenceOverride(const QString &cardName)
|
||||
{
|
||||
return getValue(cardName, "cards").toString();
|
||||
}
|
||||
25
cockatrice/src/settings/card_override_settings.h
Normal file
25
cockatrice/src/settings/card_override_settings.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef COCKATRICE_CARD_OVERRIDE_SETTINGS_H
|
||||
#define COCKATRICE_CARD_OVERRIDE_SETTINGS_H
|
||||
|
||||
#include "settings_manager.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class CardOverrideSettings : public SettingsManager
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class SettingsCache;
|
||||
|
||||
public:
|
||||
void setCardPreferenceOverride(const QString &cardName, const QString &providerId);
|
||||
|
||||
void deleteCardPreferenceOverride(const QString &cardName);
|
||||
|
||||
QString getCardPreferenceOverride(const QString &cardName);
|
||||
|
||||
private:
|
||||
explicit CardOverrideSettings(QString settingPath, QObject *parent = nullptr);
|
||||
CardOverrideSettings(const CardOverrideSettings & /*other*/);
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_CARD_OVERRIDE_SETTINGS_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue