mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-08-11 11:35:44 -05: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:
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ void PlayerActions::playCard(CardItem *card, bool faceDown)
|
||||
const CardInfo &info = exactCard.getInfo();
|
||||
|
||||
int tableRow = info.getUiAttributes().tableRow;
|
||||
bool playToStack = SettingsCache::instance().interface().getPlayToStack();
|
||||
bool playToStack = SettingsCache::instance().userInterface().getPlayToStack();
|
||||
QString currentZone = card->getZone()->getName();
|
||||
if (!faceDown && currentZone == ZoneNames::STACK && tableRow == 3) {
|
||||
cmd.set_target_zone(ZoneNames::GRAVE);
|
||||
@@ -312,7 +312,7 @@ void PlayerActions::actDrawCard()
|
||||
|
||||
void PlayerActions::actRequestMulliganDialog()
|
||||
{
|
||||
int startSize = SettingsCache::instance().interface().getStartingHandSize();
|
||||
int startSize = SettingsCache::instance().userInterface().getStartingHandSize();
|
||||
int handSize = player->getHandZone()->getCards().size();
|
||||
int deckSize = player->getDeckZone()->getCards().size() + handSize;
|
||||
|
||||
@@ -328,7 +328,7 @@ void PlayerActions::actMulligan(int number)
|
||||
}
|
||||
|
||||
doMulligan(number);
|
||||
SettingsCache::instance().interface().setStartingHandSize(number);
|
||||
SettingsCache::instance().userInterface().setStartingHandSize(number);
|
||||
}
|
||||
|
||||
void PlayerActions::actMulliganSameSize()
|
||||
@@ -932,13 +932,13 @@ void PlayerActions::setLastTokenInfo(CardInfoPtr cardInfo)
|
||||
return;
|
||||
}
|
||||
|
||||
lastTokenInfo = {.name = cardInfo->getName(),
|
||||
.color = cardInfo->getColors().isEmpty() ? QString() : cardInfo->getColors().left(1).toLower(),
|
||||
.pt = cardInfo->getPowTough(),
|
||||
.annotation = SettingsCache::instance().interface().getAnnotateTokens() ? cardInfo->getText() : "",
|
||||
.destroy = true,
|
||||
.providerId =
|
||||
SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardInfo->getName())};
|
||||
lastTokenInfo = {
|
||||
.name = cardInfo->getName(),
|
||||
.color = cardInfo->getColors().isEmpty() ? QString() : cardInfo->getColors().left(1).toLower(),
|
||||
.pt = cardInfo->getPowTough(),
|
||||
.annotation = SettingsCache::instance().userInterface().getAnnotateTokens() ? cardInfo->getText() : "",
|
||||
.destroy = true,
|
||||
.providerId = SettingsCache::instance().cardOverrides().getCardPreferenceOverride(cardInfo->getName())};
|
||||
|
||||
lastTokenTableRow = TableZone::tableRowToGridY(cardInfo->getUiAttributes().tableRow);
|
||||
|
||||
@@ -1171,7 +1171,7 @@ void PlayerActions::createCard(const CardItem *sourceCard,
|
||||
}
|
||||
|
||||
cmd.set_pt(cardInfo->getPowTough().toStdString());
|
||||
if (SettingsCache::instance().interface().getAnnotateTokens()) {
|
||||
if (SettingsCache::instance().userInterface().getAnnotateTokens()) {
|
||||
cmd.set_annotation(cardInfo->getText().toStdString());
|
||||
} else {
|
||||
cmd.set_annotation("");
|
||||
|
||||
@@ -58,7 +58,7 @@ bool ZoneViewZoneLogic::prepareAddCard(int x)
|
||||
|
||||
// autoclose check is done both here and in removeCard
|
||||
|
||||
if (cards.isEmpty() && !doInsert && SettingsCache::instance().interface().getCloseEmptyCardView()) {
|
||||
if (cards.isEmpty() && !doInsert && SettingsCache::instance().userInterface().getCloseEmptyCardView()) {
|
||||
emit closeView();
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ void ZoneViewZoneLogic::removeCard(int position, bool toNewZone)
|
||||
// card gets dragged within the view.
|
||||
// Another autoclose check is done in prepareAddCard so that the view autocloses if the last card was moved to an
|
||||
// unrevealed portion of the same zone.
|
||||
if (cards.isEmpty() && SettingsCache::instance().interface().getCloseEmptyCardView() && toNewZone) {
|
||||
if (cards.isEmpty() && SettingsCache::instance().userInterface().getCloseEmptyCardView() && toNewZone) {
|
||||
emit closeView();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#include <algorithm>
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/settings/appearance_settings.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <libcockatrice/settings/debug_settings.h>
|
||||
#include <libcockatrice/settings/personal_settings.h>
|
||||
|
||||
AbstractCardItem::AbstractCardItem(QGraphicsItem *parent, const CardRef &cardRef, PlayerLogic *_owner, int _id)
|
||||
: ArrowTarget(_owner, parent), id(_id), cardRef(cardRef), tapped(false), facedown(false), tapAngle(0),
|
||||
@@ -107,7 +107,7 @@ QSizeF AbstractCardItem::getTranslatedSize(QPainter *painter) const
|
||||
|
||||
void AbstractCardItem::transformPainter(QPainter *painter, const QSizeF &translatedSize, int angle)
|
||||
{
|
||||
const int MAX_FONT_SIZE = SettingsCache::instance().personal().getMaxFontSize();
|
||||
const int MAX_FONT_SIZE = SettingsCache::instance().appearance().getMaxFontSize();
|
||||
const int fontSize = std::max(9, MAX_FONT_SIZE);
|
||||
|
||||
QRectF totalBoundingRect = painter->combinedTransform().mapRect(boundingRect());
|
||||
|
||||
@@ -262,7 +262,7 @@ void ArrowDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
if (startZone->getName() == ZoneNames::HAND) {
|
||||
startCard->playCard(false);
|
||||
CardInfoPtr ci = startCard->getCard().getCardPtr();
|
||||
bool playToStack = SettingsCache::instance().interface().getPlayToStack();
|
||||
bool playToStack = SettingsCache::instance().userInterface().getPlayToStack();
|
||||
if (ci && ((!playToStack && ci->getUiAttributes().tableRow == 3) ||
|
||||
(playToStack && ci->getUiAttributes().tableRow != 0 &&
|
||||
startCard->getZone()->getName() != ZoneNames::STACK))) {
|
||||
|
||||
@@ -281,7 +281,7 @@ void CardItem::drawArrow(const QColor &arrowColor)
|
||||
auto *game = owner->getGame();
|
||||
PlayerLogic *arrowOwner = game->getPlayerManager()->getActiveLocalPlayer(game->getGameState()->getActivePlayer());
|
||||
int phase = 0; // 0 means to not set the phase
|
||||
if (SettingsCache::instance().interface().getDoNotDeleteArrowsInSubPhases()) {
|
||||
if (SettingsCache::instance().userInterface().getDoNotDeleteArrowsInSubPhases()) {
|
||||
int currentPhase = game->getGameState()->getCurrentPhase();
|
||||
phase = Phases::getLastSubphase(currentPhase) + 1;
|
||||
}
|
||||
@@ -400,7 +400,7 @@ void CardItem::playCard(bool faceDown)
|
||||
if (tz) {
|
||||
emit tz->toggleTapped();
|
||||
} else {
|
||||
if (SettingsCache::instance().interface().getClickPlaysAllSelected()) {
|
||||
if (SettingsCache::instance().userInterface().getClickPlaysAllSelected()) {
|
||||
if (faceDown) {
|
||||
emit playSelectedFaceDown(this);
|
||||
} else {
|
||||
@@ -464,7 +464,7 @@ static bool isUnwritableRevealZone(CardZoneLogic *zone)
|
||||
void CardItem::handleClickedToPlay(bool shiftHeld)
|
||||
{
|
||||
if (isUnwritableRevealZone(state->getZone())) {
|
||||
if (SettingsCache::instance().interface().getClickPlaysAllSelected()) {
|
||||
if (SettingsCache::instance().userInterface().getClickPlaysAllSelected()) {
|
||||
emit hideSelected(this);
|
||||
} else {
|
||||
state->getZone()->removeCard(this);
|
||||
@@ -481,7 +481,7 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
return;
|
||||
}
|
||||
if ((event->modifiers() != Qt::AltModifier) && (event->button() == Qt::LeftButton) &&
|
||||
(!SettingsCache::instance().interface().getDoubleClickToPlay())) {
|
||||
(!SettingsCache::instance().userInterface().getDoubleClickToPlay())) {
|
||||
handleClickedToPlay(event->modifiers().testFlag(Qt::ShiftModifier));
|
||||
}
|
||||
if (owner != nullptr) {
|
||||
@@ -493,7 +493,7 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if ((event->modifiers() != Qt::AltModifier) && (event->buttons() == Qt::LeftButton) &&
|
||||
(SettingsCache::instance().interface().getDoubleClickToPlay())) {
|
||||
(SettingsCache::instance().userInterface().getDoubleClickToPlay())) {
|
||||
handleClickedToPlay(event->modifiers().testFlag(Qt::ShiftModifier));
|
||||
}
|
||||
event->accept();
|
||||
|
||||
@@ -189,7 +189,7 @@ void DlgCreateToken::tokenSelectionChanged(const QModelIndex ¤t, const QMo
|
||||
const QChar cardColor = cardInfo->getColorChar();
|
||||
colorEdit->setCurrentIndex(colorEdit->findData(cardColor, Qt::UserRole, Qt::MatchFixedString));
|
||||
ptEdit->setText(cardInfo->getPowTough());
|
||||
if (SettingsCache::instance().interface().getAnnotateTokens()) {
|
||||
if (SettingsCache::instance().userInterface().getAnnotateTokens()) {
|
||||
annotationEdit->setText(cardInfo->getText());
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -37,7 +37,7 @@ GameScene::GameScene(PhasesToolbar *_phasesToolbar, QObject *parent)
|
||||
{
|
||||
animationTimer = new QBasicTimer;
|
||||
addItem(phasesToolbar);
|
||||
connect(&SettingsCache::instance().interface(), &InterfaceSettings::minPlayersForMultiColumnLayoutChanged, this,
|
||||
connect(&SettingsCache::instance().userInterface(), &InterfaceSettings::minPlayersForMultiColumnLayoutChanged, this,
|
||||
&GameScene::rearrange);
|
||||
|
||||
rearrange();
|
||||
@@ -336,7 +336,7 @@ QList<PlayerLogic *> GameScene::rotatePlayers(const QList<PlayerLogic *> &active
|
||||
|
||||
int GameScene::determineColumnCount(int playerCount)
|
||||
{
|
||||
return playerCount < SettingsCache::instance().interface().getMinPlayersForMultiColumnLayout() ? 1 : 2;
|
||||
return playerCount < SettingsCache::instance().userInterface().getMinPlayersForMultiColumnLayout() ? 1 : 2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,11 +47,11 @@ GameView::GameView(GameScene *scene, QWidget *parent) : QGraphicsView(scene, par
|
||||
connect(scene, &GameScene::sigResizeRubberBand, this, &GameView::resizeRubberBand);
|
||||
connect(scene, &GameScene::sigStopRubberBand, this, &GameView::stopRubberBand);
|
||||
connect(scene, &QGraphicsScene::selectionChanged, this, [this]() { updateTotalSelectionCount(); });
|
||||
connect(&SettingsCache::instance().interface(), &InterfaceSettings::tallyTypeChanged, this,
|
||||
connect(&SettingsCache::instance().userInterface(), &InterfaceSettings::tallyTypeChanged, this,
|
||||
[this] { updateTotalSelectionCount(); });
|
||||
|
||||
setFocusDisabled(SettingsCache::instance().interface().getKeepGameChatFocus());
|
||||
connect(&SettingsCache::instance().interface(), &InterfaceSettings::keepGameChatFocusChanged, this,
|
||||
setFocusDisabled(SettingsCache::instance().userInterface().getKeepGameChatFocus());
|
||||
connect(&SettingsCache::instance().userInterface(), &InterfaceSettings::keepGameChatFocusChanged, this,
|
||||
&GameView::setFocusDisabled);
|
||||
|
||||
aCloseMostRecentZoneView = new QAction(this);
|
||||
@@ -130,7 +130,7 @@ void GameView::resizeRubberBand(const QPointF &cursorPoint, int selectedCount)
|
||||
QRect rect = QRect(mapFromScene(selectionOrigin), cursor).normalized();
|
||||
rubberBand->setGeometry(rect);
|
||||
|
||||
if (!SettingsCache::instance().interface().getShowDragSelectionCount()) {
|
||||
if (!SettingsCache::instance().userInterface().getShowDragSelectionCount()) {
|
||||
dragCountLabel->hide();
|
||||
return;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ void GameView::updateTotalSelectionCount(const QSize &viewSize)
|
||||
|
||||
int count = scene()->selectedItems().count();
|
||||
|
||||
if (!SettingsCache::instance().interface().getShowTotalSelectionCount() || count <= 1) {
|
||||
if (!SettingsCache::instance().userInterface().getShowTotalSelectionCount() || count <= 1) {
|
||||
totalCountLabel->hide();
|
||||
} else {
|
||||
totalCountLabel->setText(QString::number(count));
|
||||
@@ -251,7 +251,7 @@ void GameView::updateTotalSelectionCount(const QSize &viewSize)
|
||||
totalCountLabel->show();
|
||||
}
|
||||
|
||||
TallyType tallyType = Tally::intToType(SettingsCache::instance().interface().getTallyType());
|
||||
TallyType tallyType = Tally::intToType(SettingsCache::instance().userInterface().getTallyType());
|
||||
|
||||
GameScene *gameScene = static_cast<GameScene *>(scene());
|
||||
QList<TallyRow> entries = Tally::compute(gameScene->selectedCards(), tallyType);
|
||||
|
||||
@@ -23,14 +23,14 @@ TallyMenu::TallyMenu()
|
||||
|
||||
QAction *TallyMenu::createTallyAction(TallyType tallyType)
|
||||
{
|
||||
TallyType currentType = Tally::intToType(SettingsCache::instance().interface().getTallyType());
|
||||
TallyType currentType = Tally::intToType(SettingsCache::instance().userInterface().getTallyType());
|
||||
|
||||
QAction *action = new QAction(this);
|
||||
action->setCheckable(true);
|
||||
action->setChecked(tallyType == currentType);
|
||||
|
||||
connect(action, &QAction::triggered, &SettingsCache::instance().interface(),
|
||||
[tallyType] { SettingsCache::instance().interface().setTallyType(static_cast<int>(tallyType)); });
|
||||
connect(action, &QAction::triggered, &SettingsCache::instance().userInterface(),
|
||||
[tallyType] { SettingsCache::instance().userInterface().setTallyType(static_cast<int>(tallyType)); });
|
||||
|
||||
actionGroup->addAction(action);
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
|
||||
PlayerGraphicsItem::PlayerGraphicsItem(PlayerLogic *_player) : player(_player)
|
||||
{
|
||||
connect(&SettingsCache::instance().interface(), &InterfaceSettings::horizontalHandChanged, this,
|
||||
connect(&SettingsCache::instance().userInterface(), &InterfaceSettings::horizontalHandChanged, this,
|
||||
&PlayerGraphicsItem::rearrangeZones);
|
||||
connect(&SettingsCache::instance().interface(), &InterfaceSettings::handJustificationChanged, this,
|
||||
connect(&SettingsCache::instance().userInterface(), &InterfaceSettings::handJustificationChanged, this,
|
||||
&PlayerGraphicsItem::rearrangeZones);
|
||||
connect(player, &PlayerLogic::rearrangeCounters, this, &PlayerGraphicsItem::rearrangeCounters);
|
||||
connect(player, &PlayerLogic::activeChanged, this, &PlayerGraphicsItem::onPlayerActiveChanged);
|
||||
@@ -149,7 +149,7 @@ qreal PlayerGraphicsItem::getMinimumWidth() const
|
||||
{
|
||||
qreal result = tableZoneGraphicsItem->getMinimumWidth() + CardDimensions::HEIGHT_F + 15 + counterAreaWidth +
|
||||
stackZoneGraphicsItem->boundingRect().width();
|
||||
if (!SettingsCache::instance().interface().getHorizontalHand()) {
|
||||
if (!SettingsCache::instance().userInterface().getHorizontalHand()) {
|
||||
result += handZoneGraphicsItem->boundingRect().width();
|
||||
}
|
||||
return result;
|
||||
@@ -166,7 +166,7 @@ void PlayerGraphicsItem::processSceneSizeChange(int newPlayerWidth)
|
||||
// Extend table (and hand, if horizontal) to accommodate the new player width.
|
||||
qreal tableWidth = newPlayerWidth - CardDimensions::HEIGHT_F - 15 - counterAreaWidth -
|
||||
stackZoneGraphicsItem->boundingRect().width();
|
||||
if (!SettingsCache::instance().interface().getHorizontalHand()) {
|
||||
if (!SettingsCache::instance().userInterface().getHorizontalHand()) {
|
||||
tableWidth -= handZoneGraphicsItem->boundingRect().width();
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ void PlayerGraphicsItem::rearrangeCounters()
|
||||
void PlayerGraphicsItem::rearrangeZones()
|
||||
{
|
||||
auto base = QPointF(CardDimensions::HEIGHT_F + counterAreaWidth + 15, 0);
|
||||
if (SettingsCache::instance().interface().getHorizontalHand()) {
|
||||
if (SettingsCache::instance().userInterface().getHorizontalHand()) {
|
||||
if (mirrored) {
|
||||
if (player->getHandZone()->contentsKnown()) {
|
||||
handVisible = true;
|
||||
@@ -285,7 +285,7 @@ void PlayerGraphicsItem::updateBoundingRect()
|
||||
{
|
||||
prepareGeometryChange();
|
||||
qreal width = CardDimensions::HEIGHT_F + 15 + counterAreaWidth + stackZoneGraphicsItem->boundingRect().width();
|
||||
if (SettingsCache::instance().interface().getHorizontalHand()) {
|
||||
if (SettingsCache::instance().userInterface().getHorizontalHand()) {
|
||||
qreal handHeight = handVisible ? handZoneGraphicsItem->boundingRect().height() : 0;
|
||||
bRect = QRectF(0, 0, width + tableZoneGraphicsItem->boundingRect().width(),
|
||||
tableZoneGraphicsItem->boundingRect().height() + handHeight);
|
||||
|
||||
@@ -34,7 +34,7 @@ void HandZone::handleDropEvent(const QList<CardDragItem *> &dragItems,
|
||||
|
||||
QPoint point = dropPoint + scenePos().toPoint();
|
||||
int x = -1;
|
||||
if (SettingsCache::instance().interface().getHorizontalHand()) {
|
||||
if (SettingsCache::instance().userInterface().getHorizontalHand()) {
|
||||
for (x = 0; x < getLogic()->getCards().size(); x++) {
|
||||
if (point.x() < static_cast<CardItem *>(getLogic()->getCards().at(x))->scenePos().x()) {
|
||||
break;
|
||||
@@ -61,7 +61,7 @@ void HandZone::handleDropEvent(const QList<CardDragItem *> &dragItems,
|
||||
|
||||
QRectF HandZone::boundingRect() const
|
||||
{
|
||||
if (SettingsCache::instance().interface().getHorizontalHand()) {
|
||||
if (SettingsCache::instance().userInterface().getHorizontalHand()) {
|
||||
return QRectF(0, 0, width, CardDimensions::HEIGHT_F + 10);
|
||||
} else {
|
||||
return QRectF(0, 0, CardDimensions::WIDTH_F * 1.5, zoneHeight);
|
||||
@@ -78,8 +78,8 @@ void HandZone::reorganizeCards()
|
||||
{
|
||||
if (!getLogic()->getCards().isEmpty()) {
|
||||
const int cardCount = getLogic()->getCards().size();
|
||||
if (SettingsCache::instance().interface().getHorizontalHand()) {
|
||||
bool leftJustified = SettingsCache::instance().interface().getLeftJustified();
|
||||
if (SettingsCache::instance().userInterface().getHorizontalHand()) {
|
||||
bool leftJustified = SettingsCache::instance().userInterface().getLeftJustified();
|
||||
qreal cardWidth = getLogic()->getCards().at(0)->boundingRect().width();
|
||||
const int xPadding = leftJustified ? cardWidth * 1.4 : 5;
|
||||
qreal totalWidth =
|
||||
@@ -127,7 +127,7 @@ void HandZone::sortHand(const QList<CardList::SortOption> &options)
|
||||
|
||||
void HandZone::setWidth(qreal _width)
|
||||
{
|
||||
if (SettingsCache::instance().interface().getHorizontalHand()) {
|
||||
if (SettingsCache::instance().userInterface().getHorizontalHand()) {
|
||||
prepareGeometryChange();
|
||||
width = _width;
|
||||
reorganizeCards();
|
||||
|
||||
@@ -29,7 +29,7 @@ TableZone::TableZone(TableZoneLogic *_logic, bool _mirrored, QGraphicsItem *pare
|
||||
connect(_logic, &TableZoneLogic::contentSizeChanged, this, &TableZone::resizeToContents);
|
||||
connect(_logic, &TableZoneLogic::toggleTapped, this, &TableZone::toggleTapped);
|
||||
connect(themeManager, &ThemeManager::themeChanged, this, &TableZone::updateBg);
|
||||
connect(&SettingsCache::instance().interface(), &InterfaceSettings::invertVerticalCoordinateChanged, this,
|
||||
connect(&SettingsCache::instance().userInterface(), &InterfaceSettings::invertVerticalCoordinateChanged, this,
|
||||
&TableZone::reorganizeCards);
|
||||
|
||||
updateBg();
|
||||
@@ -60,8 +60,8 @@ void TableZone::setMirrored(bool isMirrored)
|
||||
|
||||
bool TableZone::isInverted() const
|
||||
{
|
||||
return ((mirrored && !SettingsCache::instance().interface().getInvertVerticalCoordinate()) ||
|
||||
(!mirrored && SettingsCache::instance().interface().getInvertVerticalCoordinate()));
|
||||
return ((mirrored && !SettingsCache::instance().userInterface().getInvertVerticalCoordinate()) ||
|
||||
(!mirrored && SettingsCache::instance().userInterface().getInvertVerticalCoordinate()));
|
||||
}
|
||||
|
||||
void TableZone::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
|
||||
|
||||
@@ -66,7 +66,7 @@ ZoneViewWidget::ZoneViewWidget(PlayerLogic *_player,
|
||||
|
||||
connect(help, &QAction::triggered, this, [this] { createSearchSyntaxHelpWindow(&searchEdit); });
|
||||
|
||||
if (SettingsCache::instance().interface().getFocusCardViewSearchBar()) {
|
||||
if (SettingsCache::instance().userInterface().getFocusCardViewSearchBar()) {
|
||||
this->setActive(true);
|
||||
searchEdit.setFocus();
|
||||
}
|
||||
@@ -77,9 +77,9 @@ ZoneViewWidget::ZoneViewWidget(PlayerLogic *_player,
|
||||
vbox->addItem(searchEditProxy);
|
||||
|
||||
// hide search bar if chat autofocus setting is enabled, since typing into it will no longer work anyway
|
||||
searchEditProxy->setVisible(!SettingsCache::instance().interface().getKeepGameChatFocus());
|
||||
connect(&SettingsCache::instance().interface(), &InterfaceSettings::keepGameChatFocusChanged, searchEditProxy,
|
||||
[searchEditProxy](bool keepFocus) { searchEditProxy->setVisible(!keepFocus); });
|
||||
searchEditProxy->setVisible(!SettingsCache::instance().userInterface().getKeepGameChatFocus());
|
||||
connect(&SettingsCache::instance().userInterface(), &InterfaceSettings::keepGameChatFocusChanged,
|
||||
searchEditProxy, [searchEditProxy](bool keepFocus) { searchEditProxy->setVisible(!keepFocus); });
|
||||
|
||||
// top row
|
||||
QGraphicsLinearLayout *hTopRow = new QGraphicsLinearLayout(Qt::Horizontal);
|
||||
@@ -159,9 +159,9 @@ ZoneViewWidget::ZoneViewWidget(PlayerLogic *_player,
|
||||
connect(&sortBySelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&ZoneViewWidget::processSortBy);
|
||||
connect(&pileViewCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &ZoneViewWidget::processSetPileView);
|
||||
groupBySelector.setCurrentIndex(SettingsCache::instance().interface().getZoneViewGroupByIndex());
|
||||
sortBySelector.setCurrentIndex(SettingsCache::instance().interface().getZoneViewSortByIndex());
|
||||
pileViewCheckBox.setChecked(SettingsCache::instance().interface().getZoneViewPileView());
|
||||
groupBySelector.setCurrentIndex(SettingsCache::instance().userInterface().getZoneViewGroupByIndex());
|
||||
sortBySelector.setCurrentIndex(SettingsCache::instance().userInterface().getZoneViewSortByIndex());
|
||||
pileViewCheckBox.setChecked(SettingsCache::instance().userInterface().getZoneViewPileView());
|
||||
|
||||
if (CardList::NoSort == static_cast<CardList::SortOption>(groupBySelector.currentData().toInt())) {
|
||||
pileViewCheckBox.setEnabled(false);
|
||||
@@ -191,7 +191,7 @@ ZoneViewWidget::ZoneViewWidget(PlayerLogic *_player,
|
||||
void ZoneViewWidget::processGroupBy(int index)
|
||||
{
|
||||
auto option = static_cast<CardList::SortOption>(groupBySelector.itemData(index).toInt());
|
||||
SettingsCache::instance().interface().setZoneViewGroupByIndex(index);
|
||||
SettingsCache::instance().userInterface().setZoneViewGroupByIndex(index);
|
||||
zone->setGroupBy(option);
|
||||
|
||||
// disable pile view checkbox if we're not grouping by anything
|
||||
@@ -215,13 +215,13 @@ void ZoneViewWidget::processSortBy(int index)
|
||||
return;
|
||||
}
|
||||
|
||||
SettingsCache::instance().interface().setZoneViewSortByIndex(index);
|
||||
SettingsCache::instance().userInterface().setZoneViewSortByIndex(index);
|
||||
zone->setSortBy(option);
|
||||
}
|
||||
|
||||
void ZoneViewWidget::processSetPileView(QT_STATE_CHANGED_T value)
|
||||
{
|
||||
SettingsCache::instance().interface().setZoneViewPileView(value);
|
||||
SettingsCache::instance().userInterface().setZoneViewPileView(value);
|
||||
zone->setPileView(value);
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ static qreal rowsToHeight(int rows)
|
||||
**/
|
||||
static qreal calcMaxInitialHeight()
|
||||
{
|
||||
return rowsToHeight(SettingsCache::instance().interface().getCardViewInitialRowsMax());
|
||||
return rowsToHeight(SettingsCache::instance().userInterface().getCardViewInitialRowsMax());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -560,7 +560,7 @@ void ZoneViewWidget::initStyleOption(QStyleOption *option) const
|
||||
void ZoneViewWidget::expandWindow()
|
||||
{
|
||||
qreal maxInitialHeight = calcMaxInitialHeight();
|
||||
qreal maxExpandedHeight = rowsToHeight(SettingsCache::instance().interface().getCardViewExpandedRowsMax());
|
||||
qreal maxExpandedHeight = rowsToHeight(SettingsCache::instance().userInterface().getCardViewExpandedRowsMax());
|
||||
qreal height = rect().height() - extraHeight - 10;
|
||||
qreal maxHeight = maximumHeight() - extraHeight - 10;
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#include <QThread>
|
||||
#include <algorithm>
|
||||
#include <libcockatrice/settings/cache_storage_settings.h>
|
||||
#include <libcockatrice/settings/download_settings.h>
|
||||
#include <libcockatrice/settings/paths_settings.h>
|
||||
#include <libcockatrice/settings/personal_settings.h>
|
||||
#include <utility>
|
||||
|
||||
// never cache more than 300 cards at once for a single deck
|
||||
@@ -31,7 +31,7 @@ CardPictureLoader::CardPictureLoader() : QObject(nullptr)
|
||||
worker = new CardPictureLoaderWorker;
|
||||
connect(&SettingsCache::instance().paths(), &PathsSettings::picsPathChanged, this,
|
||||
&CardPictureLoader::picsPathChanged);
|
||||
connect(&SettingsCache::instance().personal(), &PersonalSettings::picDownloadChanged, this,
|
||||
connect(&SettingsCache::instance().downloads(), &DownloadSettings::picDownloadChanged, this,
|
||||
&CardPictureLoader::picDownloadChanged);
|
||||
|
||||
qRegisterMetaType<ExactCard>();
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QThread>
|
||||
#include <libcockatrice/settings/cache_storage_settings.h>
|
||||
#include <libcockatrice/settings/download_settings.h>
|
||||
#include <libcockatrice/settings/paths_settings.h>
|
||||
#include <libcockatrice/settings/personal_settings.h>
|
||||
#include <utility>
|
||||
#include <version_string.h>
|
||||
|
||||
static constexpr int MAX_REQUESTS_PER_SEC = 10;
|
||||
|
||||
CardPictureLoaderWorker::CardPictureLoaderWorker()
|
||||
: QObject(nullptr), picDownload(SettingsCache::instance().personal().getPicDownload()),
|
||||
: QObject(nullptr), picDownload(SettingsCache::instance().downloads().getPicDownload()),
|
||||
requestQuota(MAX_REQUESTS_PER_SEC)
|
||||
{
|
||||
networkManager = new QNetworkAccessManager(this);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QThread>
|
||||
#include <QThreadPool>
|
||||
#include <libcockatrice/settings/personal_settings.h>
|
||||
#include <libcockatrice/settings/download_settings.h>
|
||||
|
||||
// Card back returned by gatherer when card is not found
|
||||
static const QStringList MD5_BLACKLIST = {
|
||||
@@ -20,7 +20,7 @@ static const QStringList MD5_BLACKLIST = {
|
||||
|
||||
CardPictureLoaderWorkerWork::CardPictureLoaderWorkerWork(const CardPictureLoaderWorker *worker, const ExactCard &toLoad)
|
||||
: QObject(nullptr), cardToDownload(CardPictureToLoad(toLoad)),
|
||||
picDownload(SettingsCache::instance().personal().getPicDownload())
|
||||
picDownload(SettingsCache::instance().downloads().getPicDownload())
|
||||
{
|
||||
// Hook up signals to the orchestrator
|
||||
connect(this, &CardPictureLoaderWorkerWork::requestImageDownload, worker, &CardPictureLoaderWorker::queueRequest);
|
||||
@@ -32,7 +32,7 @@ CardPictureLoaderWorkerWork::CardPictureLoaderWorkerWork(const CardPictureLoader
|
||||
&CardPictureLoaderWorker::imageRequestSucceeded);
|
||||
|
||||
// Hook up signals to settings
|
||||
connect(&SettingsCache::instance().personal(), SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged()));
|
||||
connect(&SettingsCache::instance().downloads(), SIGNAL(picDownloadChanged()), this, SLOT(picDownloadChanged()));
|
||||
|
||||
startNextPicDownload();
|
||||
}
|
||||
@@ -211,5 +211,5 @@ void CardPictureLoaderWorkerWork::concludeImageLoad(const QImage &image)
|
||||
|
||||
void CardPictureLoaderWorkerWork::picDownloadChanged()
|
||||
{
|
||||
picDownload = SettingsCache::instance().personal().getPicDownload();
|
||||
picDownload = SettingsCache::instance().downloads().getPicDownload();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <QSplitter>
|
||||
#include <QTextEdit>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <libcockatrice/settings/deck_editor_settings.h>
|
||||
#include <libcockatrice/utility/macros.h>
|
||||
#include <libcockatrice/utility/string_limits.h>
|
||||
|
||||
@@ -111,20 +111,18 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||
|
||||
showBannerCardCheckBox = new QCheckBox();
|
||||
showBannerCardCheckBox->setObjectName("showBannerCardCheckBox");
|
||||
showBannerCardCheckBox->setChecked(
|
||||
SettingsCache::instance().cardsDisplay().getDeckEditorBannerCardComboBoxVisible());
|
||||
connect(showBannerCardCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().cardsDisplay(),
|
||||
&CardsDisplaySettings::setDeckEditorBannerCardComboBoxVisible);
|
||||
connect(&SettingsCache::instance().cardsDisplay(),
|
||||
&CardsDisplaySettings::deckEditorBannerCardComboBoxVisibleChanged, this,
|
||||
showBannerCardCheckBox->setChecked(SettingsCache::instance().deckEditor().getBannerCardComboBoxVisible());
|
||||
connect(showBannerCardCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().deckEditor(),
|
||||
&DeckEditorSettings::setBannerCardComboBoxVisible);
|
||||
connect(&SettingsCache::instance().deckEditor(), &DeckEditorSettings::bannerCardComboBoxVisibleChanged, this,
|
||||
&DeckEditorDeckDockWidget::updateShowBannerCardComboBox);
|
||||
|
||||
showTagsWidgetCheckBox = new QCheckBox();
|
||||
showTagsWidgetCheckBox->setObjectName("showTagsWidgetCheckBox");
|
||||
showTagsWidgetCheckBox->setChecked(SettingsCache::instance().cardsDisplay().getDeckEditorTagsWidgetVisible());
|
||||
connect(showTagsWidgetCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().cardsDisplay(),
|
||||
&CardsDisplaySettings::setDeckEditorTagsWidgetVisible);
|
||||
connect(&SettingsCache::instance().cardsDisplay(), &CardsDisplaySettings::deckEditorTagsWidgetVisibleChanged, this,
|
||||
showTagsWidgetCheckBox->setChecked(SettingsCache::instance().deckEditor().getTagsWidgetVisible());
|
||||
connect(showTagsWidgetCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().deckEditor(),
|
||||
&DeckEditorSettings::setTagsWidgetVisible);
|
||||
connect(&SettingsCache::instance().deckEditor(), &DeckEditorSettings::tagsWidgetVisibleChanged, this,
|
||||
&DeckEditorDeckDockWidget::updateShowTagsWidget);
|
||||
|
||||
quickSettingsWidget->addSettingsWidget(showBannerCardCheckBox);
|
||||
@@ -156,7 +154,7 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||
bannerCardLabel = new QLabel();
|
||||
bannerCardLabel->setObjectName("bannerCardLabel");
|
||||
bannerCardLabel->setText(tr("Banner Card"));
|
||||
bannerCardLabel->setHidden(!SettingsCache::instance().cardsDisplay().getDeckEditorBannerCardComboBoxVisible());
|
||||
bannerCardLabel->setHidden(!SettingsCache::instance().deckEditor().getBannerCardComboBoxVisible());
|
||||
bannerCardComboBox = new QComboBox(this);
|
||||
connect(getModel(), &DeckListModel::cardNodesChanged, this, [this]() {
|
||||
// Delay the update to avoid race conditions
|
||||
@@ -167,10 +165,10 @@ void DeckEditorDeckDockWidget::createDeckDock()
|
||||
|
||||
connect(bannerCardComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&DeckEditorDeckDockWidget::writeBannerCard);
|
||||
bannerCardComboBox->setHidden(!SettingsCache::instance().cardsDisplay().getDeckEditorBannerCardComboBoxVisible());
|
||||
bannerCardComboBox->setHidden(!SettingsCache::instance().deckEditor().getBannerCardComboBoxVisible());
|
||||
|
||||
deckTagsDisplayWidget = new DeckPreviewDeckTagsDisplayWidget(this, {});
|
||||
deckTagsDisplayWidget->setHidden(!SettingsCache::instance().cardsDisplay().getDeckEditorTagsWidgetVisible());
|
||||
deckTagsDisplayWidget->setHidden(!SettingsCache::instance().deckEditor().getTagsWidgetVisible());
|
||||
connect(deckTagsDisplayWidget, &DeckPreviewDeckTagsDisplayWidget::tagsChanged, deckStateManager,
|
||||
&DeckStateManager::setTags);
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/network/client/remote/remote_client.h>
|
||||
#include <libcockatrice/settings/appearance_settings.h>
|
||||
#include <libcockatrice/settings/paths_settings.h>
|
||||
#include <libcockatrice/settings/personal_settings.h>
|
||||
|
||||
HomeWidget::HomeWidget(QWidget *parent, TabSupervisor *_tabSupervisor)
|
||||
: QWidget(parent), tabSupervisor(_tabSupervisor), background("theme:backgrounds/home"), overlay("theme:cockatrice")
|
||||
@@ -43,12 +43,12 @@ HomeWidget::HomeWidget(QWidget *parent, TabSupervisor *_tabSupervisor)
|
||||
updateConnectButton(tabSupervisor->getClient()->getStatus());
|
||||
|
||||
connect(tabSupervisor->getClient(), &RemoteClient::statusChanged, this, &HomeWidget::updateConnectButton);
|
||||
connect(&SettingsCache::instance().personal(), &PersonalSettings::homeTabBackgroundSourceChanged, this,
|
||||
connect(&SettingsCache::instance().appearance(), &AppearanceSettings::homeTabBackgroundSourceChanged, this,
|
||||
&HomeWidget::initializeBackgroundFromSource);
|
||||
connect(&SettingsCache::instance().personal(), &PersonalSettings::homeTabBackgroundShuffleFrequencyChanged, this,
|
||||
&HomeWidget::onBackgroundShuffleFrequencyChanged);
|
||||
connect(&SettingsCache::instance().appearance(), &AppearanceSettings::homeTabBackgroundShuffleFrequencyChanged,
|
||||
this, &HomeWidget::onBackgroundShuffleFrequencyChanged);
|
||||
// Lambda is cleaner to read than overloading this
|
||||
connect(&SettingsCache::instance().personal(), &PersonalSettings::homeTabDisplayCardNameChanged, this,
|
||||
connect(&SettingsCache::instance().appearance(), &AppearanceSettings::homeTabDisplayCardNameChanged, this,
|
||||
[this] { repaint(); });
|
||||
connect(&SettingsCache::instance(), &SettingsCache::themeChanged, this,
|
||||
&HomeWidget::initializeBackgroundFromSource);
|
||||
@@ -65,7 +65,7 @@ void HomeWidget::initializeBackgroundFromSource()
|
||||
}
|
||||
|
||||
auto backgroundSourceType =
|
||||
BackgroundSources::fromId(SettingsCache::instance().personal().getHomeTabBackgroundSource());
|
||||
BackgroundSources::fromId(SettingsCache::instance().appearance().getHomeTabBackgroundSource());
|
||||
|
||||
switch (backgroundSourceType) {
|
||||
case BackgroundSources::Theme:
|
||||
@@ -113,7 +113,7 @@ void HomeWidget::setRandomCard(ExactCard &newCard)
|
||||
void HomeWidget::updateRandomCard()
|
||||
{
|
||||
auto backgroundSourceType =
|
||||
BackgroundSources::fromId(SettingsCache::instance().personal().getHomeTabBackgroundSource());
|
||||
BackgroundSources::fromId(SettingsCache::instance().appearance().getHomeTabBackgroundSource());
|
||||
|
||||
ExactCard newCard;
|
||||
|
||||
@@ -156,8 +156,8 @@ void HomeWidget::updateRandomCard()
|
||||
void HomeWidget::onBackgroundShuffleFrequencyChanged()
|
||||
{
|
||||
cardChangeTimer->stop();
|
||||
if (SettingsCache::instance().personal().getHomeTabBackgroundShuffleFrequency() > 0) {
|
||||
cardChangeTimer->start(SettingsCache::instance().personal().getHomeTabBackgroundShuffleFrequency() * 1000);
|
||||
if (SettingsCache::instance().appearance().getHomeTabBackgroundShuffleFrequency() > 0) {
|
||||
cardChangeTimer->start(SettingsCache::instance().appearance().getHomeTabBackgroundShuffleFrequency() * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ void HomeWidget::updateConnectButton(const ClientStatus status)
|
||||
|
||||
QPair<QColor, QColor> HomeWidget::extractDominantColors(const QPixmap &pixmap)
|
||||
{
|
||||
if (themeManager->isBuiltInTheme() && SettingsCache::instance().personal().getHomeTabBackgroundSource() ==
|
||||
if (themeManager->isBuiltInTheme() && SettingsCache::instance().appearance().getHomeTabBackgroundSource() ==
|
||||
BackgroundSources::toId(BackgroundSources::Theme)) {
|
||||
return QPair<QColor, QColor>(QColor::fromRgb(20, 140, 60), QColor::fromRgb(120, 200, 80));
|
||||
}
|
||||
@@ -352,7 +352,7 @@ void HomeWidget::paintEvent(QPaintEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
if (!cardName.isEmpty() && SettingsCache::instance().personal().getHomeTabDisplayCardName()) {
|
||||
if (!cardName.isEmpty() && SettingsCache::instance().appearance().getHomeTabDisplayCardName()) {
|
||||
QFont font = painter.font();
|
||||
font.setPointSize(14);
|
||||
font.setBold(true);
|
||||
|
||||
@@ -16,16 +16,16 @@ class TearOffMenu : public QMenu
|
||||
public:
|
||||
explicit TearOffMenu(const QString &title, QWidget *parent = nullptr) : QMenu(title, parent)
|
||||
{
|
||||
connect(&SettingsCache::instance().interface(), &InterfaceSettings::useTearOffMenusChanged, this,
|
||||
connect(&SettingsCache::instance().userInterface(), &InterfaceSettings::useTearOffMenusChanged, this,
|
||||
[this](const bool state) { setTearOffEnabled(state); });
|
||||
setTearOffEnabled(SettingsCache::instance().interface().getUseTearOffMenus());
|
||||
setTearOffEnabled(SettingsCache::instance().userInterface().getUseTearOffMenus());
|
||||
}
|
||||
|
||||
explicit TearOffMenu(QWidget *parent = nullptr) : QMenu(parent)
|
||||
{
|
||||
connect(&SettingsCache::instance().interface(), &InterfaceSettings::useTearOffMenusChanged, this,
|
||||
connect(&SettingsCache::instance().userInterface(), &InterfaceSettings::useTearOffMenusChanged, this,
|
||||
[this](const bool state) { setTearOffEnabled(state); });
|
||||
setTearOffEnabled(SettingsCache::instance().interface().getUseTearOffMenus());
|
||||
setTearOffEnabled(SettingsCache::instance().userInterface().getUseTearOffMenus());
|
||||
}
|
||||
|
||||
TearOffMenu *addTearOffMenu(const QString &title)
|
||||
|
||||
@@ -94,7 +94,7 @@ void ReplayManager::handleBackwardsSkip(bool doRewindBuffering)
|
||||
// The rewind only happens once the timer runs out.
|
||||
// If another backwards skip happens, the timer will just get reset instead of rewinding.
|
||||
rewindBufferingTimer->stop();
|
||||
rewindBufferingTimer->start(SettingsCache::instance().interface().getRewindBufferingMs());
|
||||
rewindBufferingTimer->start(SettingsCache::instance().userInterface().getRewindBufferingMs());
|
||||
} else {
|
||||
// otherwise, process the rewind immediately
|
||||
processRewind();
|
||||
|
||||
@@ -14,7 +14,7 @@ ReplayQuickSettingsWidget::ReplayQuickSettingsWidget(QWidget *parent) : Settings
|
||||
fastForwardSpeedBox.setMinimum(1);
|
||||
fastForwardSpeedBox.setMaximum(99.9);
|
||||
fastForwardSpeedBox.setDecimals(1);
|
||||
fastForwardSpeedBox.setValue(SettingsCache::instance().interface().getFastForwardSpeed());
|
||||
fastForwardSpeedBox.setValue(SettingsCache::instance().userInterface().getFastForwardSpeed());
|
||||
connect(&fastForwardSpeedBox, qOverload<double>(&QDoubleSpinBox::valueChanged), this,
|
||||
&ReplayQuickSettingsWidget::actUpdateFastForwardSpeed);
|
||||
|
||||
@@ -40,6 +40,6 @@ void ReplayQuickSettingsWidget::retranslateUi()
|
||||
|
||||
void ReplayQuickSettingsWidget::actUpdateFastForwardSpeed(qreal value)
|
||||
{
|
||||
SettingsCache::instance().interface().setFastForwardSpeed(value);
|
||||
SettingsCache::instance().userInterface().setFastForwardSpeed(value);
|
||||
emit fastForwardSpeedChanged(value);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ void ReplayWidget::replayPlayButtonToggled(bool checked)
|
||||
|
||||
void ReplayWidget::updateTimeScaleFactor(bool isFastForward)
|
||||
{
|
||||
qreal factor = isFastForward ? SettingsCache::instance().interface().getFastForwardSpeed() : 1.0;
|
||||
qreal factor = isFastForward ? SettingsCache::instance().userInterface().getFastForwardSpeed() : 1.0;
|
||||
replayManager->setTimeScaleFactor(factor);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <libcockatrice/protocol/pb/serverinfo_game.pb.h>
|
||||
#include <libcockatrice/protocol/pending_command.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
|
||||
GameSelector::GameSelector(AbstractClient *_client,
|
||||
TabSupervisor *_tabSupervisor,
|
||||
@@ -83,12 +84,12 @@ GameSelector::GameSelector(AbstractClient *_client,
|
||||
if (showFilters && restoresettings) {
|
||||
quickFilterToolBar = new GameSelectorQuickFilterToolBar(this, tabSupervisor, gameListProxyModel, gameTypeMap);
|
||||
quickFilterToolBar->setVisible(showFilters && restoresettings &&
|
||||
SettingsCache::instance().cardsDisplay().getShowGameSelectorFilterToolbar());
|
||||
SettingsCache::instance().userInterface().getShowGameSelectorFilterToolbar());
|
||||
|
||||
connect(&SettingsCache::instance().cardsDisplay(), &CardsDisplaySettings::showGameSelectorFilterToolbarChanged,
|
||||
connect(&SettingsCache::instance().userInterface(), &InterfaceSettings::showGameSelectorFilterToolbarChanged,
|
||||
this, [this] {
|
||||
quickFilterToolBar->setVisible(
|
||||
SettingsCache::instance().cardsDisplay().getShowGameSelectorFilterToolbar());
|
||||
SettingsCache::instance().userInterface().getShowGameSelectorFilterToolbar());
|
||||
});
|
||||
} else {
|
||||
quickFilterToolBar = nullptr;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <libcockatrice/protocol/pb/response_get_games_of_user.pb.h>
|
||||
#include <libcockatrice/protocol/pb/response_get_user_info.pb.h>
|
||||
#include <libcockatrice/protocol/pending_command.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <libcockatrice/settings/appearance_settings.h>
|
||||
#include <libcockatrice/utility/string_limits.h>
|
||||
|
||||
BanDialog::BanDialog(const ServerInfo_User &info, QWidget *parent) : QDialog(parent)
|
||||
@@ -349,7 +349,7 @@ bool UserListItemDelegate::editorEvent(QEvent *event,
|
||||
|
||||
QSize UserListItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
if (!SettingsCache::instance().interface().getStyleUserList()) {
|
||||
if (!SettingsCache::instance().appearance().getStyleUserList()) {
|
||||
return QStyledItemDelegate::sizeHint(option, index);
|
||||
}
|
||||
return UserListPainter::sizeHint();
|
||||
@@ -357,7 +357,7 @@ QSize UserListItemDelegate::sizeHint(const QStyleOptionViewItem &option, const Q
|
||||
|
||||
void UserListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
if (!SettingsCache::instance().interface().getStyleUserList()) {
|
||||
if (!SettingsCache::instance().appearance().getStyleUserList()) {
|
||||
QStyledItemDelegate::paint(painter, option, index);
|
||||
return;
|
||||
}
|
||||
@@ -521,7 +521,7 @@ UserListWidget::UserListWidget(TabSupervisor *_tabSupervisor,
|
||||
|
||||
// Pin on item click
|
||||
connect(userTree, &QTreeWidget::itemClicked, this, [this](QTreeWidgetItem *item, int) {
|
||||
if (!SettingsCache::instance().interface().getStyleUserList()) {
|
||||
if (!SettingsCache::instance().appearance().getStyleUserList()) {
|
||||
return;
|
||||
}
|
||||
const QString name = static_cast<UserListTWI *>(item)->getUserInfo().name().c_str();
|
||||
@@ -553,7 +553,7 @@ UserListWidget::UserListWidget(TabSupervisor *_tabSupervisor,
|
||||
connect(cardArtProvider, &UserCardArtProvider::cardArtUpdated, this,
|
||||
[this](const QString &) { userTree->viewport()->update(); });
|
||||
|
||||
connect(&SettingsCache::instance().interface(), &InterfaceSettings::styleUserListChanged, this,
|
||||
connect(&SettingsCache::instance().appearance(), &AppearanceSettings::styleUserListChanged, this,
|
||||
&UserListWidget::applyDisplayMode);
|
||||
applyDisplayMode();
|
||||
|
||||
@@ -659,7 +659,7 @@ void UserListWidget::hideEvent(QHideEvent *e)
|
||||
|
||||
void UserListWidget::applyDisplayMode()
|
||||
{
|
||||
const bool styled = SettingsCache::instance().interface().getStyleUserList();
|
||||
const bool styled = SettingsCache::instance().appearance().getStyleUserList();
|
||||
|
||||
if (styled) {
|
||||
userTree->header()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
@@ -718,7 +718,7 @@ bool UserListWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (obj == userTree->viewport()) {
|
||||
if (event->type() == QEvent::MouseMove) {
|
||||
if (!SettingsCache::instance().interface().getStyleUserList()) {
|
||||
if (!SettingsCache::instance().appearance().getStyleUserList()) {
|
||||
return QGroupBox::eventFilter(obj, event);
|
||||
}
|
||||
auto *me = static_cast<QMouseEvent *>(event);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QStyleFactory>
|
||||
#include <QTimer>
|
||||
#include <libcockatrice/settings/appearance_settings.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <libcockatrice/settings/paths_settings.h>
|
||||
@@ -104,7 +105,7 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||
homeTabBackgroundSourceBox.addItem(QObject::tr(entry.trKey), QVariant::fromValue(entry.type));
|
||||
}
|
||||
|
||||
QString homeTabBackgroundSource = SettingsCache::instance().personal().getHomeTabBackgroundSource();
|
||||
QString homeTabBackgroundSource = settings.appearance().getHomeTabBackgroundSource();
|
||||
int homeTabBackgroundSourceId =
|
||||
homeTabBackgroundSourceBox.findData(BackgroundSources::fromId(homeTabBackgroundSource));
|
||||
if (homeTabBackgroundSourceId != -1) {
|
||||
@@ -113,20 +114,19 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||
|
||||
connect(&homeTabBackgroundSourceBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]() {
|
||||
auto type = homeTabBackgroundSourceBox.currentData().value<BackgroundSources::Type>();
|
||||
SettingsCache::instance().personal().setHomeTabBackgroundSource(BackgroundSources::toId(type));
|
||||
SettingsCache::instance().appearance().setHomeTabBackgroundSource(BackgroundSources::toId(type));
|
||||
updateHomeTabSettingsVisibility();
|
||||
});
|
||||
|
||||
homeTabBackgroundShuffleFrequencySpinBox.setRange(0, 3600);
|
||||
homeTabBackgroundShuffleFrequencySpinBox.setSuffix(tr(" seconds"));
|
||||
homeTabBackgroundShuffleFrequencySpinBox.setValue(
|
||||
SettingsCache::instance().personal().getHomeTabBackgroundShuffleFrequency());
|
||||
connect(&homeTabBackgroundShuffleFrequencySpinBox, qOverload<int>(&QSpinBox::valueChanged), &settings.personal(),
|
||||
&PersonalSettings::setHomeTabBackgroundShuffleFrequency);
|
||||
homeTabBackgroundShuffleFrequencySpinBox.setValue(settings.appearance().getHomeTabBackgroundShuffleFrequency());
|
||||
connect(&homeTabBackgroundShuffleFrequencySpinBox, qOverload<int>(&QSpinBox::valueChanged), &settings.appearance(),
|
||||
&AppearanceSettings::setHomeTabBackgroundShuffleFrequency);
|
||||
|
||||
homeTabDisplayCardNameCheckBox.setChecked(settings.personal().getHomeTabDisplayCardName());
|
||||
connect(&homeTabDisplayCardNameCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.personal(),
|
||||
&PersonalSettings::setHomeTabDisplayCardName);
|
||||
homeTabDisplayCardNameCheckBox.setChecked(settings.appearance().getHomeTabDisplayCardName());
|
||||
connect(&homeTabDisplayCardNameCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.appearance(),
|
||||
&AppearanceSettings::setHomeTabDisplayCardName);
|
||||
|
||||
updateHomeTabSettingsVisibility();
|
||||
|
||||
@@ -140,9 +140,9 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||
homeTabGroupBox = new QGroupBox;
|
||||
homeTabGroupBox->setLayout(homeTabGrid);
|
||||
|
||||
styleUserListCheckBox.setChecked(settings.interface().getStyleUserList());
|
||||
connect(&styleUserListCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.interface(),
|
||||
&InterfaceSettings::setStyleUserList);
|
||||
styleUserListCheckBox.setChecked(settings.appearance().getStyleUserList());
|
||||
connect(&styleUserListCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.appearance(),
|
||||
&AppearanceSettings::setStyleUserList);
|
||||
|
||||
auto stylingTabGrid = new QGridLayout;
|
||||
stylingTabGrid->addWidget(&styleUserListCheckBox, 0, 0, 1, 2);
|
||||
@@ -151,12 +151,12 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||
stylingGroupBox->setLayout(stylingTabGrid);
|
||||
|
||||
// Menu settings
|
||||
showShortcutsCheckBox.setChecked(settings.cardsDisplay().getShowShortcuts());
|
||||
showShortcutsCheckBox.setChecked(settings.userInterface().getShowShortcuts());
|
||||
connect(&showShortcutsCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &AppearanceSettingsPage::showShortcutsChanged);
|
||||
|
||||
showGameSelectorFilterToolbarCheckBox.setChecked(settings.cardsDisplay().getShowGameSelectorFilterToolbar());
|
||||
connect(&showGameSelectorFilterToolbarCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.cardsDisplay(),
|
||||
&CardsDisplaySettings::setShowGameSelectorFilterToolbar);
|
||||
showGameSelectorFilterToolbarCheckBox.setChecked(settings.userInterface().getShowGameSelectorFilterToolbar());
|
||||
connect(&showGameSelectorFilterToolbarCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.userInterface(),
|
||||
&InterfaceSettings::setShowGameSelectorFilterToolbar);
|
||||
|
||||
auto *menuGrid = new QGridLayout;
|
||||
menuGrid->addWidget(&showShortcutsCheckBox, 0, 0);
|
||||
@@ -199,9 +199,9 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||
connect(&roundCardCornersCheckBox, &QAbstractButton::toggled, &settings.cardsDisplay(),
|
||||
&CardsDisplaySettings::setRoundCardCorners);
|
||||
|
||||
connect(&maxFontSizeForCardsEdit, qOverload<int>(&QSpinBox::valueChanged), &settings.personal(),
|
||||
&PersonalSettings::setMaxFontSize);
|
||||
maxFontSizeForCardsEdit.setValue(settings.personal().getMaxFontSize());
|
||||
connect(&maxFontSizeForCardsEdit, qOverload<int>(&QSpinBox::valueChanged), &settings.appearance(),
|
||||
&AppearanceSettings::setMaxFontSize);
|
||||
maxFontSizeForCardsEdit.setValue(settings.appearance().getMaxFontSize());
|
||||
maxFontSizeForCardsLabel.setBuddy(&maxFontSizeForCardsEdit);
|
||||
maxFontSizeForCardsEdit.setMinimum(9);
|
||||
maxFontSizeForCardsEdit.setMaximum(100);
|
||||
@@ -224,12 +224,12 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||
&CardsDisplaySettings::setStackCardOverlapPercent);
|
||||
|
||||
cardViewInitialRowsMaxBox.setRange(1, 999);
|
||||
cardViewInitialRowsMaxBox.setValue(SettingsCache::instance().interface().getCardViewInitialRowsMax());
|
||||
cardViewInitialRowsMaxBox.setValue(SettingsCache::instance().userInterface().getCardViewInitialRowsMax());
|
||||
connect(&cardViewInitialRowsMaxBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||
&AppearanceSettingsPage::cardViewInitialRowsMaxChanged);
|
||||
|
||||
cardViewExpandedRowsMaxBox.setRange(1, 999);
|
||||
cardViewExpandedRowsMaxBox.setValue(SettingsCache::instance().interface().getCardViewExpandedRowsMax());
|
||||
cardViewExpandedRowsMaxBox.setValue(SettingsCache::instance().userInterface().getCardViewExpandedRowsMax());
|
||||
connect(&cardViewExpandedRowsMaxBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||
&AppearanceSettingsPage::cardViewExpandedRowsMaxChanged);
|
||||
|
||||
@@ -291,12 +291,12 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||
cardCountersGroupBox->setLayout(cardCountersLayout);
|
||||
|
||||
// Hand layout
|
||||
horizontalHandCheckBox.setChecked(settings.interface().getHorizontalHand());
|
||||
connect(&horizontalHandCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.interface(),
|
||||
horizontalHandCheckBox.setChecked(settings.userInterface().getHorizontalHand());
|
||||
connect(&horizontalHandCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.userInterface(),
|
||||
&InterfaceSettings::setHorizontalHand);
|
||||
|
||||
leftJustifiedHandCheckBox.setChecked(settings.interface().getLeftJustified());
|
||||
connect(&leftJustifiedHandCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.interface(),
|
||||
leftJustifiedHandCheckBox.setChecked(settings.userInterface().getLeftJustified());
|
||||
connect(&leftJustifiedHandCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.userInterface(),
|
||||
&InterfaceSettings::setLeftJustified);
|
||||
|
||||
auto *handGrid = new QGridLayout;
|
||||
@@ -307,13 +307,13 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||
handGroupBox->setLayout(handGrid);
|
||||
|
||||
// table grid layout
|
||||
invertVerticalCoordinateCheckBox.setChecked(settings.interface().getInvertVerticalCoordinate());
|
||||
connect(&invertVerticalCoordinateCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.interface(),
|
||||
invertVerticalCoordinateCheckBox.setChecked(settings.userInterface().getInvertVerticalCoordinate());
|
||||
connect(&invertVerticalCoordinateCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings.userInterface(),
|
||||
&InterfaceSettings::setInvertVerticalCoordinate);
|
||||
|
||||
minPlayersForMultiColumnLayoutEdit.setMinimum(2);
|
||||
minPlayersForMultiColumnLayoutEdit.setValue(settings.interface().getMinPlayersForMultiColumnLayout());
|
||||
connect(&minPlayersForMultiColumnLayoutEdit, qOverload<int>(&QSpinBox::valueChanged), &settings.interface(),
|
||||
minPlayersForMultiColumnLayoutEdit.setValue(settings.userInterface().getMinPlayersForMultiColumnLayout());
|
||||
connect(&minPlayersForMultiColumnLayoutEdit, qOverload<int>(&QSpinBox::valueChanged), &settings.userInterface(),
|
||||
&InterfaceSettings::setMinPlayersForMultiColumnLayout);
|
||||
minPlayersForMultiColumnLayoutLabel.setBuddy(&minPlayersForMultiColumnLayoutEdit);
|
||||
|
||||
@@ -375,7 +375,7 @@ void AppearanceSettingsPage::editPalette()
|
||||
|
||||
void AppearanceSettingsPage::updateHomeTabSettingsVisibility()
|
||||
{
|
||||
bool visible = SettingsCache::instance().personal().getHomeTabBackgroundSource() !=
|
||||
bool visible = SettingsCache::instance().appearance().getHomeTabBackgroundSource() !=
|
||||
BackgroundSources::toId(BackgroundSources::Theme);
|
||||
|
||||
homeTabBackgroundShuffleFrequencyLabel.setVisible(visible);
|
||||
@@ -385,7 +385,7 @@ void AppearanceSettingsPage::updateHomeTabSettingsVisibility()
|
||||
|
||||
void AppearanceSettingsPage::showShortcutsChanged(QT_STATE_CHANGED_T value)
|
||||
{
|
||||
SettingsCache::instance().cardsDisplay().setShowShortcuts(value);
|
||||
SettingsCache::instance().userInterface().setShowShortcuts(value);
|
||||
qApp->setAttribute(Qt::AA_DontShowShortcutsInContextMenus, value == 0); // 0 = unchecked
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@ void AppearanceSettingsPage::overrideAllCardArtWithPersonalPreferenceToggled(QT_
|
||||
*/
|
||||
void AppearanceSettingsPage::cardViewInitialRowsMaxChanged(int value)
|
||||
{
|
||||
SettingsCache::instance().interface().setCardViewInitialRowsMax(value);
|
||||
SettingsCache::instance().userInterface().setCardViewInitialRowsMax(value);
|
||||
if (cardViewExpandedRowsMaxBox.value() < value) {
|
||||
cardViewExpandedRowsMaxBox.setValue(value);
|
||||
}
|
||||
@@ -425,7 +425,7 @@ void AppearanceSettingsPage::cardViewInitialRowsMaxChanged(int value)
|
||||
*/
|
||||
void AppearanceSettingsPage::cardViewExpandedRowsMaxChanged(int value)
|
||||
{
|
||||
SettingsCache::instance().interface().setCardViewExpandedRowsMax(value);
|
||||
SettingsCache::instance().userInterface().setCardViewExpandedRowsMax(value);
|
||||
if (cardViewInitialRowsMaxBox.value() > value) {
|
||||
cardViewInitialRowsMaxBox.setValue(value);
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@ private:
|
||||
QSpinBox homeTabBackgroundShuffleFrequencySpinBox;
|
||||
QCheckBox homeTabDisplayCardNameCheckBox;
|
||||
QCheckBox styleUserListCheckBox;
|
||||
QLabel minPlayersForMultiColumnLayoutLabel;
|
||||
QLabel maxFontSizeForCardsLabel;
|
||||
QCheckBox showShortcutsCheckBox;
|
||||
QCheckBox showGameSelectorFilterToolbarCheckBox;
|
||||
QLabel minPlayersForMultiColumnLayoutLabel;
|
||||
QLabel maxFontSizeForCardsLabel;
|
||||
QCheckBox overrideAllCardArtWithPersonalPreferenceCheckBox;
|
||||
QCheckBox bumpSetsWithCardsInDeckToTopCheckBox;
|
||||
QCheckBox displayCardNamesCheckBox;
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
|
||||
DeckEditorSettingsPage::DeckEditorSettingsPage()
|
||||
{
|
||||
picDownloadCheckBox.setChecked(SettingsCache::instance().personal().getPicDownload());
|
||||
connect(&picDownloadCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().personal(),
|
||||
&PersonalSettings::setPicDownload);
|
||||
picDownloadCheckBox.setChecked(SettingsCache::instance().downloads().getPicDownload());
|
||||
connect(&picDownloadCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().downloads(),
|
||||
&DownloadSettings::setPicDownload);
|
||||
|
||||
urlLinkLabel.setTextInteractionFlags(Qt::LinksAccessibleByMouse);
|
||||
urlLinkLabel.setOpenExternalLinks(true);
|
||||
@@ -29,7 +29,7 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
|
||||
auto *lpGeneralGrid = new QGridLayout;
|
||||
auto *lpSpoilerGrid = new QGridLayout;
|
||||
|
||||
mcDownloadSpoilersCheckBox.setChecked(SettingsCache::instance().personal().getDownloadSpoilersStatus());
|
||||
mcDownloadSpoilersCheckBox.setChecked(SettingsCache::instance().downloads().getDownloadSpoilersStatus());
|
||||
|
||||
mpSpoilerSavePathLineEdit = new QLineEdit(SettingsCache::instance().getSpoilerCardDatabasePath());
|
||||
mpSpoilerSavePathLineEdit->setReadOnly(true);
|
||||
@@ -91,8 +91,8 @@ DeckEditorSettingsPage::DeckEditorSettingsPage()
|
||||
lpSpoilerGrid->addWidget(&infoOnSpoilersLabel, 3, 0, 1, 3, Qt::AlignTop);
|
||||
|
||||
// On a change to the checkbox, hide/un-hide the other fields
|
||||
connect(&mcDownloadSpoilersCheckBox, &QCheckBox::toggled, &SettingsCache::instance().personal(),
|
||||
&PersonalSettings::setDownloadSpoilerStatus);
|
||||
connect(&mcDownloadSpoilersCheckBox, &QCheckBox::toggled, &SettingsCache::instance().downloads(),
|
||||
&DownloadSettings::setDownloadSpoilerStatus);
|
||||
connect(&mcDownloadSpoilersCheckBox, &QCheckBox::toggled, this, &DeckEditorSettingsPage::setSpoilersEnabled);
|
||||
|
||||
mpGeneralGroupBox = new QGroupBox;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <libcockatrice/settings/deck_editor_settings.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <libcockatrice/settings/personal_settings.h>
|
||||
#include <libcockatrice/settings/visual_deck_storage_settings.h>
|
||||
@@ -19,70 +20,70 @@ enum visualDeckStoragePromptForConversionIndex
|
||||
UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||
{
|
||||
// general settings and notification settings
|
||||
notificationsEnabledCheckBox.setChecked(SettingsCache::instance().interface().getNotificationsEnabled());
|
||||
connect(¬ificationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||
notificationsEnabledCheckBox.setChecked(SettingsCache::instance().userInterface().getNotificationsEnabled());
|
||||
connect(¬ificationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||
&InterfaceSettings::setNotificationsEnabled);
|
||||
connect(¬ificationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||
&UserInterfaceSettingsPage::setNotificationEnabled);
|
||||
|
||||
specNotificationsEnabledCheckBox.setChecked(
|
||||
SettingsCache::instance().interface().getSpectatorNotificationsEnabled());
|
||||
specNotificationsEnabledCheckBox.setEnabled(SettingsCache::instance().interface().getNotificationsEnabled());
|
||||
connect(&specNotificationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||
SettingsCache::instance().userInterface().getSpectatorNotificationsEnabled());
|
||||
specNotificationsEnabledCheckBox.setEnabled(SettingsCache::instance().userInterface().getNotificationsEnabled());
|
||||
connect(&specNotificationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||
&InterfaceSettings::setSpectatorNotificationsEnabled);
|
||||
|
||||
buddyConnectNotificationsEnabledCheckBox.setChecked(
|
||||
SettingsCache::instance().interface().getBuddyConnectNotificationsEnabled());
|
||||
SettingsCache::instance().userInterface().getBuddyConnectNotificationsEnabled());
|
||||
buddyConnectNotificationsEnabledCheckBox.setEnabled(
|
||||
SettingsCache::instance().interface().getNotificationsEnabled());
|
||||
SettingsCache::instance().userInterface().getNotificationsEnabled());
|
||||
connect(&buddyConnectNotificationsEnabledCheckBox, &QCheckBox::QT_STATE_CHANGED,
|
||||
&SettingsCache::instance().interface(), &InterfaceSettings::setBuddyConnectNotificationsEnabled);
|
||||
&SettingsCache::instance().userInterface(), &InterfaceSettings::setBuddyConnectNotificationsEnabled);
|
||||
|
||||
doubleClickToPlayCheckBox.setChecked(SettingsCache::instance().interface().getDoubleClickToPlay());
|
||||
connect(&doubleClickToPlayCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||
doubleClickToPlayCheckBox.setChecked(SettingsCache::instance().userInterface().getDoubleClickToPlay());
|
||||
connect(&doubleClickToPlayCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||
&InterfaceSettings::setDoubleClickToPlay);
|
||||
|
||||
clickPlaysAllSelectedCheckBox.setChecked(SettingsCache::instance().interface().getClickPlaysAllSelected());
|
||||
connect(&clickPlaysAllSelectedCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||
clickPlaysAllSelectedCheckBox.setChecked(SettingsCache::instance().userInterface().getClickPlaysAllSelected());
|
||||
connect(&clickPlaysAllSelectedCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||
&InterfaceSettings::setClickPlaysAllSelected);
|
||||
|
||||
playToStackCheckBox.setChecked(SettingsCache::instance().interface().getPlayToStack());
|
||||
connect(&playToStackCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||
playToStackCheckBox.setChecked(SettingsCache::instance().userInterface().getPlayToStack());
|
||||
connect(&playToStackCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||
&InterfaceSettings::setPlayToStack);
|
||||
|
||||
doNotDeleteArrowsInSubPhasesCheckBox.setChecked(
|
||||
SettingsCache::instance().interface().getDoNotDeleteArrowsInSubPhases());
|
||||
connect(&doNotDeleteArrowsInSubPhasesCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||
&InterfaceSettings::setDoNotDeleteArrowsInSubPhases);
|
||||
SettingsCache::instance().userInterface().getDoNotDeleteArrowsInSubPhases());
|
||||
connect(&doNotDeleteArrowsInSubPhasesCheckBox, &QCheckBox::QT_STATE_CHANGED,
|
||||
&SettingsCache::instance().userInterface(), &InterfaceSettings::setDoNotDeleteArrowsInSubPhases);
|
||||
|
||||
closeEmptyCardViewCheckBox.setChecked(SettingsCache::instance().interface().getCloseEmptyCardView());
|
||||
connect(&closeEmptyCardViewCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||
closeEmptyCardViewCheckBox.setChecked(SettingsCache::instance().userInterface().getCloseEmptyCardView());
|
||||
connect(&closeEmptyCardViewCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||
&InterfaceSettings::setCloseEmptyCardView);
|
||||
|
||||
focusCardViewSearchBarCheckBox.setChecked(SettingsCache::instance().interface().getFocusCardViewSearchBar());
|
||||
connect(&focusCardViewSearchBarCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||
focusCardViewSearchBarCheckBox.setChecked(SettingsCache::instance().userInterface().getFocusCardViewSearchBar());
|
||||
connect(&focusCardViewSearchBarCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||
&InterfaceSettings::setFocusCardViewSearchBar);
|
||||
|
||||
annotateTokensCheckBox.setChecked(SettingsCache::instance().interface().getAnnotateTokens());
|
||||
connect(&annotateTokensCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||
annotateTokensCheckBox.setChecked(SettingsCache::instance().userInterface().getAnnotateTokens());
|
||||
connect(&annotateTokensCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||
&InterfaceSettings::setAnnotateTokens);
|
||||
|
||||
showDragSelectionCountCheckBox.setChecked(SettingsCache::instance().interface().getShowDragSelectionCount());
|
||||
connect(&showDragSelectionCountCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||
showDragSelectionCountCheckBox.setChecked(SettingsCache::instance().userInterface().getShowDragSelectionCount());
|
||||
connect(&showDragSelectionCountCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||
&InterfaceSettings::setShowDragSelectionCount);
|
||||
|
||||
showTotalSelectionCountCheckBox.setChecked(SettingsCache::instance().interface().getShowTotalSelectionCount());
|
||||
connect(&showTotalSelectionCountCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||
showTotalSelectionCountCheckBox.setChecked(SettingsCache::instance().userInterface().getShowTotalSelectionCount());
|
||||
connect(&showTotalSelectionCountCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||
&InterfaceSettings::setShowTotalSelectionCount);
|
||||
|
||||
useTearOffMenusCheckBox.setChecked(SettingsCache::instance().interface().getUseTearOffMenus());
|
||||
connect(&useTearOffMenusCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||
useTearOffMenusCheckBox.setChecked(SettingsCache::instance().userInterface().getUseTearOffMenus());
|
||||
connect(&useTearOffMenusCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||
[](const QT_STATE_CHANGED_T state) {
|
||||
SettingsCache::instance().interface().setUseTearOffMenus(state == Qt::Checked);
|
||||
SettingsCache::instance().userInterface().setUseTearOffMenus(state == Qt::Checked);
|
||||
});
|
||||
|
||||
keepGameChatFocusCheckBox.setChecked(SettingsCache::instance().interface().getKeepGameChatFocus());
|
||||
connect(&keepGameChatFocusCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||
keepGameChatFocusCheckBox.setChecked(SettingsCache::instance().userInterface().getKeepGameChatFocus());
|
||||
connect(&keepGameChatFocusCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().userInterface(),
|
||||
&InterfaceSettings::setKeepGameChatFocus);
|
||||
|
||||
auto *generalGrid = new QGridLayout;
|
||||
@@ -121,9 +122,9 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||
animationGroupBox->setLayout(animationGrid);
|
||||
|
||||
// deck editor settings
|
||||
openDeckInNewTabCheckBox.setChecked(SettingsCache::instance().interface().getOpenDeckInNewTab());
|
||||
connect(&openDeckInNewTabCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().interface(),
|
||||
&InterfaceSettings::setOpenDeckInNewTab);
|
||||
openDeckInNewTabCheckBox.setChecked(SettingsCache::instance().deckEditor().getOpenDeckInNewTab());
|
||||
connect(&openDeckInNewTabCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().deckEditor(),
|
||||
&DeckEditorSettings::setOpenDeckInNewTab);
|
||||
|
||||
visualDeckStorageInGameCheckBox.setChecked(
|
||||
SettingsCache::instance().visualDeckStorage().getVisualDeckStorageInGame());
|
||||
@@ -156,10 +157,9 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||
|
||||
defaultDeckEditorTypeSelector.addItem(""); // these will be set in retranslateUI
|
||||
defaultDeckEditorTypeSelector.addItem("");
|
||||
defaultDeckEditorTypeSelector.setCurrentIndex(
|
||||
SettingsCache::instance().visualDeckStorage().getDefaultDeckEditorType());
|
||||
defaultDeckEditorTypeSelector.setCurrentIndex(SettingsCache::instance().deckEditor().getDefaultDeckEditorType());
|
||||
connect(&defaultDeckEditorTypeSelector, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
&SettingsCache::instance().visualDeckStorage(), &VisualDeckStorageSettings::setDefaultDeckEditorType);
|
||||
&SettingsCache::instance().deckEditor(), &DeckEditorSettings::setDefaultDeckEditorType);
|
||||
|
||||
auto *deckEditorGrid = new QGridLayout;
|
||||
deckEditorGrid->addWidget(&openDeckInNewTabCheckBox, 0, 0);
|
||||
@@ -175,8 +175,8 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||
|
||||
// replay settings
|
||||
rewindBufferingMsBox.setRange(0, 9999);
|
||||
rewindBufferingMsBox.setValue(SettingsCache::instance().interface().getRewindBufferingMs());
|
||||
connect(&rewindBufferingMsBox, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance().interface(),
|
||||
rewindBufferingMsBox.setValue(SettingsCache::instance().userInterface().getRewindBufferingMs());
|
||||
connect(&rewindBufferingMsBox, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance().userInterface(),
|
||||
&InterfaceSettings::setRewindBufferingMs);
|
||||
|
||||
auto *replayGrid = new QGridLayout;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <libcockatrice/protocol/pb/command_deck_upload.pb.h>
|
||||
#include <libcockatrice/protocol/pb/response.pb.h>
|
||||
#include <libcockatrice/protocol/pending_command.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <libcockatrice/settings/deck_editor_settings.h>
|
||||
#include <libcockatrice/settings/paths_settings.h>
|
||||
#include <libcockatrice/settings/recents_settings.h>
|
||||
#include <libcockatrice/utility/string_limits.h>
|
||||
@@ -203,7 +203,7 @@ void AbstractTabDeckEditor::cleanDeckAndResetModified()
|
||||
*/
|
||||
AbstractTabDeckEditor::DeckOpenLocation AbstractTabDeckEditor::confirmOpen(const bool openInSameTabIfBlank)
|
||||
{
|
||||
if (SettingsCache::instance().interface().getOpenDeckInNewTab()) {
|
||||
if (SettingsCache::instance().deckEditor().getOpenDeckInNewTab()) {
|
||||
if (openInSameTabIfBlank && deckStateManager->isBlankNewDeck()) {
|
||||
return SAME_TAB;
|
||||
} else {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/models/database/card/card_completer_proxy_model.h>
|
||||
#include <libcockatrice/models/database/card/card_search_model.h>
|
||||
#include <libcockatrice/settings/visual_deck_storage_settings.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <version_string.h>
|
||||
|
||||
TabArchidekt::TabArchidekt(TabSupervisor *_tabSupervisor)
|
||||
@@ -132,8 +132,8 @@ void TabArchidekt::initializeUi()
|
||||
|
||||
// Settings
|
||||
settingsButton = new SettingsButtonWidget(primaryToolbar);
|
||||
cardSizeSlider = new CardSizeWidget(primaryToolbar, nullptr,
|
||||
SettingsCache::instance().visualDeckStorage().getArchidektPreviewSize());
|
||||
cardSizeSlider =
|
||||
new CardSizeWidget(primaryToolbar, nullptr, SettingsCache::instance().cardsDisplay().getArchidektPreviewSize());
|
||||
settingsButton->addSettingsWidget(cardSizeSlider);
|
||||
|
||||
// Assemble primary toolbar
|
||||
@@ -339,8 +339,8 @@ void TabArchidekt::connectSignals()
|
||||
doSearch();
|
||||
});
|
||||
|
||||
connect(cardSizeSlider, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().visualDeckStorage(),
|
||||
&VisualDeckStorageSettings::setArchidektPreviewCardSize);
|
||||
connect(cardSizeSlider, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().cardsDisplay(),
|
||||
&CardsDisplaySettings::setArchidektPreviewCardSize);
|
||||
|
||||
// Search button triggers immediate search
|
||||
connect(searchButton, &QPushButton::clicked, this, &TabArchidekt::doSearchImmediate);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/models/database/card/card_completer_proxy_model.h>
|
||||
#include <libcockatrice/models/database/card/card_search_model.h>
|
||||
#include <libcockatrice/settings/visual_deck_storage_settings.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <version_string.h>
|
||||
|
||||
static bool canBeCommander(const CardInfoPtr &cardInfo)
|
||||
@@ -95,10 +95,9 @@ TabEdhRecMain::TabEdhRecMain(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor
|
||||
|
||||
settingsButton = new SettingsButtonWidget(this);
|
||||
|
||||
cardSizeSlider =
|
||||
new CardSizeWidget(this, nullptr, SettingsCache::instance().visualDeckStorage().getEDHRecCardSize());
|
||||
connect(cardSizeSlider, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().visualDeckStorage(),
|
||||
&VisualDeckStorageSettings::setEDHRecCardSize);
|
||||
cardSizeSlider = new CardSizeWidget(this, nullptr, SettingsCache::instance().cardsDisplay().getEDHRecCardSize());
|
||||
connect(cardSizeSlider, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().cardsDisplay(),
|
||||
&CardsDisplaySettings::setEDHRecCardSize);
|
||||
|
||||
settingsButton->addSettingsWidget(cardSizeSlider);
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ void TabGame::resetChatAndPhase()
|
||||
void TabGame::emitUserEvent()
|
||||
{
|
||||
bool globalEvent = !game->getPlayerManager()->isSpectator() ||
|
||||
SettingsCache::instance().interface().getSpectatorNotificationsEnabled();
|
||||
SettingsCache::instance().userInterface().getSpectatorNotificationsEnabled();
|
||||
emit userEvent(globalEvent);
|
||||
updatePlayerListDockTitle();
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
#include <libcockatrice/protocol/pb/serverinfo_room.pb.h>
|
||||
#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>
|
||||
#include <libcockatrice/settings/chat_settings.h>
|
||||
#include <libcockatrice/settings/deck_editor_settings.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <libcockatrice/settings/tabs_settings.h>
|
||||
#include <libcockatrice/settings/visual_deck_storage_settings.h>
|
||||
|
||||
QRect MacOSTabFixStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
|
||||
{
|
||||
@@ -910,7 +910,7 @@ void TabSupervisor::talkLeft(TabMessage *tab)
|
||||
*/
|
||||
void TabSupervisor::openDeckInNewTab(const LoadedDeck &deckToOpen)
|
||||
{
|
||||
int type = SettingsCache::instance().visualDeckStorage().getDefaultDeckEditorType();
|
||||
int type = SettingsCache::instance().deckEditor().getDefaultDeckEditorType();
|
||||
switch (type) {
|
||||
case ClassicDeckEditor:
|
||||
addDeckEditorTab(deckToOpen);
|
||||
@@ -1009,7 +1009,7 @@ void TabSupervisor::tabUserEvent(bool globalEvent)
|
||||
tab->setContentsChanged(true);
|
||||
setTabIcon(indexOf(tab), QPixmap("theme:icons/tab_changed"));
|
||||
}
|
||||
if (globalEvent && SettingsCache::instance().interface().getNotificationsEnabled()) {
|
||||
if (globalEvent && SettingsCache::instance().userInterface().getNotificationsEnabled()) {
|
||||
QApplication::alert(this);
|
||||
}
|
||||
}
|
||||
@@ -1104,7 +1104,7 @@ void TabSupervisor::processUserJoined(const ServerInfo_User &userInfoJoined)
|
||||
}
|
||||
}
|
||||
|
||||
if (SettingsCache::instance().interface().getBuddyConnectNotificationsEnabled()) {
|
||||
if (SettingsCache::instance().userInterface().getBuddyConnectNotificationsEnabled()) {
|
||||
QApplication::alert(this);
|
||||
this->actShowPopup(tr("Your buddy %1 has signed on!").arg(userName));
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <libcockatrice/card/card_info_comparator.h>
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/settings/visual_deck_storage_settings.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <utility>
|
||||
|
||||
VisualDatabaseDisplayWidget::VisualDatabaseDisplayWidget(QWidget *parent,
|
||||
@@ -52,10 +52,10 @@ VisualDatabaseDisplayWidget::VisualDatabaseDisplayWidget(QWidget *parent,
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarPolicy::ScrollBarAsNeeded);
|
||||
cardSizeWidget = new CardSizeWidget(
|
||||
this, flowWidget, SettingsCache::instance().visualDeckStorage().getVisualDatabaseDisplayCardSize());
|
||||
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().visualDeckStorage(),
|
||||
&VisualDeckStorageSettings::setVisualDatabaseDisplayCardSize);
|
||||
cardSizeWidget = new CardSizeWidget(this, flowWidget,
|
||||
SettingsCache::instance().cardsDisplay().getVisualDatabaseDisplayCardSize());
|
||||
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().cardsDisplay(),
|
||||
&CardsDisplaySettings::setVisualDatabaseDisplayCardSize);
|
||||
|
||||
searchContainer = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAlwaysOff);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <QSplitter>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/settings/visual_deck_storage_settings.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <random>
|
||||
|
||||
VisualDeckEditorSampleHandWidget::VisualDeckEditorSampleHandWidget(QWidget *parent,
|
||||
@@ -34,10 +34,10 @@ VisualDeckEditorSampleHandWidget::VisualDeckEditorSampleHandWidget(QWidget *pare
|
||||
resetAndHandSizeLayout->addWidget(resetButton);
|
||||
|
||||
handSizeSpinBox = new QSpinBox(this);
|
||||
handSizeSpinBox->setValue(SettingsCache::instance().visualDeckStorage().getVisualDeckEditorSampleHandSize());
|
||||
handSizeSpinBox->setValue(SettingsCache::instance().cardsDisplay().getSampleHandSize());
|
||||
handSizeSpinBox->setMinimum(1);
|
||||
connect(handSizeSpinBox, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance().visualDeckStorage(),
|
||||
&VisualDeckStorageSettings::setVisualDeckEditorSampleHandSize);
|
||||
connect(handSizeSpinBox, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance().cardsDisplay(),
|
||||
&CardsDisplaySettings::setSampleHandSize);
|
||||
connect(handSizeSpinBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||
&VisualDeckEditorSampleHandWidget::updateDisplay);
|
||||
resetAndHandSizeLayout->addWidget(handSizeSpinBox);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <libcockatrice/models/database/card/card_search_model.h>
|
||||
#include <libcockatrice/models/database/card_database_model.h>
|
||||
#include <libcockatrice/models/deck_list/deck_list_model.h>
|
||||
#include <libcockatrice/settings/visual_deck_storage_settings.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <qscrollarea.h>
|
||||
|
||||
VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent,
|
||||
@@ -45,9 +45,9 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent,
|
||||
initializeScrollAreaAndZoneContainer();
|
||||
|
||||
cardSizeWidget =
|
||||
new CardSizeWidget(this, nullptr, SettingsCache::instance().visualDeckStorage().getVisualDeckEditorCardSize());
|
||||
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().visualDeckStorage(),
|
||||
&VisualDeckStorageSettings::setVisualDeckEditorCardSize);
|
||||
new CardSizeWidget(this, nullptr, SettingsCache::instance().cardsDisplay().getVisualDeckEditorCardSize());
|
||||
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().cardsDisplay(),
|
||||
&CardsDisplaySettings::setVisualDeckEditorCardSize);
|
||||
|
||||
mainLayout->addWidget(displayOptionsAndSearch);
|
||||
mainLayout->addWidget(scrollArea);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QSpinBox>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <libcockatrice/settings/personal_settings.h>
|
||||
#include <libcockatrice/settings/visual_deck_storage_settings.h>
|
||||
|
||||
@@ -115,11 +116,11 @@ VisualDeckStorageQuickSettingsWidget::VisualDeckStorageQuickSettingsWidget(QWidg
|
||||
|
||||
// card size slider
|
||||
cardSizeWidget =
|
||||
new CardSizeWidget(this, nullptr, SettingsCache::instance().visualDeckStorage().getVisualDeckStorageCardSize());
|
||||
new CardSizeWidget(this, nullptr, SettingsCache::instance().cardsDisplay().getVisualDeckStorageCardSize());
|
||||
connect(cardSizeWidget->getSlider(), &QSlider::valueChanged, this,
|
||||
&VisualDeckStorageQuickSettingsWidget::cardSizeChanged);
|
||||
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().visualDeckStorage(),
|
||||
&VisualDeckStorageSettings::setVisualDeckStorageCardSize);
|
||||
connect(cardSizeWidget, &CardSizeWidget::cardSizeSettingUpdated, &SettingsCache::instance().cardsDisplay(),
|
||||
&CardsDisplaySettings::setVisualDeckStorageCardSize);
|
||||
|
||||
// putting everything together
|
||||
this->addSettingsWidget(showFoldersCheckBox);
|
||||
|
||||
@@ -70,7 +70,9 @@
|
||||
#include <libcockatrice/settings/cache_storage_settings.h>
|
||||
#include <libcockatrice/settings/debug_settings.h>
|
||||
#include <libcockatrice/settings/download_settings.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <libcockatrice/settings/layouts_settings.h>
|
||||
#include <libcockatrice/settings/network_settings.h>
|
||||
#include <libcockatrice/settings/paths_settings.h>
|
||||
#include <libcockatrice/settings/personal_settings.h>
|
||||
#include <libcockatrice/settings/servers_settings.h>
|
||||
@@ -391,9 +393,9 @@ void MainWindow::createActions()
|
||||
connect(aCheckCardUpdatesBackground, &QAction::triggered, this, &MainWindow::actCheckCardUpdatesBackground);
|
||||
aStatusBar = new QAction(this);
|
||||
aStatusBar->setCheckable(true);
|
||||
aStatusBar->setChecked(SettingsCache::instance().personal().getShowStatusBar());
|
||||
connect(aStatusBar, &QAction::triggered, &SettingsCache::instance().personal(),
|
||||
&PersonalSettings::setShowStatusBar);
|
||||
aStatusBar->setChecked(SettingsCache::instance().userInterface().getShowStatusBar());
|
||||
connect(aStatusBar, &QAction::triggered, &SettingsCache::instance().userInterface(),
|
||||
&InterfaceSettings::setShowStatusBar);
|
||||
aViewLog = new QAction(this);
|
||||
connect(aViewLog, &QAction::triggered, this, &MainWindow::actViewLog);
|
||||
aOpenSettingsFolder = new QAction(this);
|
||||
@@ -518,9 +520,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
}
|
||||
|
||||
// status bar
|
||||
connect(&SettingsCache::instance().personal(), &PersonalSettings::showStatusBarChanged, this,
|
||||
connect(&SettingsCache::instance().userInterface(), &InterfaceSettings::showStatusBarChanged, this,
|
||||
[this](bool show) { statusBar()->setVisible(show); });
|
||||
statusBar()->setVisible(SettingsCache::instance().personal().getShowStatusBar());
|
||||
statusBar()->setVisible(SettingsCache::instance().userInterface().getShowStatusBar());
|
||||
|
||||
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
|
||||
&MainWindow::refreshShortcuts);
|
||||
@@ -557,23 +559,23 @@ void MainWindow::startupConfigCheck()
|
||||
actCheckClientUpdates();
|
||||
}
|
||||
|
||||
if (SettingsCache::instance().personal().getClientVersion() == CLIENT_INFO_NOT_SET) {
|
||||
if (SettingsCache::instance().network().getClientVersion() == CLIENT_INFO_NOT_SET) {
|
||||
// no config found, 99% new clean install
|
||||
qCInfo(WindowMainStartupVersionLog)
|
||||
<< "Startup: old client version empty, assuming first start after clean install";
|
||||
alertForcedOracleRun(VERSION_STRING, false);
|
||||
SettingsCache::instance().downloads().resetToDefaultURLs(); // populate the download urls
|
||||
SettingsCache::instance().personal().setClientVersion(VERSION_STRING);
|
||||
SettingsCache::instance().network().setClientVersion(VERSION_STRING);
|
||||
|
||||
if (QString(VERSION_STRING).contains("custom", Qt::CaseInsensitive)) {
|
||||
SettingsCache::instance().updates().setCheckUpdatesOnStartup(false);
|
||||
} else if (QString(VERSION_STRING).contains("beta", Qt::CaseInsensitive)) {
|
||||
SettingsCache::instance().updates().setUpdateReleaseChannelIndex(1);
|
||||
}
|
||||
} else if (SettingsCache::instance().personal().getClientVersion() != VERSION_STRING) {
|
||||
} else if (SettingsCache::instance().network().getClientVersion() != VERSION_STRING) {
|
||||
// config found, from another (presumably older) version
|
||||
qCInfo(WindowMainStartupVersionLog)
|
||||
<< "Startup: old client version" << SettingsCache::instance().personal().getClientVersion()
|
||||
<< "Startup: old client version" << SettingsCache::instance().network().getClientVersion()
|
||||
<< "differs, assuming first start after update";
|
||||
if (SettingsCache::instance().updates().getNotifyAboutNewVersion()) {
|
||||
alertForcedOracleRun(VERSION_STRING, true);
|
||||
@@ -598,7 +600,7 @@ void MainWindow::startupConfigCheck()
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCache::instance().personal().setClientVersion(VERSION_STRING);
|
||||
SettingsCache::instance().network().setClientVersion(VERSION_STRING);
|
||||
} else {
|
||||
// previous config from this version found
|
||||
qCInfo(WindowMainStartupVersionLog) << "Startup: found config with current version";
|
||||
|
||||
@@ -47,8 +47,11 @@
|
||||
#include <QTranslator>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
#include <libcockatrice/rng/rng_sfmt.h>
|
||||
#include <libcockatrice/settings/appearance_settings.h>
|
||||
#include <libcockatrice/settings/card_database_settings.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <libcockatrice/settings/network_settings.h>
|
||||
#include <libcockatrice/settings/personal_settings.h>
|
||||
|
||||
QTranslator *translator, *qtTranslator;
|
||||
@@ -349,7 +352,7 @@ int main(int argc, char *argv[])
|
||||
// set name of the app desktop file; used by wayland to load the window icon
|
||||
QGuiApplication::setDesktopFileName("cockatrice");
|
||||
|
||||
SettingsCache::instance().personal().setClientID(generateClientID());
|
||||
SettingsCache::instance().network().setClientID(generateClientID());
|
||||
|
||||
// If spoiler mode is enabled, we will download the spoilers
|
||||
// then reload the DB. otherwise just reload the DB
|
||||
@@ -360,7 +363,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// force shortcuts to be shown/hidden in right-click menus, regardless of system defaults
|
||||
qApp->setAttribute(Qt::AA_DontShowShortcutsInContextMenus,
|
||||
!SettingsCache::instance().cardsDisplay().getShowShortcuts());
|
||||
!SettingsCache::instance().userInterface().getShowShortcuts());
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
for (const QString &url : pendingMacUrls) {
|
||||
|
||||
@@ -9,6 +9,7 @@ set(HEADERS
|
||||
libcockatrice/interfaces/interface_card_set_priority_controller.h
|
||||
libcockatrice/interfaces/interface_cards_display_settings_provider.h
|
||||
libcockatrice/interfaces/interface_chat_settings_provider.h
|
||||
libcockatrice/interfaces/interface_deck_editor_settings_provider.h
|
||||
libcockatrice/interfaces/interface_game_settings_provider.h
|
||||
libcockatrice/interfaces/interface_interface_settings_provider.h
|
||||
libcockatrice/interfaces/interface_network_settings_provider.h
|
||||
|
||||
@@ -14,15 +14,17 @@ public:
|
||||
[[nodiscard]] virtual int getPrintingSelectorCardSize() const = 0;
|
||||
[[nodiscard]] virtual bool getIncludeRebalancedCards() const = 0;
|
||||
[[nodiscard]] virtual bool getPrintingSelectorNavigationButtonsVisible() const = 0;
|
||||
[[nodiscard]] virtual bool getDeckEditorBannerCardComboBoxVisible() const = 0;
|
||||
[[nodiscard]] virtual bool getDeckEditorTagsWidgetVisible() const = 0;
|
||||
[[nodiscard]] virtual bool getTapAnimation() const = 0;
|
||||
[[nodiscard]] virtual bool getAutoRotateSidewaysLayoutCards() const = 0;
|
||||
[[nodiscard]] virtual bool getScaleCards() const = 0;
|
||||
[[nodiscard]] virtual int getStackCardOverlapPercent() const = 0;
|
||||
[[nodiscard]] virtual int getCardInfoViewMode() const = 0;
|
||||
[[nodiscard]] virtual bool getShowShortcuts() const = 0;
|
||||
[[nodiscard]] virtual bool getShowGameSelectorFilterToolbar() const = 0;
|
||||
[[nodiscard]] virtual int getVisualDeckStorageCardSize() const = 0;
|
||||
[[nodiscard]] virtual int getVisualDatabaseDisplayCardSize() const = 0;
|
||||
[[nodiscard]] virtual int getVisualDeckEditorCardSize() const = 0;
|
||||
[[nodiscard]] virtual int getEDHRecCardSize() const = 0;
|
||||
[[nodiscard]] virtual int getArchidektPreviewSize() const = 0;
|
||||
[[nodiscard]] virtual int getSampleHandSize() const = 0;
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_INTERFACE_CARDS_DISPLAY_SETTINGS_PROVIDER_H
|
||||
|
||||
@@ -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
|
||||
@@ -29,15 +29,15 @@ public:
|
||||
[[nodiscard]] virtual bool getHorizontalHand() const = 0;
|
||||
[[nodiscard]] virtual bool getInvertVerticalCoordinate() const = 0;
|
||||
[[nodiscard]] virtual int getMinPlayersForMultiColumnLayout() const = 0;
|
||||
[[nodiscard]] virtual bool getOpenDeckInNewTab() const = 0;
|
||||
[[nodiscard]] virtual int getRewindBufferingMs() const = 0;
|
||||
[[nodiscard]] virtual qreal getFastForwardSpeed() const = 0;
|
||||
[[nodiscard]] virtual bool getStyleUserList() const = 0;
|
||||
[[nodiscard]] virtual bool getLeftJustified() const = 0;
|
||||
[[nodiscard]] virtual int getZoneViewGroupByIndex() const = 0;
|
||||
[[nodiscard]] virtual int getZoneViewSortByIndex() const = 0;
|
||||
[[nodiscard]] virtual bool getZoneViewPileView() const = 0;
|
||||
[[nodiscard]] virtual QString getKnownMissingFeatures() = 0;
|
||||
[[nodiscard]] virtual bool getShowStatusBar() const = 0;
|
||||
[[nodiscard]] virtual bool getShowShortcuts() const = 0;
|
||||
[[nodiscard]] virtual bool getShowGameSelectorFilterToolbar() const = 0;
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_INTERFACE_INTERFACE_SETTINGS_PROVIDER_H
|
||||
|
||||
@@ -11,20 +11,8 @@ public:
|
||||
virtual ~IPersonalSettingsProvider() = default;
|
||||
|
||||
[[nodiscard]] virtual QString getLang() const = 0;
|
||||
[[nodiscard]] virtual QString getClientID() = 0;
|
||||
[[nodiscard]] virtual QString getClientVersion() = 0;
|
||||
[[nodiscard]] virtual int getKeepAlive() const = 0;
|
||||
[[nodiscard]] virtual int getTimeOut() const = 0;
|
||||
[[nodiscard]] virtual bool getPicDownload() const = 0;
|
||||
[[nodiscard]] virtual bool getShowStatusBar() const = 0;
|
||||
[[nodiscard]] virtual int getMaxFontSize() const = 0;
|
||||
[[nodiscard]] virtual QString getHighlightWords() const = 0;
|
||||
[[nodiscard]] virtual QString getHomeTabBackgroundSource() const = 0;
|
||||
[[nodiscard]] virtual int getHomeTabBackgroundShuffleFrequency() const = 0;
|
||||
[[nodiscard]] virtual bool getHomeTabDisplayCardName() const = 0;
|
||||
[[nodiscard]] virtual bool getShowTipsOnStartup() const = 0;
|
||||
[[nodiscard]] virtual QList<int> getSeenTips() const = 0;
|
||||
[[nodiscard]] virtual bool getDownloadSpoilersStatus() const = 0;
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_INTERFACE_PERSONAL_SETTINGS_PROVIDER_H
|
||||
|
||||
@@ -16,7 +16,6 @@ public:
|
||||
[[nodiscard]] virtual bool getVisualDeckStorageShowColorIdentity() const = 0;
|
||||
[[nodiscard]] virtual bool getVisualDeckStorageShowBannerCardComboBox() const = 0;
|
||||
[[nodiscard]] virtual bool getVisualDeckStorageShowTagsOnDeckPreviews() const = 0;
|
||||
[[nodiscard]] virtual int getVisualDeckStorageCardSize() const = 0;
|
||||
[[nodiscard]] virtual bool getVisualDeckStorageDrawUnusedColorIdentities() const = 0;
|
||||
[[nodiscard]] virtual int getVisualDeckStorageUnusedColorIdentitiesOpacity() const = 0;
|
||||
[[nodiscard]] virtual int getVisualDeckStorageTooltipType() const = 0;
|
||||
@@ -24,14 +23,8 @@ public:
|
||||
[[nodiscard]] virtual bool getVisualDeckStorageAlwaysConvert() const = 0;
|
||||
[[nodiscard]] virtual bool getVisualDeckStorageInGame() const = 0;
|
||||
[[nodiscard]] virtual bool getVisualDeckStorageSelectionAnimation() const = 0;
|
||||
[[nodiscard]] virtual int getVisualDeckEditorCardSize() const = 0;
|
||||
[[nodiscard]] virtual int getVisualDeckEditorSampleHandSize() const = 0;
|
||||
[[nodiscard]] virtual int getVisualDatabaseDisplayCardSize() const = 0;
|
||||
[[nodiscard]] virtual bool getVisualDatabaseDisplayFilterToMostRecentSetsEnabled() const = 0;
|
||||
[[nodiscard]] virtual int getVisualDatabaseDisplayFilterToMostRecentSetsAmount() const = 0;
|
||||
[[nodiscard]] virtual int getEDHRecCardSize() const = 0;
|
||||
[[nodiscard]] virtual int getArchidektPreviewSize() const = 0;
|
||||
[[nodiscard]] virtual int getDefaultDeckEditorType() const = 0;
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_INTERFACE_VISUAL_DECK_STORAGE_SETTINGS_PROVIDER_H
|
||||
|
||||
@@ -3,18 +3,21 @@ set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(HEADERS
|
||||
libcockatrice/settings/appearance_settings.h
|
||||
libcockatrice/settings/cache_storage_settings.h
|
||||
libcockatrice/settings/card_database_settings.h
|
||||
libcockatrice/settings/card_override_settings.h
|
||||
libcockatrice/settings/cards_display_settings.h
|
||||
libcockatrice/settings/chat_settings.h
|
||||
libcockatrice/settings/debug_settings.h
|
||||
libcockatrice/settings/deck_editor_settings.h
|
||||
libcockatrice/settings/download_settings.h
|
||||
libcockatrice/settings/game_filters_settings.h
|
||||
libcockatrice/settings/game_settings.h
|
||||
libcockatrice/settings/interface_settings.h
|
||||
libcockatrice/settings/layouts_settings.h
|
||||
libcockatrice/settings/message_settings.h
|
||||
libcockatrice/settings/network_settings.h
|
||||
libcockatrice/settings/paths_settings.h
|
||||
libcockatrice/settings/personal_settings.h
|
||||
libcockatrice/settings/recents_settings.h
|
||||
@@ -32,18 +35,21 @@ qt6_wrap_cpp(MOC_SOURCES ${HEADERS})
|
||||
add_library(
|
||||
libcockatrice_settings STATIC
|
||||
${MOC_SOURCES}
|
||||
libcockatrice/settings/appearance_settings.cpp
|
||||
libcockatrice/settings/cache_storage_settings.cpp
|
||||
libcockatrice/settings/card_database_settings.cpp
|
||||
libcockatrice/settings/card_override_settings.cpp
|
||||
libcockatrice/settings/cards_display_settings.cpp
|
||||
libcockatrice/settings/chat_settings.cpp
|
||||
libcockatrice/settings/debug_settings.cpp
|
||||
libcockatrice/settings/deck_editor_settings.cpp
|
||||
libcockatrice/settings/download_settings.cpp
|
||||
libcockatrice/settings/game_filters_settings.cpp
|
||||
libcockatrice/settings/game_settings.cpp
|
||||
libcockatrice/settings/interface_settings.cpp
|
||||
libcockatrice/settings/layouts_settings.cpp
|
||||
libcockatrice/settings/message_settings.cpp
|
||||
libcockatrice/settings/network_settings.cpp
|
||||
libcockatrice/settings/paths_settings.cpp
|
||||
libcockatrice/settings/personal_settings.cpp
|
||||
libcockatrice/settings/recents_settings.cpp
|
||||
|
||||
@@ -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
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "cache_storage_settings.h"
|
||||
|
||||
CacheStorageSettings::CacheStorageSettings(const QString &settingPath, QObject *parent)
|
||||
: SettingsManager(settingPath + "cache_storage.ini", "personal", QString(), parent)
|
||||
: SettingsManager(settingPath + "cache_storage.ini", "cache_storage", QString(), parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ CardDatabaseSettings::CardDatabaseSettings(const QString &settingPath, QObject *
|
||||
|
||||
void CardDatabaseSettings::setSortKey(QString shortName, unsigned int sortKey)
|
||||
{
|
||||
setValue(sortKey, "sortkey", "sets", shortName);
|
||||
setValue(sortKey, "sortKey", "sets", shortName);
|
||||
QMutexLocker lock(&setOptionsMutex);
|
||||
ensureSetOptionsLoaded();
|
||||
setOptionsCache[shortName].sortKey = sortKey;
|
||||
@@ -25,7 +25,7 @@ void CardDatabaseSettings::setEnabled(QString shortName, bool enabled)
|
||||
|
||||
void CardDatabaseSettings::setIsKnown(QString shortName, bool isknown)
|
||||
{
|
||||
setValue(isknown, "isknown", "sets", shortName);
|
||||
setValue(isknown, "isKnown", "sets", shortName);
|
||||
QMutexLocker lock(&setOptionsMutex);
|
||||
ensureSetOptionsLoaded();
|
||||
setOptionsCache[shortName].isKnown = isknown;
|
||||
@@ -42,9 +42,9 @@ void CardDatabaseSettings::ensureSetOptionsLoaded() const
|
||||
for (const QString &group : groups) {
|
||||
settings.beginGroup(group);
|
||||
SetOptions &o = setOptionsCache[group];
|
||||
o.sortKey = settings.value("sortkey", 0).toUInt();
|
||||
o.sortKey = settings.value("sortKey", 0).toUInt();
|
||||
o.enabled = settings.value("enabled", true).toBool();
|
||||
o.isKnown = settings.value("isknown", true).toBool();
|
||||
o.isKnown = settings.value("isKnown", true).toBool();
|
||||
settings.endGroup();
|
||||
}
|
||||
setOptionsLoaded = true;
|
||||
@@ -84,7 +84,7 @@ void CardDatabaseSettings::saveSets(const QVector<ICardSetPriorityController::Se
|
||||
s.beginGroup("sets");
|
||||
for (const auto &entry : data) {
|
||||
s.beginGroup(entry.shortName);
|
||||
s.setValue("sortkey", entry.sortKey);
|
||||
s.setValue("sortKey", entry.sortKey);
|
||||
s.setValue("enabled", entry.enabled);
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
@@ -7,32 +7,32 @@ CardsDisplaySettings::CardsDisplaySettings(const QString &settingPath, QObject *
|
||||
|
||||
bool CardsDisplaySettings::getDisplayCardNames() const
|
||||
{
|
||||
return getValue("displaycardnames", QString(), QString(), true).toBool();
|
||||
return getValue("displayCardNames", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool CardsDisplaySettings::getRoundCardCorners() const
|
||||
{
|
||||
return getValue("roundcardcorners", QString(), QString(), true).toBool();
|
||||
return getValue("roundCardCorners", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool CardsDisplaySettings::getOverrideAllCardArtWithPersonalPreference() const
|
||||
{
|
||||
return getValue("overrideallcardartwithpersonalpreference", QString(), QString(), false).toBool();
|
||||
return getValue("overrideAllCardArtWithPersonalPreference", QString(), QString(), false).toBool();
|
||||
}
|
||||
|
||||
bool CardsDisplaySettings::getBumpSetsWithCardsInDeckToTop() const
|
||||
{
|
||||
return getValue("bumpsetswithcardsindecktotop", QString(), QString(), true).toBool();
|
||||
return getValue("bumpSetsWithCardsInDeckToTop", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
int CardsDisplaySettings::getPrintingSelectorSortOrder() const
|
||||
{
|
||||
return getValue("printingselectorsortorder", QString(), QString(), 1).toInt();
|
||||
return getValue("sortOrder", "cards", "printingSelector", 1).toInt();
|
||||
}
|
||||
|
||||
int CardsDisplaySettings::getPrintingSelectorCardSize() const
|
||||
{
|
||||
return getValue("printingselectorcardsize", QString(), QString(), 100).toInt();
|
||||
return getValue("printingSelector", "cards", "cardSize", 100).toInt();
|
||||
}
|
||||
|
||||
bool CardsDisplaySettings::getIncludeRebalancedCards() const
|
||||
@@ -42,27 +42,17 @@ bool CardsDisplaySettings::getIncludeRebalancedCards() const
|
||||
|
||||
bool CardsDisplaySettings::getPrintingSelectorNavigationButtonsVisible() const
|
||||
{
|
||||
return getValue("printingselectornavigationbuttonsvisible", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool CardsDisplaySettings::getDeckEditorBannerCardComboBoxVisible() const
|
||||
{
|
||||
return getValue("deckeditorbannercardcomboboxvisible", "interface", QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool CardsDisplaySettings::getDeckEditorTagsWidgetVisible() const
|
||||
{
|
||||
return getValue("deckeditortagswidgetvisible", "interface", QString(), true).toBool();
|
||||
return getValue("navigationButtonsVisible", "cards", "printingSelector", true).toBool();
|
||||
}
|
||||
|
||||
bool CardsDisplaySettings::getTapAnimation() const
|
||||
{
|
||||
return getValue("tapanimation", QString(), QString(), true).toBool();
|
||||
return getValue("tapAnimation", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool CardsDisplaySettings::getAutoRotateSidewaysLayoutCards() const
|
||||
{
|
||||
return getValue("autorotatesidewayslayoutcards", QString(), QString(), true).toBool();
|
||||
return getValue("autoRotateSidewaysLayoutCards", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool CardsDisplaySettings::getScaleCards() const
|
||||
@@ -77,22 +67,42 @@ int CardsDisplaySettings::getStackCardOverlapPercent() const
|
||||
|
||||
int CardsDisplaySettings::getCardInfoViewMode() const
|
||||
{
|
||||
return getValue("cardinfoviewmode", QString(), QString(), 0).toInt();
|
||||
return getValue("cardInfoViewMode", QString(), QString(), 0).toInt();
|
||||
}
|
||||
|
||||
bool CardsDisplaySettings::getShowShortcuts() const
|
||||
int CardsDisplaySettings::getVisualDeckStorageCardSize() const
|
||||
{
|
||||
return getValue("showshortcuts", "menu", QString(), true).toBool();
|
||||
return getValue("visualDeckStorage", "cards", "cardSize", 100).toInt();
|
||||
}
|
||||
|
||||
bool CardsDisplaySettings::getShowGameSelectorFilterToolbar() const
|
||||
int CardsDisplaySettings::getVisualDatabaseDisplayCardSize() const
|
||||
{
|
||||
return getValue("showgameselectorfiltertoolbar", "menu", QString(), true).toBool();
|
||||
return getValue("visualDatabaseDisplay", "cards", "cardSize", 100).toInt();
|
||||
}
|
||||
|
||||
int CardsDisplaySettings::getVisualDeckEditorCardSize() const
|
||||
{
|
||||
return getValue("visualDeckEditor", "cards", "cardSize", 100).toInt();
|
||||
}
|
||||
|
||||
int CardsDisplaySettings::getEDHRecCardSize() const
|
||||
{
|
||||
return getValue("edhrec", "cards", "cardSize", 100).toInt();
|
||||
}
|
||||
|
||||
int CardsDisplaySettings::getArchidektPreviewSize() const
|
||||
{
|
||||
return getValue("archidektPreview", "cards", "cardSize", 100).toInt();
|
||||
}
|
||||
|
||||
int CardsDisplaySettings::getSampleHandSize() const
|
||||
{
|
||||
return getValue("sampleHandSize", "cards", "cardSize", 7).toInt();
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setDisplayCardNames(bool _displayCardNames)
|
||||
{
|
||||
setValue(_displayCardNames, "displaycardnames");
|
||||
setValue(_displayCardNames, "displayCardNames");
|
||||
emit displayCardNamesChanged();
|
||||
}
|
||||
|
||||
@@ -101,31 +111,31 @@ void CardsDisplaySettings::setRoundCardCorners(bool _roundCardCorners)
|
||||
if (_roundCardCorners == getRoundCardCorners()) {
|
||||
return;
|
||||
}
|
||||
setValue(_roundCardCorners, "roundcardcorners");
|
||||
setValue(_roundCardCorners, "roundCardCorners");
|
||||
emit roundCardCornersChanged(_roundCardCorners);
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setOverrideAllCardArtWithPersonalPreference(bool _overrideAllCardArt)
|
||||
{
|
||||
setValue(_overrideAllCardArt, "overrideallcardartwithpersonalpreference");
|
||||
setValue(_overrideAllCardArt, "overrideAllCardArtWithPersonalPreference");
|
||||
emit overrideAllCardArtWithPersonalPreferenceChanged(_overrideAllCardArt);
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setBumpSetsWithCardsInDeckToTop(bool _bumpSetsWithCardsInDeckToTop)
|
||||
{
|
||||
setValue(_bumpSetsWithCardsInDeckToTop, "bumpsetswithcardsindecktotop");
|
||||
setValue(_bumpSetsWithCardsInDeckToTop, "bumpSetsWithCardsInDeckToTop");
|
||||
emit bumpSetsWithCardsInDeckToTopChanged();
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setPrintingSelectorSortOrder(int _printingSelectorSortOrder)
|
||||
{
|
||||
setValue(_printingSelectorSortOrder, "printingselectorsortorder");
|
||||
setValue(_printingSelectorSortOrder, "sortOrder", "cards", "printingSelector");
|
||||
emit printingSelectorSortOrderChanged();
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setPrintingSelectorCardSize(int _printingSelectorCardSize)
|
||||
{
|
||||
setValue(_printingSelectorCardSize, "printingselectorcardsize");
|
||||
setValue(_printingSelectorCardSize, "printingSelector", "cards", "cardSize");
|
||||
emit printingSelectorCardSizeChanged();
|
||||
}
|
||||
|
||||
@@ -140,30 +150,18 @@ void CardsDisplaySettings::setIncludeRebalancedCards(bool _includeRebalancedCard
|
||||
|
||||
void CardsDisplaySettings::setPrintingSelectorNavigationButtonsVisible(bool _navigationButtonsVisible)
|
||||
{
|
||||
setValue(_navigationButtonsVisible, "printingselectornavigationbuttonsvisible");
|
||||
setValue(_navigationButtonsVisible, "navigationButtonsVisible", "cards", "printingSelector");
|
||||
emit printingSelectorNavigationButtonsVisibleChanged();
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setDeckEditorBannerCardComboBoxVisible(bool _deckEditorBannerCardComboBoxVisible)
|
||||
{
|
||||
setValue(_deckEditorBannerCardComboBoxVisible, "deckeditorbannercardcomboboxvisible", "interface");
|
||||
emit deckEditorBannerCardComboBoxVisibleChanged(_deckEditorBannerCardComboBoxVisible);
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setDeckEditorTagsWidgetVisible(bool _deckEditorTagsWidgetVisible)
|
||||
{
|
||||
setValue(_deckEditorTagsWidgetVisible, "deckeditortagswidgetvisible", "interface");
|
||||
emit deckEditorTagsWidgetVisibleChanged(_deckEditorTagsWidgetVisible);
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setTapAnimation(bool _tapAnimation)
|
||||
{
|
||||
setValue(_tapAnimation, "tapanimation");
|
||||
setValue(_tapAnimation, "tapAnimation");
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setAutoRotateSidewaysLayoutCards(bool _autoRotateSidewaysLayoutCards)
|
||||
{
|
||||
setValue(_autoRotateSidewaysLayoutCards, "autorotatesidewayslayoutcards");
|
||||
setValue(_autoRotateSidewaysLayoutCards, "autoRotateSidewaysLayoutCards");
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setCardScaling(bool _scaleCards)
|
||||
@@ -178,16 +176,41 @@ void CardsDisplaySettings::setStackCardOverlapPercent(int _verticalCardOverlapPe
|
||||
|
||||
void CardsDisplaySettings::setCardInfoViewMode(int _viewMode)
|
||||
{
|
||||
setValue(_viewMode, "cardinfoviewmode");
|
||||
setValue(_viewMode, "cardInfoViewMode");
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setShowShortcuts(bool _showShortcuts)
|
||||
void CardsDisplaySettings::setVisualDeckStorageCardSize(int _cardSize)
|
||||
{
|
||||
setValue(_showShortcuts, "showshortcuts", "menu");
|
||||
setValue(_cardSize, "visualDeckStorage", "cards", "cardSize");
|
||||
emit visualDeckStorageCardSizeChanged();
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setShowGameSelectorFilterToolbar(bool _showGameSelectorFilterToolbar)
|
||||
void CardsDisplaySettings::setVisualDatabaseDisplayCardSize(int _cardSize)
|
||||
{
|
||||
setValue(_showGameSelectorFilterToolbar, "showgameselectorfiltertoolbar", "menu");
|
||||
emit showGameSelectorFilterToolbarChanged(_showGameSelectorFilterToolbar);
|
||||
setValue(_cardSize, "visualDatabaseDisplay", "cards", "cardSize");
|
||||
emit visualDatabaseDisplayCardSizeChanged();
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setVisualDeckEditorCardSize(int _cardSize)
|
||||
{
|
||||
setValue(_cardSize, "visualDeckEditor", "cards", "cardSize");
|
||||
emit visualDeckEditorCardSizeChanged();
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setEDHRecCardSize(int _edhrecCardSize)
|
||||
{
|
||||
setValue(_edhrecCardSize, "edhrec", "cards", "cardSize");
|
||||
emit edhRecCardSizeChanged();
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setArchidektPreviewCardSize(int _archidektPreviewCardSize)
|
||||
{
|
||||
setValue(_archidektPreviewCardSize, "archidektPreview", "cards", "cardSize");
|
||||
emit archidektPreviewSizeChanged();
|
||||
}
|
||||
|
||||
void CardsDisplaySettings::setSampleHandSize(int _sampleHandSize)
|
||||
{
|
||||
setValue(_sampleHandSize, "sampleHandSize", "cards", "cardSize");
|
||||
emit sampleHandSizeChanged(_sampleHandSize);
|
||||
}
|
||||
|
||||
@@ -19,15 +19,17 @@ public:
|
||||
[[nodiscard]] int getPrintingSelectorCardSize() const override;
|
||||
[[nodiscard]] bool getIncludeRebalancedCards() const override;
|
||||
[[nodiscard]] bool getPrintingSelectorNavigationButtonsVisible() const override;
|
||||
[[nodiscard]] bool getDeckEditorBannerCardComboBoxVisible() const override;
|
||||
[[nodiscard]] bool getDeckEditorTagsWidgetVisible() const override;
|
||||
[[nodiscard]] bool getTapAnimation() const override;
|
||||
[[nodiscard]] bool getAutoRotateSidewaysLayoutCards() const override;
|
||||
[[nodiscard]] bool getScaleCards() const override;
|
||||
[[nodiscard]] int getStackCardOverlapPercent() const override;
|
||||
[[nodiscard]] int getCardInfoViewMode() const override;
|
||||
[[nodiscard]] bool getShowShortcuts() const override;
|
||||
[[nodiscard]] bool getShowGameSelectorFilterToolbar() const override;
|
||||
[[nodiscard]] int getVisualDeckStorageCardSize() const override;
|
||||
[[nodiscard]] int getVisualDatabaseDisplayCardSize() const override;
|
||||
[[nodiscard]] int getVisualDeckEditorCardSize() const override;
|
||||
[[nodiscard]] int getEDHRecCardSize() const override;
|
||||
[[nodiscard]] int getArchidektPreviewSize() const override;
|
||||
[[nodiscard]] int getSampleHandSize() const override;
|
||||
|
||||
void setDisplayCardNames(bool _displayCardNames);
|
||||
void setRoundCardCorners(bool _roundCardCorners);
|
||||
@@ -37,15 +39,17 @@ public:
|
||||
void setPrintingSelectorCardSize(int _printingSelectorCardSize);
|
||||
void setIncludeRebalancedCards(bool _includeRebalancedCards);
|
||||
void setPrintingSelectorNavigationButtonsVisible(bool _navigationButtonsVisible);
|
||||
void setDeckEditorBannerCardComboBoxVisible(bool _deckEditorBannerCardComboBoxVisible);
|
||||
void setDeckEditorTagsWidgetVisible(bool _deckEditorTagsWidgetVisible);
|
||||
void setTapAnimation(bool _tapAnimation);
|
||||
void setAutoRotateSidewaysLayoutCards(bool _autoRotateSidewaysLayoutCards);
|
||||
void setCardScaling(bool _scaleCards);
|
||||
void setStackCardOverlapPercent(int _verticalCardOverlapPercent);
|
||||
void setCardInfoViewMode(int _viewMode);
|
||||
void setShowShortcuts(bool _showShortcuts);
|
||||
void setShowGameSelectorFilterToolbar(bool _showGameSelectorFilterToolbar);
|
||||
void setVisualDeckStorageCardSize(int _cardSize);
|
||||
void setVisualDatabaseDisplayCardSize(int _cardSize);
|
||||
void setVisualDeckEditorCardSize(int _cardSize);
|
||||
void setEDHRecCardSize(int _edhrecCardSize);
|
||||
void setArchidektPreviewCardSize(int _archidektPreviewCardSize);
|
||||
void setSampleHandSize(int _sampleHandSize);
|
||||
|
||||
signals:
|
||||
void displayCardNamesChanged();
|
||||
@@ -56,12 +60,17 @@ signals:
|
||||
void printingSelectorCardSizeChanged();
|
||||
void includeRebalancedCardsChanged(bool _includeRebalancedCards);
|
||||
void printingSelectorNavigationButtonsVisibleChanged();
|
||||
void deckEditorBannerCardComboBoxVisibleChanged(bool _visible);
|
||||
void deckEditorTagsWidgetVisibleChanged(bool _visible);
|
||||
void showGameSelectorFilterToolbarChanged(bool state);
|
||||
void visualDeckStorageCardSizeChanged();
|
||||
void visualDatabaseDisplayCardSizeChanged();
|
||||
void visualDeckEditorCardSizeChanged();
|
||||
void edhRecCardSizeChanged();
|
||||
void archidektPreviewSizeChanged();
|
||||
void sampleHandSizeChanged(int amount);
|
||||
|
||||
public:
|
||||
explicit CardsDisplaySettings(const QString &settingPath, QObject *parent = nullptr);
|
||||
|
||||
private:
|
||||
explicit CardsDisplaySettings(const QString &settingPath, QObject *parent = nullptr);
|
||||
CardsDisplaySettings(const CardsDisplaySettings & /*other*/);
|
||||
};
|
||||
|
||||
|
||||
@@ -12,62 +12,62 @@ bool ChatSettings::getChatMention() const
|
||||
|
||||
bool ChatSettings::getChatMentionCompleter() const
|
||||
{
|
||||
return getValue("mentioncompleter", QString(), QString(), true).toBool();
|
||||
return getValue("mentionCompleter", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
QString ChatSettings::getChatMentionColor() const
|
||||
{
|
||||
return getValue("mentioncolor", QString(), QString(), "A6120D").toString();
|
||||
return getValue("mentionColor", QString(), QString(), "A6120D").toString();
|
||||
}
|
||||
|
||||
QString ChatSettings::getChatHighlightColor() const
|
||||
{
|
||||
return getValue("highlightcolor", QString(), QString(), "A6120D").toString();
|
||||
return getValue("highlightColor", QString(), QString(), "A6120D").toString();
|
||||
}
|
||||
|
||||
bool ChatSettings::getChatMentionForeground() const
|
||||
{
|
||||
return getValue("mentionforeground", QString(), QString(), true).toBool();
|
||||
return getValue("mentionForeground", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool ChatSettings::getChatHighlightForeground() const
|
||||
{
|
||||
return getValue("highlightforeground", QString(), QString(), true).toBool();
|
||||
return getValue("highlightForeground", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool ChatSettings::getIgnoreUnregisteredUsers() const
|
||||
{
|
||||
return getValue("ignore_unregistered").toBool();
|
||||
return getValue("ignoreUnregistered").toBool();
|
||||
}
|
||||
|
||||
bool ChatSettings::getIgnoreUnregisteredUserMessages() const
|
||||
{
|
||||
return getValue("ignore_unregistered_messages").toBool();
|
||||
return getValue("ignoreUnregisteredMessages").toBool();
|
||||
}
|
||||
|
||||
bool ChatSettings::getIgnoreNonBuddyUserMessages() const
|
||||
{
|
||||
return getValue("ignore_nonbuddy_messages").toBool();
|
||||
return getValue("ignoreNonBuddyMessages").toBool();
|
||||
}
|
||||
|
||||
bool ChatSettings::getShowMessagePopup() const
|
||||
{
|
||||
return getValue("showmessagepopups", QString(), QString(), true).toBool();
|
||||
return getValue("showMessagePopups", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool ChatSettings::getShowMentionPopup() const
|
||||
{
|
||||
return getValue("showmentionpopups", QString(), QString(), true).toBool();
|
||||
return getValue("showMentionPopups", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool ChatSettings::getRoomHistory() const
|
||||
{
|
||||
return getValue("roomhistory", QString(), QString(), true).toBool();
|
||||
return getValue("roomHistory", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
QString ChatSettings::getHighlightWords() const
|
||||
{
|
||||
return getValue("highlightwords").toString();
|
||||
return getValue("highlightWords").toString();
|
||||
}
|
||||
|
||||
void ChatSettings::setChatMention(bool _chatMention)
|
||||
@@ -77,61 +77,61 @@ void ChatSettings::setChatMention(bool _chatMention)
|
||||
|
||||
void ChatSettings::setChatMentionCompleter(bool _chatMentionCompleter)
|
||||
{
|
||||
setValue(_chatMentionCompleter, "mentioncompleter");
|
||||
setValue(_chatMentionCompleter, "mentionCompleter");
|
||||
emit chatMentionCompleterChanged();
|
||||
}
|
||||
|
||||
void ChatSettings::setChatMentionColor(const QString &_chatMentionColor)
|
||||
{
|
||||
setValue(_chatMentionColor, "mentioncolor");
|
||||
setValue(_chatMentionColor, "mentionColor");
|
||||
}
|
||||
|
||||
void ChatSettings::setChatHighlightColor(const QString &_chatHighlightColor)
|
||||
{
|
||||
setValue(_chatHighlightColor, "highlightcolor");
|
||||
setValue(_chatHighlightColor, "highlightColor");
|
||||
}
|
||||
|
||||
void ChatSettings::setChatMentionForeground(bool _chatMentionForeground)
|
||||
{
|
||||
setValue(_chatMentionForeground, "mentionforeground");
|
||||
setValue(_chatMentionForeground, "mentionForeground");
|
||||
}
|
||||
|
||||
void ChatSettings::setChatHighlightForeground(bool _chatHighlightForeground)
|
||||
{
|
||||
setValue(_chatHighlightForeground, "highlightforeground");
|
||||
setValue(_chatHighlightForeground, "highlightForeground");
|
||||
}
|
||||
|
||||
void ChatSettings::setIgnoreUnregisteredUsers(bool _ignoreUnregisteredUsers)
|
||||
{
|
||||
setValue(_ignoreUnregisteredUsers, "ignore_unregistered");
|
||||
setValue(_ignoreUnregisteredUsers, "ignoreUnregistered");
|
||||
}
|
||||
|
||||
void ChatSettings::setIgnoreUnregisteredUserMessages(bool _ignoreUnregisteredUserMessages)
|
||||
{
|
||||
setValue(_ignoreUnregisteredUserMessages, "ignore_unregistered_messages");
|
||||
setValue(_ignoreUnregisteredUserMessages, "ignoreUnregisteredMessages");
|
||||
}
|
||||
|
||||
void ChatSettings::setIgnoreNonBuddyUserMessages(bool _ignoreNonBuddyUserMessages)
|
||||
{
|
||||
setValue(_ignoreNonBuddyUserMessages, "ignore_nonbuddy_messages");
|
||||
setValue(_ignoreNonBuddyUserMessages, "ignoreNonBuddyMessages");
|
||||
}
|
||||
|
||||
void ChatSettings::setShowMessagePopups(bool _showMessagePopups)
|
||||
{
|
||||
setValue(_showMessagePopups, "showmessagepopups");
|
||||
setValue(_showMessagePopups, "showMessagePopups");
|
||||
}
|
||||
|
||||
void ChatSettings::setShowMentionPopups(bool _showMentionPopups)
|
||||
{
|
||||
setValue(_showMentionPopups, "showmentionpopups");
|
||||
setValue(_showMentionPopups, "showMentionPopups");
|
||||
}
|
||||
|
||||
void ChatSettings::setRoomHistory(bool _roomHistory)
|
||||
{
|
||||
setValue(_roomHistory, "roomhistory");
|
||||
setValue(_roomHistory, "roomHistory");
|
||||
}
|
||||
|
||||
void ChatSettings::setHighlightWords(const QString &_highlightWords)
|
||||
{
|
||||
setValue(_highlightWords, "highlightwords");
|
||||
setValue(_highlightWords, "highlightWords");
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -27,3 +27,25 @@ void DownloadSettings::resetToDefaultURLs()
|
||||
{
|
||||
setValue(QVariant::fromValue(DEFAULT_DOWNLOAD_URLS), "urls");
|
||||
}
|
||||
|
||||
bool DownloadSettings::getPicDownload() const
|
||||
{
|
||||
return getValue("pictureDownload", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
void DownloadSettings::setPicDownload(bool _picDownload)
|
||||
{
|
||||
setValue(_picDownload, "pictureDownload");
|
||||
emit picDownloadChanged();
|
||||
}
|
||||
|
||||
bool DownloadSettings::getDownloadSpoilersStatus() const
|
||||
{
|
||||
return getValue("downloadSpoilers", QString(), QString(), false).toBool();
|
||||
}
|
||||
|
||||
void DownloadSettings::setDownloadSpoilerStatus(bool _spoilerStatus)
|
||||
{
|
||||
setValue(_spoilerStatus, "downloadSpoilers");
|
||||
emit downloadSpoilerStatusChanged();
|
||||
}
|
||||
|
||||
@@ -22,6 +22,14 @@ public:
|
||||
QStringList getAllURLs() const;
|
||||
void setDownloadUrls(const QStringList &downloadURLs);
|
||||
void resetToDefaultURLs();
|
||||
[[nodiscard]] bool getPicDownload() const;
|
||||
void setPicDownload(bool _picDownload);
|
||||
[[nodiscard]] bool getDownloadSpoilersStatus() const;
|
||||
void setDownloadSpoilerStatus(bool _spoilerStatus);
|
||||
|
||||
signals:
|
||||
void picDownloadChanged();
|
||||
void downloadSpoilerStatusChanged();
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_DOWNLOADSETTINGS_H
|
||||
|
||||
@@ -19,137 +19,137 @@ static QString hashGameType(const QString &gameType)
|
||||
|
||||
void GameFiltersSettings::setHideBuddiesOnlyGames(bool hide)
|
||||
{
|
||||
setValue(hide, "hide_buddies_only_games");
|
||||
setValue(hide, "hideBuddiesOnlyGames");
|
||||
}
|
||||
|
||||
bool GameFiltersSettings::isHideBuddiesOnlyGames() const
|
||||
{
|
||||
QVariant previous = getValue("hide_buddies_only_games");
|
||||
QVariant previous = getValue("hideBuddiesOnlyGames");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setHideFullGames(bool hide)
|
||||
{
|
||||
setValue(hide, "hide_full_games");
|
||||
setValue(hide, "hideFullGames");
|
||||
}
|
||||
|
||||
bool GameFiltersSettings::isHideFullGames() const
|
||||
{
|
||||
QVariant previous = getValue("hide_full_games");
|
||||
QVariant previous = getValue("hideFullGames");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setHideGamesThatStarted(bool hide)
|
||||
{
|
||||
setValue(hide, "hide_games_that_started");
|
||||
setValue(hide, "hideGamesThatStarted");
|
||||
}
|
||||
|
||||
bool GameFiltersSettings::isHideGamesThatStarted() const
|
||||
{
|
||||
QVariant previous = getValue("hide_games_that_started");
|
||||
QVariant previous = getValue("hideGamesThatStarted");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setHidePasswordProtectedGames(bool hide)
|
||||
{
|
||||
setValue(hide, "hide_password_protected_games");
|
||||
setValue(hide, "hidePasswordProtectedGames");
|
||||
}
|
||||
|
||||
bool GameFiltersSettings::isHidePasswordProtectedGames() const
|
||||
{
|
||||
QVariant previous = getValue("hide_password_protected_games");
|
||||
QVariant previous = getValue("hidePasswordProtectedGames");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setHideIgnoredUserGames(bool hide)
|
||||
{
|
||||
setValue(hide, "hide_ignored_user_games");
|
||||
setValue(hide, "hideIgnoredUserGames");
|
||||
}
|
||||
|
||||
bool GameFiltersSettings::isHideIgnoredUserGames() const
|
||||
{
|
||||
QVariant previous = getValue("hide_ignored_user_games");
|
||||
QVariant previous = getValue("hideIgnoredUserGames");
|
||||
return previous == QVariant() ? true : previous.toBool();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setHideNotBuddyCreatedGames(bool hide)
|
||||
{
|
||||
setValue(hide, "hide_not_buddy_created_games");
|
||||
setValue(hide, "hideNotBuddyCreatedGames");
|
||||
}
|
||||
|
||||
bool GameFiltersSettings::isHideNotBuddyCreatedGames() const
|
||||
{
|
||||
QVariant previous = getValue("hide_not_buddy_created_games");
|
||||
QVariant previous = getValue("hideNotBuddyCreatedGames");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setHideOpenDecklistGames(bool hide)
|
||||
{
|
||||
setValue(hide, "hide_open_decklist_games");
|
||||
setValue(hide, "hideOpenDecklistGames");
|
||||
}
|
||||
|
||||
bool GameFiltersSettings::isHideOpenDecklistGames() const
|
||||
{
|
||||
QVariant previous = getValue("hide_open_decklist_games");
|
||||
QVariant previous = getValue("hideOpenDecklistGames");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setGameNameFilter(QString gameName)
|
||||
{
|
||||
setValue(gameName, "game_name_filter");
|
||||
setValue(gameName, "gameNameFilter");
|
||||
}
|
||||
|
||||
QString GameFiltersSettings::getGameNameFilter() const
|
||||
{
|
||||
return getValue("game_name_filter").toString();
|
||||
return getValue("gameNameFilter").toString();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setCreatorNameFilters(QStringList creatorName)
|
||||
{
|
||||
setValue(creatorName, "creator_name_filter");
|
||||
setValue(creatorName, "creatorNameFilter");
|
||||
}
|
||||
|
||||
QStringList GameFiltersSettings::getCreatorNameFilters() const
|
||||
{
|
||||
return getValue("creator_name_filter").toStringList();
|
||||
return getValue("creatorNameFilter").toStringList();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setMinPlayers(int min)
|
||||
{
|
||||
setValue(min, "min_players");
|
||||
setValue(min, "minPlayers");
|
||||
}
|
||||
|
||||
int GameFiltersSettings::getMinPlayers() const
|
||||
{
|
||||
QVariant previous = getValue("min_players");
|
||||
QVariant previous = getValue("minPlayers");
|
||||
return previous == QVariant() ? 1 : previous.toInt();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setMaxPlayers(int max)
|
||||
{
|
||||
setValue(max, "max_players");
|
||||
setValue(max, "maxPlayers");
|
||||
}
|
||||
|
||||
int GameFiltersSettings::getMaxPlayers() const
|
||||
{
|
||||
QVariant previous = getValue("max_players");
|
||||
QVariant previous = getValue("maxPlayers");
|
||||
return previous == QVariant() ? 99 : previous.toInt();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setMaxGameAge(const QTime &maxGameAge)
|
||||
{
|
||||
setValue(maxGameAge, "max_game_age_time");
|
||||
setValue(maxGameAge, "maxGameAgeTime");
|
||||
}
|
||||
|
||||
QTime GameFiltersSettings::getMaxGameAge() const
|
||||
{
|
||||
QVariant previous = getValue("max_game_age_time");
|
||||
QVariant previous = getValue("maxGameAgeTime");
|
||||
return previous.toTime();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setGameTypeEnabled(QString gametype, bool enabled)
|
||||
{
|
||||
setValue(enabled, "game_type/" + hashGameType(gametype));
|
||||
setValue(enabled, "gameType/" + hashGameType(gametype));
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setGameHashedTypeEnabled(QString gametypeHASHED, bool enabled)
|
||||
@@ -159,50 +159,50 @@ void GameFiltersSettings::setGameHashedTypeEnabled(QString gametypeHASHED, bool
|
||||
|
||||
bool GameFiltersSettings::isGameTypeEnabled(QString gametype) const
|
||||
{
|
||||
QVariant previous = getValue("game_type/" + hashGameType(gametype));
|
||||
QVariant previous = getValue("gameType/" + hashGameType(gametype));
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setShowOnlyIfSpectatorsCanWatch(bool show)
|
||||
{
|
||||
setValue(show, "show_only_if_spectators_can_watch");
|
||||
setValue(show, "showOnlyIfSpectatorsCanWatch");
|
||||
}
|
||||
|
||||
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanWatch() const
|
||||
{
|
||||
QVariant previous = getValue("show_only_if_spectators_can_watch");
|
||||
QVariant previous = getValue("showOnlyIfSpectatorsCanWatch");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setShowSpectatorPasswordProtected(bool show)
|
||||
{
|
||||
setValue(show, "show_spectator_password_protected");
|
||||
setValue(show, "showSpectatorPasswordProtected");
|
||||
}
|
||||
|
||||
bool GameFiltersSettings::isShowSpectatorPasswordProtected() const
|
||||
{
|
||||
QVariant previous = getValue("show_spectator_password_protected");
|
||||
QVariant previous = getValue("showSpectatorPasswordProtected");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setShowOnlyIfSpectatorsCanChat(bool show)
|
||||
{
|
||||
setValue(show, "show_only_if_spectators_can_chat");
|
||||
setValue(show, "showOnlyIfSpectatorsCanChat");
|
||||
}
|
||||
|
||||
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanChat() const
|
||||
{
|
||||
QVariant previous = getValue("show_only_if_spectators_can_chat");
|
||||
QVariant previous = getValue("showOnlyIfSpectatorsCanChat");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
|
||||
void GameFiltersSettings::setShowOnlyIfSpectatorsCanSeeHands(bool show)
|
||||
{
|
||||
setValue(show, "show_only_if_spectators_can_see_hands");
|
||||
setValue(show, "showOnlyIfSpectatorsCanSeeHands");
|
||||
}
|
||||
|
||||
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanSeeHands() const
|
||||
{
|
||||
QVariant previous = getValue("show_only_if_spectators_can_see_hands");
|
||||
QVariant previous = getValue("showOnlyIfSpectatorsCanSeeHands");
|
||||
return previous == QVariant() ? false : previous.toBool();
|
||||
}
|
||||
@@ -7,160 +7,160 @@ GameSettings::GameSettings(const QString &settingPath, QObject *parent)
|
||||
|
||||
QString GameSettings::getGameDescription() const
|
||||
{
|
||||
return getValue("gamedescription", "game").toString();
|
||||
return getValue("gameDescription", "game").toString();
|
||||
}
|
||||
|
||||
int GameSettings::getMaxPlayers() const
|
||||
{
|
||||
return getValue("maxplayers", "game", QString(), 2).toInt();
|
||||
return getValue("maxPlayers", "game", QString(), 2).toInt();
|
||||
}
|
||||
|
||||
QString GameSettings::getGameTypes() const
|
||||
{
|
||||
return getValue("gametypes", "game").toString();
|
||||
return getValue("gameTypes", "game").toString();
|
||||
}
|
||||
|
||||
bool GameSettings::getOnlyBuddies() const
|
||||
{
|
||||
return getValue("onlybuddies", "game").toBool();
|
||||
return getValue("onlyBuddies", "game").toBool();
|
||||
}
|
||||
|
||||
bool GameSettings::getOnlyRegistered() const
|
||||
{
|
||||
return getValue("onlyregistered", "game").toBool();
|
||||
return getValue("onlyRegistered", "game").toBool();
|
||||
}
|
||||
|
||||
bool GameSettings::getSpectatorsAllowed() const
|
||||
{
|
||||
return getValue("spectatorsallowed", "game").toBool();
|
||||
return getValue("spectatorsAllowed", "game").toBool();
|
||||
}
|
||||
|
||||
bool GameSettings::getSpectatorsNeedPassword() const
|
||||
{
|
||||
return getValue("spectatorsneedpassword", "game").toBool();
|
||||
return getValue("spectatorsNeedPassword", "game").toBool();
|
||||
}
|
||||
|
||||
bool GameSettings::getSpectatorsCanTalk() const
|
||||
{
|
||||
return getValue("spectatorscantalk", "game").toBool();
|
||||
return getValue("spectatorsCanTalk", "game").toBool();
|
||||
}
|
||||
|
||||
bool GameSettings::getSpectatorsCanSeeEverything() const
|
||||
{
|
||||
return getValue("spectatorscanseeeverything", "game").toBool();
|
||||
return getValue("spectatorsCanSeeEverything", "game").toBool();
|
||||
}
|
||||
|
||||
bool GameSettings::getCreateGameAsSpectator() const
|
||||
{
|
||||
return getValue("creategameasspectator", "game").toBool();
|
||||
return getValue("createGameAsSpectator", "game").toBool();
|
||||
}
|
||||
|
||||
int GameSettings::getDefaultStartingLifeTotal() const
|
||||
{
|
||||
return getValue("defaultstartinglifetotal", "game", QString(), 20).toInt();
|
||||
return getValue("defaultStartingLifeTotal", "game", QString(), 20).toInt();
|
||||
}
|
||||
|
||||
bool GameSettings::getShareDecklistsOnLoad() const
|
||||
{
|
||||
return getValue("sharedecklistsonload", "game").toBool();
|
||||
return getValue("shareDecklistsOnLoad", "game").toBool();
|
||||
}
|
||||
|
||||
bool GameSettings::getRememberGameSettings() const
|
||||
{
|
||||
return getValue("remembergamesettings", "game", QString(), true).toBool();
|
||||
return getValue("rememberGameSettings", "game", QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool GameSettings::getLocalGameRememberSettings() const
|
||||
{
|
||||
return getValue("remembersettings", "localgameoptions").toBool();
|
||||
return getValue("rememberSettings", "localgameoptions").toBool();
|
||||
}
|
||||
|
||||
int GameSettings::getLocalGameMaxPlayers() const
|
||||
{
|
||||
return getValue("maxplayers", "localgameoptions", QString(), 1).toInt();
|
||||
return getValue("maxPlayers", "localgameoptions", QString(), 1).toInt();
|
||||
}
|
||||
|
||||
int GameSettings::getLocalGameStartingLifeTotal() const
|
||||
{
|
||||
return getValue("startinglifetotal", "localgameoptions", QString(), 20).toInt();
|
||||
return getValue("startingLifeTotal", "localgameoptions", QString(), 20).toInt();
|
||||
}
|
||||
|
||||
void GameSettings::setGameDescription(const QString &_gameDescription)
|
||||
{
|
||||
setValue(_gameDescription, "gamedescription", "game");
|
||||
setValue(_gameDescription, "gameDescription", "game");
|
||||
}
|
||||
|
||||
void GameSettings::setMaxPlayers(int _maxPlayers)
|
||||
{
|
||||
setValue(_maxPlayers, "maxplayers", "game");
|
||||
setValue(_maxPlayers, "maxPlayers", "game");
|
||||
}
|
||||
|
||||
void GameSettings::setGameTypes(const QString &_gameTypes)
|
||||
{
|
||||
setValue(_gameTypes, "gametypes", "game");
|
||||
setValue(_gameTypes, "gameTypes", "game");
|
||||
}
|
||||
|
||||
void GameSettings::setOnlyBuddies(bool _onlyBuddies)
|
||||
{
|
||||
setValue(_onlyBuddies, "onlybuddies", "game");
|
||||
setValue(_onlyBuddies, "onlyBuddies", "game");
|
||||
}
|
||||
|
||||
void GameSettings::setOnlyRegistered(bool _onlyRegistered)
|
||||
{
|
||||
setValue(_onlyRegistered, "onlyregistered", "game");
|
||||
setValue(_onlyRegistered, "onlyRegistered", "game");
|
||||
}
|
||||
|
||||
void GameSettings::setSpectatorsAllowed(bool _spectatorsAllowed)
|
||||
{
|
||||
setValue(_spectatorsAllowed, "spectatorsallowed", "game");
|
||||
setValue(_spectatorsAllowed, "spectatorsAllowed", "game");
|
||||
}
|
||||
|
||||
void GameSettings::setSpectatorsNeedPassword(bool _spectatorsNeedPassword)
|
||||
{
|
||||
setValue(_spectatorsNeedPassword, "spectatorsneedpassword", "game");
|
||||
setValue(_spectatorsNeedPassword, "spectatorsNeedPassword", "game");
|
||||
}
|
||||
|
||||
void GameSettings::setSpectatorsCanTalk(bool _spectatorsCanTalk)
|
||||
{
|
||||
setValue(_spectatorsCanTalk, "spectatorscantalk", "game");
|
||||
setValue(_spectatorsCanTalk, "spectatorsCanTalk", "game");
|
||||
}
|
||||
|
||||
void GameSettings::setSpectatorsCanSeeEverything(bool _spectatorsCanSeeEverything)
|
||||
{
|
||||
setValue(_spectatorsCanSeeEverything, "spectatorscanseeeverything", "game");
|
||||
setValue(_spectatorsCanSeeEverything, "spectatorsCanSeeEverything", "game");
|
||||
}
|
||||
|
||||
void GameSettings::setCreateGameAsSpectator(bool _createGameAsSpectator)
|
||||
{
|
||||
setValue(_createGameAsSpectator, "creategameasspectator", "game");
|
||||
setValue(_createGameAsSpectator, "createGameAsSpectator", "game");
|
||||
}
|
||||
|
||||
void GameSettings::setDefaultStartingLifeTotal(int _defaultStartingLifeTotal)
|
||||
{
|
||||
setValue(_defaultStartingLifeTotal, "defaultstartinglifetotal", "game");
|
||||
setValue(_defaultStartingLifeTotal, "defaultStartingLifeTotal", "game");
|
||||
}
|
||||
|
||||
void GameSettings::setShareDecklistsOnLoad(bool _shareDecklistsOnLoad)
|
||||
{
|
||||
setValue(_shareDecklistsOnLoad, "sharedecklistsonload", "game");
|
||||
setValue(_shareDecklistsOnLoad, "shareDecklistsOnLoad", "game");
|
||||
}
|
||||
|
||||
void GameSettings::setRememberGameSettings(bool _rememberGameSettings)
|
||||
{
|
||||
setValue(_rememberGameSettings, "remembergamesettings", "game");
|
||||
setValue(_rememberGameSettings, "rememberGameSettings", "game");
|
||||
}
|
||||
|
||||
void GameSettings::setLocalGameRememberSettings(bool value)
|
||||
{
|
||||
setValue(value, "remembersettings", "localgameoptions");
|
||||
setValue(value, "rememberSettings", "localgameoptions");
|
||||
}
|
||||
|
||||
void GameSettings::setLocalGameMaxPlayers(int value)
|
||||
{
|
||||
setValue(value, "maxplayers", "localgameoptions");
|
||||
setValue(value, "maxPlayers", "localgameoptions");
|
||||
}
|
||||
|
||||
void GameSettings::setLocalGameStartingLifeTotal(int value)
|
||||
{
|
||||
setValue(value, "startinglifetotal", "localgameoptions");
|
||||
setValue(value, "startingLifeTotal", "localgameoptions");
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ InterfaceSettings::InterfaceSettings(const QString &settingPath, QObject *parent
|
||||
|
||||
bool InterfaceSettings::getUseTearOffMenus() const
|
||||
{
|
||||
return getValue("usetearoffmenus", QString(), QString(), true).toBool();
|
||||
return getValue("useTearOffMenus", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
int InterfaceSettings::getCardViewInitialRowsMax() const
|
||||
@@ -37,22 +37,22 @@ bool InterfaceSettings::getKeepGameChatFocus() const
|
||||
|
||||
bool InterfaceSettings::getNotificationsEnabled() const
|
||||
{
|
||||
return getValue("notificationsenabled", QString(), QString(), true).toBool();
|
||||
return getValue("enabled", "interface", "notifications", true).toBool();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getSpectatorNotificationsEnabled() const
|
||||
{
|
||||
return getValue("specnotificationsenabled", QString(), QString(), false).toBool();
|
||||
return getValue("spectatorsEnabled", "interface", "notifications", false).toBool();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getBuddyConnectNotificationsEnabled() const
|
||||
{
|
||||
return getValue("buddyconnectnotificationsenabled", QString(), QString(), true).toBool();
|
||||
return getValue("buddyConnectEnabled", "interface", "notifications", true).toBool();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getDoubleClickToPlay() const
|
||||
{
|
||||
return getValue("doubleclicktoplay", QString(), QString(), true).toBool();
|
||||
return getValue("doubleClickToPlay", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getClickPlaysAllSelected() const
|
||||
@@ -62,7 +62,7 @@ bool InterfaceSettings::getClickPlaysAllSelected() const
|
||||
|
||||
bool InterfaceSettings::getPlayToStack() const
|
||||
{
|
||||
return getValue("playtostack", QString(), QString(), true).toBool();
|
||||
return getValue("playToStack", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getDoNotDeleteArrowsInSubPhases() const
|
||||
@@ -72,22 +72,22 @@ bool InterfaceSettings::getDoNotDeleteArrowsInSubPhases() const
|
||||
|
||||
int InterfaceSettings::getStartingHandSize() const
|
||||
{
|
||||
return getValue("startinghandsize", QString(), QString(), 7).toInt();
|
||||
return getValue("startingHandSize", QString(), QString(), 7).toInt();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getAnnotateTokens() const
|
||||
{
|
||||
return getValue("annotatetokens", QString(), QString(), false).toBool();
|
||||
return getValue("annotateTokens", QString(), QString(), false).toBool();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getShowDragSelectionCount() const
|
||||
{
|
||||
return getValue("showlassoselectioncount", QString(), QString(), true).toBool();
|
||||
return getValue("showLassoSelectionCount", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getShowTotalSelectionCount() const
|
||||
{
|
||||
return getValue("showpersistentselectioncount", QString(), QString(), true).toBool();
|
||||
return getValue("showPersistentSelectionCount", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
int InterfaceSettings::getTallyType() const
|
||||
@@ -102,17 +102,12 @@ bool InterfaceSettings::getHorizontalHand() const
|
||||
|
||||
bool InterfaceSettings::getInvertVerticalCoordinate() const
|
||||
{
|
||||
return getValue("invert_vertical", "table", QString(), false).toBool();
|
||||
return getValue("invertVertical", "table", QString(), false).toBool();
|
||||
}
|
||||
|
||||
int InterfaceSettings::getMinPlayersForMultiColumnLayout() const
|
||||
{
|
||||
return getValue("min_players_multicolumn", QString(), QString(), 4).toInt();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getOpenDeckInNewTab() const
|
||||
{
|
||||
return getValue("openDeckInNewTab", "editor", QString(), false).toBool();
|
||||
return getValue("minPlayersMulticolumn", QString(), QString(), 4).toInt();
|
||||
}
|
||||
|
||||
int InterfaceSettings::getRewindBufferingMs() const
|
||||
@@ -125,39 +120,44 @@ qreal InterfaceSettings::getFastForwardSpeed() const
|
||||
return getValue("fastForwardSpeed", "replay", QString(), 10).toReal();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getStyleUserList() const
|
||||
{
|
||||
return getValue("styleUserList", "appearance", QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getLeftJustified() const
|
||||
{
|
||||
return getValue("leftjustified", QString(), QString(), false).toBool();
|
||||
return getValue("leftJustified", QString(), QString(), false).toBool();
|
||||
}
|
||||
|
||||
int InterfaceSettings::getZoneViewGroupByIndex() const
|
||||
{
|
||||
return getValue("groupby", "zoneview", QString(), 1).toInt();
|
||||
return getValue("groupBy", "zoneview", QString(), 1).toInt();
|
||||
}
|
||||
|
||||
int InterfaceSettings::getZoneViewSortByIndex() const
|
||||
{
|
||||
return getValue("sortby", "zoneview", QString(), 1).toInt();
|
||||
return getValue("sortBy", "zoneview", QString(), 1).toInt();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getZoneViewPileView() const
|
||||
{
|
||||
return getValue("pileview", "zoneview", QString(), true).toBool();
|
||||
return getValue("pileView", "zoneview", QString(), true).toBool();
|
||||
}
|
||||
|
||||
QString InterfaceSettings::getKnownMissingFeatures()
|
||||
bool InterfaceSettings::getShowStatusBar() const
|
||||
{
|
||||
return getValue("knownmissingfeatures", QString(), QString(), "").toString();
|
||||
return getValue("showStatusBar", QString(), QString(), false).toBool();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getShowShortcuts() const
|
||||
{
|
||||
return getValue("showShortcuts", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool InterfaceSettings::getShowGameSelectorFilterToolbar() const
|
||||
{
|
||||
return getValue("showGameSelectorFilterToolbar", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
void InterfaceSettings::setUseTearOffMenus(bool _useTearOffMenus)
|
||||
{
|
||||
setValue(_useTearOffMenus, "usetearoffmenus");
|
||||
setValue(_useTearOffMenus, "useTearOffMenus");
|
||||
emit useTearOffMenusChanged(_useTearOffMenus);
|
||||
}
|
||||
|
||||
@@ -189,22 +189,22 @@ void InterfaceSettings::setKeepGameChatFocus(bool value)
|
||||
|
||||
void InterfaceSettings::setNotificationsEnabled(bool _notificationsEnabled)
|
||||
{
|
||||
setValue(_notificationsEnabled, "notificationsenabled");
|
||||
setValue(_notificationsEnabled, "enabled", "interface", "notifications");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setSpectatorNotificationsEnabled(bool _spectatorNotificationsEnabled)
|
||||
{
|
||||
setValue(_spectatorNotificationsEnabled, "specnotificationsenabled");
|
||||
setValue(_spectatorNotificationsEnabled, "spectatorsEnabled", "interface", "notifications");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setBuddyConnectNotificationsEnabled(bool _buddyConnectNotificationsEnabled)
|
||||
{
|
||||
setValue(_buddyConnectNotificationsEnabled, "buddyconnectnotificationsenabled");
|
||||
setValue(_buddyConnectNotificationsEnabled, "buddyConnectEnabled", "interface", "notifications");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setDoubleClickToPlay(bool _doubleClickToPlay)
|
||||
{
|
||||
setValue(_doubleClickToPlay, "doubleclicktoplay");
|
||||
setValue(_doubleClickToPlay, "doubleClickToPlay");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setClickPlaysAllSelected(bool _clickPlaysAllSelected)
|
||||
@@ -214,7 +214,7 @@ void InterfaceSettings::setClickPlaysAllSelected(bool _clickPlaysAllSelected)
|
||||
|
||||
void InterfaceSettings::setPlayToStack(bool _playToStack)
|
||||
{
|
||||
setValue(_playToStack, "playtostack");
|
||||
setValue(_playToStack, "playToStack");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setDoNotDeleteArrowsInSubPhases(bool _doNotDeleteArrowsInSubPhases)
|
||||
@@ -224,22 +224,22 @@ void InterfaceSettings::setDoNotDeleteArrowsInSubPhases(bool _doNotDeleteArrowsI
|
||||
|
||||
void InterfaceSettings::setStartingHandSize(int _startingHandSize)
|
||||
{
|
||||
setValue(_startingHandSize, "startinghandsize");
|
||||
setValue(_startingHandSize, "startingHandSize");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setAnnotateTokens(bool _annotateTokens)
|
||||
{
|
||||
setValue(_annotateTokens, "annotatetokens");
|
||||
setValue(_annotateTokens, "annotateTokens");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setShowDragSelectionCount(bool _showDragSelectionCount)
|
||||
{
|
||||
setValue(_showDragSelectionCount, "showlassoselectioncount");
|
||||
setValue(_showDragSelectionCount, "showLassoSelectionCount");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setShowTotalSelectionCount(bool _showTotalSelectionCount)
|
||||
{
|
||||
setValue(_showTotalSelectionCount, "showpersistentselectioncount");
|
||||
setValue(_showTotalSelectionCount, "showPersistentSelectionCount");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setTallyType(int value)
|
||||
@@ -259,21 +259,16 @@ void InterfaceSettings::setHorizontalHand(bool _horizontalHand)
|
||||
|
||||
void InterfaceSettings::setInvertVerticalCoordinate(bool _invertVerticalCoordinate)
|
||||
{
|
||||
setValue(_invertVerticalCoordinate, "invert_vertical", "table");
|
||||
setValue(_invertVerticalCoordinate, "invertVertical", "table");
|
||||
emit invertVerticalCoordinateChanged();
|
||||
}
|
||||
|
||||
void InterfaceSettings::setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout)
|
||||
{
|
||||
setValue(_minPlayersForMultiColumnLayout, "min_players_multicolumn");
|
||||
setValue(_minPlayersForMultiColumnLayout, "minPlayersMulticolumn");
|
||||
emit minPlayersForMultiColumnLayoutChanged();
|
||||
}
|
||||
|
||||
void InterfaceSettings::setOpenDeckInNewTab(bool _openDeckInNewTab)
|
||||
{
|
||||
setValue(_openDeckInNewTab, "openDeckInNewTab", "editor");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setRewindBufferingMs(int _rewindBufferingMs)
|
||||
{
|
||||
setValue(_rewindBufferingMs, "rewindBufferingMs", "replay");
|
||||
@@ -284,34 +279,40 @@ void InterfaceSettings::setFastForwardSpeed(qreal _value)
|
||||
setValue(_value, "fastForwardSpeed", "replay");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setStyleUserList(bool _styleUserList)
|
||||
{
|
||||
setValue(_styleUserList, "styleUserList", "appearance");
|
||||
emit styleUserListChanged();
|
||||
}
|
||||
|
||||
void InterfaceSettings::setLeftJustified(bool _leftJustified)
|
||||
{
|
||||
setValue(_leftJustified, "leftjustified");
|
||||
setValue(_leftJustified, "leftJustified");
|
||||
emit handJustificationChanged();
|
||||
}
|
||||
|
||||
void InterfaceSettings::setZoneViewGroupByIndex(int _zoneViewGroupByIndex)
|
||||
{
|
||||
setValue(_zoneViewGroupByIndex, "groupby", "zoneview");
|
||||
setValue(_zoneViewGroupByIndex, "groupBy", "zoneview");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setZoneViewSortByIndex(int _zoneViewSortByIndex)
|
||||
{
|
||||
setValue(_zoneViewSortByIndex, "sortby", "zoneview");
|
||||
setValue(_zoneViewSortByIndex, "sortBy", "zoneview");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setZoneViewPileView(bool _zoneViewPileView)
|
||||
{
|
||||
setValue(_zoneViewPileView, "pileview", "zoneview");
|
||||
setValue(_zoneViewPileView, "pileView", "zoneview");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setKnownMissingFeatures(const QString &_knownMissingFeatures)
|
||||
void InterfaceSettings::setShowStatusBar(bool _showStatusBar)
|
||||
{
|
||||
setValue(_knownMissingFeatures, "knownmissingfeatures");
|
||||
setValue(_showStatusBar, "showStatusBar");
|
||||
emit showStatusBarChanged(_showStatusBar);
|
||||
}
|
||||
|
||||
void InterfaceSettings::setShowShortcuts(bool _showShortcuts)
|
||||
{
|
||||
setValue(_showShortcuts, "showShortcuts");
|
||||
}
|
||||
|
||||
void InterfaceSettings::setShowGameSelectorFilterToolbar(bool _showGameSelectorFilterToolbar)
|
||||
{
|
||||
setValue(_showGameSelectorFilterToolbar, "showGameSelectorFilterToolbar");
|
||||
emit showGameSelectorFilterToolbarChanged(_showGameSelectorFilterToolbar);
|
||||
}
|
||||
|
||||
@@ -32,15 +32,15 @@ public:
|
||||
[[nodiscard]] bool getHorizontalHand() const override;
|
||||
[[nodiscard]] bool getInvertVerticalCoordinate() const override;
|
||||
[[nodiscard]] int getMinPlayersForMultiColumnLayout() const override;
|
||||
[[nodiscard]] bool getOpenDeckInNewTab() const override;
|
||||
[[nodiscard]] int getRewindBufferingMs() const override;
|
||||
[[nodiscard]] qreal getFastForwardSpeed() const override;
|
||||
[[nodiscard]] bool getStyleUserList() const override;
|
||||
[[nodiscard]] bool getLeftJustified() const override;
|
||||
[[nodiscard]] int getZoneViewGroupByIndex() const override;
|
||||
[[nodiscard]] int getZoneViewSortByIndex() const override;
|
||||
[[nodiscard]] bool getZoneViewPileView() const override;
|
||||
[[nodiscard]] QString getKnownMissingFeatures() override;
|
||||
[[nodiscard]] bool getShowStatusBar() const override;
|
||||
[[nodiscard]] bool getShowShortcuts() const override;
|
||||
[[nodiscard]] bool getShowGameSelectorFilterToolbar() const override;
|
||||
|
||||
void setUseTearOffMenus(bool _useTearOffMenus);
|
||||
void setCardViewInitialRowsMax(int _cardViewInitialRowsMax);
|
||||
@@ -63,15 +63,15 @@ public:
|
||||
void setHorizontalHand(bool _horizontalHand);
|
||||
void setInvertVerticalCoordinate(bool _invertVerticalCoordinate);
|
||||
void setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout);
|
||||
void setOpenDeckInNewTab(bool _openDeckInNewTab);
|
||||
void setRewindBufferingMs(int _rewindBufferingMs);
|
||||
void setFastForwardSpeed(qreal _value);
|
||||
void setStyleUserList(bool _styleUserList);
|
||||
void setLeftJustified(bool _leftJustified);
|
||||
void setZoneViewGroupByIndex(int _zoneViewGroupByIndex);
|
||||
void setZoneViewSortByIndex(int _zoneViewSortByIndex);
|
||||
void setZoneViewPileView(bool _zoneViewPileView);
|
||||
void setKnownMissingFeatures(const QString &_knownMissingFeatures);
|
||||
void setShowStatusBar(bool _showStatusBar);
|
||||
void setShowShortcuts(bool _showShortcuts);
|
||||
void setShowGameSelectorFilterToolbar(bool _showGameSelectorFilterToolbar);
|
||||
|
||||
signals:
|
||||
void useTearOffMenusChanged(bool state);
|
||||
@@ -79,12 +79,15 @@ signals:
|
||||
void horizontalHandChanged();
|
||||
void invertVerticalCoordinateChanged();
|
||||
void minPlayersForMultiColumnLayoutChanged();
|
||||
void styleUserListChanged();
|
||||
void handJustificationChanged();
|
||||
void tallyTypeChanged(int type);
|
||||
void showStatusBarChanged(bool state);
|
||||
void showGameSelectorFilterToolbarChanged(bool state);
|
||||
|
||||
public:
|
||||
explicit InterfaceSettings(const QString &settingPath, QObject *parent = nullptr);
|
||||
|
||||
private:
|
||||
explicit InterfaceSettings(const QString &settingPath, QObject *parent = nullptr);
|
||||
InterfaceSettings(const InterfaceSettings & /*other*/);
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -30,7 +30,7 @@ QString PathsSettings::getPicsPath() const
|
||||
|
||||
QString PathsSettings::getCustomPicsPath() const
|
||||
{
|
||||
return getValue("custompics").toString();
|
||||
return getValue("customPics").toString();
|
||||
}
|
||||
|
||||
QString PathsSettings::getThemesPath() const
|
||||
@@ -40,22 +40,22 @@ QString PathsSettings::getThemesPath() const
|
||||
|
||||
QString PathsSettings::getCardDatabasePath() const
|
||||
{
|
||||
return getValue("carddatabase").toString();
|
||||
return getValue("cardDatabase").toString();
|
||||
}
|
||||
|
||||
QString PathsSettings::getCustomCardDatabasePath() const
|
||||
{
|
||||
return getValue("customsets").toString();
|
||||
return getValue("customSets").toString();
|
||||
}
|
||||
|
||||
QString PathsSettings::getTokenDatabasePath() const
|
||||
{
|
||||
return getValue("tokendatabase").toString();
|
||||
return getValue("tokenDatabase").toString();
|
||||
}
|
||||
|
||||
QString PathsSettings::getSpoilerCardDatabasePath() const
|
||||
{
|
||||
return getValue("spoilerdatabase").toString();
|
||||
return getValue("spoilerDatabase").toString();
|
||||
}
|
||||
|
||||
QString PathsSettings::getRedirectCachePath() const
|
||||
@@ -86,7 +86,7 @@ void PathsSettings::setPicsPath(const QString &_picsPath)
|
||||
|
||||
void PathsSettings::setCustomPicsPath(const QString &_customPicsPath)
|
||||
{
|
||||
setValue(_customPicsPath, "custompics");
|
||||
setValue(_customPicsPath, "customPics");
|
||||
}
|
||||
|
||||
void PathsSettings::setThemesPath(const QString &_themesPath)
|
||||
@@ -97,24 +97,24 @@ void PathsSettings::setThemesPath(const QString &_themesPath)
|
||||
|
||||
void PathsSettings::setCardDatabasePath(const QString &_cardDatabasePath)
|
||||
{
|
||||
setValue(_cardDatabasePath, "carddatabase");
|
||||
setValue(_cardDatabasePath, "cardDatabase");
|
||||
emit cardDatabasePathChanged();
|
||||
}
|
||||
|
||||
void PathsSettings::setCustomCardDatabasePath(const QString &_customCardDatabasePath)
|
||||
{
|
||||
setValue(_customCardDatabasePath, "customsets");
|
||||
setValue(_customCardDatabasePath, "customSets");
|
||||
emit cardDatabasePathChanged();
|
||||
}
|
||||
|
||||
void PathsSettings::setTokenDatabasePath(const QString &_tokenDatabasePath)
|
||||
{
|
||||
setValue(_tokenDatabasePath, "tokendatabase");
|
||||
setValue(_tokenDatabasePath, "tokenDatabase");
|
||||
emit cardDatabasePathChanged();
|
||||
}
|
||||
|
||||
void PathsSettings::setSpoilerDatabasePath(const QString &_spoilerDatabasePath)
|
||||
{
|
||||
setValue(_spoilerDatabasePath, "spoilerdatabase");
|
||||
setValue(_spoilerDatabasePath, "spoilerDatabase");
|
||||
emit cardDatabasePathChanged();
|
||||
}
|
||||
|
||||
@@ -10,61 +10,6 @@ QString PersonalSettings::getLang() const
|
||||
return getValue("lang", QString(), QString(), QString()).toString();
|
||||
}
|
||||
|
||||
QString PersonalSettings::getClientID()
|
||||
{
|
||||
return getValue("clientid", QString(), QString(), "notset").toString();
|
||||
}
|
||||
|
||||
QString PersonalSettings::getClientVersion()
|
||||
{
|
||||
return getValue("clientversion", QString(), QString(), "notset").toString();
|
||||
}
|
||||
|
||||
int PersonalSettings::getKeepAlive() const
|
||||
{
|
||||
return getValue("keepalive", QString(), QString(), 3).toInt();
|
||||
}
|
||||
|
||||
int PersonalSettings::getTimeOut() const
|
||||
{
|
||||
return getValue("timeout", QString(), QString(), 5).toInt();
|
||||
}
|
||||
|
||||
bool PersonalSettings::getPicDownload() const
|
||||
{
|
||||
return getValue("picturedownload", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool PersonalSettings::getShowStatusBar() const
|
||||
{
|
||||
return getValue("showStatusBar", QString(), QString(), false).toBool();
|
||||
}
|
||||
|
||||
int PersonalSettings::getMaxFontSize() const
|
||||
{
|
||||
return getValue("maxfontsize", "game", QString(), 12).toInt();
|
||||
}
|
||||
|
||||
QString PersonalSettings::getHighlightWords() const
|
||||
{
|
||||
return getValue("highlightWords", QString(), QString(), "").toString();
|
||||
}
|
||||
|
||||
QString PersonalSettings::getHomeTabBackgroundSource() const
|
||||
{
|
||||
return getValue("background", "home", QString(), "themed").toString();
|
||||
}
|
||||
|
||||
int PersonalSettings::getHomeTabBackgroundShuffleFrequency() const
|
||||
{
|
||||
return getValue("shuffleTimer", "home/background", QString(), 0).toInt();
|
||||
}
|
||||
|
||||
bool PersonalSettings::getHomeTabDisplayCardName() const
|
||||
{
|
||||
return getValue("displayCardName", "home/background", QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool PersonalSettings::getShowTipsOnStartup() const
|
||||
{
|
||||
return getValue("showTips", "tipOfDay", QString(), true).toBool();
|
||||
@@ -80,78 +25,12 @@ QList<int> PersonalSettings::getSeenTips() const
|
||||
return tips;
|
||||
}
|
||||
|
||||
bool PersonalSettings::getDownloadSpoilersStatus() const
|
||||
{
|
||||
return getValue("downloadspoilers", QString(), QString(), false).toBool();
|
||||
}
|
||||
|
||||
void PersonalSettings::setLang(const QString &_lang)
|
||||
{
|
||||
setValue(_lang, "lang");
|
||||
emit langChanged();
|
||||
}
|
||||
|
||||
void PersonalSettings::setClientID(const QString &_clientID)
|
||||
{
|
||||
setValue(_clientID, "clientid");
|
||||
}
|
||||
|
||||
void PersonalSettings::setClientVersion(const QString &_clientVersion)
|
||||
{
|
||||
setValue(_clientVersion, "clientversion");
|
||||
}
|
||||
|
||||
void PersonalSettings::setPicDownload(bool _picDownload)
|
||||
{
|
||||
setValue(_picDownload, "picturedownload");
|
||||
emit picDownloadChanged();
|
||||
}
|
||||
|
||||
void PersonalSettings::setShowStatusBar(bool value)
|
||||
{
|
||||
setValue(value, "showStatusBar");
|
||||
emit showStatusBarChanged(value);
|
||||
}
|
||||
|
||||
void PersonalSettings::setMaxFontSize(int _max)
|
||||
{
|
||||
setValue(_max, "maxfontsize", "game");
|
||||
}
|
||||
|
||||
QString PersonalSettings::getThemeName() const
|
||||
{
|
||||
return getValue("themeName", QString(), QString()).toString();
|
||||
}
|
||||
|
||||
void PersonalSettings::setThemeName(const QString &_themeName)
|
||||
{
|
||||
setValue(_themeName, "themeName");
|
||||
emit themeNameChanged();
|
||||
}
|
||||
|
||||
void PersonalSettings::setHighlightWords(const QString &_highlightWords)
|
||||
{
|
||||
setValue(_highlightWords, "highlightWords");
|
||||
}
|
||||
|
||||
void PersonalSettings::setHomeTabBackgroundSource(const QString &_backgroundSource)
|
||||
{
|
||||
setValue(_backgroundSource, "background", "home");
|
||||
emit homeTabBackgroundSourceChanged();
|
||||
}
|
||||
|
||||
void PersonalSettings::setHomeTabBackgroundShuffleFrequency(int _frequency)
|
||||
{
|
||||
setValue(_frequency, "shuffleTimer", "home/background");
|
||||
emit homeTabBackgroundShuffleFrequencyChanged();
|
||||
}
|
||||
|
||||
void PersonalSettings::setHomeTabDisplayCardName(bool _displayCardName)
|
||||
{
|
||||
setValue(_displayCardName, "displayCardName", "home/background");
|
||||
emit homeTabDisplayCardNameChanged();
|
||||
}
|
||||
|
||||
void PersonalSettings::setShowTipsOnStartup(bool _showTipsOnStartup)
|
||||
{
|
||||
setValue(_showTipsOnStartup, "showTips", "tipOfDay");
|
||||
@@ -165,9 +44,3 @@ void PersonalSettings::setSeenTips(const QList<int> &_seenTips)
|
||||
}
|
||||
setValue(QVariant::fromValue(storedTipList), "seenTips", "tipOfDay");
|
||||
}
|
||||
|
||||
void PersonalSettings::setDownloadSpoilerStatus(bool _spoilerStatus)
|
||||
{
|
||||
setValue(_spoilerStatus, "downloadspoilers");
|
||||
emit downloadSpoilerStatusChanged();
|
||||
}
|
||||
|
||||
@@ -14,46 +14,15 @@ class PersonalSettings : public SettingsManager, public IPersonalSettingsProvide
|
||||
|
||||
public:
|
||||
[[nodiscard]] QString getLang() const override;
|
||||
[[nodiscard]] QString getClientID() override;
|
||||
[[nodiscard]] QString getClientVersion() override;
|
||||
[[nodiscard]] int getKeepAlive() const override;
|
||||
[[nodiscard]] int getTimeOut() const override;
|
||||
[[nodiscard]] bool getPicDownload() const override;
|
||||
[[nodiscard]] bool getShowStatusBar() const override;
|
||||
[[nodiscard]] int getMaxFontSize() const override;
|
||||
[[nodiscard]] QString getHighlightWords() const override;
|
||||
[[nodiscard]] QString getHomeTabBackgroundSource() const override;
|
||||
[[nodiscard]] int getHomeTabBackgroundShuffleFrequency() const override;
|
||||
[[nodiscard]] QString getThemeName() const;
|
||||
void setThemeName(const QString &_themeName);
|
||||
[[nodiscard]] bool getHomeTabDisplayCardName() const override;
|
||||
[[nodiscard]] bool getShowTipsOnStartup() const override;
|
||||
[[nodiscard]] QList<int> getSeenTips() const override;
|
||||
[[nodiscard]] bool getDownloadSpoilersStatus() const override;
|
||||
|
||||
void setLang(const QString &_lang);
|
||||
void setClientID(const QString &_clientID);
|
||||
void setClientVersion(const QString &_clientVersion);
|
||||
void setPicDownload(bool _picDownload);
|
||||
void setShowStatusBar(bool value);
|
||||
void setMaxFontSize(int _max);
|
||||
void setHighlightWords(const QString &_highlightWords);
|
||||
void setHomeTabBackgroundSource(const QString &_backgroundSource);
|
||||
void setHomeTabBackgroundShuffleFrequency(int _frequency);
|
||||
void setHomeTabDisplayCardName(bool _displayCardName);
|
||||
void setShowTipsOnStartup(bool _showTipsOnStartup);
|
||||
void setSeenTips(const QList<int> &_seenTips);
|
||||
void setDownloadSpoilerStatus(bool _spoilerStatus);
|
||||
|
||||
signals:
|
||||
void langChanged();
|
||||
void themeNameChanged();
|
||||
void picDownloadChanged();
|
||||
void showStatusBarChanged(bool state);
|
||||
void homeTabBackgroundSourceChanged();
|
||||
void homeTabBackgroundShuffleFrequencyChanged();
|
||||
void homeTabDisplayCardNameChanged();
|
||||
void downloadSpoilerStatusChanged();
|
||||
|
||||
public:
|
||||
explicit PersonalSettings(const QString &settingPath, QObject *parent = nullptr);
|
||||
|
||||
@@ -9,16 +9,16 @@ RecentsSettings::RecentsSettings(const QString &settingPath, QObject *parent)
|
||||
|
||||
QStringList RecentsSettings::getRecentlyOpenedDeckPaths() const
|
||||
{
|
||||
return getValue("deckpaths").toStringList();
|
||||
return getValue("deckPaths").toStringList();
|
||||
}
|
||||
void RecentsSettings::clearRecentlyOpenedDeckPaths()
|
||||
{
|
||||
deleteValue("deckpaths");
|
||||
deleteValue("deckPaths");
|
||||
emit recentlyOpenedDeckPathsChanged();
|
||||
}
|
||||
void RecentsSettings::updateRecentlyOpenedDeckPaths(const QString &deckPath)
|
||||
{
|
||||
auto deckPaths = getValue("deckpaths").toStringList();
|
||||
auto deckPaths = getValue("deckPaths").toStringList();
|
||||
deckPaths.removeAll(deckPath);
|
||||
|
||||
deckPaths.prepend(deckPath);
|
||||
@@ -27,7 +27,7 @@ void RecentsSettings::updateRecentlyOpenedDeckPaths(const QString &deckPath)
|
||||
deckPaths.removeLast();
|
||||
}
|
||||
|
||||
setValue(deckPaths, "deckpaths");
|
||||
setValue(deckPaths, "deckPaths");
|
||||
emit recentlyOpenedDeckPathsChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,28 +10,28 @@ ServersSettings::ServersSettings(const QString &settingPath, QObject *parent)
|
||||
|
||||
void ServersSettings::setPreviousHostLogin(int previous)
|
||||
{
|
||||
setValue(previous, "previoushostlogin");
|
||||
setValue(previous, "previousHostLogin");
|
||||
}
|
||||
|
||||
int ServersSettings::getPreviousHostLogin() const
|
||||
{
|
||||
QVariant previous = getValue("previoushostlogin");
|
||||
QVariant previous = getValue("previousHostLogin");
|
||||
return previous == QVariant() ? 1 : previous.toInt();
|
||||
}
|
||||
|
||||
void ServersSettings::setPreviousHostList(QStringList list)
|
||||
{
|
||||
setValue(list, "previoushosts");
|
||||
setValue(list, "previousHosts");
|
||||
}
|
||||
|
||||
QStringList ServersSettings::getPreviousHostList() const
|
||||
{
|
||||
return getValue("previoushosts").toStringList();
|
||||
return getValue("previousHosts").toStringList();
|
||||
}
|
||||
|
||||
void ServersSettings::setPrevioushostName(const QString &name)
|
||||
{
|
||||
setValue(name, "previoushostName");
|
||||
setValue(name, "previousHostName");
|
||||
}
|
||||
|
||||
QString ServersSettings::getSaveName(QString defaultname)
|
||||
@@ -50,7 +50,7 @@ QString ServersSettings::getSite(QString defaultSite)
|
||||
|
||||
QString ServersSettings::getPrevioushostName() const
|
||||
{
|
||||
QVariant value = getValue("previoushostName");
|
||||
QVariant value = getValue("previousHostName");
|
||||
return value == QVariant() ? "Rooster Ranges" : value.toString();
|
||||
}
|
||||
|
||||
@@ -110,56 +110,56 @@ bool ServersSettings::getSavePassword() const
|
||||
|
||||
void ServersSettings::setAutoConnect(int autoconnect)
|
||||
{
|
||||
setValue(autoconnect, "auto_connect");
|
||||
setValue(autoconnect, "autoConnect");
|
||||
}
|
||||
|
||||
int ServersSettings::getAutoConnect() const
|
||||
{
|
||||
QVariant autoconnect = getValue("auto_connect");
|
||||
QVariant autoconnect = getValue("autoConnect");
|
||||
return autoconnect == QVariant() ? 0 : autoconnect.toInt();
|
||||
}
|
||||
|
||||
void ServersSettings::setFPHostName(QString hostname)
|
||||
{
|
||||
setValue(hostname, "fphostname");
|
||||
setValue(hostname, "fpHostName");
|
||||
}
|
||||
|
||||
QString ServersSettings::getFPHostname(QString defaultHost) const
|
||||
{
|
||||
QVariant hostname = getValue("fphostname");
|
||||
QVariant hostname = getValue("fpHostName");
|
||||
return hostname == QVariant() ? std::move(defaultHost) : hostname.toString();
|
||||
}
|
||||
|
||||
void ServersSettings::setFPPort(QString port)
|
||||
{
|
||||
setValue(port, "fpport");
|
||||
setValue(port, "fpPort");
|
||||
}
|
||||
|
||||
QString ServersSettings::getFPPort(QString defaultPort) const
|
||||
{
|
||||
QVariant port = getValue("fpport");
|
||||
QVariant port = getValue("fpPort");
|
||||
return port == QVariant() ? std::move(defaultPort) : port.toString();
|
||||
}
|
||||
|
||||
void ServersSettings::setFPPlayerName(QString playerName)
|
||||
{
|
||||
setValue(playerName, "fpplayername");
|
||||
setValue(playerName, "fpPlayerName");
|
||||
}
|
||||
|
||||
QString ServersSettings::getFPPlayerName(QString defaultName) const
|
||||
{
|
||||
QVariant name = getValue("fpplayername");
|
||||
QVariant name = getValue("fpPlayerName");
|
||||
return name == QVariant() ? std::move(defaultName) : name.toString();
|
||||
}
|
||||
|
||||
void ServersSettings::setClearDebugLogStatus(bool abIsChecked)
|
||||
{
|
||||
setValue(abIsChecked, "save_debug_log");
|
||||
setValue(abIsChecked, "saveDebugLog");
|
||||
}
|
||||
|
||||
bool ServersSettings::getClearDebugLogStatus(bool abDefaultValue) const
|
||||
{
|
||||
QVariant cbFlushLog = getValue("save_debug_log");
|
||||
QVariant cbFlushLog = getValue("saveDebugLog");
|
||||
return cbFlushLog == QVariant() ? abDefaultValue : cbFlushLog.toBool();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,66 +35,100 @@ static void migrateSoundSettings(const QString &settingsPath, QSettings &globalI
|
||||
QSettings soundIni(settingsPath + "sound.ini", QSettings::IniFormat);
|
||||
soundIni.setValue("sound/enabled", globalIni.value("sound/enabled", false));
|
||||
soundIni.setValue("sound/theme", globalIni.value("sound/theme"));
|
||||
soundIni.setValue("sound/mastervolume", globalIni.value("sound/mastervolume", 100));
|
||||
soundIni.setValue("sound/masterVolume", globalIni.value("sound/mastervolume", 100));
|
||||
}
|
||||
|
||||
static void migrateGameSettings(const QString &settingsPath, QSettings &globalIni)
|
||||
{
|
||||
bool hasGameKeys = false;
|
||||
globalIni.beginGroup("game");
|
||||
if (!globalIni.childKeys().isEmpty()) {
|
||||
hasGameKeys = true;
|
||||
}
|
||||
QStringList gameKeys = globalIni.childKeys();
|
||||
globalIni.endGroup();
|
||||
const QMap<QString, QString> gameKeyMap = {
|
||||
{"game/maxplayers", "game/maxPlayers"},
|
||||
{"game/gamedescription", "game/gameDescription"},
|
||||
{"game/gametypes", "game/gameTypes"},
|
||||
{"game/onlybuddies", "game/onlyBuddies"},
|
||||
{"game/onlyregistered", "game/onlyRegistered"},
|
||||
{"game/spectatorsallowed", "game/spectatorsAllowed"},
|
||||
{"game/spectatorsneedpassword", "game/spectatorsNeedPassword"},
|
||||
{"game/spectatorscantalk", "game/spectatorsCanTalk"},
|
||||
{"game/spectatorscanseeeverything", "game/spectatorsCanSeeEverything"},
|
||||
{"game/creategameasspectator", "game/createGameAsSpectator"},
|
||||
{"game/defaultstartinglifetotal", "game/defaultStartingLifeTotal"},
|
||||
{"game/sharedecklistsonload", "game/shareDecklistsOnLoad"},
|
||||
{"game/remembergamesettings", "game/rememberGameSettings"},
|
||||
{"localgameoptions/maxplayers", "localgameoptions/maxPlayers"},
|
||||
{"localgameoptions/startinglifetotal", "localgameoptions/startingLifeTotal"},
|
||||
{"localgameoptions/remembersettings", "localgameoptions/rememberSettings"},
|
||||
};
|
||||
|
||||
globalIni.beginGroup("localgameoptions");
|
||||
if (!globalIni.childKeys().isEmpty()) {
|
||||
hasGameKeys = true;
|
||||
bool hasAny = false;
|
||||
for (auto it = gameKeyMap.constBegin(); it != gameKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
hasAny = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
QStringList localGameKeys = globalIni.childKeys();
|
||||
globalIni.endGroup();
|
||||
|
||||
if (!hasGameKeys) {
|
||||
if (!hasAny) {
|
||||
return;
|
||||
}
|
||||
|
||||
QSettings gameIni(settingsPath + "game.ini", QSettings::IniFormat);
|
||||
for (const auto &key : gameKeys) {
|
||||
if (key == "maxfontsize") {
|
||||
continue;
|
||||
for (auto it = gameKeyMap.constBegin(); it != gameKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
gameIni.setValue(it.value(), globalIni.value(it.key()));
|
||||
}
|
||||
gameIni.setValue("game/" + key, globalIni.value("game/" + key));
|
||||
}
|
||||
for (const auto &key : localGameKeys) {
|
||||
gameIni.setValue("localgameoptions/" + key, globalIni.value("localgameoptions/" + key));
|
||||
}
|
||||
}
|
||||
|
||||
static void migrateChatSettings(const QString &settingsPath, QSettings &globalIni)
|
||||
{
|
||||
globalIni.beginGroup("chat");
|
||||
QStringList chatKeys = globalIni.childKeys();
|
||||
globalIni.endGroup();
|
||||
|
||||
if (chatKeys.isEmpty()) {
|
||||
const QMap<QString, QString> chatKeyMap = {
|
||||
{"chat/mention", "chat/mention"},
|
||||
{"chat/mentioncompleter", "chat/mentionCompleter"},
|
||||
{"chat/mentioncolor", "chat/mentionColor"},
|
||||
{"chat/highlightcolor", "chat/highlightColor"},
|
||||
{"chat/mentionforeground", "chat/mentionForeground"},
|
||||
{"chat/highlightforeground", "chat/highlightForeground"},
|
||||
{"chat/ignore_unregistered", "chat/ignoreUnregistered"},
|
||||
{"chat/ignore_unregistered_messages", "chat/ignoreUnregisteredMessages"},
|
||||
{"chat/ignore_nonbuddy_messages", "chat/ignoreNonBuddyMessages"},
|
||||
{"chat/showmessagepopups", "chat/showMessagePopups"},
|
||||
{"chat/showmentionpopups", "chat/showMentionPopups"},
|
||||
{"chat/roomhistory", "chat/roomHistory"},
|
||||
{"chat/highlightwords", "chat/highlightWords"},
|
||||
// Legacy highlight words lived under [personal], but the chat settings
|
||||
// class reads them from [chat]
|
||||
{"personal/highlightWords", "chat/highlightWords"},
|
||||
};
|
||||
bool hasAny = false;
|
||||
for (auto it = chatKeyMap.constBegin(); it != chatKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
hasAny = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasAny) {
|
||||
return;
|
||||
}
|
||||
|
||||
QSettings chatIni(settingsPath + "chat.ini", QSettings::IniFormat);
|
||||
for (const auto &key : chatKeys) {
|
||||
chatIni.setValue("chat/" + key, globalIni.value("chat/" + key));
|
||||
for (auto it = chatKeyMap.constBegin(); it != chatKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
chatIni.setValue(it.value(), globalIni.value(it.key()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void migrateCacheStorageSettings(const QString &settingsPath, QSettings &globalIni)
|
||||
{
|
||||
const QStringList cacheKeys = {"personal/pixmapCacheSize", "personal/networkCacheSize", "personal/redirectCacheTtl",
|
||||
"personal/cardPictureLoaderCacheMethod",
|
||||
"personal/localCardImageStorageNamingScheme"};
|
||||
const QMap<QString, QString> cacheStorageKeyMap = {
|
||||
{"personal/pixmapCacheSize", "cache_storage/pixmapCacheSize"},
|
||||
{"personal/networkCacheSize", "cache_storage/networkCacheSize"},
|
||||
{"personal/redirectCacheTtl", "cache_storage/redirectCacheTtl"},
|
||||
{"personal/cardPictureLoaderCacheMethod", "cache_storage/cardPictureLoaderCacheMethod"},
|
||||
{"personal/localCardImageStorageNamingScheme", "cache_storage/localCardImageStorageNamingScheme"},
|
||||
};
|
||||
bool hasAny = false;
|
||||
for (const auto &key : cacheKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
for (auto it = cacheStorageKeyMap.constBegin(); it != cacheStorageKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
hasAny = true;
|
||||
break;
|
||||
}
|
||||
@@ -104,9 +138,9 @@ static void migrateCacheStorageSettings(const QString &settingsPath, QSettings &
|
||||
}
|
||||
|
||||
QSettings cacheStorageIni(settingsPath + "cache_storage.ini", QSettings::IniFormat);
|
||||
for (const auto &key : cacheKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
cacheStorageIni.setValue(key, globalIni.value(key));
|
||||
for (auto it = cacheStorageKeyMap.constBegin(); it != cacheStorageKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
cacheStorageIni.setValue(it.value(), globalIni.value(it.key()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,9 +154,9 @@ static void migrateUpdatesSettings(const QString &settingsPath, QSettings &globa
|
||||
{"personal/cardUpdateCheckInterval", "updates/cardUpdateCheckInterval"},
|
||||
{"personal/lastCardUpdateCheck", "updates/lastCardUpdateCheck"},
|
||||
{"personal/alwaysEnableNewSets", "updates/alwaysEnableNewSets"},
|
||||
{"personal/updatenotification", "updates/updatenotification"},
|
||||
{"personal/newversionnotification", "updates/newversionnotification"},
|
||||
{"personal/updatereleasechannel", "updates/updatereleasechannel"},
|
||||
{"personal/updatenotification", "updates/updateNotification"},
|
||||
{"personal/newversionnotification", "updates/newVersionNotification"},
|
||||
{"personal/updatereleasechannel", "updates/updateReleaseChannel"},
|
||||
};
|
||||
bool hasAny = false;
|
||||
for (auto it = updateKeyMap.constBegin(); it != updateKeyMap.constEnd(); ++it) {
|
||||
@@ -145,19 +179,7 @@ static void migrateUpdatesSettings(const QString &settingsPath, QSettings &globa
|
||||
|
||||
static void migratePersonalSettings(const QString &settingsPath, QSettings &globalIni)
|
||||
{
|
||||
const QStringList personalRootKeys = {"personal/lang", "personal/highlightWords"};
|
||||
const QMap<QString, QString> personalKeyMap = {
|
||||
{"theme/name", "personal/themeName"},
|
||||
{"personal/clientid", "personal/clientid"},
|
||||
{"personal/clientversion", "personal/clientversion"},
|
||||
{"personal/keepalive", "personal/keepalive"},
|
||||
{"personal/timeout", "personal/timeout"},
|
||||
{"personal/picturedownload", "personal/picturedownload"},
|
||||
{"personal/showStatusBar", "personal/showStatusBar"},
|
||||
{"game/maxfontsize", "game/maxfontsize"},
|
||||
{"personal/downloadspoilers", "personal/downloadspoilers"},
|
||||
};
|
||||
const QStringList homeKeys = {"home/background", "home/background/shuffleTimer", "home/background/displayCardName"};
|
||||
const QStringList personalRootKeys = {"personal/lang"};
|
||||
const QStringList tipKeys = {"tipOfDay/showTips", "tipOfDay/seenTips"};
|
||||
|
||||
bool hasAny = false;
|
||||
@@ -166,16 +188,6 @@ static void migratePersonalSettings(const QString &settingsPath, QSettings &glob
|
||||
hasAny = true;
|
||||
}
|
||||
}
|
||||
for (auto it = personalKeyMap.constBegin(); it != personalKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
hasAny = true;
|
||||
}
|
||||
}
|
||||
for (const auto &key : homeKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
hasAny = true;
|
||||
}
|
||||
}
|
||||
for (const auto &key : tipKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
hasAny = true;
|
||||
@@ -191,16 +203,6 @@ static void migratePersonalSettings(const QString &settingsPath, QSettings &glob
|
||||
personalIni.setValue(key, globalIni.value(key));
|
||||
}
|
||||
}
|
||||
for (auto it = personalKeyMap.constBegin(); it != personalKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
personalIni.setValue(it.value(), globalIni.value(it.key()));
|
||||
}
|
||||
}
|
||||
for (const auto &key : homeKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
personalIni.setValue(key, globalIni.value(key));
|
||||
}
|
||||
}
|
||||
for (const auto &key : tipKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
personalIni.setValue(key, globalIni.value(key));
|
||||
@@ -210,39 +212,33 @@ static void migratePersonalSettings(const QString &settingsPath, QSettings &glob
|
||||
|
||||
static void migrateCardsDisplaySettings(const QString &settingsPath, QSettings &globalIni)
|
||||
{
|
||||
const QStringList cardsRootKeys = {
|
||||
"cards/displaycardnames",
|
||||
"cards/roundcardcorners",
|
||||
"cards/overrideallcardartwithpersonalpreference",
|
||||
"cards/bumpsetswithcardsindecktotop",
|
||||
"cards/printingselectorsortorder",
|
||||
"cards/printingselectorcardsize",
|
||||
"cards/includerebalancedcards",
|
||||
"cards/printingselectornavigationbuttonsvisible",
|
||||
"cards/tapanimation",
|
||||
"cards/autorotatesidewayslayoutcards",
|
||||
"cards/scaleCards",
|
||||
"cards/verticalCardOverlapPercent",
|
||||
"cards/cardinfoviewmode",
|
||||
const QMap<QString, QString> cardsKeyMap = {
|
||||
{"cards/displaycardnames", "cards/displayCardNames"},
|
||||
{"cards/roundcardcorners", "cards/roundCardCorners"},
|
||||
{"cards/overrideallcardartwithpersonalpreference", "cards/overrideAllCardArtWithPersonalPreference"},
|
||||
{"cards/bumpsetswithcardsindecktotop", "cards/bumpSetsWithCardsInDeckToTop"},
|
||||
{"cards/includerebalancedcards", "cards/includerebalancedcards"},
|
||||
{"cards/tapanimation", "cards/tapAnimation"},
|
||||
{"cards/autorotatesidewayslayoutcards", "cards/autoRotateSidewaysLayoutCards"},
|
||||
{"cards/scaleCards", "cards/scaleCards"},
|
||||
{"cards/verticalCardOverlapPercent", "cards/verticalCardOverlapPercent"},
|
||||
{"cards/cardinfoviewmode", "cards/cardInfoViewMode"},
|
||||
{"cards/printingselectorsortorder", "cards/printingSelector/sortOrder"},
|
||||
{"cards/printingselectornavigationbuttonsvisible", "cards/printingSelector/navigationButtonsVisible"},
|
||||
{"cards/printingselectorcardsize", "cards/cardSize/printingSelector"},
|
||||
{"interface/visualdeckstoragecardsize", "cards/cardSize/visualDeckStorage"},
|
||||
{"interface/visualdatabasedisplaycardsize", "cards/cardSize/visualDatabaseDisplay"},
|
||||
{"interface/visualdeckeditorcardsize", "cards/cardSize/visualDeckEditor"},
|
||||
{"interface/edhreccardsize", "cards/cardSize/edhrec"},
|
||||
{"interface/archidektpreviewsize", "cards/cardSize/archidektPreview"},
|
||||
{"interface/visualdeckeditorsamplehandsize", "cards/cardSize/sampleHandSize"},
|
||||
};
|
||||
const QStringList cardsInterfaceKeys = {"interface/deckeditorbannercardcomboboxvisible",
|
||||
"interface/deckeditortagswidgetvisible"};
|
||||
const QStringList menuKeys = {"menu/showshortcuts", "menu/showgameselectorfiltertoolbar"};
|
||||
|
||||
bool hasAny = false;
|
||||
for (const auto &key : cardsRootKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
hasAny = true;
|
||||
}
|
||||
}
|
||||
for (const auto &key : cardsInterfaceKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
hasAny = true;
|
||||
}
|
||||
}
|
||||
for (const auto &key : menuKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
for (auto it = cardsKeyMap.constBegin(); it != cardsKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
hasAny = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasAny) {
|
||||
@@ -250,60 +246,71 @@ static void migrateCardsDisplaySettings(const QString &settingsPath, QSettings &
|
||||
}
|
||||
|
||||
QSettings cardsIni(settingsPath + "cards_display.ini", QSettings::IniFormat);
|
||||
for (const auto &key : cardsRootKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
cardsIni.setValue(key, globalIni.value(key));
|
||||
for (auto it = cardsKeyMap.constBegin(); it != cardsKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
cardsIni.setValue(it.value(), globalIni.value(it.key()));
|
||||
}
|
||||
}
|
||||
for (const auto &key : cardsInterfaceKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
cardsIni.setValue(key, globalIni.value(key));
|
||||
}
|
||||
|
||||
static void migrateCardCounterSettings(const QString &settingsPath, QSettings &globalIni)
|
||||
{
|
||||
QStringList counterKeys;
|
||||
const QStringList allKeys = globalIni.allKeys();
|
||||
for (const auto &key : allKeys) {
|
||||
if (key.startsWith("cards/counters/")) {
|
||||
counterKeys.append(key);
|
||||
}
|
||||
}
|
||||
for (const auto &key : menuKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
cardsIni.setValue(key, globalIni.value(key));
|
||||
}
|
||||
if (counterKeys.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QSettings countersIni(settingsPath + "card_counters.ini", QSettings::IniFormat);
|
||||
for (const auto &key : counterKeys) {
|
||||
countersIni.setValue(key, globalIni.value(key));
|
||||
}
|
||||
}
|
||||
|
||||
static void migrateInterfaceSettings(const QString &settingsPath, QSettings &globalIni)
|
||||
{
|
||||
const QStringList interfaceRootKeys = {
|
||||
"interface/usetearoffmenus",
|
||||
"interface/cardViewInitialRowsMax",
|
||||
"interface/cardViewExpandedRowsMax",
|
||||
"interface/closeEmptyCardView",
|
||||
"interface/focusCardViewSearchBar",
|
||||
"interface/keepGameChatFocus",
|
||||
"interface/notificationsenabled",
|
||||
"interface/specnotificationsenabled",
|
||||
"interface/buddyconnectnotificationsenabled",
|
||||
"interface/doubleclicktoplay",
|
||||
"interface/clickPlaysAllSelected",
|
||||
"interface/playtostack",
|
||||
"interface/doNotDeleteArrowsInSubPhases",
|
||||
"interface/startinghandsize",
|
||||
"interface/annotatetokens",
|
||||
"interface/showlassoselectioncount",
|
||||
"interface/showpersistentselectioncount",
|
||||
"interface/showsubtypeselectiontally",
|
||||
"interface/leftjustified",
|
||||
"interface/min_players_multicolumn",
|
||||
"interface/knownmissingfeatures",
|
||||
const QMap<QString, QString> interfaceKeyMap = {
|
||||
{"interface/usetearoffmenus", "interface/useTearOffMenus"},
|
||||
{"interface/cardViewInitialRowsMax", "interface/cardViewInitialRowsMax"},
|
||||
{"interface/cardViewExpandedRowsMax", "interface/cardViewExpandedRowsMax"},
|
||||
{"interface/closeEmptyCardView", "interface/closeEmptyCardView"},
|
||||
{"interface/focusCardViewSearchBar", "interface/focusCardViewSearchBar"},
|
||||
{"interface/keepGameChatFocus", "interface/keepGameChatFocus"},
|
||||
{"interface/doubleclicktoplay", "interface/doubleClickToPlay"},
|
||||
{"interface/clickPlaysAllSelected", "interface/clickPlaysAllSelected"},
|
||||
{"interface/playtostack", "interface/playToStack"},
|
||||
{"interface/doNotDeleteArrowsInSubPhases", "interface/doNotDeleteArrowsInSubPhases"},
|
||||
{"interface/startinghandsize", "interface/startingHandSize"},
|
||||
{"interface/annotatetokens", "interface/annotateTokens"},
|
||||
{"interface/showlassoselectioncount", "interface/showLassoSelectionCount"},
|
||||
{"interface/showpersistentselectioncount", "interface/showPersistentSelectionCount"},
|
||||
{"interface/tallyType", "interface/tallyType"},
|
||||
{"interface/leftjustified", "interface/leftJustified"},
|
||||
{"interface/min_players_multicolumn", "interface/minPlayersMulticolumn"},
|
||||
{"hand/horizontal", "hand/horizontal"},
|
||||
{"table/invert_vertical", "table/invertVertical"},
|
||||
{"replay/rewindBufferingMs", "replay/rewindBufferingMs"},
|
||||
{"replay/fastForwardSpeed", "replay/fastForwardSpeed"},
|
||||
{"zoneview/groupby", "zoneview/groupBy"},
|
||||
{"zoneview/sortby", "zoneview/sortBy"},
|
||||
{"zoneview/pileview", "zoneview/pileView"},
|
||||
{"personal/showStatusBar", "interface/showStatusBar"},
|
||||
{"menu/showshortcuts", "interface/showShortcuts"},
|
||||
{"menu/showgameselectorfiltertoolbar", "interface/showGameSelectorFilterToolbar"},
|
||||
{"interface/notificationsenabled", "interface/notifications/enabled"},
|
||||
{"interface/specnotificationsenabled", "interface/notifications/spectatorsEnabled"},
|
||||
{"interface/buddyconnectnotificationsenabled", "interface/notifications/buddyConnectEnabled"},
|
||||
};
|
||||
const QStringList interfaceSubKeys = {
|
||||
"hand/horizontal", "table/invert_vertical", "editor/openDeckInNewTab", "replay/rewindBufferingMs",
|
||||
"appearance/styleUserList", "zoneview/groupby", "zoneview/sortby", "zoneview/pileview"};
|
||||
bool hasAny = false;
|
||||
for (const auto &key : interfaceRootKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
hasAny = true;
|
||||
}
|
||||
}
|
||||
for (const auto &key : interfaceSubKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
for (auto it = interfaceKeyMap.constBegin(); it != interfaceKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
hasAny = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasAny) {
|
||||
@@ -311,63 +318,159 @@ static void migrateInterfaceSettings(const QString &settingsPath, QSettings &glo
|
||||
}
|
||||
|
||||
QSettings interfaceIni(settingsPath + "interface.ini", QSettings::IniFormat);
|
||||
for (const auto &key : interfaceRootKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
interfaceIni.setValue(key, globalIni.value(key));
|
||||
for (auto it = interfaceKeyMap.constBegin(); it != interfaceKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
interfaceIni.setValue(it.value(), globalIni.value(it.key()));
|
||||
}
|
||||
}
|
||||
for (const auto &key : interfaceSubKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
interfaceIni.setValue(key, globalIni.value(key));
|
||||
}
|
||||
|
||||
static void migrateDownloadSettings(const QString &settingsPath, QSettings &globalIni)
|
||||
{
|
||||
const QMap<QString, QString> downloadKeyMap = {
|
||||
{"personal/picturedownload", "downloads/pictureDownload"},
|
||||
{"personal/downloadspoilers", "downloads/downloadSpoilers"},
|
||||
};
|
||||
bool hasAny = false;
|
||||
for (auto it = downloadKeyMap.constBegin(); it != downloadKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
hasAny = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasAny) {
|
||||
return;
|
||||
}
|
||||
|
||||
QSettings downloadsIni(settingsPath + "downloads.ini", QSettings::IniFormat);
|
||||
for (auto it = downloadKeyMap.constBegin(); it != downloadKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
downloadsIni.setValue(it.value(), globalIni.value(it.key()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void migrateAppearanceSettings(const QString &settingsPath, QSettings &globalIni)
|
||||
{
|
||||
const QMap<QString, QString> appearanceKeyMap = {
|
||||
{"theme/name", "appearance/themeName"},
|
||||
{"game/maxfontsize", "appearance/maxFontSize"},
|
||||
{"home/background", "appearance/homeTabBackgroundSource"},
|
||||
{"home/background/shuffleTimer", "appearance/homeTabBackgroundShuffleFrequency"},
|
||||
{"home/background/displayCardName", "appearance/homeTabDisplayCardName"},
|
||||
{"appearance/styleUserList", "appearance/styleUserList"},
|
||||
};
|
||||
bool hasAny = false;
|
||||
for (auto it = appearanceKeyMap.constBegin(); it != appearanceKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
hasAny = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasAny) {
|
||||
return;
|
||||
}
|
||||
|
||||
QSettings appearanceIni(settingsPath + "appearance.ini", QSettings::IniFormat);
|
||||
for (auto it = appearanceKeyMap.constBegin(); it != appearanceKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
appearanceIni.setValue(it.value(), globalIni.value(it.key()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void migrateNetworkSettings(const QString &settingsPath, QSettings &globalIni)
|
||||
{
|
||||
const QMap<QString, QString> networkKeyMap = {
|
||||
{"personal/clientid", "network/clientId"},
|
||||
{"personal/clientversion", "network/clientVersion"},
|
||||
{"personal/keepalive", "network/keepAlive"},
|
||||
{"personal/timeout", "network/timeout"},
|
||||
{"interface/knownmissingfeatures", "network/knownMissingFeatures"},
|
||||
};
|
||||
bool hasAny = false;
|
||||
for (auto it = networkKeyMap.constBegin(); it != networkKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
hasAny = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasAny) {
|
||||
return;
|
||||
}
|
||||
|
||||
QSettings networkIni(settingsPath + "network.ini", QSettings::IniFormat);
|
||||
for (auto it = networkKeyMap.constBegin(); it != networkKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
networkIni.setValue(it.value(), globalIni.value(it.key()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void migratePathsSettings(const QString &settingsPath, QSettings &globalIni)
|
||||
{
|
||||
globalIni.beginGroup("paths");
|
||||
QStringList pathsKeys = globalIni.childKeys();
|
||||
globalIni.endGroup();
|
||||
if (pathsKeys.isEmpty()) {
|
||||
const QMap<QString, QString> pathsKeyMap = {
|
||||
{"paths/decks", "paths/decks"},
|
||||
{"paths/filters", "paths/filters"},
|
||||
{"paths/replays", "paths/replays"},
|
||||
{"paths/pics", "paths/pics"},
|
||||
{"paths/custompics", "paths/customPics"},
|
||||
{"paths/themes", "paths/themes"},
|
||||
{"paths/carddatabase", "paths/cardDatabase"},
|
||||
{"paths/customsets", "paths/customSets"},
|
||||
{"paths/tokendatabase", "paths/tokenDatabase"},
|
||||
{"paths/spoilerdatabase", "paths/spoilerDatabase"},
|
||||
{"paths/redirects", "paths/redirects"},
|
||||
};
|
||||
bool hasAny = false;
|
||||
for (auto it = pathsKeyMap.constBegin(); it != pathsKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
hasAny = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasAny) {
|
||||
return;
|
||||
}
|
||||
|
||||
QSettings pathsIni(settingsPath + "paths.ini", QSettings::IniFormat);
|
||||
for (const auto &key : pathsKeys) {
|
||||
pathsIni.setValue("paths/" + key, globalIni.value("paths/" + key));
|
||||
for (auto it = pathsKeyMap.constBegin(); it != pathsKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
pathsIni.setValue(it.value(), globalIni.value(it.key()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void migrateVisualDeckStorageSettings(const QString &settingsPath, QSettings &globalIni)
|
||||
{
|
||||
const QStringList vdsKeys = {"interface/visualdeckstoragecardsize",
|
||||
"interface/visualdeckstoragesortingorder",
|
||||
"interface/visualdeckstorageshowfolders",
|
||||
"interface/visualdeckstorageshowtagfilter",
|
||||
"interface/visualdeckstoragedefaulttagslist",
|
||||
"interface/visualdeckstoragesearchfoldernames",
|
||||
"interface/visualdeckstorageshowcoloridentity",
|
||||
"interface/visualdeckstorageshowbannercardcombobox",
|
||||
"interface/visualdeckstorageshowtagsondeckpreviews",
|
||||
"interface/visualdeckstoragedrawunusedcoloridentities",
|
||||
"interface/visualdeckstorageunusedcoloridentitiesopacity",
|
||||
"interface/visualdeckstoragetooltiptype",
|
||||
"interface/visualdeckstoragepromptforconversion",
|
||||
"interface/visualdeckstoragealwaysconvert",
|
||||
"interface/visualdeckstorageingame",
|
||||
"interface/visualdeckstorageselectionanimation",
|
||||
"interface/defaultDeckEditorType",
|
||||
"interface/visualdatabasedisplayfiltertomostrecentsetsenabled",
|
||||
"interface/visualdatabasedisplayfiltertomostrecentsetsamount",
|
||||
"interface/visualdeckeditorsamplehandsize",
|
||||
"interface/visualdeckeditorcardsize",
|
||||
"interface/visualdatabasedisplaycardsize",
|
||||
"interface/edhreccardsize",
|
||||
"interface/archidektpreviewsize"};
|
||||
const QMap<QString, QString> vdsKeyMap = {
|
||||
{"interface/visualdeckstoragesortingorder", "interface/visualDeckStorage/sortingOrder"},
|
||||
{"interface/visualdeckstorageshowfolders", "interface/visualDeckStorage/showFolders"},
|
||||
{"interface/visualdeckstorageshowtagfilter", "interface/visualDeckStorage/showTagFilter"},
|
||||
{"interface/visualdeckstoragedefaulttagslist", "interface/visualDeckStorage/defaultTagsList"},
|
||||
{"interface/visualdeckstoragesearchfoldernames", "interface/visualDeckStorage/searchFolderNames"},
|
||||
{"interface/visualdeckstorageshowcoloridentity", "interface/visualDeckStorage/showColorIdentity"},
|
||||
{"interface/visualdeckstorageshowbannercardcombobox", "interface/visualDeckStorage/showBannerCardComboBox"},
|
||||
{"interface/visualdeckstorageshowtagsondeckpreviews", "interface/visualDeckStorage/showTagsOnDeckPreviews"},
|
||||
{"interface/visualdeckstoragedrawunusedcoloridentities",
|
||||
"interface/visualDeckStorage/drawUnusedColorIdentities"},
|
||||
{"interface/visualdeckstorageunusedcoloridentitiesopacity",
|
||||
"interface/visualDeckStorage/unusedColorIdentitiesOpacity"},
|
||||
{"interface/visualdeckstoragetooltiptype", "interface/visualDeckStorage/tooltipType"},
|
||||
{"interface/visualdeckstoragepromptforconversion", "interface/visualDeckStorage/promptForConversion"},
|
||||
{"interface/visualdeckstoragealwaysconvert", "interface/visualDeckStorage/alwaysConvert"},
|
||||
{"interface/visualdeckstorageingame", "interface/visualDeckStorage/inGame"},
|
||||
{"interface/visualdeckstorageselectionanimation", "interface/visualDeckStorage/selectionAnimation"},
|
||||
{"interface/visualdatabasedisplayfiltertomostrecentsetsenabled",
|
||||
"interface/visualDatabaseDisplay/filterToMostRecentSetsEnabled"},
|
||||
{"interface/visualdatabasedisplayfiltertomostrecentsetsamount",
|
||||
"interface/visualDatabaseDisplay/filterToMostRecentSetsAmount"},
|
||||
};
|
||||
bool hasAny = false;
|
||||
for (const auto &key : vdsKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
for (auto it = vdsKeyMap.constBegin(); it != vdsKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
hasAny = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasAny) {
|
||||
@@ -375,9 +478,36 @@ static void migrateVisualDeckStorageSettings(const QString &settingsPath, QSetti
|
||||
}
|
||||
|
||||
QSettings vdsIni(settingsPath + "visual_deck_storage.ini", QSettings::IniFormat);
|
||||
for (const auto &key : vdsKeys) {
|
||||
if (globalIni.contains(key)) {
|
||||
vdsIni.setValue(key, globalIni.value(key));
|
||||
for (auto it = vdsKeyMap.constBegin(); it != vdsKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
vdsIni.setValue(it.value(), globalIni.value(it.key()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void migrateDeckEditorSettings(const QString &settingsPath, QSettings &globalIni)
|
||||
{
|
||||
const QMap<QString, QString> deckEditorKeyMap = {
|
||||
{"editor/openDeckInNewTab", "deckeditor/openDeckInNewTab"},
|
||||
{"interface/deckeditorbannercardcomboboxvisible", "deckeditor/bannerCardComboBoxVisible"},
|
||||
{"interface/deckeditortagswidgetvisible", "deckeditor/tagsWidgetVisible"},
|
||||
{"interface/defaultDeckEditorType", "deckeditor/defaultDeckEditorType"},
|
||||
};
|
||||
bool hasAny = false;
|
||||
for (auto it = deckEditorKeyMap.constBegin(); it != deckEditorKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
hasAny = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasAny) {
|
||||
return;
|
||||
}
|
||||
|
||||
QSettings deckEditorIni(settingsPath + "deck_editor.ini", QSettings::IniFormat);
|
||||
for (auto it = deckEditorKeyMap.constBegin(); it != deckEditorKeyMap.constEnd(); ++it) {
|
||||
if (globalIni.contains(it.key())) {
|
||||
deckEditorIni.setValue(it.value(), globalIni.value(it.key()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -395,9 +525,9 @@ static void migrateLegacySets(const QString &settingsPath)
|
||||
QSettings cardDbIni(settingsPath + "cardDatabase.ini", QSettings::IniFormat);
|
||||
for (const auto &shortName : groups) {
|
||||
legacySetting.beginGroup(shortName);
|
||||
cardDbIni.setValue("sets/" + shortName + "/sortkey", legacySetting.value("sortkey"));
|
||||
cardDbIni.setValue("sets/" + shortName + "/sortKey", legacySetting.value("sortkey"));
|
||||
cardDbIni.setValue("sets/" + shortName + "/enabled", legacySetting.value("enabled"));
|
||||
cardDbIni.setValue("sets/" + shortName + "/isknown", legacySetting.value("isknown"));
|
||||
cardDbIni.setValue("sets/" + shortName + "/isKnown", legacySetting.value("isknown"));
|
||||
legacySetting.endGroup();
|
||||
}
|
||||
legacySetting.endGroup();
|
||||
@@ -413,13 +543,30 @@ static void migrateLegacyServers(const QString &settingsPath)
|
||||
return;
|
||||
}
|
||||
|
||||
const QMap<QString, QString> serverKeyMap = {
|
||||
{"previoushostlogin", "previousHostLogin"},
|
||||
{"previoushosts", "previousHosts"},
|
||||
{"previoushostName", "previousHostName"},
|
||||
{"auto_connect", "autoConnect"},
|
||||
{"fphostname", "fpHostName"},
|
||||
{"fpport", "fpPort"},
|
||||
{"fpplayername", "fpPlayerName"},
|
||||
{"save_debug_log", "saveDebugLog"},
|
||||
};
|
||||
|
||||
QSettings serversIni(settingsPath + "servers.ini", QSettings::IniFormat);
|
||||
serversIni.setValue("server/previoushostlogin", legacySetting.value("previoushostlogin"));
|
||||
serversIni.setValue("server/previoushosts", legacySetting.value("previoushosts"));
|
||||
serversIni.setValue("server/auto_connect", legacySetting.value("auto_connect"));
|
||||
serversIni.setValue("server/fphostname", legacySetting.value("fphostname"));
|
||||
serversIni.setValue("server/fpport", legacySetting.value("fpport"));
|
||||
serversIni.setValue("server/fpplayername", legacySetting.value("fpplayername"));
|
||||
for (auto it = serverKeyMap.constBegin(); it != serverKeyMap.constEnd(); ++it) {
|
||||
if (legacySetting.contains(it.key())) {
|
||||
serversIni.setValue("server/" + it.value(), legacySetting.value(it.key()));
|
||||
}
|
||||
}
|
||||
|
||||
legacySetting.beginGroup("server_details");
|
||||
const QStringList detailsKeys = legacySetting.allKeys();
|
||||
for (const auto &key : detailsKeys) {
|
||||
serversIni.setValue("server/server_details/" + key, legacySetting.value(key));
|
||||
}
|
||||
legacySetting.endGroup();
|
||||
legacySetting.endGroup();
|
||||
}
|
||||
|
||||
@@ -454,9 +601,36 @@ static void migrateLegacyGameFilters(const QString &settingsPath)
|
||||
return;
|
||||
}
|
||||
|
||||
const QMap<QString, QString> filterKeyMap = {
|
||||
{"hide_buddies_only_games", "hideBuddiesOnlyGames"},
|
||||
{"hide_full_games", "hideFullGames"},
|
||||
{"hide_games_that_started", "hideGamesThatStarted"},
|
||||
{"hide_password_protected_games", "hidePasswordProtectedGames"},
|
||||
{"hide_ignored_user_games", "hideIgnoredUserGames"},
|
||||
{"hide_not_buddy_created_games", "hideNotBuddyCreatedGames"},
|
||||
{"hide_open_decklist_games", "hideOpenDecklistGames"},
|
||||
{"game_name_filter", "gameNameFilter"},
|
||||
{"creator_name_filter", "creatorNameFilter"},
|
||||
{"min_players", "minPlayers"},
|
||||
{"max_players", "maxPlayers"},
|
||||
{"max_game_age_time", "maxGameAgeTime"},
|
||||
{"show_only_if_spectators_can_watch", "showOnlyIfSpectatorsCanWatch"},
|
||||
{"show_spectator_password_protected", "showSpectatorPasswordProtected"},
|
||||
{"show_only_if_spectators_can_chat", "showOnlyIfSpectatorsCanChat"},
|
||||
{"show_only_if_spectators_can_see_hands", "showOnlyIfSpectatorsCanSeeHands"},
|
||||
};
|
||||
|
||||
QSettings filtersIni(settingsPath + "gamefilters.ini", QSettings::IniFormat);
|
||||
for (auto it = filterKeyMap.constBegin(); it != filterKeyMap.constEnd(); ++it) {
|
||||
if (legacySetting.contains(it.key())) {
|
||||
filtersIni.setValue("filter_games/" + it.value(), legacySetting.value(it.key()));
|
||||
}
|
||||
}
|
||||
const QString gameTypePrefix = "game_type/";
|
||||
for (const auto &key : keys) {
|
||||
filtersIni.setValue("filter_games/" + key, legacySetting.value(key));
|
||||
if (key.startsWith(gameTypePrefix)) {
|
||||
filtersIni.setValue("filter_games/gameType/" + key.mid(gameTypePrefix.size()), legacySetting.value(key));
|
||||
}
|
||||
}
|
||||
legacySetting.endGroup();
|
||||
}
|
||||
@@ -503,10 +677,15 @@ bool SettingsMigration::migrateSettingsFromGlobalIni(const QString &settingsPath
|
||||
migrateCacheStorageSettings(settingsPath, globalIni);
|
||||
migrateUpdatesSettings(settingsPath, globalIni);
|
||||
migratePersonalSettings(settingsPath, globalIni);
|
||||
migrateDownloadSettings(settingsPath, globalIni);
|
||||
migrateCardsDisplaySettings(settingsPath, globalIni);
|
||||
migrateCardCounterSettings(settingsPath, globalIni);
|
||||
migrateInterfaceSettings(settingsPath, globalIni);
|
||||
migrateAppearanceSettings(settingsPath, globalIni);
|
||||
migrateNetworkSettings(settingsPath, globalIni);
|
||||
migratePathsSettings(settingsPath, globalIni);
|
||||
migrateVisualDeckStorageSettings(settingsPath, globalIni);
|
||||
migrateDeckEditorSettings(settingsPath, globalIni);
|
||||
|
||||
QFile::remove(settingsPath + "global.ini.old");
|
||||
QFile::rename(settingsPath + "global.ini", settingsPath + "global.ini.old");
|
||||
|
||||
@@ -17,7 +17,7 @@ QString SoundSettings::getSoundThemeName() const
|
||||
|
||||
int SoundSettings::getMasterVolume() const
|
||||
{
|
||||
return getValue("mastervolume", QString(), QString(), 100).toInt();
|
||||
return getValue("masterVolume", QString(), QString(), 100).toInt();
|
||||
}
|
||||
|
||||
void SoundSettings::setSoundEnabled(bool _soundEnabled)
|
||||
@@ -34,6 +34,6 @@ void SoundSettings::setSoundThemeName(const QString &_soundThemeName)
|
||||
|
||||
void SoundSettings::setMasterVolume(int _masterVolume)
|
||||
{
|
||||
setValue(_masterVolume, "mastervolume");
|
||||
setValue(_masterVolume, "masterVolume");
|
||||
emit masterVolumeChanged(_masterVolume);
|
||||
}
|
||||
|
||||
@@ -45,17 +45,17 @@ bool UpdatesSettings::getAlwaysEnableNewSets() const
|
||||
|
||||
bool UpdatesSettings::getNotifyAboutUpdates() const
|
||||
{
|
||||
return getValue("updatenotification", QString(), QString(), true).toBool();
|
||||
return getValue("updateNotification", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
bool UpdatesSettings::getNotifyAboutNewVersion() const
|
||||
{
|
||||
return getValue("newversionnotification", QString(), QString(), true).toBool();
|
||||
return getValue("newVersionNotification", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
int UpdatesSettings::getUpdateReleaseChannelIndex() const
|
||||
{
|
||||
return getValue("updatereleasechannel", QString(), QString(), 0).toInt();
|
||||
return getValue("updateReleaseChannel", QString(), QString(), 0).toInt();
|
||||
}
|
||||
|
||||
void UpdatesSettings::setCheckUpdatesOnStartup(bool value)
|
||||
@@ -90,15 +90,15 @@ void UpdatesSettings::setAlwaysEnableNewSets(bool value)
|
||||
|
||||
void UpdatesSettings::setNotifyAboutUpdates(bool _notifyaboutupdate)
|
||||
{
|
||||
setValue(_notifyaboutupdate, "updatenotification");
|
||||
setValue(_notifyaboutupdate, "updateNotification");
|
||||
}
|
||||
|
||||
void UpdatesSettings::setNotifyAboutNewVersion(bool _notifyaboutnewversion)
|
||||
{
|
||||
setValue(_notifyaboutnewversion, "newversionnotification");
|
||||
setValue(_notifyaboutnewversion, "newVersionNotification");
|
||||
}
|
||||
|
||||
void UpdatesSettings::setUpdateReleaseChannelIndex(int value)
|
||||
{
|
||||
setValue(value, "updatereleasechannel");
|
||||
setValue(value, "updateReleaseChannel");
|
||||
}
|
||||
|
||||
@@ -91,258 +91,182 @@ VisualDeckStorageSettings::VisualDeckStorageSettings(const QString &settingPath,
|
||||
|
||||
int VisualDeckStorageSettings::getVisualDeckStorageSortingOrder() const
|
||||
{
|
||||
return getValue("visualdeckstoragesortingorder", QString(), QString(), 0).toInt();
|
||||
return getValue("sortingOrder", "interface", "visualDeckStorage", 0).toInt();
|
||||
}
|
||||
|
||||
bool VisualDeckStorageSettings::getVisualDeckStorageShowFolders() const
|
||||
{
|
||||
return getValue("visualdeckstorageshowfolders", QString(), QString(), true).toBool();
|
||||
return getValue("showFolders", "interface", "visualDeckStorage", true).toBool();
|
||||
}
|
||||
|
||||
bool VisualDeckStorageSettings::getVisualDeckStorageShowTagFilter() const
|
||||
{
|
||||
return getValue("visualdeckstorageshowtagfilter", QString(), QString(), true).toBool();
|
||||
return getValue("showTagFilter", "interface", "visualDeckStorage", true).toBool();
|
||||
}
|
||||
|
||||
QStringList VisualDeckStorageSettings::getVisualDeckStorageDefaultTagsList() const
|
||||
{
|
||||
return getValue("visualdeckstoragedefaulttagslist", QString(), QString(), QVariant::fromValue(defaultTags))
|
||||
return getValue("defaultTagsList", "interface", "visualDeckStorage", QVariant::fromValue(defaultTags))
|
||||
.toStringList();
|
||||
}
|
||||
|
||||
bool VisualDeckStorageSettings::getVisualDeckStorageSearchFolderNames() const
|
||||
{
|
||||
return getValue("visualdeckstoragesearchfoldernames", QString(), QString(), true).toBool();
|
||||
return getValue("searchFolderNames", "interface", "visualDeckStorage", true).toBool();
|
||||
}
|
||||
|
||||
bool VisualDeckStorageSettings::getVisualDeckStorageShowColorIdentity() const
|
||||
{
|
||||
return getValue("visualdeckstorageshowcoloridentity", QString(), QString(), true).toBool();
|
||||
return getValue("showColorIdentity", "interface", "visualDeckStorage", true).toBool();
|
||||
}
|
||||
|
||||
bool VisualDeckStorageSettings::getVisualDeckStorageShowBannerCardComboBox() const
|
||||
{
|
||||
return getValue("visualdeckstorageshowbannercardcombobox", QString(), QString(), true).toBool();
|
||||
return getValue("showBannerCardComboBox", "interface", "visualDeckStorage", true).toBool();
|
||||
}
|
||||
|
||||
bool VisualDeckStorageSettings::getVisualDeckStorageShowTagsOnDeckPreviews() const
|
||||
{
|
||||
return getValue("visualdeckstorageshowtagsondeckpreviews", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
int VisualDeckStorageSettings::getVisualDeckStorageCardSize() const
|
||||
{
|
||||
return getValue("visualdeckstoragecardsize", QString(), QString(), 100).toInt();
|
||||
return getValue("showTagsOnDeckPreviews", "interface", "visualDeckStorage", true).toBool();
|
||||
}
|
||||
|
||||
bool VisualDeckStorageSettings::getVisualDeckStorageDrawUnusedColorIdentities() const
|
||||
{
|
||||
return getValue("visualdeckstoragedrawunusedcoloridentities", QString(), QString(), true).toBool();
|
||||
return getValue("drawUnusedColorIdentities", "interface", "visualDeckStorage", true).toBool();
|
||||
}
|
||||
|
||||
int VisualDeckStorageSettings::getVisualDeckStorageUnusedColorIdentitiesOpacity() const
|
||||
{
|
||||
return getValue("visualdeckstorageunusedcoloridentitiesopacity", QString(), QString(), 15).toInt();
|
||||
return getValue("unusedColorIdentitiesOpacity", "interface", "visualDeckStorage", 15).toInt();
|
||||
}
|
||||
|
||||
int VisualDeckStorageSettings::getVisualDeckStorageTooltipType() const
|
||||
{
|
||||
return getValue("visualdeckstoragetooltiptype", QString(), QString(), 0).toInt();
|
||||
return getValue("tooltipType", "interface", "visualDeckStorage", 0).toInt();
|
||||
}
|
||||
|
||||
bool VisualDeckStorageSettings::getVisualDeckStoragePromptForConversion() const
|
||||
{
|
||||
return getValue("visualdeckstoragepromptforconversion", QString(), QString(), true).toBool();
|
||||
return getValue("promptForConversion", "interface", "visualDeckStorage", true).toBool();
|
||||
}
|
||||
|
||||
bool VisualDeckStorageSettings::getVisualDeckStorageAlwaysConvert() const
|
||||
{
|
||||
return getValue("visualdeckstoragealwaysconvert", QString(), QString(), false).toBool();
|
||||
return getValue("alwaysConvert", "interface", "visualDeckStorage", false).toBool();
|
||||
}
|
||||
|
||||
bool VisualDeckStorageSettings::getVisualDeckStorageInGame() const
|
||||
{
|
||||
return getValue("visualdeckstorageingame", QString(), QString(), true).toBool();
|
||||
return getValue("inGame", "interface", "visualDeckStorage", true).toBool();
|
||||
}
|
||||
|
||||
bool VisualDeckStorageSettings::getVisualDeckStorageSelectionAnimation() const
|
||||
{
|
||||
return getValue("visualdeckstorageselectionanimation", QString(), QString(), true).toBool();
|
||||
}
|
||||
|
||||
int VisualDeckStorageSettings::getVisualDeckEditorCardSize() const
|
||||
{
|
||||
return getValue("visualdeckeditorcardsize", QString(), QString(), 100).toInt();
|
||||
}
|
||||
|
||||
int VisualDeckStorageSettings::getVisualDeckEditorSampleHandSize() const
|
||||
{
|
||||
return getValue("visualdeckeditorsamplehandsize", QString(), QString(), 7).toInt();
|
||||
}
|
||||
|
||||
int VisualDeckStorageSettings::getVisualDatabaseDisplayCardSize() const
|
||||
{
|
||||
return getValue("visualdatabasedisplaycardsize", QString(), QString(), 100).toInt();
|
||||
return getValue("selectionAnimation", "interface", "visualDeckStorage", true).toBool();
|
||||
}
|
||||
|
||||
bool VisualDeckStorageSettings::getVisualDatabaseDisplayFilterToMostRecentSetsEnabled() const
|
||||
{
|
||||
return getValue("visualdatabasedisplayfiltertomostrecentsetsenabled", QString(), QString(), false).toBool();
|
||||
return getValue("filterToMostRecentSetsEnabled", "interface", "visualDatabaseDisplay", false).toBool();
|
||||
}
|
||||
|
||||
int VisualDeckStorageSettings::getVisualDatabaseDisplayFilterToMostRecentSetsAmount() const
|
||||
{
|
||||
return getValue("visualdatabasedisplayfiltertomostrecentsetsamount", QString(), QString(), 10).toInt();
|
||||
}
|
||||
|
||||
int VisualDeckStorageSettings::getEDHRecCardSize() const
|
||||
{
|
||||
return getValue("edhreccardsize", QString(), QString(), 100).toInt();
|
||||
}
|
||||
|
||||
int VisualDeckStorageSettings::getArchidektPreviewSize() const
|
||||
{
|
||||
return getValue("archidektpreviewsize", QString(), QString(), 100).toInt();
|
||||
}
|
||||
|
||||
int VisualDeckStorageSettings::getDefaultDeckEditorType() const
|
||||
{
|
||||
return getValue("defaultDeckEditorType", QString(), QString(), 1).toInt();
|
||||
return getValue("filterToMostRecentSetsAmount", "interface", "visualDatabaseDisplay", 10).toInt();
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageSortingOrder(int _sortingOrder)
|
||||
{
|
||||
setValue(_sortingOrder, "visualdeckstoragesortingorder");
|
||||
setValue(_sortingOrder, "sortingOrder", "interface", "visualDeckStorage");
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageShowFolders(bool value)
|
||||
{
|
||||
setValue(value, "visualdeckstorageshowfolders");
|
||||
setValue(value, "showFolders", "interface", "visualDeckStorage");
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageShowTagFilter(bool _showTags)
|
||||
{
|
||||
setValue(_showTags, "visualdeckstorageshowtagfilter");
|
||||
setValue(_showTags, "showTagFilter", "interface", "visualDeckStorage");
|
||||
emit visualDeckStorageShowTagFilterChanged(_showTags);
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageDefaultTagsList(QStringList _defaultTagsList)
|
||||
{
|
||||
setValue(QVariant::fromValue(_defaultTagsList), "visualdeckstoragedefaulttagslist");
|
||||
setValue(QVariant::fromValue(_defaultTagsList), "defaultTagsList", "interface", "visualDeckStorage");
|
||||
emit visualDeckStorageDefaultTagsListChanged();
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageSearchFolderNames(bool value)
|
||||
{
|
||||
setValue(value, "visualdeckstoragesearchfoldernames");
|
||||
setValue(value, "searchFolderNames", "interface", "visualDeckStorage");
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageShowColorIdentity(bool value)
|
||||
{
|
||||
setValue(value, "visualdeckstorageshowcoloridentity");
|
||||
setValue(value, "showColorIdentity", "interface", "visualDeckStorage");
|
||||
emit visualDeckStorageShowColorIdentityChanged(value);
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageShowBannerCardComboBox(bool _showBannerCardComboBox)
|
||||
{
|
||||
setValue(_showBannerCardComboBox, "visualdeckstorageshowbannercardcombobox");
|
||||
setValue(_showBannerCardComboBox, "showBannerCardComboBox", "interface", "visualDeckStorage");
|
||||
emit visualDeckStorageShowBannerCardComboBoxChanged(_showBannerCardComboBox);
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageShowTagsOnDeckPreviews(bool _showTags)
|
||||
{
|
||||
setValue(_showTags, "visualdeckstorageshowtagsondeckpreviews");
|
||||
setValue(_showTags, "showTagsOnDeckPreviews", "interface", "visualDeckStorage");
|
||||
emit visualDeckStorageShowTagsOnDeckPreviewsChanged(_showTags);
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageCardSize(int _cardSize)
|
||||
{
|
||||
setValue(_cardSize, "visualdeckstoragecardsize");
|
||||
emit visualDeckStorageCardSizeChanged();
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageDrawUnusedColorIdentities(bool _draw)
|
||||
{
|
||||
setValue(_draw, "visualdeckstoragedrawunusedcoloridentities");
|
||||
setValue(_draw, "drawUnusedColorIdentities", "interface", "visualDeckStorage");
|
||||
emit visualDeckStorageDrawUnusedColorIdentitiesChanged(_draw);
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageUnusedColorIdentitiesOpacity(int _opacity)
|
||||
{
|
||||
setValue(_opacity, "visualdeckstorageunusedcoloridentitiesopacity");
|
||||
setValue(_opacity, "unusedColorIdentitiesOpacity", "interface", "visualDeckStorage");
|
||||
emit visualDeckStorageUnusedColorIdentitiesOpacityChanged(_opacity);
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageTooltipType(int value)
|
||||
{
|
||||
setValue(value, "visualdeckstoragetooltiptype");
|
||||
setValue(value, "tooltipType", "interface", "visualDeckStorage");
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStoragePromptForConversion(bool _prompt)
|
||||
{
|
||||
setValue(_prompt, "visualdeckstoragepromptforconversion");
|
||||
setValue(_prompt, "promptForConversion", "interface", "visualDeckStorage");
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageAlwaysConvert(bool _always)
|
||||
{
|
||||
setValue(_always, "visualdeckstoragealwaysconvert");
|
||||
setValue(_always, "alwaysConvert", "interface", "visualDeckStorage");
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageInGame(bool enabled)
|
||||
{
|
||||
setValue(enabled, "visualdeckstorageingame");
|
||||
setValue(enabled, "inGame", "interface", "visualDeckStorage");
|
||||
emit visualDeckStorageInGameChanged(enabled);
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckStorageSelectionAnimation(bool enabled)
|
||||
{
|
||||
setValue(enabled, "visualdeckstorageselectionanimation");
|
||||
setValue(enabled, "selectionAnimation", "interface", "visualDeckStorage");
|
||||
emit visualDeckStorageSelectionAnimationChanged(enabled);
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckEditorCardSize(int _cardSize)
|
||||
{
|
||||
setValue(_cardSize, "visualdeckeditorcardsize");
|
||||
emit visualDeckEditorCardSizeChanged();
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDeckEditorSampleHandSize(int _amount)
|
||||
{
|
||||
setValue(_amount, "visualdeckeditorsamplehandsize");
|
||||
emit visualDeckEditorSampleHandSizeAmountChanged(_amount);
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDatabaseDisplayCardSize(int _cardSize)
|
||||
{
|
||||
setValue(_cardSize, "visualdatabasedisplaycardsize");
|
||||
emit visualDatabaseDisplayCardSizeChanged();
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDatabaseDisplayFilterToMostRecentSetsEnabled(bool _enabled)
|
||||
{
|
||||
setValue(_enabled, "visualdatabasedisplayfiltertomostrecentsetsenabled");
|
||||
setValue(_enabled, "filterToMostRecentSetsEnabled", "interface", "visualDatabaseDisplay");
|
||||
emit visualDatabaseDisplayFilterToMostRecentSetsEnabledChanged(_enabled);
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setVisualDatabaseDisplayFilterToMostRecentSetsAmount(int _amount)
|
||||
{
|
||||
setValue(_amount, "visualdatabasedisplayfiltertomostrecentsetsamount");
|
||||
setValue(_amount, "filterToMostRecentSetsAmount", "interface", "visualDatabaseDisplay");
|
||||
emit visualDatabaseDisplayFilterToMostRecentSetsAmountChanged(_amount);
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setEDHRecCardSize(int _edhrecCardSize)
|
||||
{
|
||||
setValue(_edhrecCardSize, "edhreccardsize");
|
||||
emit edhRecCardSizeChanged();
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setArchidektPreviewCardSize(int _archidektPreviewCardSize)
|
||||
{
|
||||
setValue(_archidektPreviewCardSize, "archidektpreviewsize");
|
||||
emit archidektPreviewSizeChanged();
|
||||
}
|
||||
|
||||
void VisualDeckStorageSettings::setDefaultDeckEditorType(int value)
|
||||
{
|
||||
setValue(value, "defaultDeckEditorType");
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ public:
|
||||
[[nodiscard]] bool getVisualDeckStorageShowColorIdentity() const override;
|
||||
[[nodiscard]] bool getVisualDeckStorageShowBannerCardComboBox() const override;
|
||||
[[nodiscard]] bool getVisualDeckStorageShowTagsOnDeckPreviews() const override;
|
||||
[[nodiscard]] int getVisualDeckStorageCardSize() const override;
|
||||
[[nodiscard]] bool getVisualDeckStorageDrawUnusedColorIdentities() const override;
|
||||
[[nodiscard]] int getVisualDeckStorageUnusedColorIdentitiesOpacity() const override;
|
||||
[[nodiscard]] int getVisualDeckStorageTooltipType() const override;
|
||||
@@ -28,14 +27,8 @@ public:
|
||||
[[nodiscard]] bool getVisualDeckStorageAlwaysConvert() const override;
|
||||
[[nodiscard]] bool getVisualDeckStorageInGame() const override;
|
||||
[[nodiscard]] bool getVisualDeckStorageSelectionAnimation() const override;
|
||||
[[nodiscard]] int getVisualDeckEditorCardSize() const override;
|
||||
[[nodiscard]] int getVisualDeckEditorSampleHandSize() const override;
|
||||
[[nodiscard]] int getVisualDatabaseDisplayCardSize() const override;
|
||||
[[nodiscard]] bool getVisualDatabaseDisplayFilterToMostRecentSetsEnabled() const override;
|
||||
[[nodiscard]] int getVisualDatabaseDisplayFilterToMostRecentSetsAmount() const override;
|
||||
[[nodiscard]] int getEDHRecCardSize() const override;
|
||||
[[nodiscard]] int getArchidektPreviewSize() const override;
|
||||
[[nodiscard]] int getDefaultDeckEditorType() const override;
|
||||
|
||||
void setVisualDeckStorageSortingOrder(int _sortingOrder);
|
||||
void setVisualDeckStorageShowFolders(bool value);
|
||||
@@ -45,7 +38,6 @@ public:
|
||||
void setVisualDeckStorageShowColorIdentity(bool value);
|
||||
void setVisualDeckStorageShowBannerCardComboBox(bool _showBannerCardComboBox);
|
||||
void setVisualDeckStorageShowTagsOnDeckPreviews(bool _showTags);
|
||||
void setVisualDeckStorageCardSize(int _cardSize);
|
||||
void setVisualDeckStorageDrawUnusedColorIdentities(bool _draw);
|
||||
void setVisualDeckStorageUnusedColorIdentitiesOpacity(int _opacity);
|
||||
void setVisualDeckStorageTooltipType(int value);
|
||||
@@ -53,14 +45,8 @@ public:
|
||||
void setVisualDeckStorageAlwaysConvert(bool _always);
|
||||
void setVisualDeckStorageInGame(bool enabled);
|
||||
void setVisualDeckStorageSelectionAnimation(bool enabled);
|
||||
void setVisualDeckEditorCardSize(int _cardSize);
|
||||
void setVisualDeckEditorSampleHandSize(int _amount);
|
||||
void setVisualDatabaseDisplayCardSize(int _cardSize);
|
||||
void setVisualDatabaseDisplayFilterToMostRecentSetsEnabled(bool _enabled);
|
||||
void setVisualDatabaseDisplayFilterToMostRecentSetsAmount(int _amount);
|
||||
void setEDHRecCardSize(int _edhrecCardSize);
|
||||
void setArchidektPreviewCardSize(int _archidektPreviewCardSize);
|
||||
void setDefaultDeckEditorType(int value);
|
||||
|
||||
signals:
|
||||
void visualDeckStorageShowTagFilterChanged(bool _visible);
|
||||
@@ -68,18 +54,12 @@ signals:
|
||||
void visualDeckStorageShowColorIdentityChanged(bool _visible);
|
||||
void visualDeckStorageShowBannerCardComboBoxChanged(bool _visible);
|
||||
void visualDeckStorageShowTagsOnDeckPreviewsChanged(bool _visible);
|
||||
void visualDeckStorageCardSizeChanged();
|
||||
void visualDeckStorageDrawUnusedColorIdentitiesChanged(bool _visible);
|
||||
void visualDeckStorageUnusedColorIdentitiesOpacityChanged(bool value);
|
||||
void visualDeckStorageInGameChanged(bool enabled);
|
||||
void visualDeckStorageSelectionAnimationChanged(bool enabled);
|
||||
void visualDatabaseDisplayFilterToMostRecentSetsEnabledChanged(bool enabled);
|
||||
void visualDatabaseDisplayFilterToMostRecentSetsAmountChanged(int amount);
|
||||
void visualDeckEditorSampleHandSizeAmountChanged(int amount);
|
||||
void visualDeckEditorCardSizeChanged();
|
||||
void visualDatabaseDisplayCardSizeChanged();
|
||||
void edhRecCardSizeChanged();
|
||||
void archidektPreviewSizeChanged();
|
||||
|
||||
public:
|
||||
explicit VisualDeckStorageSettings(const QString &settingPath, QObject *parent = nullptr);
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include <QSettings>
|
||||
#include <QTemporaryDir>
|
||||
#include <libcockatrice/settings/appearance_settings.h>
|
||||
#include <libcockatrice/settings/cache_storage_settings.h>
|
||||
#include <libcockatrice/settings/cards_display_settings.h>
|
||||
#include <libcockatrice/settings/chat_settings.h>
|
||||
#include <libcockatrice/settings/deck_editor_settings.h>
|
||||
#include <libcockatrice/settings/download_settings.h>
|
||||
#include <libcockatrice/settings/game_settings.h>
|
||||
#include <libcockatrice/settings/interface_settings.h>
|
||||
#include <libcockatrice/settings/network_settings.h>
|
||||
#include <libcockatrice/settings/personal_settings.h>
|
||||
#include <libcockatrice/settings/sound_settings.h>
|
||||
#include <libcockatrice/settings/tabs_settings.h>
|
||||
@@ -258,66 +264,218 @@ TEST_F(SettingsDefaultsTest, Personal_Lang_Default)
|
||||
ASSERT_EQ(s.getLang(), QString(""));
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Personal_ClientID_Default)
|
||||
{
|
||||
PersonalSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getClientID(), QString("notset"));
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Personal_KeepAlive_Default)
|
||||
{
|
||||
PersonalSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getKeepAlive(), 3);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Personal_TimeOut_Default)
|
||||
{
|
||||
PersonalSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getTimeOut(), 5);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Personal_PicDownload_Default)
|
||||
{
|
||||
PersonalSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getPicDownload(), true);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Personal_ShowStatusBar_Default)
|
||||
{
|
||||
PersonalSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getShowStatusBar(), false);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Personal_MaxFontSize_Default)
|
||||
{
|
||||
PersonalSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getMaxFontSize(), 12);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Personal_HomeTabBackgroundSource_Default)
|
||||
{
|
||||
PersonalSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getHomeTabBackgroundSource(), QString("themed"));
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Personal_HomeTabDisplayCardName_Default)
|
||||
{
|
||||
PersonalSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getHomeTabDisplayCardName(), true);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Personal_ShowTipsOnStartup_Default)
|
||||
{
|
||||
PersonalSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getShowTipsOnStartup(), true);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Personal_DownloadSpoilersStatus_Default)
|
||||
// --- DownloadSettings ---
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Download_PicDownload_Default)
|
||||
{
|
||||
PersonalSettings s(settingsPath, nullptr);
|
||||
DownloadSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getPicDownload(), true);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Download_DownloadSpoilersStatus_Default)
|
||||
{
|
||||
DownloadSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getDownloadSpoilersStatus(), false);
|
||||
}
|
||||
|
||||
// --- AppearanceSettings ---
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Appearance_ThemeName_Default)
|
||||
{
|
||||
AppearanceSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getThemeName(), QString(""));
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Appearance_ThemeName_SetAndGet)
|
||||
{
|
||||
AppearanceSettings s(settingsPath, nullptr);
|
||||
s.setThemeName("my_theme");
|
||||
ASSERT_EQ(s.getThemeName(), QString("my_theme"));
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Appearance_StyleUserList_Default)
|
||||
{
|
||||
AppearanceSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getStyleUserList(), true);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Appearance_MaxFontSize_Default)
|
||||
{
|
||||
AppearanceSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getMaxFontSize(), 12);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Appearance_MaxFontSize_SetAndGet)
|
||||
{
|
||||
AppearanceSettings s(settingsPath, nullptr);
|
||||
s.setMaxFontSize(14);
|
||||
ASSERT_EQ(s.getMaxFontSize(), 14);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Appearance_HomeTabBackgroundSource_Default)
|
||||
{
|
||||
AppearanceSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getHomeTabBackgroundSource(), QString("themed"));
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Appearance_HomeTabBackgroundShuffleFrequency_Default)
|
||||
{
|
||||
AppearanceSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getHomeTabBackgroundShuffleFrequency(), 0);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Appearance_HomeTabDisplayCardName_Default)
|
||||
{
|
||||
AppearanceSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getHomeTabDisplayCardName(), true);
|
||||
}
|
||||
|
||||
// --- InterfaceSettings ---
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Interface_ShowStatusBar_Default)
|
||||
{
|
||||
InterfaceSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getShowStatusBar(), false);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Interface_ShowShortcuts_Default)
|
||||
{
|
||||
InterfaceSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getShowShortcuts(), true);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Interface_ShowGameSelectorFilterToolbar_Default)
|
||||
{
|
||||
InterfaceSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getShowGameSelectorFilterToolbar(), true);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Interface_NotificationsEnabled_Default)
|
||||
{
|
||||
InterfaceSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getNotificationsEnabled(), true);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Interface_SpectatorNotificationsEnabled_Default)
|
||||
{
|
||||
InterfaceSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getSpectatorNotificationsEnabled(), false);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Interface_BuddyConnectNotificationsEnabled_Default)
|
||||
{
|
||||
InterfaceSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getBuddyConnectNotificationsEnabled(), true);
|
||||
}
|
||||
|
||||
// --- DeckEditorSettings ---
|
||||
|
||||
TEST_F(SettingsDefaultsTest, DeckEditor_OpenDeckInNewTab_Default)
|
||||
{
|
||||
DeckEditorSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getOpenDeckInNewTab(), false);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, DeckEditor_BannerCardComboBoxVisible_Default)
|
||||
{
|
||||
DeckEditorSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getBannerCardComboBoxVisible(), true);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, DeckEditor_TagsWidgetVisible_Default)
|
||||
{
|
||||
DeckEditorSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getTagsWidgetVisible(), true);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, DeckEditor_DefaultDeckEditorType_Default)
|
||||
{
|
||||
DeckEditorSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getDefaultDeckEditorType(), 1);
|
||||
}
|
||||
|
||||
// --- NetworkSettings ---
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Network_ClientID_Default)
|
||||
{
|
||||
NetworkSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getClientID(), QString("notset"));
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Network_ClientVersion_Default)
|
||||
{
|
||||
NetworkSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getClientVersion(), QString("notset"));
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Network_KeepAlive_Default)
|
||||
{
|
||||
NetworkSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getKeepAlive(), 3);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Network_TimeOut_Default)
|
||||
{
|
||||
NetworkSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getTimeOut(), 5);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, Network_KnownMissingFeatures_Default)
|
||||
{
|
||||
NetworkSettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getKnownMissingFeatures(), QString(""));
|
||||
}
|
||||
|
||||
// --- CardsDisplaySettings ---
|
||||
|
||||
TEST_F(SettingsDefaultsTest, CardsDisplay_PrintingSelectorCardSize_Default)
|
||||
{
|
||||
CardsDisplaySettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getPrintingSelectorCardSize(), 100);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, CardsDisplay_VisualDeckStorageCardSize_Default)
|
||||
{
|
||||
CardsDisplaySettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getVisualDeckStorageCardSize(), 100);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, CardsDisplay_VisualDatabaseDisplayCardSize_Default)
|
||||
{
|
||||
CardsDisplaySettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getVisualDatabaseDisplayCardSize(), 100);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, CardsDisplay_VisualDeckEditorCardSize_Default)
|
||||
{
|
||||
CardsDisplaySettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getVisualDeckEditorCardSize(), 100);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, CardsDisplay_EDHRecCardSize_Default)
|
||||
{
|
||||
CardsDisplaySettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getEDHRecCardSize(), 100);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, CardsDisplay_ArchidektPreviewSize_Default)
|
||||
{
|
||||
CardsDisplaySettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getArchidektPreviewSize(), 100);
|
||||
}
|
||||
|
||||
TEST_F(SettingsDefaultsTest, CardsDisplay_SampleHandSize_Default)
|
||||
{
|
||||
CardsDisplaySettings s(settingsPath, nullptr);
|
||||
ASSERT_EQ(s.getSampleHandSize(), 7);
|
||||
}
|
||||
|
||||
// --- VisualDeckStorageSettings ---
|
||||
|
||||
TEST_F(SettingsDefaultsTest, VisualDeckStorage_SortingOrder_Default)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include <QColor>
|
||||
#include <QCoreApplication>
|
||||
#include <QDate>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QSettings>
|
||||
@@ -10,18 +12,6 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static bool nativeSettingsAvailable()
|
||||
{
|
||||
QSettings probe;
|
||||
probe.setValue("_migration_native_probe", "ok");
|
||||
probe.sync();
|
||||
QSettings read;
|
||||
bool ok = read.value("_migration_native_probe").toString() == "ok";
|
||||
QSettings().clear();
|
||||
QSettings().sync();
|
||||
return ok;
|
||||
}
|
||||
|
||||
class SettingsMigrationTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
@@ -31,6 +21,17 @@ protected:
|
||||
void SetUp() override
|
||||
{
|
||||
settingsPath = tempDir.path() + "/";
|
||||
|
||||
// Isolate the settings used by the legacy migration tests inside the temporary
|
||||
// directory so the tests never read or write the real user config (registry on
|
||||
// Windows, plist on macOS, .conf on Linux), which would otherwise be shared
|
||||
// across CI jobs and flaky. Default-format QSettings is forced to IniFormat and
|
||||
// its UserScope path is redirected here; setPath wins over the XDG_CONFIG_HOME
|
||||
// default on Unix, so every platform resolves to <tempDir>/config/...
|
||||
const QString configDir = tempDir.path() + "/config";
|
||||
QDir().mkpath(configDir);
|
||||
qputenv("XDG_CONFIG_HOME", configDir.toUtf8());
|
||||
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, configDir);
|
||||
}
|
||||
|
||||
bool fileExists(const QString &name) const
|
||||
@@ -43,6 +44,26 @@ protected:
|
||||
QSettings ini(settingsPath + fileName, QSettings::IniFormat);
|
||||
return ini.value(key);
|
||||
}
|
||||
|
||||
// Checks for the exact legacy key in the raw INI content. On Windows, INI keys are
|
||||
// case-insensitive, so reading back a lower-case legacy key would match its migrated
|
||||
// camelCase counterpart and hide regressions. Checking the file bytes directly keeps
|
||||
// the comparison case-sensitive on every platform.
|
||||
bool iniFileHasKeyCaseSensitive(const QString &fileName, const QString &key) const
|
||||
{
|
||||
QFile f(settingsPath + fileName);
|
||||
if (!f.open(QIODevice::ReadOnly)) {
|
||||
return false;
|
||||
}
|
||||
const QString valueName = key.section('/', -1);
|
||||
const QStringList lines = QString::fromUtf8(f.readAll()).split('\n');
|
||||
for (const auto &line : lines) {
|
||||
if (line.startsWith(valueName + '=')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(SettingsMigrationTest, NoGlobalIniDoesNothing)
|
||||
@@ -95,6 +116,8 @@ TEST_F(SettingsMigrationTest, MigratesAllSettingsGroups)
|
||||
g.setValue("maxplayers", 4);
|
||||
g.setValue("gamedescription", "test game");
|
||||
g.setValue("remembergamesettings", false);
|
||||
g.setValue("gametypes", "commander");
|
||||
g.setValue("onlybuddies", true);
|
||||
g.endGroup();
|
||||
|
||||
// localgameoptions
|
||||
@@ -108,44 +131,119 @@ TEST_F(SettingsMigrationTest, MigratesAllSettingsGroups)
|
||||
g.setValue("mention", false);
|
||||
g.setValue("mentioncolor", "FF0000");
|
||||
g.setValue("showmessagepopups", false);
|
||||
g.setValue("mentioncompleter", false);
|
||||
g.setValue("roomhistory", false);
|
||||
g.setValue("highlightcolor", "00FF00");
|
||||
g.endGroup();
|
||||
|
||||
// legacy highlight words (under [personal])
|
||||
g.setValue("personal/highlightWords", "alpha beta");
|
||||
|
||||
// cache storage (under [personal] group)
|
||||
g.setValue("personal/pixmapCacheSize", 1024);
|
||||
g.setValue("personal/networkCacheSize", 2048);
|
||||
g.setValue("personal/redirectCacheTtl", 5);
|
||||
g.setValue("personal/cardPictureLoaderCacheMethod", 1);
|
||||
g.setValue("personal/localCardImageStorageNamingScheme", 2);
|
||||
|
||||
// updates (under [personal] group)
|
||||
g.setValue("personal/startupUpdateCheck", false);
|
||||
g.setValue("personal/startupCardUpdateCheckPromptForUpdate", false);
|
||||
g.setValue("personal/startupCardUpdateCheckAlwaysUpdate", true);
|
||||
g.setValue("personal/cardUpdateCheckInterval", 14);
|
||||
g.setValue("personal/lastCardUpdateCheck", QDate(2024, 1, 1));
|
||||
g.setValue("personal/alwaysEnableNewSets", true);
|
||||
g.setValue("personal/updatenotification", false);
|
||||
g.setValue("personal/newversionnotification", false);
|
||||
|
||||
// personal
|
||||
g.setValue("personal/lang", "de");
|
||||
g.setValue("personal/keepalive", 10);
|
||||
g.setValue("personal/timeout", 30);
|
||||
g.setValue("personal/clientid", "test-client-id");
|
||||
|
||||
// downloads (previously under [personal])
|
||||
g.setValue("personal/picturedownload", true);
|
||||
g.setValue("personal/downloadspoilers", true);
|
||||
|
||||
// interface (previously under [personal])
|
||||
g.setValue("personal/showStatusBar", true);
|
||||
|
||||
// theme
|
||||
g.setValue("theme/name", "custom_theme");
|
||||
g.setValue("game/maxfontsize", 14);
|
||||
|
||||
// appearance
|
||||
g.setValue("appearance/styleUserList", false);
|
||||
g.setValue("home/background/displayCardName", false);
|
||||
g.setValue("menu/showshortcuts", false);
|
||||
g.setValue("menu/showgameselectorfiltertoolbar", false);
|
||||
|
||||
// deck editor
|
||||
g.setValue("editor/openDeckInNewTab", false);
|
||||
g.setValue("interface/deckeditortagswidgetvisible", false);
|
||||
g.setValue("interface/defaultDeckEditorType", 0);
|
||||
g.setValue("interface/visualdeckeditorsamplehandsize", 5);
|
||||
|
||||
// personal home
|
||||
g.setValue("home/background", "custom_bg");
|
||||
g.setValue("home/background/shuffleTimer", 30);
|
||||
|
||||
// personal tipOfDay
|
||||
g.setValue("tipOfDay/showTips", false);
|
||||
g.setValue("tipOfDay/seenTips", QStringList{"1", "2", "3"});
|
||||
|
||||
// network
|
||||
g.setValue("personal/keepalive", 10);
|
||||
g.setValue("personal/timeout", 30);
|
||||
g.setValue("personal/clientid", "test-client-id");
|
||||
g.setValue("personal/clientversion", "test-client-version");
|
||||
g.setValue("interface/knownmissingfeatures", "feature1,feature2");
|
||||
|
||||
// cards
|
||||
g.setValue("cards/displaycardnames", false);
|
||||
g.setValue("cards/roundcardcorners", false);
|
||||
g.setValue("cards/overrideallcardartwithpersonalpreference", true);
|
||||
g.setValue("cards/bumpsetswithcardsindecktotop", false);
|
||||
g.setValue("cards/includerebalancedcards", false);
|
||||
g.setValue("cards/autorotatesidewayslayoutcards", false);
|
||||
g.setValue("cards/tapanimation", true);
|
||||
g.setValue("cards/scaleCards", false);
|
||||
g.setValue("cards/verticalCardOverlapPercent", 42);
|
||||
g.setValue("cards/cardinfoviewmode", 1);
|
||||
g.setValue("cards/printingselectorcardsize", 90);
|
||||
g.setValue("cards/printingselectorsortorder", 3);
|
||||
g.setValue("cards/printingselectornavigationbuttonsvisible", false);
|
||||
// card counters (migrate into card_counters.ini)
|
||||
g.setValue("cards/counters/0/color", QColor(Qt::red));
|
||||
|
||||
// interface
|
||||
g.setValue("interface/usetearoffmenus", true);
|
||||
g.setValue("interface/cardViewInitialRowsMax", 8);
|
||||
g.setValue("interface/cardViewExpandedRowsMax", 12);
|
||||
g.setValue("interface/closeEmptyCardView", false);
|
||||
g.setValue("interface/focusCardViewSearchBar", false);
|
||||
g.setValue("interface/keepGameChatFocus", true);
|
||||
g.setValue("interface/notificationsenabled", false);
|
||||
g.setValue("interface/specnotificationsenabled", true);
|
||||
g.setValue("interface/buddyconnectnotificationsenabled", false);
|
||||
g.setValue("interface/doubleclicktoplay", false);
|
||||
g.setValue("interface/clickPlaysAllSelected", false);
|
||||
g.setValue("interface/playtostack", false);
|
||||
g.setValue("interface/doNotDeleteArrowsInSubPhases", false);
|
||||
g.setValue("interface/startinghandsize", 5);
|
||||
|
||||
// hand/table
|
||||
g.setValue("interface/annotatetokens", true);
|
||||
g.setValue("interface/showlassoselectioncount", false);
|
||||
g.setValue("interface/showpersistentselectioncount", false);
|
||||
g.setValue("interface/tallyType", 2);
|
||||
g.setValue("interface/leftjustified", true);
|
||||
g.setValue("interface/min_players_multicolumn", 6);
|
||||
g.setValue("interface/deckeditorbannercardcomboboxvisible", false);
|
||||
// hand/table/replay/zoneview
|
||||
g.setValue("hand/horizontal", true);
|
||||
g.setValue("table/invert_vertical", true);
|
||||
g.setValue("replay/rewindBufferingMs", 6000);
|
||||
g.setValue("replay/fastForwardSpeed", 5);
|
||||
g.setValue("zoneview/groupby", 2);
|
||||
g.setValue("zoneview/sortby", 1);
|
||||
g.setValue("zoneview/pileview", false);
|
||||
|
||||
// paths
|
||||
g.beginGroup("paths");
|
||||
@@ -155,8 +253,29 @@ TEST_F(SettingsMigrationTest, MigratesAllSettingsGroups)
|
||||
|
||||
// visual deck storage (under [interface] group)
|
||||
g.setValue("interface/visualdeckstoragecardsize", 150);
|
||||
g.setValue("interface/visualdeckstoragesortingorder", 2);
|
||||
g.setValue("interface/visualdeckstorageshowfolders", false);
|
||||
g.setValue("interface/visualdeckstorageshowtagfilter", false);
|
||||
g.setValue("interface/visualdeckstoragedefaulttagslist", QStringList{"Alpha", "Beta"});
|
||||
g.setValue("interface/visualdeckstoragesearchfoldernames", false);
|
||||
g.setValue("interface/visualdeckstorageshowcoloridentity", false);
|
||||
g.setValue("interface/visualdeckstorageshowbannercardcombobox", false);
|
||||
g.setValue("interface/visualdeckstorageshowtagsondeckpreviews", false);
|
||||
g.setValue("interface/visualdeckstoragedrawunusedcoloridentities", false);
|
||||
g.setValue("interface/visualdeckstorageunusedcoloridentitiesopacity", 35);
|
||||
g.setValue("interface/visualdeckstoragetooltiptype", 1);
|
||||
g.setValue("interface/visualdeckstoragepromptforconversion", false);
|
||||
g.setValue("interface/visualdeckstoragealwaysconvert", true);
|
||||
g.setValue("interface/visualdeckstorageingame", false);
|
||||
g.setValue("interface/visualdeckstorageselectionanimation", false);
|
||||
g.setValue("interface/visualdatabasedisplayfiltertomostrecentsetsenabled", true);
|
||||
g.setValue("interface/visualdatabasedisplayfiltertomostrecentsetsamount", 25);
|
||||
|
||||
// card sizes (migrate into cards_display.ini)
|
||||
g.setValue("interface/visualdatabasedisplaycardsize", 80);
|
||||
g.setValue("interface/visualdeckeditorcardsize", 70);
|
||||
g.setValue("interface/edhreccardsize", 60);
|
||||
g.setValue("interface/archidektpreviewsize", 50);
|
||||
|
||||
g.sync();
|
||||
}
|
||||
@@ -176,54 +295,189 @@ TEST_F(SettingsMigrationTest, MigratesAllSettingsGroups)
|
||||
ASSERT_TRUE(fileExists("sound.ini"));
|
||||
ASSERT_EQ(readFromIni("sound.ini", "sound/enabled"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("sound.ini", "sound/theme"), QVariant("custom_theme"));
|
||||
ASSERT_EQ(readFromIni("sound.ini", "sound/mastervolume"), QVariant(75));
|
||||
ASSERT_EQ(readFromIni("sound.ini", "sound/masterVolume"), QVariant(75));
|
||||
|
||||
ASSERT_TRUE(fileExists("game.ini"));
|
||||
ASSERT_EQ(readFromIni("game.ini", "game/maxplayers"), QVariant(4));
|
||||
ASSERT_EQ(readFromIni("game.ini", "game/gamedescription"), QVariant("test game"));
|
||||
ASSERT_EQ(readFromIni("game.ini", "game/remembergamesettings"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("game.ini", "localgameoptions/maxplayers"), QVariant(2));
|
||||
ASSERT_EQ(readFromIni("game.ini", "localgameoptions/startinglifetotal"), QVariant(40));
|
||||
ASSERT_EQ(readFromIni("game.ini", "game/maxPlayers"), QVariant(4));
|
||||
ASSERT_EQ(readFromIni("game.ini", "game/gameDescription"), QVariant("test game"));
|
||||
ASSERT_EQ(readFromIni("game.ini", "game/rememberGameSettings"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("game.ini", "game/gameTypes"), QVariant("commander"));
|
||||
ASSERT_EQ(readFromIni("game.ini", "game/onlyBuddies"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("game.ini", "localgameoptions/maxPlayers"), QVariant(2));
|
||||
ASSERT_EQ(readFromIni("game.ini", "localgameoptions/startingLifeTotal"), QVariant(40));
|
||||
|
||||
ASSERT_TRUE(fileExists("chat.ini"));
|
||||
ASSERT_EQ(readFromIni("chat.ini", "chat/mention"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("chat.ini", "chat/mentioncolor"), QVariant("FF0000"));
|
||||
ASSERT_EQ(readFromIni("chat.ini", "chat/showmessagepopups"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("chat.ini", "chat/mentionColor"), QVariant("FF0000"));
|
||||
ASSERT_EQ(readFromIni("chat.ini", "chat/showMessagePopups"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("chat.ini", "chat/mentionCompleter"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("chat.ini", "chat/roomHistory"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("chat.ini", "chat/highlightColor"), QVariant("00FF00"));
|
||||
ASSERT_EQ(readFromIni("chat.ini", "chat/highlightWords"), QVariant("alpha beta"));
|
||||
|
||||
ASSERT_TRUE(fileExists("cache_storage.ini"));
|
||||
ASSERT_EQ(readFromIni("cache_storage.ini", "personal/pixmapCacheSize"), QVariant(1024));
|
||||
ASSERT_EQ(readFromIni("cache_storage.ini", "personal/networkCacheSize"), QVariant(2048));
|
||||
ASSERT_EQ(readFromIni("cache_storage.ini", "cache_storage/pixmapCacheSize"), QVariant(1024));
|
||||
ASSERT_EQ(readFromIni("cache_storage.ini", "cache_storage/networkCacheSize"), QVariant(2048));
|
||||
ASSERT_EQ(readFromIni("cache_storage.ini", "cache_storage/redirectCacheTtl"), QVariant(5));
|
||||
ASSERT_EQ(readFromIni("cache_storage.ini", "cache_storage/cardPictureLoaderCacheMethod"), QVariant(1));
|
||||
ASSERT_EQ(readFromIni("cache_storage.ini", "cache_storage/localCardImageStorageNamingScheme"), QVariant(2));
|
||||
|
||||
ASSERT_TRUE(fileExists("updates.ini"));
|
||||
ASSERT_EQ(readFromIni("updates.ini", "updates/startupUpdateCheck"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("updates.ini", "updates/startupCardUpdateCheckPromptForUpdate"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("updates.ini", "updates/startupCardUpdateCheckAlwaysUpdate"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("updates.ini", "updates/cardUpdateCheckInterval"), QVariant(14));
|
||||
ASSERT_EQ(readFromIni("updates.ini", "updates/lastCardUpdateCheck"), QVariant(QDate(2024, 1, 1)));
|
||||
ASSERT_EQ(readFromIni("updates.ini", "updates/alwaysEnableNewSets"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("updates.ini", "updates/updateNotification"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("updates.ini", "updates/newVersionNotification"), QVariant(false));
|
||||
|
||||
ASSERT_TRUE(fileExists("personal.ini"));
|
||||
ASSERT_EQ(readFromIni("personal.ini", "personal/lang"), QVariant("de"));
|
||||
ASSERT_EQ(readFromIni("personal.ini", "personal/keepalive"), QVariant(10));
|
||||
ASSERT_EQ(readFromIni("personal.ini", "personal/clientid"), QVariant("test-client-id"));
|
||||
ASSERT_EQ(readFromIni("personal.ini", "personal/showStatusBar"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("personal.ini", "home/background"), QVariant("custom_bg"));
|
||||
ASSERT_EQ(readFromIni("personal.ini", "tipOfDay/showTips"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("personal.ini", "tipOfDay/seenTips"), QVariant(QStringList{"1", "2", "3"}));
|
||||
|
||||
ASSERT_TRUE(fileExists("downloads.ini"));
|
||||
ASSERT_EQ(readFromIni("downloads.ini", "downloads/pictureDownload"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("downloads.ini", "downloads/downloadSpoilers"), QVariant(true));
|
||||
|
||||
ASSERT_TRUE(fileExists("appearance.ini"));
|
||||
ASSERT_EQ(readFromIni("appearance.ini", "appearance/themeName"), QVariant("custom_theme"));
|
||||
ASSERT_EQ(readFromIni("appearance.ini", "appearance/maxFontSize"), QVariant(14));
|
||||
ASSERT_EQ(readFromIni("appearance.ini", "appearance/styleUserList"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("appearance.ini", "appearance/homeTabBackgroundSource"), QVariant("custom_bg"));
|
||||
ASSERT_EQ(readFromIni("appearance.ini", "appearance/homeTabBackgroundShuffleFrequency"), QVariant(30));
|
||||
ASSERT_EQ(readFromIni("appearance.ini", "appearance/homeTabDisplayCardName"), QVariant(false));
|
||||
|
||||
ASSERT_TRUE(fileExists("network.ini"));
|
||||
ASSERT_EQ(readFromIni("network.ini", "network/keepAlive"), QVariant(10));
|
||||
ASSERT_EQ(readFromIni("network.ini", "network/timeout"), QVariant(30));
|
||||
ASSERT_EQ(readFromIni("network.ini", "network/clientId"), QVariant("test-client-id"));
|
||||
ASSERT_EQ(readFromIni("network.ini", "network/clientVersion"), QVariant("test-client-version"));
|
||||
ASSERT_EQ(readFromIni("network.ini", "network/knownMissingFeatures"), QVariant("feature1,feature2"));
|
||||
|
||||
ASSERT_TRUE(fileExists("cards_display.ini"));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/displaycardnames"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/tapanimation"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/displayCardNames"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/roundCardCorners"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/overrideAllCardArtWithPersonalPreference"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/bumpSetsWithCardsInDeckToTop"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/includerebalancedcards"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/autoRotateSidewaysLayoutCards"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/tapAnimation"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/scaleCards"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/verticalCardOverlapPercent"), QVariant(42));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/cardInfoViewMode"), QVariant(1));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/cardSize/printingSelector"), QVariant(90));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/printingSelector/sortOrder"), QVariant(3));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/printingSelector/navigationButtonsVisible"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/cardSize/visualDeckStorage"), QVariant(150));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/cardSize/visualDatabaseDisplay"), QVariant(80));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/cardSize/visualDeckEditor"), QVariant(70));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/cardSize/edhrec"), QVariant(60));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/cardSize/archidektPreview"), QVariant(50));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/cardSize/sampleHandSize"), QVariant(5));
|
||||
|
||||
ASSERT_TRUE(fileExists("card_counters.ini"));
|
||||
ASSERT_EQ(readFromIni("card_counters.ini", "cards/counters/0/color").toString(), QColor(Qt::red).name());
|
||||
ASSERT_FALSE(readFromIni("global.ini", "cards/counters/0/color").isValid());
|
||||
|
||||
ASSERT_TRUE(fileExists("interface.ini"));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/usetearoffmenus"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/notificationsenabled"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/startinghandsize"), QVariant(5));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/useTearOffMenus"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/cardViewInitialRowsMax"), QVariant(8));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/cardViewExpandedRowsMax"), QVariant(12));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/closeEmptyCardView"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/focusCardViewSearchBar"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/keepGameChatFocus"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/notifications/enabled"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/notifications/spectatorsEnabled"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/notifications/buddyConnectEnabled"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/doubleClickToPlay"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/clickPlaysAllSelected"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/playToStack"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/doNotDeleteArrowsInSubPhases"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/startingHandSize"), QVariant(5));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/annotateTokens"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/showLassoSelectionCount"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/showPersistentSelectionCount"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/tallyType"), QVariant(2));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/leftJustified"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/minPlayersMulticolumn"), QVariant(6));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/showStatusBar"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/showShortcuts"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "interface/showGameSelectorFilterToolbar"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "hand/horizontal"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "table/invert_vertical"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "table/invertVertical"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "replay/rewindBufferingMs"), QVariant(6000));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "replay/fastForwardSpeed"), QVariant(5));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "zoneview/groupBy"), QVariant(2));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "zoneview/sortBy"), QVariant(1));
|
||||
ASSERT_EQ(readFromIni("interface.ini", "zoneview/pileView"), QVariant(false));
|
||||
|
||||
ASSERT_TRUE(fileExists("deck_editor.ini"));
|
||||
ASSERT_EQ(readFromIni("deck_editor.ini", "deckeditor/openDeckInNewTab"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("deck_editor.ini", "deckeditor/bannerCardComboBoxVisible"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("deck_editor.ini", "deckeditor/tagsWidgetVisible"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("deck_editor.ini", "deckeditor/defaultDeckEditorType"), QVariant(0));
|
||||
|
||||
ASSERT_TRUE(fileExists("paths.ini"));
|
||||
ASSERT_EQ(readFromIni("paths.ini", "paths/decks"), QVariant("/custom/decks"));
|
||||
ASSERT_EQ(readFromIni("paths.ini", "paths/pics"), QVariant("/custom/pics"));
|
||||
|
||||
ASSERT_TRUE(fileExists("visual_deck_storage.ini"));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualdeckstoragecardsize"), QVariant(150));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualdeckstorageshowfolders"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/sortingOrder"), QVariant(2));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/showFolders"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/showTagFilter"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/defaultTagsList"),
|
||||
QVariant(QStringList{"Alpha", "Beta"}));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/searchFolderNames"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/showColorIdentity"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/showBannerCardComboBox"),
|
||||
QVariant(false));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/showTagsOnDeckPreviews"),
|
||||
QVariant(false));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/drawUnusedColorIdentities"),
|
||||
QVariant(false));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/unusedColorIdentitiesOpacity"),
|
||||
QVariant(35));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/tooltipType"), QVariant(1));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/promptForConversion"),
|
||||
QVariant(false));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/alwaysConvert"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/inGame"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDeckStorage/selectionAnimation"),
|
||||
QVariant(false));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDatabaseDisplay/filterToMostRecentSetsEnabled"),
|
||||
QVariant(true));
|
||||
ASSERT_EQ(readFromIni("visual_deck_storage.ini", "interface/visualDatabaseDisplay/filterToMostRecentSetsAmount"),
|
||||
QVariant(25));
|
||||
|
||||
// No legacy flat keys should remain in the per-file INIs
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("visual_deck_storage.ini", "interface/visualdeckstorageshowfolders"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("visual_deck_storage.ini", "interface/visualdeckstoragecardsize"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("deck_editor.ini", "deckeditor/sampleHandSize"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("deck_editor.ini", "deckeditor/cardSize"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("interface.ini", "interface/notificationsenabled"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("cards_display.ini", "cards/printingselectorsortorder"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("cards_display.ini", "cards/visualDeckStorage/cardSize"));
|
||||
|
||||
// No legacy non-camelCase keys should remain in the per-file INIs
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("game.ini", "game/gamedescription"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("game.ini", "localgameoptions/maxplayers"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("chat.ini", "chat/roomhistory"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("chat.ini", "chat/highlightwords"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("sound.ini", "sound/mastervolume"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("downloads.ini", "downloads/picturedownload"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("network.ini", "network/keepalive"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("network.ini", "network/knownmissingfeatures"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("updates.ini", "updates/updatenotification"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("cards_display.ini", "cards/displaycardnames"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("cards_display.ini", "cards/cardinfoviewmode"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("interface.ini", "interface/usetearoffmenus"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("interface.ini", "interface/doubleclicktoplay"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("interface.ini", "interface/min_players_multicolumn"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("interface.ini", "table/invert_vertical"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("interface.ini", "zoneview/groupby"));
|
||||
ASSERT_FALSE(iniFileHasKeyCaseSensitive("interface.ini", "zoneview/pileview"));
|
||||
|
||||
// Verify sentinel was written
|
||||
ASSERT_EQ(readFromIni("global.ini", "migration/perfile_complete"), QVariant(true));
|
||||
@@ -303,7 +557,7 @@ TEST_F(SettingsMigrationTest, KeyMapTranslationIsCorrect)
|
||||
ASSERT_TRUE(fileExists("updates.ini"));
|
||||
// The key should be translated from "personal/cardUpdateCheckInterval" to "updates/cardUpdateCheckInterval"
|
||||
ASSERT_EQ(readFromIni("updates.ini", "updates/cardUpdateCheckInterval"), QVariant(30));
|
||||
ASSERT_EQ(readFromIni("updates.ini", "updates/updatereleasechannel"), QVariant(1));
|
||||
ASSERT_EQ(readFromIni("updates.ini", "updates/updateReleaseChannel"), QVariant(1));
|
||||
}
|
||||
|
||||
TEST_F(SettingsMigrationTest, CardsKeysKeepGroupPrefix)
|
||||
@@ -319,18 +573,15 @@ TEST_F(SettingsMigrationTest, CardsKeysKeepGroupPrefix)
|
||||
|
||||
ASSERT_TRUE(fileExists("global.ini.old"));
|
||||
ASSERT_TRUE(fileExists("cards_display.ini"));
|
||||
ASSERT_TRUE(fileExists("deck_editor.ini"));
|
||||
// "cards/displaycardnames" should be stored with its group prefix
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/displaycardnames"), QVariant(false));
|
||||
// "interface/..." keys should keep their full path
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "interface/deckeditorbannercardcomboboxvisible"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("cards_display.ini", "cards/displayCardNames"), QVariant(false));
|
||||
// deck editor keys belong to the deck editor settings now
|
||||
ASSERT_EQ(readFromIni("deck_editor.ini", "deckeditor/bannerCardComboBoxVisible"), QVariant(true));
|
||||
}
|
||||
|
||||
TEST_F(SettingsMigrationTest, LegacyMigrationIsIdempotent)
|
||||
{
|
||||
if (!nativeSettingsAvailable()) {
|
||||
GTEST_SKIP() << "NativeFormat QSettings not available in this environment";
|
||||
}
|
||||
|
||||
{
|
||||
QSettings nativeSettings;
|
||||
nativeSettings.setValue("server/previoushostlogin", "test_user");
|
||||
@@ -343,17 +594,62 @@ TEST_F(SettingsMigrationTest, LegacyMigrationIsIdempotent)
|
||||
// Change the migrated value
|
||||
{
|
||||
QSettings serversIni(settingsPath + "servers.ini", QSettings::IniFormat);
|
||||
serversIni.setValue("server/previoushostlogin", "modified_user");
|
||||
serversIni.setValue("server/previousHostLogin", "modified_user");
|
||||
serversIni.sync();
|
||||
}
|
||||
|
||||
// Second migration should NOT overwrite the change
|
||||
ASSERT_FALSE(SettingsMigration::migrateLegacySettings(settingsPath));
|
||||
ASSERT_EQ(readFromIni("servers.ini", "server/previoushostlogin"), QVariant("modified_user"));
|
||||
ASSERT_EQ(readFromIni("servers.ini", "server/previousHostLogin"), QVariant("modified_user"));
|
||||
}
|
||||
|
||||
TEST_F(SettingsMigrationTest, LegacyMigrationCamelCasesKeys)
|
||||
{
|
||||
{
|
||||
QSettings nativeSettings;
|
||||
nativeSettings.setValue("sets/AAA/sortkey", 2);
|
||||
nativeSettings.setValue("sets/AAA/enabled", false);
|
||||
nativeSettings.setValue("sets/AAA/isknown", false);
|
||||
nativeSettings.setValue("server/previoushostlogin", "legacy_user");
|
||||
nativeSettings.setValue("server/auto_connect", 1);
|
||||
nativeSettings.setValue("server/fpport", "5080");
|
||||
nativeSettings.setValue("messages/count", 1);
|
||||
nativeSettings.setValue("messages/msg0", "hello");
|
||||
nativeSettings.setValue("filter_games/hide_full_games", true);
|
||||
nativeSettings.setValue("filter_games/min_players", 3);
|
||||
nativeSettings.setValue("filter_games/max_players", 5);
|
||||
nativeSettings.setValue("filter_games/game_type/deadbeef", true);
|
||||
nativeSettings.sync();
|
||||
}
|
||||
|
||||
ASSERT_TRUE(SettingsMigration::migrateLegacySettings(settingsPath));
|
||||
|
||||
ASSERT_TRUE(fileExists("cardDatabase.ini"));
|
||||
ASSERT_EQ(readFromIni("cardDatabase.ini", "sets/AAA/sortKey"), QVariant(2));
|
||||
ASSERT_EQ(readFromIni("cardDatabase.ini", "sets/AAA/enabled"), QVariant(false));
|
||||
ASSERT_EQ(readFromIni("cardDatabase.ini", "sets/AAA/isKnown"), QVariant(false));
|
||||
|
||||
ASSERT_TRUE(fileExists("servers.ini"));
|
||||
ASSERT_EQ(readFromIni("servers.ini", "server/previousHostLogin"), QVariant("legacy_user"));
|
||||
ASSERT_EQ(readFromIni("servers.ini", "server/autoConnect"), QVariant(1));
|
||||
ASSERT_EQ(readFromIni("servers.ini", "server/fpPort"), QVariant("5080"));
|
||||
|
||||
ASSERT_TRUE(fileExists("messages.ini"));
|
||||
ASSERT_EQ(readFromIni("messages.ini", "messages/count"), QVariant(1));
|
||||
ASSERT_EQ(readFromIni("messages.ini", "messages/msg0"), QVariant("hello"));
|
||||
|
||||
ASSERT_TRUE(fileExists("gamefilters.ini"));
|
||||
ASSERT_EQ(readFromIni("gamefilters.ini", "filter_games/hideFullGames"), QVariant(true));
|
||||
ASSERT_EQ(readFromIni("gamefilters.ini", "filter_games/minPlayers"), QVariant(3));
|
||||
ASSERT_EQ(readFromIni("gamefilters.ini", "filter_games/maxPlayers"), QVariant(5));
|
||||
ASSERT_EQ(readFromIni("gamefilters.ini", "filter_games/gameType/deadbeef"), QVariant(true));
|
||||
}
|
||||
|
||||
TEST_F(SettingsMigrationTest, LegacyMigrationEmptyNativeFormatWritesSentinel)
|
||||
{
|
||||
QSettings().clear();
|
||||
QSettings().sync();
|
||||
|
||||
ASSERT_TRUE(SettingsMigration::migrateLegacySettings(settingsPath));
|
||||
ASSERT_TRUE(fileExists("personal.ini"));
|
||||
ASSERT_EQ(readFromIni("personal.ini", "migration/legacy_complete"), QVariant(true));
|
||||
@@ -409,5 +705,6 @@ int main(int argc, char **argv)
|
||||
QCoreApplication app(argc, argv);
|
||||
app.setOrganizationName("CockatriceTest");
|
||||
app.setApplicationName("SettingsMigrationTest");
|
||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user