[Settings] Camel case everything

This commit is contained in:
Lukas Brübach 2026-08-05 20:29:12 +02:00
parent e37cb5dadf
commit 8a3ffac8e2
15 changed files with 481 additions and 352 deletions

View file

@ -222,15 +222,15 @@ void SettingsCache::loadPaths()
// customPicsPath derived from picsPath // customPicsPath derived from picsPath
QString picsPath = pathsIni.value("paths/pics").toString(); QString picsPath = pathsIni.value("paths/pics").toString();
if (picsPath.endsWith("/")) { if (picsPath.endsWith("/")) {
computePath("custompics", picsPath + "CUSTOM/"); computePath("customPics", picsPath + "CUSTOM/");
} else { } else {
computePath("custompics", picsPath + "/CUSTOM/"); computePath("customPics", picsPath + "/CUSTOM/");
} }
computePath("customsets", dataPath + "/customsets/"); computePath("customSets", dataPath + "/customsets/");
computeFilePath("carddatabase", dataPath + "/cards.xml"); computeFilePath("cardDatabase", dataPath + "/cards.xml");
computeFilePath("tokendatabase", dataPath + "/tokens.xml"); computeFilePath("tokenDatabase", dataPath + "/tokens.xml");
computeFilePath("spoilerdatabase", dataPath + "/spoiler.xml"); computeFilePath("spoilerDatabase", dataPath + "/spoiler.xml");
} }
void SettingsCache::resetPaths() void SettingsCache::resetPaths()

View file

