mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-22 09:35:08 -07:00
[Settings] Shuffle some settings around (#7084)
* [Settings] Shuffle some settings around Took 21 minutes Took 1 hour 25 minutes * [Settings] Camel case everything * Revert debug schema change * Add new classes * Fix card counters writing to global * Fix CI tests * Fix Windows CI * interface() is a protected keyword for MSVC Took 5 minutes Took 5 seconds * [Settings] Keep menu settings on the appearance settings page Leave the 'Menu settings' group box on the appearance settings page for now; relocating it to the user interface settings page will be done in a separate PR. Took 6 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
bf6b2a90bc
commit
adf574e038
79 changed files with 1899 additions and 1123 deletions
|
|
@ -14,8 +14,8 @@
|
|||
#include <QtConcurrent>
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/settings/download_settings.h>
|
||||
#include <libcockatrice/settings/paths_settings.h>
|
||||
#include <libcockatrice/settings/personal_settings.h>
|
||||
#include <version_string.h>
|
||||
|
||||
#define SPOILERS_STATUS_URL "https://raw.githubusercontent.com/Cockatrice/Magic-Spoiler/files/SpoilerSeasonEnabled"
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
SpoilerBackgroundUpdater::SpoilerBackgroundUpdater(QObject *apParent) : QObject(apParent), cardUpdateProcess(nullptr)
|
||||
{
|
||||
isSpoilerDownloadEnabled = SettingsCache::instance().personal().getDownloadSpoilersStatus();
|
||||
isSpoilerDownloadEnabled = SettingsCache::instance().downloads().getDownloadSpoilersStatus();
|
||||
if (isSpoilerDownloadEnabled) {
|
||||
// Start the process of checking if we're in spoiler season
|
||||
// File exists means we're in spoiler season
|
||||
|
|
|
|||
|
|
@ -11,18 +11,21 @@
|
|||
#include <QGlobalStatic>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <libcockatrice/settings/appearance_settings.h>
|
||||
#include <libcockatrice/settings/cache_storage_settings.h>
|
||||
#include <libcockatrice/settings/card_database_settings.h>
|
||||
#include <libcockatrice/settings/card_override_settings.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <libcockatrice/settings/chat_settings.h>
|
||||
#include <libcockatrice/settings/debug_settings.h>
|
||||
#include <libcockatrice/settings/deck_editor_settings.h>
|
||||
#include <libcockatrice/settings/download_settings.h>
|
||||
#include <libcockatrice/settings/game_filters_settings.h>
|
||||
#include <libcockatrice/settings/game_settings.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <libcockatrice/settings/layouts_settings.h>
|
||||
#include <libcockatrice/settings/message_settings.h>
|
||||
#include <libcockatrice/settings/network_settings.h>
|
||||
#include <libcockatrice/settings/paths_settings.h>
|
||||
#include <libcockatrice/settings/personal_settings.h>
|
||||
#include <libcockatrice/settings/recents_settings.h>
|
||||
|
|
@ -135,8 +138,11 @@ SettingsCache::SettingsCache()
|
|||
personalSettings = new PersonalSettings(settingsPath, this);
|
||||
cardsDisplaySettings = new CardsDisplaySettings(settingsPath, this);
|
||||
interfaceSettings = new InterfaceSettings(settingsPath, this);
|
||||
deckEditorSettings = new DeckEditorSettings(settingsPath, this);
|
||||
pathsSettings = new PathsSettings(settingsPath, this);
|
||||
visualDeckStorageSettings = new VisualDeckStorageSettings(settingsPath, this);
|
||||
appearanceSettings = new AppearanceSettings(settingsPath, this);
|
||||
networkSettings = new NetworkSettings(settingsPath, this);
|
||||
|
||||
// Forward ICardDatabasePathProvider signal from PathsSettings
|
||||
connect(pathsSettings, &PathsSettings::cardDatabasePathChanged, this,
|
||||
|
|
@ -147,7 +153,7 @@ SettingsCache::SettingsCache()
|
|||
releaseChannels << new StableReleaseChannel();
|
||||
releaseChannels << new BetaReleaseChannel();
|
||||
|
||||
themeName = personalSettings->getThemeName();
|
||||
themeName = appearanceSettings->getThemeName();
|
||||
|
||||
loadPaths();
|
||||
}
|
||||
|
|
@ -155,7 +161,7 @@ SettingsCache::SettingsCache()
|
|||
void SettingsCache::setThemeName(const QString &_themeName)
|
||||
{
|
||||
themeName = _themeName;
|
||||
personalSettings->setThemeName(themeName);
|
||||
appearanceSettings->setThemeName(themeName);
|
||||
emit themeChanged();
|
||||
}
|
||||
|
||||
|
|
@ -216,15 +222,15 @@ void SettingsCache::loadPaths()
|
|||
// customPicsPath derived from picsPath
|
||||
QString picsPath = pathsIni.value("paths/pics").toString();
|
||||
if (picsPath.endsWith("/")) {
|
||||
computePath("custompics", picsPath + "CUSTOM/");
|
||||
computePath("customPics", picsPath + "CUSTOM/");
|
||||
} else {
|
||||
computePath("custompics", picsPath + "/CUSTOM/");
|
||||
computePath("customPics", picsPath + "/CUSTOM/");
|
||||
}
|
||||
|
||||
computePath("customsets", dataPath + "/customsets/");
|
||||
computeFilePath("carddatabase", dataPath + "/cards.xml");
|
||||
computeFilePath("tokendatabase", dataPath + "/tokens.xml");
|
||||
computeFilePath("spoilerdatabase", dataPath + "/spoiler.xml");
|
||||
computePath("customSets", dataPath + "/customsets/");
|
||||
computeFilePath("cardDatabase", dataPath + "/cards.xml");
|
||||
computeFilePath("tokenDatabase", dataPath + "/tokens.xml");
|
||||
computeFilePath("spoilerDatabase", dataPath + "/spoiler.xml");
|
||||
}
|
||||
|
||||
void SettingsCache::resetPaths()
|
||||
|
|
@ -272,12 +278,12 @@ QString SettingsCache::getTokenDatabasePath() const
|
|||
// INetworkSettingsProvider - delegate to sub-objects
|
||||
int SettingsCache::getKeepAlive() const
|
||||
{
|
||||
return personalSettings->getKeepAlive();
|
||||
return networkSettings->getKeepAlive();
|
||||
}
|
||||
|
||||
int SettingsCache::getTimeOut() const
|
||||
{
|
||||
return personalSettings->getTimeOut();
|
||||
return networkSettings->getTimeOut();
|
||||
}
|
||||
|
||||
bool SettingsCache::getNotifyAboutUpdates() const
|
||||
|
|
@ -287,17 +293,17 @@ bool SettingsCache::getNotifyAboutUpdates() const
|
|||
|
||||
void SettingsCache::setKnownMissingFeatures(const QString &_knownMissingFeatures)
|
||||
{
|
||||
interfaceSettings->setKnownMissingFeatures(_knownMissingFeatures);
|
||||
networkSettings->setKnownMissingFeatures(_knownMissingFeatures);
|
||||
}
|
||||
|
||||
QString SettingsCache::getKnownMissingFeatures()
|
||||
{
|
||||
return interfaceSettings->getKnownMissingFeatures();
|
||||
return networkSettings->getKnownMissingFeatures();
|
||||
}
|
||||
|
||||
QString SettingsCache::getClientID()
|
||||
{
|
||||
return personalSettings->getClientID();
|
||||
return networkSettings->getClientID();
|
||||
}
|
||||
|
||||
// Release channels
|
||||
|
|
@ -412,7 +418,7 @@ CardsDisplaySettings &SettingsCache::cardsDisplay() const
|
|||
return *cardsDisplaySettings;
|
||||
}
|
||||
|
||||
InterfaceSettings &SettingsCache::interface() const
|
||||
InterfaceSettings &SettingsCache::userInterface() const
|
||||
{
|
||||
return *interfaceSettings;
|
||||
}
|
||||
|
|
@ -422,7 +428,22 @@ PathsSettings &SettingsCache::paths() const
|
|||
return *pathsSettings;
|
||||
}
|
||||
|
||||
DeckEditorSettings &SettingsCache::deckEditor() const
|
||||
{
|
||||
return *deckEditorSettings;
|
||||
}
|
||||
|
||||
VisualDeckStorageSettings &SettingsCache::visualDeckStorage() const
|
||||
{
|
||||
return *visualDeckStorageSettings;
|
||||
}
|
||||
|
||||
AppearanceSettings &SettingsCache::appearance() const
|
||||
{
|
||||
return *appearanceSettings;
|
||||
}
|
||||
|
||||
NetworkSettings &SettingsCache::network() const
|
||||
{
|
||||
return *networkSettings;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class CardOverrideSettings;
|
|||
class CardsDisplaySettings;
|
||||
class ChatSettings;
|
||||
class DebugSettings;
|
||||
class DeckEditorSettings;
|
||||
class DownloadSettings;
|
||||
class GameFiltersSettings;
|
||||
class GameSettings;
|
||||
|
|
@ -44,6 +45,8 @@ class SoundSettings;
|
|||
class TabsSettings;
|
||||
class UpdatesSettings;
|
||||
class VisualDeckStorageSettings;
|
||||
class AppearanceSettings;
|
||||
class NetworkSettings;
|
||||
class QSettings;
|
||||
|
||||
class SettingsCache : public ICardDatabasePathProvider, public INetworkSettingsProvider
|
||||
|
|
@ -75,8 +78,11 @@ private:
|
|||
PersonalSettings *personalSettings;
|
||||
CardsDisplaySettings *cardsDisplaySettings;
|
||||
InterfaceSettings *interfaceSettings;
|
||||
DeckEditorSettings *deckEditorSettings;
|
||||
PathsSettings *pathsSettings;
|
||||
VisualDeckStorageSettings *visualDeckStorageSettings;
|
||||
AppearanceSettings *appearanceSettings;
|
||||
NetworkSettings *networkSettings;
|
||||
|
||||
QString themeName;
|
||||
|
||||
|
|
@ -138,9 +144,12 @@ public:
|
|||
[[nodiscard]] UpdatesSettings &updates() const;
|
||||
[[nodiscard]] PersonalSettings &personal() const;
|
||||
[[nodiscard]] CardsDisplaySettings &cardsDisplay() const;
|
||||
[[nodiscard]] InterfaceSettings &interface() const;
|
||||
[[nodiscard]] InterfaceSettings &userInterface() const;
|
||||
[[nodiscard]] DeckEditorSettings &deckEditor() const;
|
||||
[[nodiscard]] PathsSettings &paths() const;
|
||||
[[nodiscard]] VisualDeckStorageSettings &visualDeckStorage() const;
|
||||
[[nodiscard]] AppearanceSettings &appearance() const;
|
||||
[[nodiscard]] NetworkSettings &network() const;
|
||||
|
||||
[[nodiscard]] bool getIsPortableBuild() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <QtMath>
|
||||
|
||||
CardCounterSettings::CardCounterSettings(const QString &settingsPath, QObject *parent)
|
||||
: SettingsManager(settingsPath + "global.ini", "cards", "counters", parent)
|
||||
: SettingsManager(settingsPath + "card_counters.ini", "cards", "counters", parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue