mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-08-06 02:33:48 -05:00
Add new classes
This commit is contained in:
parent
8ba27debfb
commit
f89400a3c9
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef COCKATRICE_INTERFACE_DECK_EDITOR_SETTINGS_PROVIDER_H
|
||||
#define COCKATRICE_INTERFACE_DECK_EDITOR_SETTINGS_PROVIDER_H
|
||||
|
||||
class IDeckEditorSettingsProvider
|
||||
{
|
||||
public:
|
||||
virtual ~IDeckEditorSettingsProvider() = default;
|
||||
|
||||
[[nodiscard]] virtual bool getOpenDeckInNewTab() const = 0;
|
||||
[[nodiscard]] virtual bool getBannerCardComboBoxVisible() const = 0;
|
||||
[[nodiscard]] virtual bool getTagsWidgetVisible() const = 0;
|
||||
[[nodiscard]] virtual int getDefaultDeckEditorType() const = 0;
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_INTERFACE_DECK_EDITOR_SETTINGS_PROVIDER_H
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
#include "appearance_settings.h"
|
||||
|
||||
AppearanceSettings::AppearanceSettings(const QString &settingPath, QObject *parent)
|
||||
: SettingsManager(settingPath + "appearance.ini", "appearance", QString(), parent)
|
||||
{
|
||||
}
|
||||
|
||||
QString AppearanceSettings::getThemeName() const
|
||||
{
|
||||
return getValue("themeName", QString(), QString()).toString();
|
||||
}
|
||||
|
||||
void AppearanceSettings::setThemeName(const QString &_themeName)
|
||||
{
|
||||
setValue(_themeName, "themeName");
|
||||
emit themeNameChanged();
|
||||
}
|
||||
|
||||
bool AppearanceSettings::getStyleUserList() const
|
||||
{
|
||||
return getValue("styleUserList", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
void AppearanceSettings::setStyleUserList(bool _styleUserList)
|
||||
{
|
||||
setValue(_styleUserList, "styleUserList");
|
||||
emit styleUserListChanged();
|
||||
}
|
||||
|
||||
int AppearanceSettings::getMaxFontSize() const
|
||||
{
|
||||
return getValue("maxFontSize", QString(), QString(), 12).toInt();
|
||||
}
|
||||
|
||||
void AppearanceSettings::setMaxFontSize(int _max)
|
||||
{
|
||||
setValue(_max, "maxFontSize");
|
||||
}
|
||||
|
||||
QString AppearanceSettings::getHomeTabBackgroundSource() const
|
||||
{
|
||||
return getValue("homeTabBackgroundSource", QString(), QString(), "themed").toString();
|
||||
}
|
||||
|
||||
void AppearanceSettings::setHomeTabBackgroundSource(const QString &_backgroundSource)
|
||||
{
|
||||
setValue(_backgroundSource, "homeTabBackgroundSource");
|
||||
emit homeTabBackgroundSourceChanged();
|
||||
}
|
||||
|
||||
int AppearanceSettings::getHomeTabBackgroundShuffleFrequency() const
|
||||
{
|
||||
return getValue("homeTabBackgroundShuffleFrequency", QString(), QString(), 0).toInt();
|
||||
}
|
||||
|
||||
void AppearanceSettings::setHomeTabBackgroundShuffleFrequency(int _frequency)
|
||||
{
|
||||
setValue(_frequency, "homeTabBackgroundShuffleFrequency");
|
||||
emit homeTabBackgroundShuffleFrequencyChanged();
|
||||
}
|
||||
|
||||
bool AppearanceSettings::getHomeTabDisplayCardName() const
|
||||
{
|
||||
return getValue("homeTabDisplayCardName", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
void AppearanceSettings::setHomeTabDisplayCardName(bool _displayCardName)
|
||||
{
|
||||
setValue(_displayCardName, "homeTabDisplayCardName");
|
||||
emit homeTabDisplayCardNameChanged();
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* @file appearance_settings.h
|
||||
* @ingroup CoreSettings
|
||||
*/
|
||||
//! \todo Document this file.
|
||||
|
||||
#ifndef APPEARANCE_SETTINGS_H
|
||||
#define APPEARANCE_SETTINGS_H
|
||||
|
||||
#include "settings_manager.h"
|
||||
|
||||
class AppearanceSettings : public SettingsManager
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class SettingsCache;
|
||||
|
||||
public:
|
||||
[[nodiscard]] QString getThemeName() const;
|
||||
void setThemeName(const QString &_themeName);
|
||||
[[nodiscard]] bool getStyleUserList() const;
|
||||
void setStyleUserList(bool _styleUserList);
|
||||
[[nodiscard]] int getMaxFontSize() const;
|
||||
void setMaxFontSize(int _max);
|
||||
[[nodiscard]] QString getHomeTabBackgroundSource() const;
|
||||
void setHomeTabBackgroundSource(const QString &_backgroundSource);
|
||||
[[nodiscard]] int getHomeTabBackgroundShuffleFrequency() const;
|
||||
void setHomeTabBackgroundShuffleFrequency(int _frequency);
|
||||
[[nodiscard]] bool getHomeTabDisplayCardName() const;
|
||||
void setHomeTabDisplayCardName(bool _displayCardName);
|
||||
|
||||
signals:
|
||||
void themeNameChanged();
|
||||
void styleUserListChanged();
|
||||
void homeTabBackgroundSourceChanged();
|
||||
void homeTabBackgroundShuffleFrequencyChanged();
|
||||
void homeTabDisplayCardNameChanged();
|
||||
|
||||
public:
|
||||
explicit AppearanceSettings(const QString &settingPath, QObject *parent = nullptr);
|
||||
|
||||
private:
|
||||
AppearanceSettings(const AppearanceSettings & /*other*/);
|
||||
};
|
||||
|
||||
#endif // APPEARANCE_SETTINGS_H
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
#include "deck_editor_settings.h"
|
||||
|
||||
DeckEditorSettings::DeckEditorSettings(const QString &settingPath, QObject *parent)
|
||||
: SettingsManager(settingPath + "deck_editor.ini", "deckeditor", QString(), parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool DeckEditorSettings::getOpenDeckInNewTab() const
|
||||
{
|
||||
return getValue("openDeckInNewTab", QString(), QString(), false).toBool();
|
||||
}
|
||||
|
||||
bool DeckEditorSettings::getBannerCardComboBoxVisible() const
|
||||
{
|
||||
return getValue("bannerCardComboBoxVisible", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool DeckEditorSettings::getTagsWidgetVisible() const
|
||||
{
|
||||
return getValue("tagsWidgetVisible", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
int DeckEditorSettings::getDefaultDeckEditorType() const
|
||||
{
|
||||
return getValue("defaultDeckEditorType", QString(), QString(), 1).toInt();
|
||||
}
|
||||
|
||||
void DeckEditorSettings::setOpenDeckInNewTab(bool _openDeckInNewTab)
|
||||
{
|
||||
setValue(_openDeckInNewTab, "openDeckInNewTab");
|
||||
}
|
||||
|
||||
void DeckEditorSettings::setBannerCardComboBoxVisible(bool _bannerCardComboBoxVisible)
|
||||
{
|
||||
setValue(_bannerCardComboBoxVisible, "bannerCardComboBoxVisible");
|
||||
emit bannerCardComboBoxVisibleChanged(_bannerCardComboBoxVisible);
|
||||
}
|
||||
|
||||
void DeckEditorSettings::setTagsWidgetVisible(bool _tagsWidgetVisible)
|
||||
{
|
||||
setValue(_tagsWidgetVisible, "tagsWidgetVisible");
|
||||
emit tagsWidgetVisibleChanged(_tagsWidgetVisible);
|
||||
}
|
||||
|
||||
void DeckEditorSettings::setDefaultDeckEditorType(int _defaultDeckEditorType)
|
||||
{
|
||||
setValue(_defaultDeckEditorType, "defaultDeckEditorType");
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef DECK_EDITOR_SETTINGS_H
|
||||
#define DECK_EDITOR_SETTINGS_H
|
||||
|
||||
#include "settings_manager.h"
|
||||
|
||||
#include <libcockatrice/interfaces/interface_deck_editor_settings_provider.h>
|
||||
|
||||
class DeckEditorSettings : public SettingsManager, public IDeckEditorSettingsProvider
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class SettingsCache;
|
||||
|
||||
public:
|
||||
[[nodiscard]] bool getOpenDeckInNewTab() const override;
|
||||
[[nodiscard]] bool getBannerCardComboBoxVisible() const override;
|
||||
[[nodiscard]] bool getTagsWidgetVisible() const override;
|
||||
[[nodiscard]] int getDefaultDeckEditorType() const override;
|
||||
|
||||
void setOpenDeckInNewTab(bool _openDeckInNewTab);
|
||||
void setBannerCardComboBoxVisible(bool _bannerCardComboBoxVisible);
|
||||
void setTagsWidgetVisible(bool _tagsWidgetVisible);
|
||||
void setDefaultDeckEditorType(int _defaultDeckEditorType);
|
||||
|
||||
signals:
|
||||
void bannerCardComboBoxVisibleChanged(bool visible);
|
||||
void tagsWidgetVisibleChanged(bool visible);
|
||||
|
||||
public:
|
||||
explicit DeckEditorSettings(const QString &settingPath, QObject *parent = nullptr);
|
||||
|
||||
private:
|
||||
DeckEditorSettings(const DeckEditorSettings & /*other*/);
|
||||
};
|
||||
|
||||
#endif // DECK_EDITOR_SETTINGS_H
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
#include "network_settings.h"
|
||||
|
||||
NetworkSettings::NetworkSettings(const QString &settingPath, QObject *parent)
|
||||
: SettingsManager(settingPath + "network.ini", "network", QString(), parent)
|
||||
{
|
||||
}
|
||||
|
||||
QString NetworkSettings::getClientID() const
|
||||
{
|
||||
return getValue("clientId", QString(), QString(), "notset").toString();
|
||||
}
|
||||
|
||||
void NetworkSettings::setClientID(const QString &_clientID)
|
||||
{
|
||||
setValue(_clientID, "clientId");
|
||||
}
|
||||
|
||||
QString NetworkSettings::getClientVersion() const
|
||||
{
|
||||
return getValue("clientVersion", QString(), QString(), "notset").toString();
|
||||
}
|
||||
|
||||
void NetworkSettings::setClientVersion(const QString &_clientVersion)
|
||||
{
|
||||
setValue(_clientVersion, "clientVersion");
|
||||
}
|
||||
|
||||
int NetworkSettings::getKeepAlive() const
|
||||
{
|
||||
return getValue("keepAlive", QString(), QString(), 3).toInt();
|
||||
}
|
||||
|
||||
void NetworkSettings::setKeepAlive(int _keepAlive)
|
||||
{
|
||||
setValue(_keepAlive, "keepAlive");
|
||||
}
|
||||
|
||||
int NetworkSettings::getTimeOut() const
|
||||
{
|
||||
return getValue("timeout", QString(), QString(), 5).toInt();
|
||||
}
|
||||
|
||||
void NetworkSettings::setTimeOut(int _timeOut)
|
||||
{
|
||||
setValue(_timeOut, "timeout");
|
||||
}
|
||||
|
||||
QString NetworkSettings::getKnownMissingFeatures() const
|
||||
{
|
||||
return getValue("knownMissingFeatures", QString(), QString(), "").toString();
|
||||
}
|
||||
|
||||
void NetworkSettings::setKnownMissingFeatures(const QString &_knownMissingFeatures)
|
||||
{
|
||||
setValue(_knownMissingFeatures, "knownMissingFeatures");
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* @file network_settings.h
|
||||
* @ingroup NetworkSettings
|
||||
*/
|
||||
//! \todo Document this file.
|
||||
|
||||
#ifndef NETWORK_SETTINGS_H
|
||||
#define NETWORK_SETTINGS_H
|
||||
|
||||
#include "settings_manager.h"
|
||||
|
||||
class NetworkSettings : public SettingsManager
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class SettingsCache;
|
||||
|
||||
public:
|
||||
[[nodiscard]] QString getClientID() const;
|
||||
void setClientID(const QString &_clientID);
|
||||
[[nodiscard]] QString getClientVersion() const;
|
||||
void setClientVersion(const QString &_clientVersion);
|
||||
[[nodiscard]] int getKeepAlive() const;
|
||||
void setKeepAlive(int _keepAlive);
|
||||
[[nodiscard]] int getTimeOut() const;
|
||||
void setTimeOut(int _timeOut);
|
||||
[[nodiscard]] QString getKnownMissingFeatures() const;
|
||||
void setKnownMissingFeatures(const QString &_knownMissingFeatures);
|
||||
|
||||
public:
|
||||
explicit NetworkSettings(const QString &settingPath, QObject *parent = nullptr);
|
||||
|
||||
private:
|
||||
NetworkSettings(const NetworkSettings & /*other*/);
|
||||
};
|
||||
|
||||
#endif // NETWORK_SETTINGS_H
|
||||
Loading…
Reference in New Issue
Block a user