@ -9,7 +9,7 @@ CardDatabaseSettings::CardDatabaseSettings(const QString &settingPath, QObject *
void CardDatabaseSettings::setSortKey(QString shortName, unsigned int sortKey) void CardDatabaseSettings::setSortKey(QString shortName, unsigned int sortKey)
{ {
setValue(sortKey, "sortkey", "sets", shortName); setValue(sortKey, "sortKey", "sets", shortName);
QMutexLocker lock(&setOptionsMutex); QMutexLocker lock(&setOptionsMutex);
ensureSetOptionsLoaded(); ensureSetOptionsLoaded();
setOptionsCache[shortName].sortKey = sortKey; setOptionsCache[shortName].sortKey = sortKey;
@ -25,7 +25,7 @@ void CardDatabaseSettings::setEnabled(QString shortName, bool enabled)
void CardDatabaseSettings::setIsKnown(QString shortName, bool isknown) void CardDatabaseSettings::setIsKnown(QString shortName, bool isknown)
{ {
setValue(isknown, "isknown", "sets", shortName); setValue(isknown, "isKnown", "sets", shortName);
QMutexLocker lock(&setOptionsMutex); QMutexLocker lock(&setOptionsMutex);
ensureSetOptionsLoaded(); ensureSetOptionsLoaded();
setOptionsCache[shortName].isKnown = isknown; setOptionsCache[shortName].isKnown = isknown;
@ -42,9 +42,9 @@ void CardDatabaseSettings::ensureSetOptionsLoaded() const
for (const QString &group : groups) { for (const QString &group : groups) {
settings.beginGroup(group); settings.beginGroup(group);
SetOptions &o = setOptionsCache[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.enabled = settings.value("enabled", true).toBool();
o.isKnown = settings.value("isknown", true).toBool(); o.isKnown = settings.value("isKnown", true).toBool();
settings.endGroup(); settings.endGroup();
} }
setOptionsLoaded = true; setOptionsLoaded = true;
@ -84,7 +84,7 @@ void CardDatabaseSettings::saveSets(const QVector<ICardSetPriorityController::Se
s.beginGroup("sets"); s.beginGroup("sets");
for (const auto &entry : data) { for (const auto &entry : data) {
s.beginGroup(entry.shortName); s.beginGroup(entry.shortName);
s.setValue("sortkey", entry.sortKey); s.setValue("sortKey", entry.sortKey);
s.setValue("enabled", entry.enabled); s.setValue("enabled", entry.enabled);
s.endGroup(); s.endGroup();
} }

View file

@ -7,22 +7,22 @@ CardsDisplaySettings::CardsDisplaySettings(const QString &settingPath, QObject *
bool CardsDisplaySettings::getDisplayCardNames() const bool CardsDisplaySettings::getDisplayCardNames() const
{ {
return getValue("displaycardnames", QString(), QString(), true).toBool(); return getValue("displayCardNames", QString(), QString(), true).toBool();
} }
bool CardsDisplaySettings::getRoundCardCorners() const bool CardsDisplaySettings::getRoundCardCorners() const
{ {
return getValue("roundcardcorners", QString(), QString(), true).toBool(); return getValue("roundCardCorners", QString(), QString(), true).toBool();
} }
bool CardsDisplaySettings::getOverrideAllCardArtWithPersonalPreference() const bool CardsDisplaySettings::getOverrideAllCardArtWithPersonalPreference() const
{ {
return getValue("overrideallcardartwithpersonalpreference", QString(), QString(), false).toBool(); return getValue("overrideAllCardArtWithPersonalPreference", QString(), QString(), false).toBool();
} }
bool CardsDisplaySettings::getBumpSetsWithCardsInDeckToTop() const bool CardsDisplaySettings::getBumpSetsWithCardsInDeckToTop() const
{ {
return getValue("bumpsetswithcardsindecktotop", QString(), QString(), true).toBool(); return getValue("bumpSetsWithCardsInDeckToTop", QString(), QString(), true).toBool();
} }
int CardsDisplaySettings::getPrintingSelectorSortOrder() const int CardsDisplaySettings::getPrintingSelectorSortOrder() const
@ -47,12 +47,12 @@ bool CardsDisplaySettings::getPrintingSelectorNavigationButtonsVisible() const
bool CardsDisplaySettings::getTapAnimation() const bool CardsDisplaySettings::getTapAnimation() const
{ {
return getValue("tapanimation", QString(), QString(), true).toBool(); return getValue("tapAnimation", QString(), QString(), true).toBool();
} }
bool CardsDisplaySettings::getAutoRotateSidewaysLayoutCards() const bool CardsDisplaySettings::getAutoRotateSidewaysLayoutCards() const
{ {
return getValue("autorotatesidewayslayoutcards", QString(), QString(), true).toBool(); return getValue("autoRotateSidewaysLayoutCards", QString(), QString(), true).toBool();
} }
bool CardsDisplaySettings::getScaleCards() const bool CardsDisplaySettings::getScaleCards() const
@ -67,7 +67,7 @@ int CardsDisplaySettings::getStackCardOverlapPercent() const
int CardsDisplaySettings::getCardInfoViewMode() const int CardsDisplaySettings::getCardInfoViewMode() const
{ {
return getValue("cardinfoviewmode", QString(), QString(), 0).toInt(); return getValue("cardInfoViewMode", QString(), QString(), 0).toInt();
} }
int CardsDisplaySettings::getVisualDeckStorageCardSize() const int CardsDisplaySettings::getVisualDeckStorageCardSize() const
@ -102,7 +102,7 @@ int CardsDisplaySettings::getSampleHandSize() const
void CardsDisplaySettings::setDisplayCardNames(bool _displayCardNames) void CardsDisplaySettings::setDisplayCardNames(bool _displayCardNames)
{ {
setValue(_displayCardNames, "displaycardnames"); setValue(_displayCardNames, "displayCardNames");
emit displayCardNamesChanged(); emit displayCardNamesChanged();
} }
@ -111,19 +111,19 @@ void CardsDisplaySettings::setRoundCardCorners(bool _roundCardCorners)
if (_roundCardCorners == getRoundCardCorners()) { if (_roundCardCorners == getRoundCardCorners()) {
return; return;
} }
setValue(_roundCardCorners, "roundcardcorners"); setValue(_roundCardCorners, "roundCardCorners");
emit roundCardCornersChanged(_roundCardCorners); emit roundCardCornersChanged(_roundCardCorners);
} }
void CardsDisplaySettings::setOverrideAllCardArtWithPersonalPreference(bool _overrideAllCardArt) void CardsDisplaySettings::setOverrideAllCardArtWithPersonalPreference(bool _overrideAllCardArt)
{ {
setValue(_overrideAllCardArt, "overrideallcardartwithpersonalpreference"); setValue(_overrideAllCardArt, "overrideAllCardArtWithPersonalPreference");
emit overrideAllCardArtWithPersonalPreferenceChanged(_overrideAllCardArt); emit overrideAllCardArtWithPersonalPreferenceChanged(_overrideAllCardArt);
} }
void CardsDisplaySettings::setBumpSetsWithCardsInDeckToTop(bool _bumpSetsWithCardsInDeckToTop) void CardsDisplaySettings::setBumpSetsWithCardsInDeckToTop(bool _bumpSetsWithCardsInDeckToTop)
{ {
setValue(_bumpSetsWithCardsInDeckToTop, "bumpsetswithcardsindecktotop"); setValue(_bumpSetsWithCardsInDeckToTop, "bumpSetsWithCardsInDeckToTop");
emit bumpSetsWithCardsInDeckToTopChanged(); emit bumpSetsWithCardsInDeckToTopChanged();
} }
@ -156,12 +156,12 @@ void CardsDisplaySettings::setPrintingSelectorNavigationButtonsVisible(bool _nav
void CardsDisplaySettings::setTapAnimation(bool _tapAnimation) void CardsDisplaySettings::setTapAnimation(bool _tapAnimation)
{ {
setValue(_tapAnimation, "tapanimation"); setValue(_tapAnimation, "tapAnimation");
} }
void CardsDisplaySettings::setAutoRotateSidewaysLayoutCards(bool _autoRotateSidewaysLayoutCards) void CardsDisplaySettings::setAutoRotateSidewaysLayoutCards(bool _autoRotateSidewaysLayoutCards)
{ {
setValue(_autoRotateSidewaysLayoutCards, "autorotatesidewayslayoutcards"); setValue(_autoRotateSidewaysLayoutCards, "autoRotateSidewaysLayoutCards");
} }
void CardsDisplaySettings::setCardScaling(bool _scaleCards) void CardsDisplaySettings::setCardScaling(bool _scaleCards)
@ -176,7 +176,7 @@ void CardsDisplaySettings::setStackCardOverlapPercent(int _verticalCardOverlapPe
void CardsDisplaySettings::setCardInfoViewMode(int _viewMode) void CardsDisplaySettings::setCardInfoViewMode(int _viewMode)
{ {
setValue(_viewMode, "cardinfoviewmode"); setValue(_viewMode, "cardInfoViewMode");
} }
void CardsDisplaySettings::setVisualDeckStorageCardSize(int _cardSize) void CardsDisplaySettings::setVisualDeckStorageCardSize(int _cardSize)

View file

@ -12,62 +12,62 @@ bool ChatSettings::getChatMention() const
bool ChatSettings::getChatMentionCompleter() const bool ChatSettings::getChatMentionCompleter() const
{ {
return getValue("mentioncompleter", QString(), QString(), true).toBool(); return getValue("mentionCompleter", QString(), QString(), true).toBool();
} }
QString ChatSettings::getChatMentionColor() const QString ChatSettings::getChatMentionColor() const
{ {
return getValue("mentioncolor", QString(), QString(), "A6120D").toString(); return getValue("mentionColor", QString(), QString(), "A6120D").toString();
} }
QString ChatSettings::getChatHighlightColor() const QString ChatSettings::getChatHighlightColor() const
{ {
return getValue("highlightcolor", QString(), QString(), "A6120D").toString(); return getValue("highlightColor", QString(), QString(), "A6120D").toString();
} }
bool ChatSettings::getChatMentionForeground() const bool ChatSettings::getChatMentionForeground() const
{ {
return getValue("mentionforeground", QString(), QString(), true).toBool(); return getValue("mentionForeground", QString(), QString(), true).toBool();
} }
bool ChatSettings::getChatHighlightForeground() const bool ChatSettings::getChatHighlightForeground() const
{ {
return getValue("highlightforeground", QString(), QString(), true).toBool(); return getValue("highlightForeground", QString(), QString(), true).toBool();
} }
bool ChatSettings::getIgnoreUnregisteredUsers() const bool ChatSettings::getIgnoreUnregisteredUsers() const
{ {
return getValue("ignore_unregistered").toBool(); return getValue("ignoreUnregistered").toBool();
} }
bool ChatSettings::getIgnoreUnregisteredUserMessages() const bool ChatSettings::getIgnoreUnregisteredUserMessages() const
{ {
return getValue("ignore_unregistered_messages").toBool(); return getValue("ignoreUnregisteredMessages").toBool();
} }
bool ChatSettings::getIgnoreNonBuddyUserMessages() const bool ChatSettings::getIgnoreNonBuddyUserMessages() const
{ {
return getValue("ignore_nonbuddy_messages").toBool(); return getValue("ignoreNonBuddyMessages").toBool();
} }
bool ChatSettings::getShowMessagePopup() const bool ChatSettings::getShowMessagePopup() const
{ {
return getValue("showmessagepopups", QString(), QString(), true).toBool(); return getValue("showMessagePopups", QString(), QString(), true).toBool();
} }
bool ChatSettings::getShowMentionPopup() const bool ChatSettings::getShowMentionPopup() const
{ {
return getValue("showmentionpopups", QString(), QString(), true).toBool(); return getValue("showMentionPopups", QString(), QString(), true).toBool();
} }
bool ChatSettings::getRoomHistory() const bool ChatSettings::getRoomHistory() const
{ {
return getValue("roomhistory", QString(), QString(), true).toBool(); return getValue("roomHistory", QString(), QString(), true).toBool();
} }
QString ChatSettings::getHighlightWords() const QString ChatSettings::getHighlightWords() const
{ {
return getValue("highlightwords").toString(); return getValue("highlightWords").toString();
} }
void ChatSettings::setChatMention(bool _chatMention) void ChatSettings::setChatMention(bool _chatMention)
@ -77,61 +77,61 @@ void ChatSettings::setChatMention(bool _chatMention)
void ChatSettings::setChatMentionCompleter(bool _chatMentionCompleter) void ChatSettings::setChatMentionCompleter(bool _chatMentionCompleter)
{ {
setValue(_chatMentionCompleter, "mentioncompleter"); setValue(_chatMentionCompleter, "mentionCompleter");
emit chatMentionCompleterChanged(); emit chatMentionCompleterChanged();
} }
void ChatSettings::setChatMentionColor(const QString &_chatMentionColor) void ChatSettings::setChatMentionColor(const QString &_chatMentionColor)
{ {
setValue(_chatMentionColor, "mentioncolor"); setValue(_chatMentionColor, "mentionColor");
} }
void ChatSettings::setChatHighlightColor(const QString &_chatHighlightColor) void ChatSettings::setChatHighlightColor(const QString &_chatHighlightColor)
{ {
setValue(_chatHighlightColor, "highlightcolor"); setValue(_chatHighlightColor, "highlightColor");
} }
void ChatSettings::setChatMentionForeground(bool _chatMentionForeground) void ChatSettings::setChatMentionForeground(bool _chatMentionForeground)
{ {
setValue(_chatMentionForeground, "mentionforeground"); setValue(_chatMentionForeground, "mentionForeground");
} }
void ChatSettings::setChatHighlightForeground(bool _chatHighlightForeground) void ChatSettings::setChatHighlightForeground(bool _chatHighlightForeground)
{ {
setValue(_chatHighlightForeground, "highlightforeground"); setValue(_chatHighlightForeground, "highlightForeground");
} }
void ChatSettings::setIgnoreUnregisteredUsers(bool _ignoreUnregisteredUsers) void ChatSettings::setIgnoreUnregisteredUsers(bool _ignoreUnregisteredUsers)
{ {
setValue(_ignoreUnregisteredUsers, "ignore_unregistered"); setValue(_ignoreUnregisteredUsers, "ignoreUnregistered");
} }
void ChatSettings::setIgnoreUnregisteredUserMessages(bool _ignoreUnregisteredUserMessages) void ChatSettings::setIgnoreUnregisteredUserMessages(bool _ignoreUnregisteredUserMessages)
{ {
setValue(_ignoreUnregisteredUserMessages, "ignore_unregistered_messages"); setValue(_ignoreUnregisteredUserMessages, "ignoreUnregisteredMessages");
} }
void ChatSettings::setIgnoreNonBuddyUserMessages(bool _ignoreNonBuddyUserMessages) void ChatSettings::setIgnoreNonBuddyUserMessages(bool _ignoreNonBuddyUserMessages)
{ {
setValue(_ignoreNonBuddyUserMessages, "ignore_nonbuddy_messages"); setValue(_ignoreNonBuddyUserMessages, "ignoreNonBuddyMessages");
} }
void ChatSettings::setShowMessagePopups(bool _showMessagePopups) void ChatSettings::setShowMessagePopups(bool _showMessagePopups)
{ {
setValue(_showMessagePopups, "showmessagepopups"); setValue(_showMessagePopups, "showMessagePopups");
} }
void ChatSettings::setShowMentionPopups(bool _showMentionPopups) void ChatSettings::setShowMentionPopups(bool _showMentionPopups)
{ {
setValue(_showMentionPopups, "showmentionpopups"); setValue(_showMentionPopups, "showMentionPopups");
} }
void ChatSettings::setRoomHistory(bool _roomHistory) void ChatSettings::setRoomHistory(bool _roomHistory)
{ {
setValue(_roomHistory, "roomhistory"); setValue(_roomHistory, "roomHistory");
} }
void ChatSettings::setHighlightWords(const QString &_highlightWords) void ChatSettings::setHighlightWords(const QString &_highlightWords)
{ {
setValue(_highlightWords, "highlightwords"); setValue(_highlightWords, "highlightWords");
} }

View file

@ -30,22 +30,22 @@ void DownloadSettings::resetToDefaultURLs()
bool DownloadSettings::getPicDownload() const bool DownloadSettings::getPicDownload() const
{ {
return getValue("picturedownload", QString(), QString(), true).toBool(); return getValue("pictureDownload", QString(), QString(), true).toBool();
} }
void DownloadSettings::setPicDownload(bool _picDownload) void DownloadSettings::setPicDownload(bool _picDownload)
{ {
setValue(_picDownload, "picturedownload"); setValue(_picDownload, "pictureDownload");
emit picDownloadChanged(); emit picDownloadChanged();
} }
bool DownloadSettings::getDownloadSpoilersStatus() const bool DownloadSettings::getDownloadSpoilersStatus() const
{ {
return getValue("downloadspoilers", QString(), QString(), false).toBool(); return getValue("downloadSpoilers", QString(), QString(), false).toBool();
} }
void DownloadSettings::setDownloadSpoilerStatus(bool _spoilerStatus) void DownloadSettings::setDownloadSpoilerStatus(bool _spoilerStatus)
{ {
setValue(_spoilerStatus, "downloadspoilers"); setValue(_spoilerStatus, "downloadSpoilers");
emit downloadSpoilerStatusChanged(); emit downloadSpoilerStatusChanged();
} }

View file

@ -19,137 +19,137 @@ static QString hashGameType(const QString &gameType)
void GameFiltersSettings::setHideBuddiesOnlyGames(bool hide) void GameFiltersSettings::setHideBuddiesOnlyGames(bool hide)
{ {
setValue(hide, "hide_buddies_only_games"); setValue(hide, "hideBuddiesOnlyGames");
} }
bool GameFiltersSettings::isHideBuddiesOnlyGames() const bool GameFiltersSettings::isHideBuddiesOnlyGames() const
{ {
QVariant previous = getValue("hide_buddies_only_games"); QVariant previous = getValue("hideBuddiesOnlyGames");
return previous == QVariant() ? false : previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setHideFullGames(bool hide) void GameFiltersSettings::setHideFullGames(bool hide)
{ {
setValue(hide, "hide_full_games"); setValue(hide, "hideFullGames");
} }
bool GameFiltersSettings::isHideFullGames() const bool GameFiltersSettings::isHideFullGames() const
{ {
QVariant previous = getValue("hide_full_games"); QVariant previous = getValue("hideFullGames");
return previous == QVariant() ? false : previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setHideGamesThatStarted(bool hide) void GameFiltersSettings::setHideGamesThatStarted(bool hide)
{ {
setValue(hide, "hide_games_that_started"); setValue(hide, "hideGamesThatStarted");
} }
bool GameFiltersSettings::isHideGamesThatStarted() const bool GameFiltersSettings::isHideGamesThatStarted() const
{ {
QVariant previous = getValue("hide_games_that_started"); QVariant previous = getValue("hideGamesThatStarted");
return previous == QVariant() ? false : previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setHidePasswordProtectedGames(bool hide) void GameFiltersSettings::setHidePasswordProtectedGames(bool hide)
{ {
setValue(hide, "hide_password_protected_games"); setValue(hide, "hidePasswordProtectedGames");
} }
bool GameFiltersSettings::isHidePasswordProtectedGames() const bool GameFiltersSettings::isHidePasswordProtectedGames() const
{ {
QVariant previous = getValue("hide_password_protected_games"); QVariant previous = getValue("hidePasswordProtectedGames");
return previous == QVariant() ? false : previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setHideIgnoredUserGames(bool hide) void GameFiltersSettings::setHideIgnoredUserGames(bool hide)
{ {
setValue(hide, "hide_ignored_user_games"); setValue(hide, "hideIgnoredUserGames");
} }
bool GameFiltersSettings::isHideIgnoredUserGames() const bool GameFiltersSettings::isHideIgnoredUserGames() const
{ {
QVariant previous = getValue("hide_ignored_user_games"); QVariant previous = getValue("hideIgnoredUserGames");
return previous == QVariant() ? true : previous.toBool(); return previous == QVariant() ? true : previous.toBool();
} }
void GameFiltersSettings::setHideNotBuddyCreatedGames(bool hide) void GameFiltersSettings::setHideNotBuddyCreatedGames(bool hide)
{ {
setValue(hide, "hide_not_buddy_created_games"); setValue(hide, "hideNotBuddyCreatedGames");
} }
bool GameFiltersSettings::isHideNotBuddyCreatedGames() const bool GameFiltersSettings::isHideNotBuddyCreatedGames() const
{ {
QVariant previous = getValue("hide_not_buddy_created_games"); QVariant previous = getValue("hideNotBuddyCreatedGames");
return previous == QVariant() ? false : previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setHideOpenDecklistGames(bool hide) void GameFiltersSettings::setHideOpenDecklistGames(bool hide)
{ {
setValue(hide, "hide_open_decklist_games"); setValue(hide, "hideOpenDecklistGames");
} }
bool GameFiltersSettings::isHideOpenDecklistGames() const bool GameFiltersSettings::isHideOpenDecklistGames() const
{ {
QVariant previous = getValue("hide_open_decklist_games"); QVariant previous = getValue("hideOpenDecklistGames");
return previous == QVariant() ? false : previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setGameNameFilter(QString gameName) void GameFiltersSettings::setGameNameFilter(QString gameName)
{ {
setValue(gameName, "game_name_filter"); setValue(gameName, "gameNameFilter");
} }
QString GameFiltersSettings::getGameNameFilter() const QString GameFiltersSettings::getGameNameFilter() const
{ {
return getValue("game_name_filter").toString(); return getValue("gameNameFilter").toString();
} }
void GameFiltersSettings::setCreatorNameFilters(QStringList creatorName) void GameFiltersSettings::setCreatorNameFilters(QStringList creatorName)
{ {
setValue(creatorName, "creator_name_filter"); setValue(creatorName, "creatorNameFilter");
} }
QStringList GameFiltersSettings::getCreatorNameFilters() const QStringList GameFiltersSettings::getCreatorNameFilters() const
{ {
return getValue("creator_name_filter").toStringList(); return getValue("creatorNameFilter").toStringList();
} }
void GameFiltersSettings::setMinPlayers(int min) void GameFiltersSettings::setMinPlayers(int min)
{ {
setValue(min, "min_players"); setValue(min, "minPlayers");
} }
int GameFiltersSettings::getMinPlayers() const int GameFiltersSettings::getMinPlayers() const
{ {
QVariant previous = getValue("min_players"); QVariant previous = getValue("minPlayers");
return previous == QVariant() ? 1 : previous.toInt(); return previous == QVariant() ? 1 : previous.toInt();
} }
void GameFiltersSettings::setMaxPlayers(int max) void GameFiltersSettings::setMaxPlayers(int max)
{ {
setValue(max, "max_players"); setValue(max, "maxPlayers");
} }
int GameFiltersSettings::getMaxPlayers() const int GameFiltersSettings::getMaxPlayers() const
{ {
QVariant previous = getValue("max_players"); QVariant previous = getValue("maxPlayers");
return previous == QVariant() ? 99 : previous.toInt(); return previous == QVariant() ? 99 : previous.toInt();
} }
void GameFiltersSettings::setMaxGameAge(const QTime &maxGameAge) void GameFiltersSettings::setMaxGameAge(const QTime &maxGameAge)
{ {
setValue(maxGameAge, "max_game_age_time"); setValue(maxGameAge, "maxGameAgeTime");
} }
QTime GameFiltersSettings::getMaxGameAge() const QTime GameFiltersSettings::getMaxGameAge() const
{ {
QVariant previous = getValue("max_game_age_time"); QVariant previous = getValue("maxGameAgeTime");
return previous.toTime(); return previous.toTime();
} }
void GameFiltersSettings::setGameTypeEnabled(QString gametype, bool enabled) 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) void GameFiltersSettings::setGameHashedTypeEnabled(QString gametypeHASHED, bool enabled)
@ -159,50 +159,50 @@ void GameFiltersSettings::setGameHashedTypeEnabled(QString gametypeHASHED, bool
bool GameFiltersSettings::isGameTypeEnabled(QString gametype) const 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(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setShowOnlyIfSpectatorsCanWatch(bool show) void GameFiltersSettings::setShowOnlyIfSpectatorsCanWatch(bool show)
{ {
setValue(show, "show_only_if_spectators_can_watch"); setValue(show, "showOnlyIfSpectatorsCanWatch");
} }
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanWatch() const bool GameFiltersSettings::isShowOnlyIfSpectatorsCanWatch() const
{ {
QVariant previous = getValue("show_only_if_spectators_can_watch"); QVariant previous = getValue("showOnlyIfSpectatorsCanWatch");
return previous == QVariant() ? false : previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setShowSpectatorPasswordProtected(bool show) void GameFiltersSettings::setShowSpectatorPasswordProtected(bool show)
{ {
setValue(show, "show_spectator_password_protected"); setValue(show, "showSpectatorPasswordProtected");
} }
bool GameFiltersSettings::isShowSpectatorPasswordProtected() const bool GameFiltersSettings::isShowSpectatorPasswordProtected() const
{ {
QVariant previous = getValue("show_spectator_password_protected"); QVariant previous = getValue("showSpectatorPasswordProtected");
return previous == QVariant() ? false : previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setShowOnlyIfSpectatorsCanChat(bool show) void GameFiltersSettings::setShowOnlyIfSpectatorsCanChat(bool show)
{ {
setValue(show, "show_only_if_spectators_can_chat"); setValue(show, "showOnlyIfSpectatorsCanChat");
} }
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanChat() const bool GameFiltersSettings::isShowOnlyIfSpectatorsCanChat() const
{ {
QVariant previous = getValue("show_only_if_spectators_can_chat"); QVariant previous = getValue("showOnlyIfSpectatorsCanChat");
return previous == QVariant() ? false : previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setShowOnlyIfSpectatorsCanSeeHands(bool show) void GameFiltersSettings::setShowOnlyIfSpectatorsCanSeeHands(bool show)
{ {
setValue(show, "show_only_if_spectators_can_see_hands"); setValue(show, "showOnlyIfSpectatorsCanSeeHands");
} }
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanSeeHands() const bool GameFiltersSettings::isShowOnlyIfSpectatorsCanSeeHands() const
{ {
QVariant previous = getValue("show_only_if_spectators_can_see_hands"); QVariant previous = getValue("showOnlyIfSpectatorsCanSeeHands");
return previous == QVariant() ? false : previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }

View file

@ -7,160 +7,160 @@ GameSettings::GameSettings(const QString &settingPath, QObject *parent)
QString GameSettings::getGameDescription() const QString GameSettings::getGameDescription() const
{ {
return getValue("gamedescription", "game").toString(); return getValue("gameDescription", "game").toString();
} }
int GameSettings::getMaxPlayers() const int GameSettings::getMaxPlayers() const
{ {
return getValue("maxplayers", "game", QString(), 2).toInt(); return getValue("maxPlayers", "game", QString(), 2).toInt();
} }
QString GameSettings::getGameTypes() const QString GameSettings::getGameTypes() const
{ {
return getValue("gametypes", "game").toString(); return getValue("gameTypes", "game").toString();
} }
bool GameSettings::getOnlyBuddies() const bool GameSettings::getOnlyBuddies() const
{ {
return getValue("onlybuddies", "game").toBool(); return getValue("onlyBuddies", "game").toBool();
} }
bool GameSettings::getOnlyRegistered() const bool GameSettings::getOnlyRegistered() const
{ {
return getValue("onlyregistered", "game").toBool(); return getValue("onlyRegistered", "game").toBool();
} }
bool GameSettings::getSpectatorsAllowed() const bool GameSettings::getSpectatorsAllowed() const
{ {
return getValue("spectatorsallowed", "game").toBool(); return getValue("spectatorsAllowed", "game").toBool();
} }
bool GameSettings::getSpectatorsNeedPassword() const bool GameSettings::getSpectatorsNeedPassword() const
{ {
return getValue("spectatorsneedpassword", "game").toBool(); return getValue("spectatorsNeedPassword", "game").toBool();
} }
bool GameSettings::getSpectatorsCanTalk() const bool GameSettings::getSpectatorsCanTalk() const
{ {
return getValue("spectatorscantalk", "game").toBool(); return getValue("spectatorsCanTalk", "game").toBool();
} }
bool GameSettings::getSpectatorsCanSeeEverything() const bool GameSettings::getSpectatorsCanSeeEverything() const
{ {
return getValue("spectatorscanseeeverything", "game").toBool(); return getValue("spectatorsCanSeeEverything", "game").toBool();
} }
bool GameSettings::getCreateGameAsSpectator() const bool GameSettings::getCreateGameAsSpectator() const
{ {
return getValue("creategameasspectator", "game").toBool(); return getValue("createGameAsSpectator", "game").toBool();
} }
int GameSettings::getDefaultStartingLifeTotal() const int GameSettings::getDefaultStartingLifeTotal() const
{ {
return getValue("defaultstartinglifetotal", "game", QString(), 20).toInt(); return getValue("defaultStartingLifeTotal", "game", QString(), 20).toInt();
} }
bool GameSettings::getShareDecklistsOnLoad() const bool GameSettings::getShareDecklistsOnLoad() const
{ {
return getValue("sharedecklistsonload", "game").toBool(); return getValue("shareDecklistsOnLoad", "game").toBool();
} }
bool GameSettings::getRememberGameSettings() const bool GameSettings::getRememberGameSettings() const
{ {
return getValue("remembergamesettings", "game", QString(), true).toBool(); return getValue("rememberGameSettings", "game", QString(), true).toBool();
} }
bool GameSettings::getLocalGameRememberSettings() const bool GameSettings::getLocalGameRememberSettings() const
{ {
return getValue("remembersettings", "localgameoptions").toBool(); return getValue("rememberSettings", "localgameoptions").toBool();
} }
int GameSettings::getLocalGameMaxPlayers() const int GameSettings::getLocalGameMaxPlayers() const
{ {
return getValue("maxplayers", "localgameoptions", QString(), 1).toInt(); return getValue("maxPlayers", "localgameoptions", QString(), 1).toInt();
} }
int GameSettings::getLocalGameStartingLifeTotal() const int GameSettings::getLocalGameStartingLifeTotal() const
{ {
return getValue("startinglifetotal", "localgameoptions", QString(), 20).toInt(); return getValue("startingLifeTotal", "localgameoptions", QString(), 20).toInt();
} }
void GameSettings::setGameDescription(const QString &_gameDescription) void GameSettings::setGameDescription(const QString &_gameDescription)
{ {
setValue(_gameDescription, "gamedescription", "game"); setValue(_gameDescription, "gameDescription", "game");
} }
void GameSettings::setMaxPlayers(int _maxPlayers) void GameSettings::setMaxPlayers(int _maxPlayers)
{ {
setValue(_maxPlayers, "maxplayers", "game"); setValue(_maxPlayers, "maxPlayers", "game");
} }
void GameSettings::setGameTypes(const QString &_gameTypes) void GameSettings::setGameTypes(const QString &_gameTypes)
{ {
setValue(_gameTypes, "gametypes", "game"); setValue(_gameTypes, "gameTypes", "game");
} }
void GameSettings::setOnlyBuddies(bool _onlyBuddies) void GameSettings::setOnlyBuddies(bool _onlyBuddies)
{ {
setValue(_onlyBuddies, "onlybuddies", "game"); setValue(_onlyBuddies, "onlyBuddies", "game");
} }
void GameSettings::setOnlyRegistered(bool _onlyRegistered) void GameSettings::setOnlyRegistered(bool _onlyRegistered)
{ {
setValue(_onlyRegistered, "onlyregistered", "game"); setValue(_onlyRegistered, "onlyRegistered", "game");
} }
void GameSettings::setSpectatorsAllowed(bool _spectatorsAllowed) void GameSettings::setSpectatorsAllowed(bool _spectatorsAllowed)
{ {
setValue(_spectatorsAllowed, "spectatorsallowed", "game"); setValue(_spectatorsAllowed, "spectatorsAllowed", "game");
} }
void GameSettings::setSpectatorsNeedPassword(bool _spectatorsNeedPassword) void GameSettings::setSpectatorsNeedPassword(bool _spectatorsNeedPassword)
{ {
setValue(_spectatorsNeedPassword, "spectatorsneedpassword", "game"); setValue(_spectatorsNeedPassword, "spectatorsNeedPassword", "game");
} }
void GameSettings::setSpectatorsCanTalk(bool _spectatorsCanTalk) void GameSettings::setSpectatorsCanTalk(bool _spectatorsCanTalk)
{ {
setValue(_spectatorsCanTalk, "spectatorscantalk", "game"); setValue(_spectatorsCanTalk, "spectatorsCanTalk", "game");
} }
void GameSettings::setSpectatorsCanSeeEverything(bool _spectatorsCanSeeEverything) void GameSettings::setSpectatorsCanSeeEverything(bool _spectatorsCanSeeEverything)
{ {
setValue(_spectatorsCanSeeEverything, "spectatorscanseeeverything", "game"); setValue(_spectatorsCanSeeEverything, "spectatorsCanSeeEverything", "game");
} }
void GameSettings::setCreateGameAsSpectator(bool _createGameAsSpectator) void GameSettings::setCreateGameAsSpectator(bool _createGameAsSpectator)
{ {
setValue(_createGameAsSpectator, "creategameasspectator", "game"); setValue(_createGameAsSpectator, "createGameAsSpectator", "game");
} }
void GameSettings::setDefaultStartingLifeTotal(int _defaultStartingLifeTotal) void GameSettings::setDefaultStartingLifeTotal(int _defaultStartingLifeTotal)
{ {
setValue(_defaultStartingLifeTotal, "defaultstartinglifetotal", "game"); setValue(_defaultStartingLifeTotal, "defaultStartingLifeTotal", "game");
} }
void GameSettings::setShareDecklistsOnLoad(bool _shareDecklistsOnLoad) void GameSettings::setShareDecklistsOnLoad(bool _shareDecklistsOnLoad)
{ {
setValue(_shareDecklistsOnLoad, "sharedecklistsonload", "game"); setValue(_shareDecklistsOnLoad, "shareDecklistsOnLoad", "game");
} }
void GameSettings::setRememberGameSettings(bool _rememberGameSettings) void GameSettings::setRememberGameSettings(bool _rememberGameSettings)
{ {
setValue(_rememberGameSettings, "remembergamesettings", "game"); setValue(_rememberGameSettings, "rememberGameSettings", "game");
} }
void GameSettings::setLocalGameRememberSettings(bool value) void GameSettings::setLocalGameRememberSettings(bool value)
{ {
setValue(value, "remembersettings", "localgameoptions"); setValue(value, "rememberSettings", "localgameoptions");
} }
void GameSettings::setLocalGameMaxPlayers(int value) void GameSettings::setLocalGameMaxPlayers(int value)
{ {
setValue(value, "maxplayers", "localgameoptions"); setValue(value, "maxPlayers", "localgameoptions");
} }
void GameSettings::setLocalGameStartingLifeTotal(int value) void GameSettings::setLocalGameStartingLifeTotal(int value)
{ {
setValue(value, "startinglifetotal", "localgameoptions"); setValue(value, "startingLifeTotal", "localgameoptions");
} }

View file

@ -7,7 +7,7 @@ InterfaceSettings::InterfaceSettings(const QString &settingPath, QObject *parent
bool InterfaceSettings::getUseTearOffMenus() const bool InterfaceSettings::getUseTearOffMenus() const
{ {
return getValue("usetearoffmenus", QString(), QString(), true).toBool(); return getValue("useTearOffMenus", QString(), QString(), true).toBool();
} }
int InterfaceSettings::getCardViewInitialRowsMax() const int InterfaceSettings::getCardViewInitialRowsMax() const
@ -52,7 +52,7 @@ bool InterfaceSettings::getBuddyConnectNotificationsEnabled() const
bool InterfaceSettings::getDoubleClickToPlay() const bool InterfaceSettings::getDoubleClickToPlay() const
{ {
return getValue("doubleclicktoplay", QString(), QString(), true).toBool(); return getValue("doubleClickToPlay", QString(), QString(), true).toBool();
} }
bool InterfaceSettings::getClickPlaysAllSelected() const bool InterfaceSettings::getClickPlaysAllSelected() const
@ -62,7 +62,7 @@ bool InterfaceSettings::getClickPlaysAllSelected() const
bool InterfaceSettings::getPlayToStack() const bool InterfaceSettings::getPlayToStack() const
{ {
return getValue("playtostack", QString(), QString(), true).toBool(); return getValue("playToStack", QString(), QString(), true).toBool();
} }
bool InterfaceSettings::getDoNotDeleteArrowsInSubPhases() const bool InterfaceSettings::getDoNotDeleteArrowsInSubPhases() const
@ -72,22 +72,22 @@ bool InterfaceSettings::getDoNotDeleteArrowsInSubPhases() const
int InterfaceSettings::getStartingHandSize() const int InterfaceSettings::getStartingHandSize() const
{ {
return getValue("startinghandsize", QString(), QString(), 7).toInt(); return getValue("startingHandSize", QString(), QString(), 7).toInt();
} }
bool InterfaceSettings::getAnnotateTokens() const bool InterfaceSettings::getAnnotateTokens() const
{ {
return getValue("annotatetokens", QString(), QString(), false).toBool(); return getValue("annotateTokens", QString(), QString(), false).toBool();
} }
bool InterfaceSettings::getShowDragSelectionCount() const bool InterfaceSettings::getShowDragSelectionCount() const
{ {
return getValue("showlassoselectioncount", QString(), QString(), true).toBool(); return getValue("showLassoSelectionCount", QString(), QString(), true).toBool();
} }
bool InterfaceSettings::getShowTotalSelectionCount() const bool InterfaceSettings::getShowTotalSelectionCount() const
{ {
return getValue("showpersistentselectioncount", QString(), QString(), true).toBool(); return getValue("showPersistentSelectionCount", QString(), QString(), true).toBool();
} }
int InterfaceSettings::getTallyType() const int InterfaceSettings::getTallyType() const
@ -102,12 +102,12 @@ bool InterfaceSettings::getHorizontalHand() const
bool InterfaceSettings::getInvertVerticalCoordinate() const bool InterfaceSettings::getInvertVerticalCoordinate() const
{ {
return getValue("invert_vertical", "table", QString(), false).toBool(); return getValue("invertVertical", "table", QString(), false).toBool();
} }
int InterfaceSettings::getMinPlayersForMultiColumnLayout() const int InterfaceSettings::getMinPlayersForMultiColumnLayout() const
{ {
return getValue("min_players_multicolumn", QString(), QString(), 4).toInt(); return getValue("minPlayersMulticolumn", QString(), QString(), 4).toInt();
} }
int InterfaceSettings::getRewindBufferingMs() const int InterfaceSettings::getRewindBufferingMs() const
@ -122,22 +122,22 @@ qreal InterfaceSettings::getFastForwardSpeed() const
bool InterfaceSettings::getLeftJustified() const bool InterfaceSettings::getLeftJustified() const
{ {
return getValue("leftjustified", QString(), QString(), false).toBool(); return getValue("leftJustified", QString(), QString(), false).toBool();
} }
int InterfaceSettings::getZoneViewGroupByIndex() const int InterfaceSettings::getZoneViewGroupByIndex() const
{ {
return getValue("groupby", "zoneview", QString(), 1).toInt(); return getValue("groupBy", "zoneview", QString(), 1).toInt();
} }
int InterfaceSettings::getZoneViewSortByIndex() const int InterfaceSettings::getZoneViewSortByIndex() const
{ {
return getValue("sortby", "zoneview", QString(), 1).toInt(); return getValue("sortBy", "zoneview", QString(), 1).toInt();
} }
bool InterfaceSettings::getZoneViewPileView() const bool InterfaceSettings::getZoneViewPileView() const
{ {
return getValue("pileview", "zoneview", QString(), true).toBool(); return getValue("pileView", "zoneview", QString(), true).toBool();
} }
bool InterfaceSettings::getShowStatusBar() const bool InterfaceSettings::getShowStatusBar() const
@ -157,7 +157,7 @@ bool InterfaceSettings::getShowGameSelectorFilterToolbar() const
void InterfaceSettings::setUseTearOffMenus(bool _useTearOffMenus) void InterfaceSettings::setUseTearOffMenus(bool _useTearOffMenus)
{ {
setValue(_useTearOffMenus, "usetearoffmenus"); setValue(_useTearOffMenus, "useTearOffMenus");
emit useTearOffMenusChanged(_useTearOffMenus); emit useTearOffMenusChanged(_useTearOffMenus);
} }
@ -204,7 +204,7 @@ void InterfaceSettings::setBuddyConnectNotificationsEnabled(bool _buddyConnectNo
void InterfaceSettings::setDoubleClickToPlay(bool _doubleClickToPlay) void InterfaceSettings::setDoubleClickToPlay(bool _doubleClickToPlay)
{ {
setValue(_doubleClickToPlay, "doubleclicktoplay"); setValue(_doubleClickToPlay, "doubleClickToPlay");
} }
void InterfaceSettings::setClickPlaysAllSelected(bool _clickPlaysAllSelected) void InterfaceSettings::setClickPlaysAllSelected(bool _clickPlaysAllSelected)
@ -214,7 +214,7 @@ void InterfaceSettings::setClickPlaysAllSelected(bool _clickPlaysAllSelected)
void InterfaceSettings::setPlayToStack(bool _playToStack) void InterfaceSettings::setPlayToStack(bool _playToStack)
{ {
setValue(_playToStack, "playtostack"); setValue(_playToStack, "playToStack");
} }
void InterfaceSettings::setDoNotDeleteArrowsInSubPhases(bool _doNotDeleteArrowsInSubPhases) void InterfaceSettings::setDoNotDeleteArrowsInSubPhases(bool _doNotDeleteArrowsInSubPhases)
@ -224,22 +224,22 @@ void InterfaceSettings::setDoNotDeleteArrowsInSubPhases(bool _doNotDeleteArrowsI
void InterfaceSettings::setStartingHandSize(int _startingHandSize) void InterfaceSettings::setStartingHandSize(int _startingHandSize)
{ {
setValue(_startingHandSize, "startinghandsize"); setValue(_startingHandSize, "startingHandSize");
} }
void InterfaceSettings::setAnnotateTokens(bool _annotateTokens) void InterfaceSettings::setAnnotateTokens(bool _annotateTokens)
{ {
setValue(_annotateTokens, "annotatetokens"); setValue(_annotateTokens, "annotateTokens");
} }
void InterfaceSettings::setShowDragSelectionCount(bool _showDragSelectionCount) void InterfaceSettings::setShowDragSelectionCount(bool _showDragSelectionCount)
{ {
setValue(_showDragSelectionCount, "showlassoselectioncount"); setValue(_showDragSelectionCount, "showLassoSelectionCount");
} }
void InterfaceSettings::setShowTotalSelectionCount(bool _showTotalSelectionCount) void InterfaceSettings::setShowTotalSelectionCount(bool _showTotalSelectionCount)
{ {
setValue(_showTotalSelectionCount, "showpersistentselectioncount"); setValue(_showTotalSelectionCount, "showPersistentSelectionCount");
} }
void InterfaceSettings::setTallyType(int value) void InterfaceSettings::setTallyType(int value)
@ -259,13 +259,13 @@ void InterfaceSettings::setHorizontalHand(bool _horizontalHand)
void InterfaceSettings::setInvertVerticalCoordinate(bool _invertVerticalCoordinate) void InterfaceSettings::setInvertVerticalCoordinate(bool _invertVerticalCoordinate)
{ {
setValue(_invertVerticalCoordinate, "invert_vertical", "table"); setValue(_invertVerticalCoordinate, "invertVertical", "table");
emit invertVerticalCoordinateChanged(); emit invertVerticalCoordinateChanged();
} }
void InterfaceSettings::setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout) void InterfaceSettings::setMinPlayersForMultiColumnLayout(int _minPlayersForMultiColumnLayout)
{ {
setValue(_minPlayersForMultiColumnLayout, "min_players_multicolumn"); setValue(_minPlayersForMultiColumnLayout, "minPlayersMulticolumn");
emit minPlayersForMultiColumnLayoutChanged(); emit minPlayersForMultiColumnLayoutChanged();
} }
@ -281,23 +281,23 @@ void InterfaceSettings::setFastForwardSpeed(qreal _value)
void InterfaceSettings::setLeftJustified(bool _leftJustified) void InterfaceSettings::setLeftJustified(bool _leftJustified)
{ {
setValue(_leftJustified, "leftjustified"); setValue(_leftJustified, "leftJustified");
emit handJustificationChanged(); emit handJustificationChanged();
} }
void InterfaceSettings::setZoneViewGroupByIndex(int _zoneViewGroupByIndex) void InterfaceSettings::setZoneViewGroupByIndex(int _zoneViewGroupByIndex)
{ {
setValue(_zoneViewGroupByIndex, "groupby", "zoneview"); setValue(_zoneViewGroupByIndex, "groupBy", "zoneview");
} }
void InterfaceSettings::setZoneViewSortByIndex(int _zoneViewSortByIndex) void InterfaceSettings::setZoneViewSortByIndex(int _zoneViewSortByIndex)
{ {
setValue(_zoneViewSortByIndex, "sortby", "zoneview"); setValue(_zoneViewSortByIndex, "sortBy", "zoneview");
} }
void InterfaceSettings::setZoneViewPileView(bool _zoneViewPileView) void InterfaceSettings::setZoneViewPileView(bool _zoneViewPileView)
{ {
setValue(_zoneViewPileView, "pileview", "zoneview"); setValue(_zoneViewPileView, "pileView", "zoneview");
} }
void InterfaceSettings::setShowStatusBar(bool _showStatusBar) void InterfaceSettings::setShowStatusBar(bool _showStatusBar)

View file

@ -30,7 +30,7 @@ QString PathsSettings::getPicsPath() const
QString PathsSettings::getCustomPicsPath() const QString PathsSettings::getCustomPicsPath() const
{ {
return getValue("custompics").toString(); return getValue("customPics").toString();
} }
QString PathsSettings::getThemesPath() const QString PathsSettings::getThemesPath() const
@ -40,22 +40,22 @@ QString PathsSettings::getThemesPath() const
QString PathsSettings::getCardDatabasePath() const QString PathsSettings::getCardDatabasePath() const
{ {
return getValue("carddatabase").toString(); return getValue("cardDatabase").toString();
} }
QString PathsSettings::getCustomCardDatabasePath() const QString PathsSettings::getCustomCardDatabasePath() const
{ {
return getValue("customsets").toString(); return getValue("customSets").toString();
} }
QString PathsSettings::getTokenDatabasePath() const QString PathsSettings::getTokenDatabasePath() const
{ {
return getValue("tokendatabase").toString(); return getValue("tokenDatabase").toString();
} }
QString PathsSettings::getSpoilerCardDatabasePath() const QString PathsSettings::getSpoilerCardDatabasePath() const
{ {
return getValue("spoilerdatabase").toString(); return getValue("spoilerDatabase").toString();
} }
QString PathsSettings::getRedirectCachePath() const QString PathsSettings::getRedirectCachePath() const
@ -86,7 +86,7 @@ void PathsSettings::setPicsPath(const QString &_picsPath)
void PathsSettings::setCustomPicsPath(const QString &_customPicsPath) void PathsSettings::setCustomPicsPath(const QString &_customPicsPath)
{ {
setValue(_customPicsPath, "custompics"); setValue(_customPicsPath, "customPics");
} }
void PathsSettings::setThemesPath(const QString &_themesPath) void PathsSettings::setThemesPath(const QString &_themesPath)
@ -97,24 +97,24 @@ void PathsSettings::setThemesPath(const QString &_themesPath)
void PathsSettings::setCardDatabasePath(const QString &_cardDatabasePath) void PathsSettings::setCardDatabasePath(const QString &_cardDatabasePath)
{ {
setValue(_cardDatabasePath, "carddatabase"); setValue(_cardDatabasePath, "cardDatabase");
emit cardDatabasePathChanged(); emit cardDatabasePathChanged();
} }
void PathsSettings::setCustomCardDatabasePath(const QString &_customCardDatabasePath) void PathsSettings::setCustomCardDatabasePath(const QString &_customCardDatabasePath)
{ {
setValue(_customCardDatabasePath, "customsets"); setValue(_customCardDatabasePath, "customSets");
emit cardDatabasePathChanged(); emit cardDatabasePathChanged();
} }
void PathsSettings::setTokenDatabasePath(const QString &_tokenDatabasePath) void PathsSettings::setTokenDatabasePath(const QString &_tokenDatabasePath)
{ {
setValue(_tokenDatabasePath, "tokendatabase"); setValue(_tokenDatabasePath, "tokenDatabase");
emit cardDatabasePathChanged(); emit cardDatabasePathChanged();
} }
void PathsSettings::setSpoilerDatabasePath(const QString &_spoilerDatabasePath) void PathsSettings::setSpoilerDatabasePath(const QString &_spoilerDatabasePath)
{ {
setValue(_spoilerDatabasePath, "spoilerdatabase"); setValue(_spoilerDatabasePath, "spoilerDatabase");
emit cardDatabasePathChanged(); emit cardDatabasePathChanged();
} }

View file

@ -9,16 +9,16 @@ RecentsSettings::RecentsSettings(const QString &settingPath, QObject *parent)
QStringList RecentsSettings::getRecentlyOpenedDeckPaths() const QStringList RecentsSettings::getRecentlyOpenedDeckPaths() const
{ {
return getValue("deckpaths").toStringList(); return getValue("deckPaths").toStringList();
} }
void RecentsSettings::clearRecentlyOpenedDeckPaths() void RecentsSettings::clearRecentlyOpenedDeckPaths()
{ {
deleteValue("deckpaths"); deleteValue("deckPaths");
emit recentlyOpenedDeckPathsChanged(); emit recentlyOpenedDeckPathsChanged();
} }
void RecentsSettings::updateRecentlyOpenedDeckPaths(const QString &deckPath) void RecentsSettings::updateRecentlyOpenedDeckPaths(const QString &deckPath)
{ {
auto deckPaths = getValue("deckpaths").toStringList(); auto deckPaths = getValue("deckPaths").toStringList();
deckPaths.removeAll(deckPath); deckPaths.removeAll(deckPath);
deckPaths.prepend(deckPath); deckPaths.prepend(deckPath);
@ -27,7 +27,7 @@ void RecentsSettings::updateRecentlyOpenedDeckPaths(const QString &deckPath)
deckPaths.removeLast(); deckPaths.removeLast();
} }
setValue(deckPaths, "deckpaths"); setValue(deckPaths, "deckPaths");
emit recentlyOpenedDeckPathsChanged(); emit recentlyOpenedDeckPathsChanged();
} }

View file

@ -10,28 +10,28 @@ ServersSettings::ServersSettings(const QString &settingPath, QObject *parent)
void ServersSettings::setPreviousHostLogin(int previous) void ServersSettings::setPreviousHostLogin(int previous)
{ {
setValue(previous, "previoushostlogin"); setValue(previous, "previousHostLogin");
} }
int ServersSettings::getPreviousHostLogin() const int ServersSettings::getPreviousHostLogin() const
{ {
QVariant previous = getValue("previoushostlogin"); QVariant previous = getValue("previousHostLogin");
return previous == QVariant() ? 1 : previous.toInt(); return previous == QVariant() ? 1 : previous.toInt();
} }
void ServersSettings::setPreviousHostList(QStringList list) void ServersSettings::setPreviousHostList(QStringList list)
{ {
setValue(list, "previoushosts"); setValue(list, "previousHosts");
} }
QStringList ServersSettings::getPreviousHostList() const QStringList ServersSettings::getPreviousHostList() const
{ {
return getValue("previoushosts").toStringList(); return getValue("previousHosts").toStringList();
} }
void ServersSettings::setPrevioushostName(const QString &name) void ServersSettings::setPrevioushostName(const QString &name)
{ {
setValue(name, "previoushostName"); setValue(name, "previousHostName");
} }
QString ServersSettings::getSaveName(QString defaultname) QString ServersSettings::getSaveName(QString defaultname)
@ -50,7 +50,7 @@ QString ServersSettings::getSite(QString defaultSite)
QString ServersSettings::getPrevioushostName() const QString ServersSettings::getPrevioushostName() const
{ {
QVariant value = getValue("previoushostName"); QVariant value = getValue("previousHostName");
return value == QVariant() ? "Rooster Ranges" : value.toString(); return value == QVariant() ? "Rooster Ranges" : value.toString();
} }
@ -110,56 +110,56 @@ bool ServersSettings::getSavePassword() const
void ServersSettings::setAutoConnect(int autoconnect) void ServersSettings::setAutoConnect(int autoconnect)
{ {
setValue(autoconnect, "auto_connect"); setValue(autoconnect, "autoConnect");
} }
int ServersSettings::getAutoConnect() const int ServersSettings::getAutoConnect() const
{ {
QVariant autoconnect = getValue("auto_connect"); QVariant autoconnect = getValue("autoConnect");
return autoconnect == QVariant() ? 0 : autoconnect.toInt(); return autoconnect == QVariant() ? 0 : autoconnect.toInt();
} }
void ServersSettings::setFPHostName(QString hostname) void ServersSettings::setFPHostName(QString hostname)
{ {
setValue(hostname, "fphostname"); setValue(hostname, "fpHostName");
} }
QString ServersSettings::getFPHostname(QString defaultHost) const QString ServersSettings::getFPHostname(QString defaultHost) const
{ {
QVariant hostname = getValue("fphostname"); QVariant hostname = getValue("fpHostName");
return hostname == QVariant() ? std::move(defaultHost) : hostname.toString(); return hostname == QVariant() ? std::move(defaultHost) : hostname.toString();
} }
void ServersSettings::setFPPort(QString port) void ServersSettings::setFPPort(QString port)
{ {
setValue(port, "fpport"); setValue(port, "fpPort");
} }
QString ServersSettings::getFPPort(QString defaultPort) const QString ServersSettings::getFPPort(QString defaultPort) const
{ {
QVariant port = getValue("fpport"); QVariant port = getValue("fpPort");
return port == QVariant() ? std::move(defaultPort) : port.toString(); return port == QVariant() ? std::move(defaultPort) : port.toString();
} }
void ServersSettings::setFPPlayerName(QString playerName) void ServersSettings::setFPPlayerName(QString playerName)
{ {
setValue(playerName, "fpplayername"); setValue(playerName, "fpPlayerName");
} }
QString ServersSettings::getFPPlayerName(QString defaultName) const QString ServersSettings::getFPPlayerName(QString defaultName) const
{ {
QVariant name = getValue("fpplayername"); QVariant name = getValue("fpPlayerName");
return name == QVariant() ? std::move(defaultName) : name.toString(); return name == QVariant() ? std::move(defaultName) : name.toString();
} }
void ServersSettings::setClearDebugLogStatus(bool abIsChecked) void ServersSettings::setClearDebugLogStatus(bool abIsChecked)
{ {
setValue(abIsChecked, "save_debug_log"); setValue(abIsChecked, "saveDebugLog");
} }
bool ServersSettings::getClearDebugLogStatus(bool abDefaultValue) const bool ServersSettings::getClearDebugLogStatus(bool abDefaultValue) const
{ {
QVariant cbFlushLog = getValue("save_debug_log"); QVariant cbFlushLog = getValue("saveDebugLog");
return cbFlushLog == QVariant() ? abDefaultValue : cbFlushLog.toBool(); return cbFlushLog == QVariant() ? abDefaultValue : cbFlushLog.toBool();
} }

View file

@ -35,61 +35,85 @@ static void migrateSoundSettings(const QString &settingsPath, QSettings &globalI
QSettings soundIni(settingsPath + "sound.ini", QSettings::IniFormat); QSettings soundIni(settingsPath + "sound.ini", QSettings::IniFormat);
soundIni.setValue("sound/enabled", globalIni.value("sound/enabled", false)); soundIni.setValue("sound/enabled", globalIni.value("sound/enabled", false));
soundIni.setValue("sound/theme", globalIni.value("sound/theme")); 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) static void migrateGameSettings(const QString &settingsPath, QSettings &globalIni)
{ {
bool hasGameKeys = false; const QMap<QString, QString> gameKeyMap = {
globalIni.beginGroup("game"); {"game/maxplayers", "game/maxPlayers"},
if (!globalIni.childKeys().isEmpty()) { {"game/gamedescription", "game/gameDescription"},
hasGameKeys = true; {"game/gametypes", "game/gameTypes"},
} {"game/onlybuddies", "game/onlyBuddies"},
QStringList gameKeys = globalIni.childKeys(); {"game/onlyregistered", "game/onlyRegistered"},
globalIni.endGroup(); {"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"); bool hasAny = false;
if (!globalIni.childKeys().isEmpty()) { for (auto it = gameKeyMap.constBegin(); it != gameKeyMap.constEnd(); ++it) {
hasGameKeys = true; if (globalIni.contains(it.key())) {
hasAny = true;
break;
} }
QStringList localGameKeys = globalIni.childKeys(); }
globalIni.endGroup(); if (!hasAny) {
if (!hasGameKeys) {
return; return;
} }
QSettings gameIni(settingsPath + "game.ini", QSettings::IniFormat); QSettings gameIni(settingsPath + "game.ini", QSettings::IniFormat);
for (const auto &key : gameKeys) { for (auto it = gameKeyMap.constBegin(); it != gameKeyMap.constEnd(); ++it) {
if (key == "maxfontsize") { if (globalIni.contains(it.key())) {
continue; 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) static void migrateChatSettings(const QString &settingsPath, QSettings &globalIni)
{ {
globalIni.beginGroup("chat"); const QMap<QString, QString> chatKeyMap = {
QStringList chatKeys = globalIni.childKeys(); {"chat/mention", "chat/mention"},
globalIni.endGroup(); {"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 // Legacy highlight words lived under [personal], but the chat settings
// class reads them from [chat] // class reads them from [chat]
bool hasHighlightWords = globalIni.contains("personal/highlightWords"); {"personal/highlightWords", "chat/highlightWords"},
if (chatKeys.isEmpty() && !hasHighlightWords) { };
bool hasAny = false;
for (auto it = chatKeyMap.constBegin(); it != chatKeyMap.constEnd(); ++it) {
if (globalIni.contains(it.key())) {
hasAny = true;
break;
}
}
if (!hasAny) {
return; return;
} }
QSettings chatIni(settingsPath + "chat.ini", QSettings::IniFormat); QSettings chatIni(settingsPath + "chat.ini", QSettings::IniFormat);
for (const auto &key : chatKeys) { for (auto it = chatKeyMap.constBegin(); it != chatKeyMap.constEnd(); ++it) {
chatIni.setValue("chat/" + key, globalIni.value("chat/" + key)); if (globalIni.contains(it.key())) {
chatIni.setValue(it.value(), globalIni.value(it.key()));
} }
if (hasHighlightWords) {
chatIni.setValue("chat/highlightwords", globalIni.value("personal/highlightWords"));
} }
} }
@ -130,9 +154,9 @@ static void migrateUpdatesSettings(const QString &settingsPath, QSettings &globa
{"personal/cardUpdateCheckInterval", "updates/cardUpdateCheckInterval"}, {"personal/cardUpdateCheckInterval", "updates/cardUpdateCheckInterval"},
{"personal/lastCardUpdateCheck", "updates/lastCardUpdateCheck"}, {"personal/lastCardUpdateCheck", "updates/lastCardUpdateCheck"},
{"personal/alwaysEnableNewSets", "updates/alwaysEnableNewSets"}, {"personal/alwaysEnableNewSets", "updates/alwaysEnableNewSets"},
{"personal/updatenotification", "updates/updatenotification"}, {"personal/updatenotification", "updates/updateNotification"},
{"personal/newversionnotification", "updates/newversionnotification"}, {"personal/newversionnotification", "updates/newVersionNotification"},
{"personal/updatereleasechannel", "updates/updatereleasechannel"}, {"personal/updatereleasechannel", "updates/updateReleaseChannel"},
}; };
bool hasAny = false; bool hasAny = false;
for (auto it = updateKeyMap.constBegin(); it != updateKeyMap.constEnd(); ++it) { for (auto it = updateKeyMap.constBegin(); it != updateKeyMap.constEnd(); ++it) {
@ -188,19 +212,17 @@ static void migratePersonalSettings(const QString &settingsPath, QSettings &glob
static void migrateCardsDisplaySettings(const QString &settingsPath, QSettings &globalIni) static void migrateCardsDisplaySettings(const QString &settingsPath, QSettings &globalIni)
{ {
const QStringList cardsRootKeys = {
"cards/displaycardnames",
"cards/roundcardcorners",
"cards/overrideallcardartwithpersonalpreference",
"cards/bumpsetswithcardsindecktotop",
"cards/includerebalancedcards",
"cards/tapanimation",
"cards/autorotatesidewayslayoutcards",
"cards/scaleCards",
"cards/verticalCardOverlapPercent",
"cards/cardinfoviewmode",
};
const QMap<QString, QString> cardsKeyMap = { 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/printingselectorsortorder", "cards/printingSelector/sortOrder"},
{"cards/printingselectornavigationbuttonsvisible", "cards/printingSelector/navigationButtonsVisible"}, {"cards/printingselectornavigationbuttonsvisible", "cards/printingSelector/navigationButtonsVisible"},
{"cards/printingselectorcardsize", "cards/cardSize/printingSelector"}, {"cards/printingselectorcardsize", "cards/cardSize/printingSelector"},
@ -213,14 +235,10 @@ static void migrateCardsDisplaySettings(const QString &settingsPath, QSettings &
}; };
bool hasAny = false; bool hasAny = false;
for (const auto &key : cardsRootKeys) {
if (globalIni.contains(key)) {
hasAny = true;
}
}
for (auto it = cardsKeyMap.constBegin(); it != cardsKeyMap.constEnd(); ++it) { for (auto it = cardsKeyMap.constBegin(); it != cardsKeyMap.constEnd(); ++it) {
if (globalIni.contains(it.key())) { if (globalIni.contains(it.key())) {
hasAny = true; hasAny = true;
break;
} }
} }
if (!hasAny) { if (!hasAny) {
@ -228,11 +246,6 @@ static void migrateCardsDisplaySettings(const QString &settingsPath, QSettings &
} }
QSettings cardsIni(settingsPath + "cards_display.ini", QSettings::IniFormat); 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) { for (auto it = cardsKeyMap.constBegin(); it != cardsKeyMap.constEnd(); ++it) {
if (globalIni.contains(it.key())) { if (globalIni.contains(it.key())) {
cardsIni.setValue(it.value(), globalIni.value(it.key())); cardsIni.setValue(it.value(), globalIni.value(it.key()));
@ -242,29 +255,31 @@ static void migrateCardsDisplaySettings(const QString &settingsPath, QSettings &
static void migrateInterfaceSettings(const QString &settingsPath, QSettings &globalIni) static void migrateInterfaceSettings(const QString &settingsPath, QSettings &globalIni)
{ {
const QStringList interfaceRootKeys = {
"interface/usetearoffmenus",
"interface/cardViewInitialRowsMax",
"interface/cardViewExpandedRowsMax",
"interface/closeEmptyCardView",
"interface/focusCardViewSearchBar",
"interface/keepGameChatFocus",
"interface/doubleclicktoplay",
"interface/clickPlaysAllSelected",
"interface/playtostack",
"interface/doNotDeleteArrowsInSubPhases",
"interface/startinghandsize",
"interface/annotatetokens",
"interface/showlassoselectioncount",
"interface/showpersistentselectioncount",
"interface/tallyType",
"interface/leftjustified",
"interface/min_players_multicolumn",
};
const QStringList interfaceSubKeys = {
"hand/horizontal", "table/invert_vertical", "replay/rewindBufferingMs", "replay/fastForwardSpeed",
"zoneview/groupby", "zoneview/sortby", "zoneview/pileview"};
const QMap<QString, QString> interfaceKeyMap = { 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"}, {"personal/showStatusBar", "interface/showStatusBar"},
{"menu/showshortcuts", "interface/showShortcuts"}, {"menu/showshortcuts", "interface/showShortcuts"},
{"menu/showgameselectorfiltertoolbar", "interface/showGameSelectorFilterToolbar"}, {"menu/showgameselectorfiltertoolbar", "interface/showGameSelectorFilterToolbar"},
@ -273,19 +288,10 @@ static void migrateInterfaceSettings(const QString &settingsPath, QSettings &glo
{"interface/buddyconnectnotificationsenabled", "interface/notifications/buddyConnectEnabled"}, {"interface/buddyconnectnotificationsenabled", "interface/notifications/buddyConnectEnabled"},
}; };
bool hasAny = false; bool hasAny = false;
for (const auto &key : interfaceRootKeys) {
if (globalIni.contains(key)) {
hasAny = true;
}
}
for (const auto &key : interfaceSubKeys) {
if (globalIni.contains(key)) {
hasAny = true;
}
}
for (auto it = interfaceKeyMap.constBegin(); it != interfaceKeyMap.constEnd(); ++it) { for (auto it = interfaceKeyMap.constBegin(); it != interfaceKeyMap.constEnd(); ++it) {
if (globalIni.contains(it.key())) { if (globalIni.contains(it.key())) {
hasAny = true; hasAny = true;
break;
} }
} }
if (!hasAny) { if (!hasAny) {
@ -293,16 +299,6 @@ static void migrateInterfaceSettings(const QString &settingsPath, QSettings &glo
} }
QSettings interfaceIni(settingsPath + "interface.ini", QSettings::IniFormat); QSettings interfaceIni(settingsPath + "interface.ini", QSettings::IniFormat);
for (const auto &key : interfaceRootKeys) {
if (globalIni.contains(key)) {
interfaceIni.setValue(key, globalIni.value(key));
}
}
for (const auto &key : interfaceSubKeys) {
if (globalIni.contains(key)) {
interfaceIni.setValue(key, globalIni.value(key));
}
}
for (auto it = interfaceKeyMap.constBegin(); it != interfaceKeyMap.constEnd(); ++it) { for (auto it = interfaceKeyMap.constBegin(); it != interfaceKeyMap.constEnd(); ++it) {
if (globalIni.contains(it.key())) { if (globalIni.contains(it.key())) {
interfaceIni.setValue(it.value(), globalIni.value(it.key())); interfaceIni.setValue(it.value(), globalIni.value(it.key()));
@ -313,8 +309,8 @@ static void migrateInterfaceSettings(const QString &settingsPath, QSettings &glo
static void migrateDownloadSettings(const QString &settingsPath, QSettings &globalIni) static void migrateDownloadSettings(const QString &settingsPath, QSettings &globalIni)
{ {
const QMap<QString, QString> downloadKeyMap = { const QMap<QString, QString> downloadKeyMap = {
{"personal/picturedownload", "downloads/picturedownload"}, {"personal/picturedownload", "downloads/pictureDownload"},
{"personal/downloadspoilers", "downloads/downloadspoilers"}, {"personal/downloadspoilers", "downloads/downloadSpoilers"},
}; };
bool hasAny = false; bool hasAny = false;
for (auto it = downloadKeyMap.constBegin(); it != downloadKeyMap.constEnd(); ++it) { for (auto it = downloadKeyMap.constBegin(); it != downloadKeyMap.constEnd(); ++it) {
@ -367,11 +363,11 @@ static void migrateAppearanceSettings(const QString &settingsPath, QSettings &gl
static void migrateNetworkSettings(const QString &settingsPath, QSettings &globalIni) static void migrateNetworkSettings(const QString &settingsPath, QSettings &globalIni)
{ {
const QMap<QString, QString> networkKeyMap = { const QMap<QString, QString> networkKeyMap = {
{"personal/clientid", "network/clientid"}, {"personal/clientid", "network/clientId"},
{"personal/clientversion", "network/clientversion"}, {"personal/clientversion", "network/clientVersion"},
{"personal/keepalive", "network/keepalive"}, {"personal/keepalive", "network/keepAlive"},
{"personal/timeout", "network/timeout"}, {"personal/timeout", "network/timeout"},
{"interface/knownmissingfeatures", "network/knownmissingfeatures"}, {"interface/knownmissingfeatures", "network/knownMissingFeatures"},
}; };
bool hasAny = false; bool hasAny = false;
for (auto it = networkKeyMap.constBegin(); it != networkKeyMap.constEnd(); ++it) { for (auto it = networkKeyMap.constBegin(); it != networkKeyMap.constEnd(); ++it) {
@ -394,16 +390,35 @@ static void migrateNetworkSettings(const QString &settingsPath, QSettings &globa
static void migratePathsSettings(const QString &settingsPath, QSettings &globalIni) static void migratePathsSettings(const QString &settingsPath, QSettings &globalIni)
{ {
globalIni.beginGroup("paths"); const QMap<QString, QString> pathsKeyMap = {
QStringList pathsKeys = globalIni.childKeys(); {"paths/decks", "paths/decks"},
globalIni.endGroup(); {"paths/filters", "paths/filters"},
if (pathsKeys.isEmpty()) { {"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; return;
} }
QSettings pathsIni(settingsPath + "paths.ini", QSettings::IniFormat); QSettings pathsIni(settingsPath + "paths.ini", QSettings::IniFormat);
for (const auto &key : pathsKeys) { for (auto it = pathsKeyMap.constBegin(); it != pathsKeyMap.constEnd(); ++it) {
pathsIni.setValue("paths/" + key, globalIni.value("paths/" + key)); if (globalIni.contains(it.key())) {
pathsIni.setValue(it.value(), globalIni.value(it.key()));
}
} }
} }
@ -490,9 +505,9 @@ static void migrateLegacySets(const QString &settingsPath)
QSettings cardDbIni(settingsPath + "cardDatabase.ini", QSettings::IniFormat); QSettings cardDbIni(settingsPath + "cardDatabase.ini", QSettings::IniFormat);
for (const auto &shortName : groups) { for (const auto &shortName : groups) {
legacySetting.beginGroup(shortName); 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 + "/enabled", legacySetting.value("enabled"));
cardDbIni.setValue("sets/" + shortName + "/isknown", legacySetting.value("isknown")); cardDbIni.setValue("sets/" + shortName + "/isKnown", legacySetting.value("isknown"));
legacySetting.endGroup(); legacySetting.endGroup();
} }
legacySetting.endGroup(); legacySetting.endGroup();
@ -508,13 +523,30 @@ static void migrateLegacyServers(const QString &settingsPath)
return; 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); QSettings serversIni(settingsPath + "servers.ini", QSettings::IniFormat);
serversIni.setValue("server/previoushostlogin", legacySetting.value("previoushostlogin")); for (auto it = serverKeyMap.constBegin(); it != serverKeyMap.constEnd(); ++it) {
serversIni.setValue("server/previoushosts", legacySetting.value("previoushosts")); if (legacySetting.contains(it.key())) {
serversIni.setValue("server/auto_connect", legacySetting.value("auto_connect")); serversIni.setValue("server/" + it.value(), legacySetting.value(it.key()));
serversIni.setValue("server/fphostname", legacySetting.value("fphostname")); }
serversIni.setValue("server/fpport", legacySetting.value("fpport")); }
serversIni.setValue("server/fpplayername", legacySetting.value("fpplayername"));
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(); legacySetting.endGroup();
} }
@ -549,9 +581,36 @@ static void migrateLegacyGameFilters(const QString &settingsPath)
return; 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); 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) { 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(); legacySetting.endGroup();
} }

View file

@ -17,7 +17,7 @@ QString SoundSettings::getSoundThemeName() const
int SoundSettings::getMasterVolume() const int SoundSettings::getMasterVolume() const
{ {
return getValue("mastervolume", QString(), QString(), 100).toInt(); return getValue("masterVolume", QString(), QString(), 100).toInt();
} }
void SoundSettings::setSoundEnabled(bool _soundEnabled) void SoundSettings::setSoundEnabled(bool _soundEnabled)
@ -34,6 +34,6 @@ void SoundSettings::setSoundThemeName(const QString &_soundThemeName)
void SoundSettings::setMasterVolume(int _masterVolume) void SoundSettings::setMasterVolume(int _masterVolume)
{ {
setValue(_masterVolume, "mastervolume"); setValue(_masterVolume, "masterVolume");
emit masterVolumeChanged(_masterVolume); emit masterVolumeChanged(_masterVolume);
} }

View file

@ -45,17 +45,17 @@ bool UpdatesSettings::getAlwaysEnableNewSets() const
bool UpdatesSettings::getNotifyAboutUpdates() const bool UpdatesSettings::getNotifyAboutUpdates() const
{ {
return getValue("updatenotification", QString(), QString(), true).toBool(); return getValue("updateNotification", QString(), QString(), true).toBool();
} }
bool UpdatesSettings::getNotifyAboutNewVersion() const bool UpdatesSettings::getNotifyAboutNewVersion() const
{ {
return getValue("newversionnotification", QString(), QString(), true).toBool(); return getValue("newVersionNotification", QString(), QString(), true).toBool();
} }
int UpdatesSettings::getUpdateReleaseChannelIndex() const int UpdatesSettings::getUpdateReleaseChannelIndex() const
{ {
return getValue("updatereleasechannel", QString(), QString(), 0).toInt(); return getValue("updateReleaseChannel", QString(), QString(), 0).toInt();
} }
void UpdatesSettings::setCheckUpdatesOnStartup(bool value) void UpdatesSettings::setCheckUpdatesOnStartup(bool value)
@ -90,15 +90,15 @@ void UpdatesSettings::setAlwaysEnableNewSets(bool value)
void UpdatesSettings::setNotifyAboutUpdates(bool _notifyaboutupdate) void UpdatesSettings::setNotifyAboutUpdates(bool _notifyaboutupdate)
{ {
setValue(_notifyaboutupdate, "updatenotification"); setValue(_notifyaboutupdate, "updateNotification");
} }
void UpdatesSettings::setNotifyAboutNewVersion(bool _notifyaboutnewversion) void UpdatesSettings::setNotifyAboutNewVersion(bool _notifyaboutnewversion)
{ {
setValue(_notifyaboutnewversion, "newversionnotification"); setValue(_notifyaboutnewversion, "newVersionNotification");
} }
void UpdatesSettings::setUpdateReleaseChannelIndex(int value) void UpdatesSettings::setUpdateReleaseChannelIndex(int value)
{ {
setValue(value, "updatereleasechannel"); setValue(value, "updateReleaseChannel");
} }

View file

@ -273,25 +273,25 @@ TEST_F(SettingsMigrationTest, MigratesAllSettingsGroups)
ASSERT_TRUE(fileExists("sound.ini")); ASSERT_TRUE(fileExists("sound.ini"));
ASSERT_EQ(readFromIni("sound.ini", "sound/enabled"), QVariant(true)); 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/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_TRUE(fileExists("game.ini"));
ASSERT_EQ(readFromIni("game.ini", "game/maxplayers"), QVariant(4)); 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/gameDescription"), QVariant("test game"));
ASSERT_EQ(readFromIni("game.ini", "game/remembergamesettings"), QVariant(false)); ASSERT_EQ(readFromIni("game.ini", "game/rememberGameSettings"), QVariant(false));
ASSERT_EQ(readFromIni("game.ini", "game/gametypes"), QVariant("commander")); ASSERT_EQ(readFromIni("game.ini", "game/gameTypes"), QVariant("commander"));
ASSERT_EQ(readFromIni("game.ini", "game/onlybuddies"), QVariant(true)); ASSERT_EQ(readFromIni("game.ini", "game/onlyBuddies"), QVariant(true));
ASSERT_EQ(readFromIni("game.ini", "localgameoptions/maxplayers"), QVariant(2)); ASSERT_EQ(readFromIni("game.ini", "localgameoptions/maxPlayers"), QVariant(2));
ASSERT_EQ(readFromIni("game.ini", "localgameoptions/startinglifetotal"), QVariant(40)); ASSERT_EQ(readFromIni("game.ini", "localgameoptions/startingLifeTotal"), QVariant(40));
ASSERT_TRUE(fileExists("chat.ini")); ASSERT_TRUE(fileExists("chat.ini"));
ASSERT_EQ(readFromIni("chat.ini", "chat/mention"), QVariant(false)); ASSERT_EQ(readFromIni("chat.ini", "chat/mention"), QVariant(false));
ASSERT_EQ(readFromIni("chat.ini", "chat/mentioncolor"), QVariant("FF0000")); ASSERT_EQ(readFromIni("chat.ini", "chat/mentionColor"), QVariant("FF0000"));
ASSERT_EQ(readFromIni("chat.ini", "chat/showmessagepopups"), QVariant(false)); ASSERT_EQ(readFromIni("chat.ini", "chat/showMessagePopups"), QVariant(false));
ASSERT_EQ(readFromIni("chat.ini", "chat/mentioncompleter"), 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/roomHistory"), QVariant(false));
ASSERT_EQ(readFromIni("chat.ini", "chat/highlightcolor"), QVariant("00FF00")); ASSERT_EQ(readFromIni("chat.ini", "chat/highlightColor"), QVariant("00FF00"));
ASSERT_EQ(readFromIni("chat.ini", "chat/highlightwords"), QVariant("alpha beta")); ASSERT_EQ(readFromIni("chat.ini", "chat/highlightWords"), QVariant("alpha beta"));
ASSERT_TRUE(fileExists("cache_storage.ini")); ASSERT_TRUE(fileExists("cache_storage.ini"));
ASSERT_EQ(readFromIni("cache_storage.ini", "cache_storage/pixmapCacheSize"), QVariant(1024)); ASSERT_EQ(readFromIni("cache_storage.ini", "cache_storage/pixmapCacheSize"), QVariant(1024));
@ -307,8 +307,8 @@ TEST_F(SettingsMigrationTest, MigratesAllSettingsGroups)
ASSERT_EQ(readFromIni("updates.ini", "updates/cardUpdateCheckInterval"), QVariant(14)); 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/lastCardUpdateCheck"), QVariant(QDate(2024, 1, 1)));
ASSERT_EQ(readFromIni("updates.ini", "updates/alwaysEnableNewSets"), QVariant(true)); ASSERT_EQ(readFromIni("updates.ini", "updates/alwaysEnableNewSets"), QVariant(true));
ASSERT_EQ(readFromIni("updates.ini", "updates/updatenotification"), QVariant(false)); ASSERT_EQ(readFromIni("updates.ini", "updates/updateNotification"), QVariant(false));
ASSERT_EQ(readFromIni("updates.ini", "updates/newversionnotification"), QVariant(false)); ASSERT_EQ(readFromIni("updates.ini", "updates/newVersionNotification"), QVariant(false));
ASSERT_TRUE(fileExists("personal.ini")); ASSERT_TRUE(fileExists("personal.ini"));
ASSERT_EQ(readFromIni("personal.ini", "personal/lang"), QVariant("de")); ASSERT_EQ(readFromIni("personal.ini", "personal/lang"), QVariant("de"));
@ -316,8 +316,8 @@ TEST_F(SettingsMigrationTest, MigratesAllSettingsGroups)
ASSERT_EQ(readFromIni("personal.ini", "tipOfDay/seenTips"), QVariant(QStringList{"1", "2", "3"})); ASSERT_EQ(readFromIni("personal.ini", "tipOfDay/seenTips"), QVariant(QStringList{"1", "2", "3"}));
ASSERT_TRUE(fileExists("downloads.ini")); ASSERT_TRUE(fileExists("downloads.ini"));
ASSERT_EQ(readFromIni("downloads.ini", "downloads/picturedownload"), QVariant(true)); ASSERT_EQ(readFromIni("downloads.ini", "downloads/pictureDownload"), QVariant(true));
ASSERT_EQ(readFromIni("downloads.ini", "downloads/downloadspoilers"), QVariant(true)); ASSERT_EQ(readFromIni("downloads.ini", "downloads/downloadSpoilers"), QVariant(true));
ASSERT_TRUE(fileExists("appearance.ini")); ASSERT_TRUE(fileExists("appearance.ini"));
ASSERT_EQ(readFromIni("appearance.ini", "appearance/themeName"), QVariant("custom_theme")); ASSERT_EQ(readFromIni("appearance.ini", "appearance/themeName"), QVariant("custom_theme"));
@ -328,23 +328,23 @@ TEST_F(SettingsMigrationTest, MigratesAllSettingsGroups)
ASSERT_EQ(readFromIni("appearance.ini", "appearance/homeTabDisplayCardName"), QVariant(false)); ASSERT_EQ(readFromIni("appearance.ini", "appearance/homeTabDisplayCardName"), QVariant(false));
ASSERT_TRUE(fileExists("network.ini")); ASSERT_TRUE(fileExists("network.ini"));
ASSERT_EQ(readFromIni("network.ini", "network/keepalive"), QVariant(10)); ASSERT_EQ(readFromIni("network.ini", "network/keepAlive"), QVariant(10));
ASSERT_EQ(readFromIni("network.ini", "network/timeout"), QVariant(30)); 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/clientId"), QVariant("test-client-id"));
ASSERT_EQ(readFromIni("network.ini", "network/clientversion"), QVariant("test-client-version")); ASSERT_EQ(readFromIni("network.ini", "network/clientVersion"), QVariant("test-client-version"));
ASSERT_EQ(readFromIni("network.ini", "network/knownmissingfeatures"), QVariant("feature1,feature2")); ASSERT_EQ(readFromIni("network.ini", "network/knownMissingFeatures"), QVariant("feature1,feature2"));
ASSERT_TRUE(fileExists("cards_display.ini")); ASSERT_TRUE(fileExists("cards_display.ini"));
ASSERT_EQ(readFromIni("cards_display.ini", "cards/displaycardnames"), QVariant(false)); 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/roundCardCorners"), QVariant(false));
ASSERT_EQ(readFromIni("cards_display.ini", "cards/overrideallcardartwithpersonalpreference"), QVariant(true)); 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/bumpSetsWithCardsInDeckToTop"), QVariant(false));
ASSERT_EQ(readFromIni("cards_display.ini", "cards/includerebalancedcards"), 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/autoRotateSidewaysLayoutCards"), QVariant(false));
ASSERT_EQ(readFromIni("cards_display.ini", "cards/tapanimation"), QVariant(true)); 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/scaleCards"), QVariant(false));
ASSERT_EQ(readFromIni("cards_display.ini", "cards/verticalCardOverlapPercent"), QVariant(42)); 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/cardInfoViewMode"), QVariant(1));
ASSERT_EQ(readFromIni("cards_display.ini", "cards/cardSize/printingSelector"), QVariant(90)); 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/sortOrder"), QVariant(3));
ASSERT_EQ(readFromIni("cards_display.ini", "cards/printingSelector/navigationButtonsVisible"), QVariant(false)); ASSERT_EQ(readFromIni("cards_display.ini", "cards/printingSelector/navigationButtonsVisible"), QVariant(false));
@ -356,7 +356,7 @@ TEST_F(SettingsMigrationTest, MigratesAllSettingsGroups)
ASSERT_EQ(readFromIni("cards_display.ini", "cards/cardSize/sampleHandSize"), QVariant(5)); ASSERT_EQ(readFromIni("cards_display.ini", "cards/cardSize/sampleHandSize"), QVariant(5));
ASSERT_TRUE(fileExists("interface.ini")); ASSERT_TRUE(fileExists("interface.ini"));
ASSERT_EQ(readFromIni("interface.ini", "interface/usetearoffmenus"), QVariant(true)); ASSERT_EQ(readFromIni("interface.ini", "interface/useTearOffMenus"), QVariant(true));
ASSERT_EQ(readFromIni("interface.ini", "interface/cardViewInitialRowsMax"), QVariant(8)); ASSERT_EQ(readFromIni("interface.ini", "interface/cardViewInitialRowsMax"), QVariant(8));
ASSERT_EQ(readFromIni("interface.ini", "interface/cardViewExpandedRowsMax"), QVariant(12)); ASSERT_EQ(readFromIni("interface.ini", "interface/cardViewExpandedRowsMax"), QVariant(12));
ASSERT_EQ(readFromIni("interface.ini", "interface/closeEmptyCardView"), QVariant(false)); ASSERT_EQ(readFromIni("interface.ini", "interface/closeEmptyCardView"), QVariant(false));
@ -365,27 +365,27 @@ TEST_F(SettingsMigrationTest, MigratesAllSettingsGroups)
ASSERT_EQ(readFromIni("interface.ini", "interface/notifications/enabled"), QVariant(false)); 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/spectatorsEnabled"), QVariant(true));
ASSERT_EQ(readFromIni("interface.ini", "interface/notifications/buddyConnectEnabled"), QVariant(false)); 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/doubleClickToPlay"), QVariant(false));
ASSERT_EQ(readFromIni("interface.ini", "interface/clickPlaysAllSelected"), 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/playToStack"), QVariant(false));
ASSERT_EQ(readFromIni("interface.ini", "interface/doNotDeleteArrowsInSubPhases"), 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/startingHandSize"), QVariant(5));
ASSERT_EQ(readFromIni("interface.ini", "interface/annotatetokens"), QVariant(true)); ASSERT_EQ(readFromIni("interface.ini", "interface/annotateTokens"), QVariant(true));
ASSERT_EQ(readFromIni("interface.ini", "interface/showlassoselectioncount"), QVariant(false)); ASSERT_EQ(readFromIni("interface.ini", "interface/showLassoSelectionCount"), QVariant(false));
ASSERT_EQ(readFromIni("interface.ini", "interface/showpersistentselectioncount"), 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/tallyType"), QVariant(2));
ASSERT_EQ(readFromIni("interface.ini", "interface/leftjustified"), QVariant(true)); ASSERT_EQ(readFromIni("interface.ini", "interface/leftJustified"), QVariant(true));
ASSERT_EQ(readFromIni("interface.ini", "interface/min_players_multicolumn"), QVariant(6)); ASSERT_EQ(readFromIni("interface.ini", "interface/minPlayersMulticolumn"), QVariant(6));
ASSERT_EQ(readFromIni("interface.ini", "interface/showStatusBar"), QVariant(true)); ASSERT_EQ(readFromIni("interface.ini", "interface/showStatusBar"), QVariant(true));
ASSERT_EQ(readFromIni("interface.ini", "interface/showShortcuts"), QVariant(false)); ASSERT_EQ(readFromIni("interface.ini", "interface/showShortcuts"), QVariant(false));
ASSERT_EQ(readFromIni("interface.ini", "interface/showGameSelectorFilterToolbar"), 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", "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/rewindBufferingMs"), QVariant(6000));
ASSERT_EQ(readFromIni("interface.ini", "replay/fastForwardSpeed"), QVariant(5)); ASSERT_EQ(readFromIni("interface.ini", "replay/fastForwardSpeed"), QVariant(5));
ASSERT_EQ(readFromIni("interface.ini", "zoneview/groupby"), QVariant(2)); ASSERT_EQ(readFromIni("interface.ini", "zoneview/groupBy"), QVariant(2));
ASSERT_EQ(readFromIni("interface.ini", "zoneview/sortby"), QVariant(1)); ASSERT_EQ(readFromIni("interface.ini", "zoneview/sortBy"), QVariant(1));
ASSERT_EQ(readFromIni("interface.ini", "zoneview/pileview"), QVariant(false)); ASSERT_EQ(readFromIni("interface.ini", "zoneview/pileView"), QVariant(false));
ASSERT_TRUE(fileExists("deck_editor.ini")); ASSERT_TRUE(fileExists("deck_editor.ini"));
ASSERT_EQ(readFromIni("deck_editor.ini", "deckeditor/openDeckInNewTab"), QVariant(false)); ASSERT_EQ(readFromIni("deck_editor.ini", "deckeditor/openDeckInNewTab"), QVariant(false));
@ -434,6 +434,25 @@ TEST_F(SettingsMigrationTest, MigratesAllSettingsGroups)
ASSERT_FALSE(readFromIni("cards_display.ini", "cards/printingselectorsortorder").isValid()); ASSERT_FALSE(readFromIni("cards_display.ini", "cards/printingselectorsortorder").isValid());
ASSERT_FALSE(readFromIni("cards_display.ini", "cards/visualDeckStorage/cardSize").isValid()); ASSERT_FALSE(readFromIni("cards_display.ini", "cards/visualDeckStorage/cardSize").isValid());
// No legacy non-camelCase keys should remain in the per-file INIs
ASSERT_FALSE(readFromIni("game.ini", "game/gamedescription").isValid());
ASSERT_FALSE(readFromIni("game.ini", "localgameoptions/maxplayers").isValid());
ASSERT_FALSE(readFromIni("chat.ini", "chat/roomhistory").isValid());
ASSERT_FALSE(readFromIni("chat.ini", "chat/highlightwords").isValid());
ASSERT_FALSE(readFromIni("sound.ini", "sound/mastervolume").isValid());
ASSERT_FALSE(readFromIni("downloads.ini", "downloads/picturedownload").isValid());
ASSERT_FALSE(readFromIni("network.ini", "network/keepalive").isValid());
ASSERT_FALSE(readFromIni("network.ini", "network/knownmissingfeatures").isValid());
ASSERT_FALSE(readFromIni("updates.ini", "updates/updatenotification").isValid());
ASSERT_FALSE(readFromIni("cards_display.ini", "cards/displaycardnames").isValid());
ASSERT_FALSE(readFromIni("cards_display.ini", "cards/cardinfoviewmode").isValid());
ASSERT_FALSE(readFromIni("interface.ini", "interface/usetearoffmenus").isValid());
ASSERT_FALSE(readFromIni("interface.ini", "interface/doubleclicktoplay").isValid());
ASSERT_FALSE(readFromIni("interface.ini", "interface/min_players_multicolumn").isValid());
ASSERT_FALSE(readFromIni("interface.ini", "table/invert_vertical").isValid());
ASSERT_FALSE(readFromIni("interface.ini", "zoneview/groupby").isValid());
ASSERT_FALSE(readFromIni("interface.ini", "zoneview/pileview").isValid());
// Verify sentinel was written // Verify sentinel was written
ASSERT_EQ(readFromIni("global.ini", "migration/perfile_complete"), QVariant(true)); ASSERT_EQ(readFromIni("global.ini", "migration/perfile_complete"), QVariant(true));
} }
@ -512,7 +531,7 @@ TEST_F(SettingsMigrationTest, KeyMapTranslationIsCorrect)
ASSERT_TRUE(fileExists("updates.ini")); ASSERT_TRUE(fileExists("updates.ini"));
// The key should be translated from "personal/cardUpdateCheckInterval" to "updates/cardUpdateCheckInterval" // 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/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) TEST_F(SettingsMigrationTest, CardsKeysKeepGroupPrefix)
@ -530,7 +549,7 @@ TEST_F(SettingsMigrationTest, CardsKeysKeepGroupPrefix)
ASSERT_TRUE(fileExists("cards_display.ini")); ASSERT_TRUE(fileExists("cards_display.ini"));
ASSERT_TRUE(fileExists("deck_editor.ini")); ASSERT_TRUE(fileExists("deck_editor.ini"));
// "cards/displaycardnames" should be stored with its group prefix // "cards/displaycardnames" should be stored with its group prefix
ASSERT_EQ(readFromIni("cards_display.ini", "cards/displaycardnames"), QVariant(false)); ASSERT_EQ(readFromIni("cards_display.ini", "cards/displayCardNames"), QVariant(false));
// deck editor keys belong to the deck editor settings now // deck editor keys belong to the deck editor settings now
ASSERT_EQ(readFromIni("deck_editor.ini", "deckeditor/bannerCardComboBoxVisible"), QVariant(true)); ASSERT_EQ(readFromIni("deck_editor.ini", "deckeditor/bannerCardComboBoxVisible"), QVariant(true));
} }
@ -553,17 +572,68 @@ TEST_F(SettingsMigrationTest, LegacyMigrationIsIdempotent)
// Change the migrated value // Change the migrated value
{ {
QSettings serversIni(settingsPath + "servers.ini", QSettings::IniFormat); QSettings serversIni(settingsPath + "servers.ini", QSettings::IniFormat);
serversIni.setValue("server/previoushostlogin", "modified_user"); serversIni.setValue("server/previousHostLogin", "modified_user");
serversIni.sync(); serversIni.sync();
} }
// Second migration should NOT overwrite the change // Second migration should NOT overwrite the change
ASSERT_FALSE(SettingsMigration::migrateLegacySettings(settingsPath)); 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)
{
if (!nativeSettingsAvailable()) {
GTEST_SKIP() << "NativeFormat QSettings not available in this environment";
}
{
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) TEST_F(SettingsMigrationTest, LegacyMigrationEmptyNativeFormatWritesSentinel)
{ {
if (nativeSettingsAvailable()) {
QSettings().clear();
QSettings().sync();
}
ASSERT_TRUE(SettingsMigration::migrateLegacySettings(settingsPath)); ASSERT_TRUE(SettingsMigration::migrateLegacySettings(settingsPath));
ASSERT_TRUE(fileExists("personal.ini")); ASSERT_TRUE(fileExists("personal.ini"));
ASSERT_EQ(readFromIni("personal.ini", "migration/legacy_complete"), QVariant(true)); ASSERT_EQ(readFromIni("personal.ini", "migration/legacy_complete"), QVariant(true));