Turn Card, Deck_List, Protocol, RNG, Server, Settings and Utility into libraries and remove cockatrice_common.

Took 6 hours 3 minutes

Took 31 seconds
This commit is contained in:
Lukas Brübach 2025-10-02 17:41:07 +02:00
parent 3cff55b0bb
commit 1e4e5a4419
593 changed files with 1913 additions and 1601 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,56 @@
#include "card_counter_settings.h"
#include <QColor>
#include <QSettings>
#include <QtMath>
CardCounterSettings::CardCounterSettings(const QString &settingsPath, QObject *parent)
: SettingsManager(settingsPath + "global.ini", parent)
{
}
void CardCounterSettings::setColor(int counterId, const QColor &color)
{
QString key = QString("cards/counters/%1/color").arg(counterId);
if (settings.value(key).value<QColor>() == color)
return;
settings.setValue(key, color);
emit colorChanged(counterId, color);
}
QColor CardCounterSettings::color(int counterId) const
{
QColor defaultColor;
if (counterId < 6) {
// Preserve legacy colors
defaultColor = QColor::fromHsv(counterId * 60, 150, 255);
} else {
// Future-proof support for more counters with pseudo-random colors
int h = (counterId * 37) % 360;
int s = 128 + 64 * qSin((counterId * 97) * 0.1); // 64-192
int v = 196 + 32 * qSin((counterId * 101) * 0.07); // 164-228
defaultColor = QColor::fromHsv(h, s, v);
}
return settings.value(QString("cards/counters/%1/color").arg(counterId), defaultColor).value<QColor>();
}
QString CardCounterSettings::displayName(int counterId) const
{
// Currently, card counters name are fixed to A, B, ..., Z, AA, AB, ...
auto nChars = 1 + counterId / 26;
QString str;
str.resize(nChars);
for (auto it = str.rbegin(); it != str.rend(); ++it) {
*it = QChar('A' + (counterId) % 26);
counterId /= 26;
}
return str;
}

View file

@ -0,0 +1,35 @@
/**
* @file card_counter_settings.h
* @ingroup GameSettings
* @brief TODO: Document this.
*/
#ifndef CARD_COUNTER_SETTINGS_H
#define CARD_COUNTER_SETTINGS_H
#include "settings_manager.h"
#include <QObject>
class QSettings;
class QColor;
class CardCounterSettings : public SettingsManager
{
Q_OBJECT
public:
CardCounterSettings(const QString &settingsPath, QObject *parent = nullptr);
QColor color(int counterId) const;
QString displayName(int counterId) const;
public slots:
void setColor(int counterId, const QColor &color);
signals:
void colorChanged(int counterId, const QColor &color);
};
#endif // CARD_COUNTER_SETTINGS_H

View file

@ -0,0 +1,36 @@
#include "card_database_settings.h"
CardDatabaseSettings::CardDatabaseSettings(const QString &settingPath, QObject *parent)
: SettingsManager(settingPath + "cardDatabase.ini", parent)
{
}
void CardDatabaseSettings::setSortKey(QString shortName, unsigned int sortKey)
{
setValue(sortKey, "sortkey", "sets", std::move(shortName));
}
void CardDatabaseSettings::setEnabled(QString shortName, bool enabled)
{
setValue(enabled, "enabled", "sets", std::move(shortName));
}
void CardDatabaseSettings::setIsKnown(QString shortName, bool isknown)
{
setValue(isknown, "isknown", "sets", std::move(shortName));
}
unsigned int CardDatabaseSettings::getSortKey(QString shortName)
{
return getValue("sortkey", "sets", std::move(shortName)).toUInt();
}
bool CardDatabaseSettings::isEnabled(QString shortName)
{
return getValue("enabled", "sets", std::move(shortName)).toBool();
}
bool CardDatabaseSettings::isKnown(QString shortName)
{
return getValue("isknown", "sets", std::move(shortName)).toBool();
}

View file

@ -0,0 +1,39 @@
/**
* @file card_database_settings.h
* @ingroup CardDatabase
* @ingroup CardSettings
* @brief TODO: Document this.
*/
#ifndef CARDDATABASESETTINGS_H
#define CARDDATABASESETTINGS_H
#include "settings_manager.h"
#include <QObject>
#include <QSettings>
#include <QVariant>
class CardDatabaseSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
public:
void setSortKey(QString shortName, unsigned int sortKey);
void setEnabled(QString shortName, bool enabled);
void setIsKnown(QString shortName, bool isknown);
unsigned int getSortKey(QString shortName);
bool isEnabled(QString shortName);
bool isKnown(QString shortName);
signals:
public slots:
private:
explicit CardDatabaseSettings(const QString &settingPath, QObject *parent = nullptr);
CardDatabaseSettings(const CardDatabaseSettings & /*other*/);
};
#endif // CARDDATABASESETTINGS_H

View file

@ -0,0 +1,21 @@
#include "card_override_settings.h"
CardOverrideSettings::CardOverrideSettings(const QString &settingPath, QObject *parent)
: SettingsManager(settingPath + "cardPreferenceOverrides.ini", parent)
{
}
void CardOverrideSettings::setCardPreferenceOverride(const CardRef &cardRef)
{
setValue(cardRef.providerId, cardRef.name, "cards");
}
void CardOverrideSettings::deleteCardPreferenceOverride(const QString &cardName)
{
deleteValue(cardName, "cards");
}
QString CardOverrideSettings::getCardPreferenceOverride(const QString &cardName)
{
return getValue(cardName, "cards").toString();
}

View file

@ -0,0 +1,32 @@
/**
* @file card_override_settings.h
* @ingroup CardSettings
* @brief TODO: Document this.
*/
#ifndef COCKATRICE_CARD_OVERRIDE_SETTINGS_H
#define COCKATRICE_CARD_OVERRIDE_SETTINGS_H
#include "settings_manager.h"
#include <QObject>
#include <libcockatrice/utility/card_ref.h>
class CardOverrideSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
public:
void setCardPreferenceOverride(const CardRef &cardRef);
void deleteCardPreferenceOverride(const QString &cardName);
QString getCardPreferenceOverride(const QString &cardName);
private:
explicit CardOverrideSettings(const QString &settingPath, QObject *parent = nullptr);
CardOverrideSettings(const CardOverrideSettings & /*other*/);
};
#endif // COCKATRICE_CARD_OVERRIDE_SETTINGS_H

View file

@ -0,0 +1,32 @@
#include "debug_settings.h"
#include <QtCore/QFile>
DebugSettings::DebugSettings(const QString &settingPath, QObject *parent)
: SettingsManager(settingPath + "debug.ini", parent)
{
// Create the default debug.ini if it doesn't exist yet
if (!QFile(settingPath + "debug.ini").exists()) {
QFile::copy(":/resources/config/debug.ini", settingPath + "debug.ini");
}
}
bool DebugSettings::getShowCardId()
{
return getValue("showCardId", "debug").toBool();
}
bool DebugSettings::getLocalGameOnStartup()
{
return getValue("onStartup", "localgame").toBool();
}
int DebugSettings::getLocalGamePlayerCount()
{
return getValue("playerCount", "localgame").toInt();
}
QString DebugSettings::getDeckPathForPlayer(const QString &playerName)
{
return getValue(playerName, "localgame", "deck").toString();
}

View file

@ -0,0 +1,28 @@
/**
* @file debug_settings.h
* @ingroup CoreSettings
* @brief TODO: Document this.
*/
#ifndef DEBUG_SETTINGS_H
#define DEBUG_SETTINGS_H
#include "settings_manager.h"
class DebugSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
explicit DebugSettings(const QString &settingPath, QObject *parent = nullptr);
DebugSettings(const DebugSettings & /*other*/);
public:
bool getShowCardId();
bool getLocalGameOnStartup();
int getLocalGamePlayerCount();
QString getDeckPathForPlayer(const QString &playerName);
};
#endif // DEBUG_SETTINGS_H

View file

@ -0,0 +1,29 @@
#include "download_settings.h"
#include "settings_manager.h"
const QStringList DownloadSettings::DEFAULT_DOWNLOAD_URLS = {
"https://api.scryfall.com/cards/!set:uuid!?format=image&face=!prop:side!",
"https://api.scryfall.com/cards/multiverse/!set:muid!?format=image",
"https://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!set:muid!&type=card",
"https://gatherer.wizards.com/Handlers/Image.ashx?name=!name!&type=card"};
DownloadSettings::DownloadSettings(const QString &settingPath, QObject *parent = nullptr)
: SettingsManager(settingPath + "downloads.ini", parent)
{
}
void DownloadSettings::setDownloadUrls(const QStringList &downloadURLs)
{
setValue(QVariant::fromValue(downloadURLs), "urls", "downloads");
}
QStringList DownloadSettings::getAllURLs()
{
return getValue("urls", "downloads").toStringList();
}
void DownloadSettings::resetToDefaultURLs()
{
setValue(QVariant::fromValue(DEFAULT_DOWNLOAD_URLS), "urls", "downloads");
}

View file

@ -0,0 +1,29 @@
/**
* @file download_settings.h
* @ingroup NetworkSettings
* @brief TODO: Document this.
*/
#ifndef COCKATRICE_DOWNLOADSETTINGS_H
#define COCKATRICE_DOWNLOADSETTINGS_H
#include "settings_manager.h"
#include <QObject>
class DownloadSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
static const QStringList DEFAULT_DOWNLOAD_URLS;
public:
explicit DownloadSettings(const QString &, QObject *);
QStringList getAllURLs();
void setDownloadUrls(const QStringList &downloadURLs);
void resetToDefaultURLs();
};
#endif // COCKATRICE_DOWNLOADSETTINGS_H

View file

@ -0,0 +1,208 @@
#include "game_filters_settings.h"
#include <QCryptographicHash>
#include <QTime>
GameFiltersSettings::GameFiltersSettings(const QString &settingPath, QObject *parent)
: SettingsManager(settingPath + "gamefilters.ini", parent)
{
}
/*
* The game type might contain special characters, so to use it in
* QSettings we just hash it.
*/
QString GameFiltersSettings::hashGameType(const QString &gameType) const
{
return QCryptographicHash::hash(gameType.toUtf8(), QCryptographicHash::Md5).toHex();
}
void GameFiltersSettings::setHideBuddiesOnlyGames(bool hide)
{
setValue(hide, "hide_buddies_only_games", "filter_games");
}
bool GameFiltersSettings::isHideBuddiesOnlyGames()
{
QVariant previous = getValue("hide_buddies_only_games", "filter_games");
return previous == QVariant() || previous.toBool();
}
void GameFiltersSettings::setHideFullGames(bool hide)
{
setValue(hide, "hide_full_games", "filter_games");
}
bool GameFiltersSettings::isHideFullGames()
{
QVariant previous = getValue("hide_full_games", "filter_games");
return !(previous == QVariant()) && previous.toBool();
}
void GameFiltersSettings::setHideGamesThatStarted(bool hide)
{
setValue(hide, "hide_games_that_started", "filter_games");
}
bool GameFiltersSettings::isHideGamesThatStarted()
{
QVariant previous = getValue("hide_games_that_started", "filter_games");
return !(previous == QVariant()) && previous.toBool();
}
void GameFiltersSettings::setHidePasswordProtectedGames(bool hide)
{
setValue(hide, "hide_password_protected_games", "filter_games");
}
bool GameFiltersSettings::isHidePasswordProtectedGames()
{
QVariant previous = getValue("hide_password_protected_games", "filter_games");
return previous == QVariant() || previous.toBool();
}
void GameFiltersSettings::setHideIgnoredUserGames(bool hide)
{
setValue(hide, "hide_ignored_user_games", "filter_games");
}
bool GameFiltersSettings::isHideIgnoredUserGames()
{
QVariant previous = getValue("hide_ignored_user_games", "filter_games");
return !(previous == QVariant()) && previous.toBool();
}
void GameFiltersSettings::setHideNotBuddyCreatedGames(bool hide)
{
setValue(hide, "hide_not_buddy_created_games", "filter_games");
}
bool GameFiltersSettings::isHideNotBuddyCreatedGames()
{
QVariant previous = getValue("hide_not_buddy_created_games", "filter_games");
return !(previous == QVariant()) && previous.toBool();
}
void GameFiltersSettings::setHideOpenDecklistGames(bool hide)
{
setValue(hide, "hide_open_decklist_games", "filter_games");
}
bool GameFiltersSettings::isHideOpenDecklistGames()
{
QVariant previous = getValue("hide_open_decklist_games", "filter_games");
return !(previous == QVariant()) && previous.toBool();
}
void GameFiltersSettings::setGameNameFilter(QString gameName)
{
setValue(gameName, "game_name_filter", "filter_games");
}
QString GameFiltersSettings::getGameNameFilter()
{
return getValue("game_name_filter", "filter_games").toString();
}
void GameFiltersSettings::setCreatorNameFilter(QString creatorName)
{
setValue(creatorName, "creator_name_filter", "filter_games");
}
QString GameFiltersSettings::getCreatorNameFilter()
{
return getValue("creator_name_filter", "filter_games").toString();
}
void GameFiltersSettings::setMinPlayers(int min)
{
setValue(min, "min_players", "filter_games");
}
int GameFiltersSettings::getMinPlayers()
{
QVariant previous = getValue("min_players", "filter_games");
return previous == QVariant() ? 1 : previous.toInt();
}
void GameFiltersSettings::setMaxPlayers(int max)
{
setValue(max, "max_players", "filter_games");
}
int GameFiltersSettings::getMaxPlayers()
{
QVariant previous = getValue("max_players", "filter_games");
return previous == QVariant() ? 99 : previous.toInt();
}
void GameFiltersSettings::setMaxGameAge(const QTime &maxGameAge)
{
setValue(maxGameAge, "max_game_age_time", "filter_games");
}
QTime GameFiltersSettings::getMaxGameAge()
{
QVariant previous = getValue("max_game_age_time", "filter_games");
return previous.toTime();
}
void GameFiltersSettings::setGameTypeEnabled(QString gametype, bool enabled)
{
setValue(enabled, "game_type/" + hashGameType(gametype), "filter_games");
}
void GameFiltersSettings::setGameHashedTypeEnabled(QString gametypeHASHED, bool enabled)
{
setValue(enabled, gametypeHASHED, "filter_games");
}
bool GameFiltersSettings::isGameTypeEnabled(QString gametype)
{
QVariant previous = getValue("game_type/" + hashGameType(gametype), "filter_games");
return previous == QVariant() ? false : previous.toBool();
}
void GameFiltersSettings::setShowOnlyIfSpectatorsCanWatch(bool show)
{
setValue(show, "show_only_if_spectators_can_watch", "filter_games");
}
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanWatch()
{
QVariant previous = getValue("show_only_if_spectators_can_watch", "filter_games");
return previous == QVariant() ? false : previous.toBool();
}
void GameFiltersSettings::setShowSpectatorPasswordProtected(bool show)
{
setValue(show, "show_spectator_password_protected", "filter_games");
}
bool GameFiltersSettings::isShowSpectatorPasswordProtected()
{
QVariant previous = getValue("show_spectator_password_protected", "filter_games");
return previous == QVariant() ? true : previous.toBool();
}
void GameFiltersSettings::setShowOnlyIfSpectatorsCanChat(bool show)
{
setValue(show, "show_only_if_spectators_can_chat", "filter_games");
}
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanChat()
{
QVariant previous = getValue("show_only_if_spectators_can_chat", "filter_games");
return previous == QVariant() ? true : previous.toBool();
}
void GameFiltersSettings::setShowOnlyIfSpectatorsCanSeeHands(bool show)
{
setValue(show, "show_only_if_spectators_can_see_hands", "filter_games");
}
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanSeeHands()
{
QVariant previous = getValue("show_only_if_spectators_can_see_hands", "filter_games");
return previous == QVariant() ? true : previous.toBool();
}

View file

@ -0,0 +1,66 @@
/**
* @file game_filters_settings.h
* @ingroup Lobby
* @ingroup GameSettings
* @brief TODO: Document this.
*/
#ifndef GAMEFILTERSSETTINGS_H
#define GAMEFILTERSSETTINGS_H
#include "settings_manager.h"
class GameFiltersSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
public:
bool isHideBuddiesOnlyGames();
bool isHideFullGames();
bool isHideGamesThatStarted();
bool isHidePasswordProtectedGames();
bool isHideIgnoredUserGames();
bool isHideNotBuddyCreatedGames();
void setHideOpenDecklistGames(bool hide);
bool isHideOpenDecklistGames();
QString getGameNameFilter();
QString getCreatorNameFilter();
int getMinPlayers();
int getMaxPlayers();
QTime getMaxGameAge();
bool isGameTypeEnabled(QString gametype);
bool isShowOnlyIfSpectatorsCanWatch();
bool isShowSpectatorPasswordProtected();
bool isShowOnlyIfSpectatorsCanChat();
bool isShowOnlyIfSpectatorsCanSeeHands();
void setHideBuddiesOnlyGames(bool hide);
void setHideIgnoredUserGames(bool hide);
void setHideFullGames(bool hide);
void setHideGamesThatStarted(bool hide);
void setHidePasswordProtectedGames(bool hide);
void setHideNotBuddyCreatedGames(bool hide);
void setGameNameFilter(QString gameName);
void setCreatorNameFilter(QString creatorName);
void setMinPlayers(int min);
void setMaxPlayers(int max);
void setMaxGameAge(const QTime &maxGameAge);
void setGameTypeEnabled(QString gametype, bool enabled);
void setGameHashedTypeEnabled(QString gametypeHASHED, bool enabled);
void setShowOnlyIfSpectatorsCanWatch(bool show);
void setShowSpectatorPasswordProtected(bool show);
void setShowOnlyIfSpectatorsCanChat(bool show);
void setShowOnlyIfSpectatorsCanSeeHands(bool show);
signals:
public slots:
private:
explicit GameFiltersSettings(const QString &settingPath, QObject *parent = nullptr);
GameFiltersSettings(const GameFiltersSettings & /*other*/);
QString hashGameType(const QString &gameType) const;
};
#endif // GAMEFILTERSSETTINGS_H

View file

@ -0,0 +1,207 @@
#include "layouts_settings.h"
LayoutsSettings::LayoutsSettings(const QString &settingPath, QObject *parent)
: SettingsManager(settingPath + "layouts.ini", parent)
{
}
const QByteArray LayoutsSettings::getDeckEditorLayoutState()
{
return getValue("layouts/deckEditor_state").toByteArray();
}
void LayoutsSettings::setDeckEditorLayoutState(const QByteArray &value)
{
setValue(value, "layouts/deckEditor_state");
}
const QByteArray LayoutsSettings::getDeckEditorGeometry()
{
return getValue("layouts/deckEditor_geometry").toByteArray();
}
void LayoutsSettings::setDeckEditorGeometry(const QByteArray &value)
{
setValue(value, "layouts/deckEditor_geometry");
}
QSize LayoutsSettings::getDeckEditorCardSize()
{
QVariant previous = getValue("layouts/deckEditor_CardSize");
return previous == QVariant() ? QSize(250, 500) : previous.toSize();
}
void LayoutsSettings::setDeckEditorCardSize(const QSize &value)
{
setValue(value, "layouts/deckEditor_CardSize");
}
QSize LayoutsSettings::getDeckEditorDeckSize()
{
QVariant previous = getValue("layouts/deckEditor_DeckSize");
return previous == QVariant() ? QSize(250, 360) : previous.toSize();
}
void LayoutsSettings::setDeckEditorDeckSize(const QSize &value)
{
setValue(value, "layouts/deckEditor_DeckSize");
}
QSize LayoutsSettings::getDeckEditorPrintingSelectorSize()
{
QVariant previous = getValue("layouts/deckEditor_PrintingSelectorSize");
return previous == QVariant() ? QSize(525, 250) : previous.toSize();
}
void LayoutsSettings::setDeckEditorPrintingSelectorSize(const QSize &value)
{
setValue(value, "layouts/deckEditor_PrintingSelectorSize");
}
QSize LayoutsSettings::getDeckEditorFilterSize()
{
QVariant previous = getValue("layouts/deckEditor_FilterSize");
return previous == QVariant() ? QSize(250, 250) : previous.toSize();
}
void LayoutsSettings::setDeckEditorFilterSize(const QSize &value)
{
setValue(value, "layouts/deckEditor_FilterSize");
}
const QByteArray LayoutsSettings::getDeckEditorDbHeaderState()
{
return getValue("layouts/deckEditorDbHeader_state").toByteArray();
}
void LayoutsSettings::setDeckEditorDbHeaderState(const QByteArray &value)
{
setValue(value, "layouts/deckEditorDbHeader_state");
}
const QByteArray LayoutsSettings::getSetsDialogHeaderState()
{
return getValue("layouts/setsDialogHeader_state").toByteArray();
}
void LayoutsSettings::setSetsDialogHeaderState(const QByteArray &value)
{
setValue(value, "layouts/setsDialogHeader_state");
}
void LayoutsSettings::setGamePlayAreaGeometry(const QByteArray &value)
{
setValue(value, "layouts/gameplayarea_geometry");
}
void LayoutsSettings::setGamePlayAreaState(const QByteArray &value)
{
setValue(value, "layouts/gameplayarea_state");
}
const QByteArray LayoutsSettings::getGamePlayAreaLayoutState()
{
return getValue("layouts/gameplayarea_state").toByteArray();
}
const QByteArray LayoutsSettings::getGamePlayAreaGeometry()
{
return getValue("layouts/gameplayarea_geometry").toByteArray();
}
const QSize LayoutsSettings::getGameCardInfoSize()
{
QVariant previous = getValue("layouts/gameplayarea_CardInfoSize");
return previous == QVariant() ? QSize(250, 360) : previous.toSize();
}
void LayoutsSettings::setGameCardInfoSize(const QSize &value)
{
setValue(value, "layouts/gameplayarea_CardInfoSize");
}
const QSize LayoutsSettings::getGameMessageLayoutSize()
{
QVariant previous = getValue("layouts/gameplayarea_MessageLayoutSize");
return previous == QVariant() ? QSize(250, 250) : previous.toSize();
}
void LayoutsSettings::setGameMessageLayoutSize(const QSize &value)
{
setValue(value, "layouts/gameplayarea_MessageLayoutSize");
}
const QSize LayoutsSettings::getGamePlayerListSize()
{
QVariant previous = getValue("layouts/gameplayarea_PlayerListSize");
return previous == QVariant() ? QSize(250, 50) : previous.toSize();
}
void LayoutsSettings::setGamePlayerListSize(const QSize &value)
{
setValue(value, "layouts/gameplayarea_PlayerListSize");
}
void LayoutsSettings::setReplayPlayAreaGeometry(const QByteArray &value)
{
setValue(value, "layouts/replayplayarea_geometry");
}
void LayoutsSettings::setReplayPlayAreaState(const QByteArray &value)
{
setValue(value, "layouts/replayplayarea_state");
}
const QByteArray LayoutsSettings::getReplayPlayAreaLayoutState()
{
return getValue("layouts/replayplayarea_state").toByteArray();
}
const QByteArray LayoutsSettings::getReplayPlayAreaGeometry()
{
return getValue("layouts/replayplayarea_geometry").toByteArray();
}
const QSize LayoutsSettings::getReplayCardInfoSize()
{
QVariant previous = getValue("layouts/replayplayarea_CardInfoSize");
return previous == QVariant() ? QSize(250, 360) : previous.toSize();
}
void LayoutsSettings::setReplayCardInfoSize(const QSize &value)
{
setValue(value, "layouts/replayplayarea_CardInfoSize");
}
const QSize LayoutsSettings::getReplayMessageLayoutSize()
{
QVariant previous = getValue("layouts/replayplayarea_MessageLayoutSize");
return previous == QVariant() ? QSize(250, 200) : previous.toSize();
}
void LayoutsSettings::setReplayMessageLayoutSize(const QSize &value)
{
setValue(value, "layouts/replayplayarea_MessageLayoutSize");
}
const QSize LayoutsSettings::getReplayPlayerListSize()
{
QVariant previous = getValue("layouts/replayplayarea_PlayerListSize");
return previous == QVariant() ? QSize(250, 50) : previous.toSize();
}
void LayoutsSettings::setReplayPlayerListSize(const QSize &value)
{
setValue(value, "layouts/replayplayarea_PlayerListSize");
}
const QSize LayoutsSettings::getReplayReplaySize()
{
QVariant previous = getValue("layouts/replayplayarea_ReplaySize");
return previous == QVariant() ? QSize(900, 100) : previous.toSize();
}
void LayoutsSettings::setReplayReplaySize(const QSize &value)
{
setValue(value, "layouts/replayplayarea_ReplaySize");
}

View file

@ -0,0 +1,72 @@
/**
* @file layouts_settings.h
* @ingroup CoreSettings
* @brief TODO: Document this.
*/
#ifndef LAYOUTSSETTINGS_H
#define LAYOUTSSETTINGS_H
#include "settings_manager.h"
#include <QSize>
class LayoutsSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
public:
void setDeckEditorLayoutState(const QByteArray &value);
void setDeckEditorGeometry(const QByteArray &value);
void setDeckEditorCardSize(const QSize &value);
void setDeckEditorDeckSize(const QSize &value);
void setDeckEditorPrintingSelectorSize(const QSize &value);
void setDeckEditorFilterSize(const QSize &value);
void setDeckEditorDbHeaderState(const QByteArray &value);
void setSetsDialogHeaderState(const QByteArray &value);
void setGamePlayAreaGeometry(const QByteArray &value);
void setGamePlayAreaState(const QByteArray &value);
void setGameCardInfoSize(const QSize &value);
void setGameMessageLayoutSize(const QSize &value);
void setGamePlayerListSize(const QSize &value);
void setReplayPlayAreaGeometry(const QByteArray &value);
void setReplayPlayAreaState(const QByteArray &value);
void setReplayCardInfoSize(const QSize &value);
void setReplayMessageLayoutSize(const QSize &value);
void setReplayPlayerListSize(const QSize &value);
void setReplayReplaySize(const QSize &value);
const QByteArray getDeckEditorLayoutState();
const QByteArray getDeckEditorGeometry();
QSize getDeckEditorCardSize();
QSize getDeckEditorDeckSize();
QSize getDeckEditorPrintingSelectorSize();
QSize getDeckEditorFilterSize();
const QByteArray getDeckEditorDbHeaderState();
const QByteArray getSetsDialogHeaderState();
const QByteArray getGamePlayAreaLayoutState();
const QByteArray getGamePlayAreaGeometry();
const QSize getGameCardInfoSize();
const QSize getGameMessageLayoutSize();
const QSize getGamePlayerListSize();
const QByteArray getReplayPlayAreaLayoutState();
const QByteArray getReplayPlayAreaGeometry();
const QSize getReplayCardInfoSize();
const QSize getReplayMessageLayoutSize();
const QSize getReplayPlayerListSize();
const QSize getReplayReplaySize();
signals:
public slots:
private:
explicit LayoutsSettings(const QString &settingPath, QObject *parent = nullptr);
LayoutsSettings(const LayoutsSettings & /*other*/);
};
#endif // LAYOUTSSETTINGS_H

View file

@ -0,0 +1,26 @@
#include "message_settings.h"
MessageSettings::MessageSettings(const QString &settingPath, QObject *parent)
: SettingsManager(settingPath + "messages.ini", parent)
{
}
QString MessageSettings::getMessageAt(int index)
{
return getValue(QString("msg%1").arg(index), "messages").toString();
}
int MessageSettings::getCount()
{
return getValue("count", "messages").toInt();
}
void MessageSettings::setCount(int count)
{
setValue(count, "count", "messages");
}
void MessageSettings::setMessageAt(int index, QString message)
{
setValue(message, QString("msg%1").arg(index), "messages");
}

View file

@ -0,0 +1,33 @@
/**
* @file message_settings.h
* @ingroup NetworkSettings
* @brief TODO: Document this.
*/
#ifndef MESSAGESETTINGS_H
#define MESSAGESETTINGS_H
#include "settings_manager.h"
class MessageSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
public:
int getCount();
QString getMessageAt(int index);
void setCount(int count);
void setMessageAt(int index, QString message);
signals:
void messageMacrosChanged();
public slots:
private:
explicit MessageSettings(const QString &settingPath, QObject *parent = nullptr);
MessageSettings(const MessageSettings & /*other*/);
};
#endif // MESSAGESETTINGS_H

View file

@ -0,0 +1,42 @@
#include "recents_settings.h"
#define MAX_RECENT_DECK_COUNT 10
RecentsSettings::RecentsSettings(const QString &settingPath, QObject *parent)
: SettingsManager(settingPath + "recents.ini", parent)
{
}
QStringList RecentsSettings::getRecentlyOpenedDeckPaths()
{
return getValue("deckpaths", "deckbuilder").toStringList();
}
void RecentsSettings::clearRecentlyOpenedDeckPaths()
{
deleteValue("deckpaths", "deckbuilder");
emit recentlyOpenedDeckPathsChanged();
}
void RecentsSettings::updateRecentlyOpenedDeckPaths(const QString &deckPath)
{
auto deckPaths = getValue("deckpaths", "deckbuilder").toStringList();
deckPaths.removeAll(deckPath);
deckPaths.prepend(deckPath);
while (deckPaths.size() > MAX_RECENT_DECK_COUNT) {
deckPaths.removeLast();
}
setValue(deckPaths, "deckpaths", "deckbuilder");
emit recentlyOpenedDeckPathsChanged();
}
QString RecentsSettings::getLatestDeckDirPath()
{
return getValue("latestDeckDir", "dirs").toString();
}
void RecentsSettings::setLatestDeckDirPath(const QString &dirPath)
{
setValue(dirPath, "latestDeckDir", "dirs");
}

View file

@ -0,0 +1,32 @@
/**
* @file recents_settings.h
* @ingroup DeckSettings
* @brief TODO: Document this.
*/
#ifndef RECENTS_SETTINGS_H
#define RECENTS_SETTINGS_H
#include "settings_manager.h"
class RecentsSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
explicit RecentsSettings(const QString &settingPath, QObject *parent = nullptr);
RecentsSettings(const RecentsSettings & /*other*/);
public:
QStringList getRecentlyOpenedDeckPaths();
void clearRecentlyOpenedDeckPaths();
void updateRecentlyOpenedDeckPaths(const QString &deckPath);
QString getLatestDeckDirPath();
void setLatestDeckDirPath(const QString &dirPath);
signals:
void recentlyOpenedDeckPathsChanged();
};
#endif // RECENTS_SETTINGS_H

View file

@ -0,0 +1,291 @@
#include "servers_settings.h"
#include <QDebug>
#include <utility>
ServersSettings::ServersSettings(const QString &settingPath, QObject *parent)
: SettingsManager(settingPath + "servers.ini", parent)
{
}
void ServersSettings::setPreviousHostLogin(int previous)
{
setValue(previous, "previoushostlogin", "server");
}
int ServersSettings::getPreviousHostLogin()
{
QVariant previous = getValue("previoushostlogin", "server");
return previous == QVariant() ? 1 : previous.toInt();
}
void ServersSettings::setPreviousHostList(QStringList list)
{
setValue(list, "previoushosts", "server");
}
QStringList ServersSettings::getPreviousHostList()
{
return getValue("previoushosts", "server").toStringList();
}
void ServersSettings::setPrevioushostName(const QString &name)
{
setValue(name, "previoushostName", "server");
}
QString ServersSettings::getSaveName(QString defaultname)
{
int index = getPrevioushostindex(getPrevioushostName());
QVariant saveName = getValue(QString("saveName%1").arg(index), "server", "server_details");
return saveName == QVariant() ? std::move(defaultname) : saveName.toString();
}
QString ServersSettings::getSite(QString defaultSite)
{
int index = getPrevioushostindex(getPrevioushostName());
QVariant site = getValue(QString("site%1").arg(index), "server", "server_details");
return site == QVariant() ? std::move(defaultSite) : site.toString();
}
QString ServersSettings::getPrevioushostName()
{
QVariant value = getValue("previoushostName", "server");
return value == QVariant() ? "Rooster Ranges" : value.toString();
}
int ServersSettings::getPrevioushostindex(const QString &saveName)
{
int size = getValue("totalServers", "server", "server_details").toInt();
for (int i = 0; i <= size; ++i)
if (saveName == getValue(QString("saveName%1").arg(i), "server", "server_details").toString())
return i;
return -1;
}
QString ServersSettings::getHostname(QString defaultHost)
{
int index = getPrevioushostindex(getPrevioushostName());
QVariant hostname = getValue(QString("server%1").arg(index), "server", "server_details");
return hostname == QVariant() ? std::move(defaultHost) : hostname.toString();
}
QString ServersSettings::getPort(QString defaultPort)
{
int index = getPrevioushostindex(getPrevioushostName());
QVariant port = getValue(QString("port%1").arg(index), "server", "server_details");
qCDebug(ServersSettingsLog) << "getPort() index = " << index << " port.val = " << port.toString();
return port == QVariant() ? std::move(defaultPort) : port.toString();
}
QString ServersSettings::getPlayerName(QString defaultName)
{
int index = getPrevioushostindex(getPrevioushostName());
QVariant name = getValue(QString("username%1").arg(index), "server", "server_details");
qCDebug(ServersSettingsLog) << "getPlayerName() index = " << index << " name.val = " << name.toString();
return name == QVariant() ? std::move(defaultName) : name.toString();
}
QString ServersSettings::getPassword()
{
int index = getPrevioushostindex(getPrevioushostName());
if (getSavePassword())
return getValue(QString("password%1").arg(index), "server", "server_details").toString();
return QString();
}
bool ServersSettings::getSavePassword()
{
int index = getPrevioushostindex(getPrevioushostName());
bool save = getValue(QString("savePassword%1").arg(index), "server", "server_details").toBool();
return save;
}
void ServersSettings::setAutoConnect(int autoconnect)
{
setValue(autoconnect, "auto_connect", "server");
}
int ServersSettings::getAutoConnect()
{
QVariant autoconnect = getValue("auto_connect", "server");
return autoconnect == QVariant() ? 0 : autoconnect.toInt();
}
void ServersSettings::setFPHostName(QString hostname)
{
setValue(hostname, "fphostname", "server");
}
QString ServersSettings::getFPHostname(QString defaultHost)
{
QVariant hostname = getValue("fphostname", "server");
return hostname == QVariant() ? std::move(defaultHost) : hostname.toString();
}
void ServersSettings::setFPPort(QString port)
{
setValue(port, "fpport", "server");
}
QString ServersSettings::getFPPort(QString defaultPort)
{
QVariant port = getValue("fpport", "server");
return port == QVariant() ? std::move(defaultPort) : port.toString();
}
void ServersSettings::setFPPlayerName(QString playerName)
{
setValue(playerName, "fpplayername", "server");
}
QString ServersSettings::getFPPlayerName(QString defaultName)
{
QVariant name = getValue("fpplayername", "server");
return name == QVariant() ? std::move(defaultName) : name.toString();
}
void ServersSettings::setClearDebugLogStatus(bool abIsChecked)
{
setValue(abIsChecked, "save_debug_log", "server");
}
bool ServersSettings::getClearDebugLogStatus(bool abDefaultValue)
{
QVariant cbFlushLog = getValue("save_debug_log", "server");
return cbFlushLog == QVariant() ? abDefaultValue : cbFlushLog.toBool();
}
void ServersSettings::addNewServer(const QString &saveName,
const QString &serv,
const QString &port,
const QString &username,
const QString &password,
bool savePassword,
const QString &site)
{
if (updateExistingServer(saveName, serv, port, username, password, savePassword, site))
return;
int index = getValue("totalServers", "server", "server_details").toInt() + 1;
setValue(saveName, QString("saveName%1").arg(index), "server", "server_details");
setValue(serv, QString("server%1").arg(index), "server", "server_details");
setValue(port, QString("port%1").arg(index), "server", "server_details");
setValue(username, QString("username%1").arg(index), "server", "server_details");
setValue(savePassword, QString("savePassword%1").arg(index), "server", "server_details");
setValue(index, "totalServers", "server", "server_details");
setValue(password, QString("password%1").arg(index), "server", "server_details");
setValue(site, QString("site%1").arg(index), "server", "server_details");
}
void ServersSettings::removeServer(QString servAddr)
{
int size = getValue("totalServers", "server", "server_details").toInt();
bool found = false;
for (int i = 0; i <= size; ++i) {
if (!found) {
// find entry and overwrite it
if (servAddr == getValue(QString("server%1").arg(i), "server", "server_details").toString()) {
found = true;
}
} else {
// move all other entries after it one back, overwriting the previous one
int previous = i - 1; // we delete only one entry
setValue(getValue(QString("server%1").arg(i), "server", "server_details"),
QString("server%1").arg(previous), "server", "server_details");
setValue(getValue(QString("port%1").arg(i), "server", "server_details"), QString("port%1").arg(previous),
"server", "server_details");
setValue(getValue(QString("username%1").arg(i), "server", "server_details"),
QString("username%1").arg(previous), "server", "server_details");
setValue(getValue(QString("savePassword%1").arg(i), "server", "server_details"),
QString("savePassword%1").arg(previous), "server", "server_details");
setValue(getValue(QString("password%1").arg(i), "server", "server_details"),
QString("password%1").arg(previous), "server", "server_details");
setValue(getValue(QString("saveName%1").arg(i), "server", "server_details"),
QString("saveName%1").arg(previous), "server", "server_details");
setValue(getValue(QString("site%1").arg(i), "server", "server_details"), QString("site%1").arg(previous),
"server", "server_details");
}
}
// if we have deleted an entry, adjust the total
if (found) {
setValue(size - 1, "totalServers", "server", "server_details");
// delete last value
deleteValue(QString("server%1").arg(size), "server", "server_details");
deleteValue(QString("port%1").arg(size), "server", "server_details");
deleteValue(QString("username%1").arg(size), "server", "server_details");
deleteValue(QString("savePassword%1").arg(size), "server", "server_details");
deleteValue(QString("password%1").arg(size), "server", "server_details");
deleteValue(QString("saveName%1").arg(size), "server", "server_details");
deleteValue(QString("site%1").arg(size), "server", "server_details");
}
}
/**
* Will only update fields with new values, ignores empty values
*/
bool ServersSettings::updateExistingServerWithoutLoss(QString saveName, QString serv, QString port, QString site)
{
int size = getValue("totalServers", "server", "server_details").toInt();
for (int i = 0; i <= size; ++i) {
if (serv == getValue(QString("server%1").arg(i), "server", "server_details").toString()) {
if (!port.isEmpty()) {
setValue(port, QString("port%1").arg(i), "server", "server_details");
}
if (!site.isEmpty()) {
setValue(site, QString("site%1").arg(i), "server", "server_details");
}
setValue(saveName, QString("saveName%1").arg(i), "server", "server_details");
return true;
}
}
return false;
}
bool ServersSettings::updateExistingServer(QString saveName,
QString serv,
QString port,
QString username,
QString password,
bool savePassword,
QString site)
{
int size = getValue("totalServers", "server", "server_details").toInt();
for (int i = 0; i <= size; ++i) {
if (serv == getValue(QString("server%1").arg(i), "server", "server_details").toString()) {
setValue(port, QString("port%1").arg(i), "server", "server_details");
if (!username.isEmpty()) {
setValue(username, QString("username%1").arg(i), "server", "server_details");
}
if (savePassword && !password.isEmpty()) {
setValue(password, QString("password%1").arg(i), "server", "server_details");
} else {
setValue(QString(), QString("password%1").arg(i), "server", "server_details");
}
if (!site.isEmpty()) {
setValue(site, QString("site%1").arg(i), "server", "server_details");
}
setValue(savePassword, QString("savePassword%1").arg(i), "server", "server_details");
setValue(saveName, QString("saveName%1").arg(i), "server", "server_details");
return true;
}
}
return false;
}

View file

@ -0,0 +1,77 @@
/**
* @file servers_settings.h
* @ingroup NetworkSettings
* @brief TODO: Document this.
*/
#ifndef SERVERSSETTINGS_H
#define SERVERSSETTINGS_H
#include "settings_manager.h"
#include <QLoggingCategory>
#include <QObject>
#define SERVERSETTINGS_DEFAULT_HOST "server.cockatrice.us"
#define SERVERSETTINGS_DEFAULT_PORT "4748"
inline Q_LOGGING_CATEGORY(ServersSettingsLog, "servers_settings");
class ServersSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
public:
int getPreviousHostLogin();
int getPrevioushostindex(const QString &);
QStringList getPreviousHostList();
QString getPrevioushostName();
QString getHostname(QString defaultHost = SERVERSETTINGS_DEFAULT_HOST);
QString getPort(QString defaultPort = SERVERSETTINGS_DEFAULT_PORT);
QString getPlayerName(QString defaultName = "");
QString getFPHostname(QString defaultHost = SERVERSETTINGS_DEFAULT_HOST);
QString getFPPort(QString defaultPort = SERVERSETTINGS_DEFAULT_PORT);
QString getFPPlayerName(QString defaultName = "");
QString getPassword();
QString getSaveName(QString defaultname = "");
QString getSite(QString defaultName = "");
bool getSavePassword();
int getAutoConnect();
void setPreviousHostLogin(int previous);
void setPrevioushostName(const QString &);
void setPreviousHostList(QStringList list);
void setAutoConnect(int autoconnect);
void setSite(QString site);
void setFPHostName(QString hostname);
void setFPPort(QString port);
void setFPPlayerName(QString playerName);
void addNewServer(const QString &saveName,
const QString &serv,
const QString &port,
const QString &username,
const QString &password,
bool savePassword,
const QString &site = QString());
void removeServer(QString servAddr);
bool updateExistingServer(QString saveName,
QString serv,
QString port,
QString username,
QString password,
bool savePassword,
QString site = QString());
bool updateExistingServerWithoutLoss(QString saveName,
QString serv = QString(),
QString port = QString(),
QString site = QString());
void setClearDebugLogStatus(bool abIsChecked);
bool getClearDebugLogStatus(bool abDefaultValue);
private:
explicit ServersSettings(const QString &settingPath, QObject *parent = nullptr);
ServersSettings(const ServersSettings & /*other*/);
};
#endif // SERVERSSETTINGS_H

View file

@ -0,0 +1,82 @@
#include "settings_manager.h"
SettingsManager::SettingsManager(const QString &settingPath, QObject *parent)
: QObject(parent), settings(settingPath, QSettings::IniFormat)
{
}
void SettingsManager::setValue(const QVariant &value,
const QString &name,
const QString &group,
const QString &subGroup)
{
if (!group.isEmpty()) {
settings.beginGroup(group);
}
if (!subGroup.isEmpty()) {
settings.beginGroup(subGroup);
}
settings.setValue(name, value);
if (!subGroup.isEmpty()) {
settings.endGroup();
}
if (!group.isEmpty()) {
settings.endGroup();
}
}
void SettingsManager::deleteValue(const QString &name, const QString &group, const QString &subGroup)
{
if (!group.isEmpty()) {
settings.beginGroup(group);
}
if (!subGroup.isEmpty()) {
settings.beginGroup(subGroup);
}
settings.remove(name);
if (!subGroup.isEmpty()) {
settings.endGroup();
}
if (!group.isEmpty()) {
settings.endGroup();
}
}
QVariant SettingsManager::getValue(const QString &name, const QString &group, const QString &subGroup)
{
if (!group.isEmpty()) {
settings.beginGroup(group);
}
if (!subGroup.isEmpty()) {
settings.beginGroup(subGroup);
}
QVariant value = settings.value(name);
if (!subGroup.isEmpty()) {
settings.endGroup();
}
if (!group.isEmpty()) {
settings.endGroup();
}
return value;
}
/**
* Calls sync on the underlying QSettings object
*/
void SettingsManager::sync()
{
settings.sync();
}

View file

@ -0,0 +1,29 @@
/**
* @file settings_manager.h
* @ingroup Settings
* @brief TODO: Document this.
*/
#ifndef SETTINGSMANAGER_H
#define SETTINGSMANAGER_H
#include <QObject>
#include <QSettings>
#include <QStringList>
#include <QVariant>
class SettingsManager : public QObject
{
Q_OBJECT
public:
explicit SettingsManager(const QString &settingPath, QObject *parent = nullptr);
QVariant getValue(const QString &name, const QString &group = "", const QString &subGroup = "");
void sync();
protected:
QSettings settings;
void setValue(const QVariant &value, const QString &name, const QString &group = "", const QString &subGroup = "");
void deleteValue(const QString &name, const QString &group = "", const QString &subGroup = "");
};
#endif // SETTINGSMANAGER_H

View file

@ -0,0 +1,167 @@
#include "shortcut_treeview.h"
#include "cache_settings.h"
#include "shortcuts_settings.h"
#include <QHeaderView>
ShortcutFilterProxyModel::ShortcutFilterProxyModel(QObject *parent) : QSortFilterProxyModel(parent)
{
}
/**
* Appends the parent and source row together before doing the regex match.
*/
bool ShortcutFilterProxyModel::filterAcceptsRow(const int sourceRow, const QModelIndex &sourceParent) const
{
QModelIndex nameIndex = sourceModel()->index(sourceRow, filterKeyColumn(), sourceParent);
QModelIndex parentIndex = sourceModel()->index(sourceParent.row(), filterKeyColumn(), sourceParent.parent());
QString name = sourceModel()->data(nameIndex).toString();
QString parentName = sourceModel()->data(parentIndex).toString();
QString searchedString = parentName + " " + name;
return searchedString.contains(filterRegularExpression());
}
ShortcutTreeView::ShortcutTreeView(QWidget *parent) : QTreeView(parent)
{
// model
shortcutsModel = new QStandardItemModel(this);
shortcutsModel->setColumnCount(3);
populateShortcutsModel();
// filter proxy
proxyModel = new ShortcutFilterProxyModel(this);
proxyModel->setRecursiveFilteringEnabled(true);
proxyModel->setSourceModel(shortcutsModel);
proxyModel->setDynamicSortFilter(true);
proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
proxyModel->setFilterKeyColumn(0);
QTreeView::setModel(proxyModel);
// treeview
hideColumn(2);
setUniformRowHeights(true);
setAlternatingRowColors(true);
setSortingEnabled(true);
proxyModel->sort(0, Qt::AscendingOrder);
header()->setSectionResizeMode(QHeaderView::Interactive);
header()->setSortIndicator(0, Qt::AscendingOrder);
setSelectionMode(SingleSelection);
setSelectionBehavior(SelectRows);
expandAll();
connect(&SettingsCache::instance().shortcuts(), &ShortcutsSettings::shortCutChanged, this,
&ShortcutTreeView::refreshShortcuts);
}
void ShortcutTreeView::populateShortcutsModel()
{
QHash<QString, QStandardItem *> parentItems;
QStandardItem *curParent = nullptr;
for (const auto &key : SettingsCache::instance().shortcuts().getAllShortcutKeys()) {
QString name = SettingsCache::instance().shortcuts().getShortcut(key).getName();
QString group = SettingsCache::instance().shortcuts().getShortcut(key).getGroupName();
QString shortcut = SettingsCache::instance().shortcuts().getShortcutString(key);
if (parentItems.contains(group)) {
curParent = parentItems.value(group);
} else {
curParent = new QStandardItem(group);
static QFont font = curParent->font();
font.setBold(true);
curParent->setFont(font);
parentItems.insert(group, curParent);
}
QList<QStandardItem *> list = {};
list << new QStandardItem(name) << new QStandardItem(shortcut) << new QStandardItem(key);
curParent->appendRow(list);
}
for (const auto &parent : parentItems) {
shortcutsModel->appendRow(parent);
}
}
void ShortcutTreeView::retranslateUi()
{
shortcutsModel->setHeaderData(0, Qt::Horizontal, tr("Action"));
shortcutsModel->setHeaderData(1, Qt::Horizontal, tr("Shortcut"));
refreshShortcuts();
}
/**
* Loops over the model and reloads all rows
*/
static void loopOverModel(QAbstractItemModel *model, const QModelIndex &parent = QModelIndex())
{
for (int r = 0; r < model->rowCount(parent); ++r) {
const auto friendlyNameIndex = model->index(r, 0, parent);
if (model->hasChildren(friendlyNameIndex)) {
const auto childIndex = model->index(0, 2, friendlyNameIndex);
const auto key = model->data(childIndex).toString();
const auto shortcutGroupName = SettingsCache::instance().shortcuts().getShortcut(key).getGroupName();
model->setData(friendlyNameIndex, shortcutGroupName);
loopOverModel(model, friendlyNameIndex);
} else {
const auto shortcutSequenceIndex = model->index(r, 1, parent);
const auto keyIndex = model->index(r, 2, parent);
const auto key = model->data(keyIndex).toString();
const auto shortcutKey = SettingsCache::instance().shortcuts().getShortcut(key).getName();
const auto shortcutSequence = SettingsCache::instance().shortcuts().getShortcutString(key);
model->setData(friendlyNameIndex, shortcutKey);
model->setData(shortcutSequenceIndex, shortcutSequence);
}
}
}
void ShortcutTreeView::refreshShortcuts()
{
loopOverModel(shortcutsModel);
}
void ShortcutTreeView::currentChanged(const QModelIndex &current, const QModelIndex & /* previous */)
{
QTreeView::scrollTo(current, QAbstractItemView::EnsureVisible);
if (current.parent().isValid()) {
auto shortcutName = model()->data(model()->index(current.row(), 2, current.parent())).toString();
emit currentItemChanged(shortcutName);
} else {
// emit empty string if the selection is a category header
emit currentItemChanged("");
}
}
/**
* The search string is split by word.
* A String is a match as long as it contains all the words in the search string in order
*/
void ShortcutTreeView::updateSearchString(const QString &searchString)
{
#if QT_VERSION > QT_VERSION_CHECK(5, 14, 0)
const auto skipEmptyParts = Qt::SkipEmptyParts;
#else
const auto skipEmptyParts = QString::SkipEmptyParts;
#endif
QStringList searchWords = searchString.split(" ", skipEmptyParts);
auto escapeRegex = [](const QString &s) { return QRegularExpression::escape(s); };
std::transform(searchWords.begin(), searchWords.end(), searchWords.begin(), escapeRegex);
auto regex = QRegularExpression(searchWords.join(".*"), QRegularExpression::CaseInsensitiveOption);
proxyModel->setFilterRegularExpression(regex);
expandAll();
}

View file

@ -0,0 +1,53 @@
/**
* @file shortcut_treeview.h
* @ingroup CoreSettings
* @brief TODO: Document this.
*/
#ifndef SHORTCUT_TREEVIEW_H
#define SHORTCUT_TREEVIEW_H
#include <QModelIndex>
#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <QTreeView>
/**
* Custom implementation of QSortFilterProxyModel that appends the source and parent strings together when filtering
*/
class ShortcutFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
explicit ShortcutFilterProxyModel(QObject *parent = nullptr);
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
};
class ShortcutTreeView : public QTreeView
{
Q_OBJECT
public:
explicit ShortcutTreeView(QWidget *parent);
void retranslateUi();
signals:
void currentItemChanged(const QString &shortcut);
public slots:
void updateSearchString(const QString &searchString);
private:
QStandardItemModel *shortcutsModel;
ShortcutFilterProxyModel *proxyModel;
void populateShortcutsModel();
private slots:
void refreshShortcuts();
protected:
void currentChanged(const QModelIndex &current, const QModelIndex &previous) override;
};
#endif // SHORTCUT_TREEVIEW_H

View file

@ -0,0 +1,263 @@
#include "shortcuts_settings.h"
#include <QDebug>
#include <QFile>
#include <QMessageBox>
#include <QStringList>
#include <utility>
ShortcutKey::ShortcutKey(const QString &_name, QList<QKeySequence> _sequence, ShortcutGroup::Groups _group)
: QList<QKeySequence>(_sequence), name(_name), group(_group)
{
}
ShortcutsSettings::ShortcutsSettings(const QString &settingsPath, QObject *parent) : QObject(parent)
{
shortCuts = defaultShortCuts;
settingsFilePath = settingsPath;
settingsFilePath.append("shortcuts.ini");
bool exists = QFile(settingsFilePath).exists();
QSettings shortCutsFile(settingsFilePath, QSettings::IniFormat);
if (exists) {
shortCutsFile.beginGroup(custom);
const QStringList customKeys = shortCutsFile.allKeys();
QMap<QString, QString> invalidItems;
for (QStringList::const_iterator it = customKeys.constBegin(); it != customKeys.constEnd(); ++it) {
QString stringSequence = shortCutsFile.value(*it).toString();
// check whether shortcut name exists
if (!shortCuts.contains(*it)) {
qCWarning(ShortcutsSettingsLog) << "Unknown shortcut name:" << *it;
continue;
}
// check whether shortcut is forbidden
if (isKeyAllowed(*it, stringSequence)) {
auto shortcut = getShortcut(*it);
shortcut.setSequence(parseSequenceString(stringSequence));
shortCuts.insert(*it, shortcut);
} else {
invalidItems.insert(*it, stringSequence);
}
}
shortCutsFile.endGroup();
if (!invalidItems.isEmpty()) {
// warning message in case of invalid items
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText(tr("Your configuration file contained invalid shortcuts.\n"
"Please check your shortcut settings!"));
QString detailedMessage = tr("The following shortcuts have been set to default:\n");
for (QMap<QString, QString>::const_iterator item = invalidItems.constBegin();
item != invalidItems.constEnd(); ++item) {
detailedMessage += item.key() + " - \"" + item.value() + "\"\n";
}
msgBox.setDetailedText(detailedMessage);
msgBox.exec();
}
}
}
/// PR 5079 changes Textbox/unfocusTextBox to Player/unfocusTextBox and tab_game/aFocusChat to Player/aFocusChat.
/// A migration is necessary to let players keep their already configured shortcuts.
void ShortcutsSettings::migrateShortcuts()
{
if (QFile(settingsFilePath).exists()) {
QSettings shortCutsFile(settingsFilePath, QSettings::IniFormat);
shortCutsFile.beginGroup(custom);
if (shortCutsFile.contains("Textbox/unfocusTextBox")) {
qCInfo(ShortcutsSettingsLog)
<< "[ShortcutsSettings] Textbox/unfocusTextBox shortcut found. Migrating to Player/unfocusTextBox.";
QString unfocusTextBox = shortCutsFile.value("Textbox/unfocusTextBox", "").toString();
this->setShortcuts("Player/unfocusTextBox", unfocusTextBox);
shortCutsFile.remove("Textbox/unfocusTextBox");
}
if (shortCutsFile.contains("tab_game/aFocusChat")) {
qCInfo(ShortcutsSettingsLog)
<< "[ShortcutsSettings] tab_game/aFocusChat shortcut found. Migrating to Player/aFocusChat.";
QString aFocusChat = shortCutsFile.value("tab_game/aFocusChat", "").toString();
this->setShortcuts("Player/aFocusChat", aFocusChat);
shortCutsFile.remove("tab_game/aFocusChat");
}
// PR #5564 changes "MainWindow/aDeckEditor" to "Tabs/aTabDeckEditor"
if (shortCutsFile.contains("MainWindow/aDeckEditor")) {
qCInfo(ShortcutsSettingsLog) << "MainWindow/aDeckEditor shortcut found. Migrating to Tabs/aTabDeckEditor.";
QString keySequence = shortCutsFile.value("MainWindow/aDeckEditor", "").toString();
this->setShortcuts("Tabs/aTabDeckEditor", keySequence);
shortCutsFile.remove("MainWindow/aDeckEditor");
}
shortCutsFile.endGroup();
}
}
ShortcutKey ShortcutsSettings::getDefaultShortcut(const QString &name) const
{
return defaultShortCuts.value(name, ShortcutKey());
}
ShortcutKey ShortcutsSettings::getShortcut(const QString &name) const
{
if (shortCuts.contains(name)) {
return shortCuts.value(name);
}
return getDefaultShortcut(name);
}
/**
* Gets the first shortcut for the given action.
*
* NOTE: In most cases you should be using ShortcutsSettings::getShortcut instead,
* as that will return all shortcuts if there are multiple shortcuts.
* The only reason to use this method is if an object does not accept multiple shortcuts, such as with QButtons.
*/
QKeySequence ShortcutsSettings::getSingleShortcut(const QString &name) const
{
return getShortcut(name).at(0);
}
QString ShortcutsSettings::getDefaultShortcutString(const QString &name) const
{
return stringifySequence(getDefaultShortcut(name));
}
QString ShortcutsSettings::getShortcutString(const QString &name) const
{
return stringifySequence(getShortcut(name));
}
QString ShortcutsSettings::getShortcutFriendlyName(const QString &shortcutName) const
{
for (auto it = defaultShortCuts.cbegin(); it != defaultShortCuts.cend(); ++it) {
if (shortcutName == it.key()) {
return it.value().getName();
}
}
return {};
}
QString ShortcutsSettings::stringifySequence(const QList<QKeySequence> &Sequence) const
{
QStringList stringSequence;
for (const auto &i : Sequence) {
stringSequence.append(i.toString(QKeySequence::PortableText));
}
return stringSequence.join(sep);
}
QList<QKeySequence> ShortcutsSettings::parseSequenceString(const QString &stringSequence) const
{
QList<QKeySequence> SequenceList;
for (const QString &shortcut : stringSequence.split(sep)) {
SequenceList.append(QKeySequence(shortcut, QKeySequence::PortableText));
}
return SequenceList;
}
void ShortcutsSettings::setShortcuts(const QString &name, const QList<QKeySequence> &Sequence)
{
shortCuts[name].setSequence(Sequence);
QSettings shortCutsFile(settingsFilePath, QSettings::IniFormat);
shortCutsFile.beginGroup(custom);
shortCutsFile.setValue(name, stringifySequence(Sequence));
shortCutsFile.endGroup();
emit shortCutChanged();
}
void ShortcutsSettings::setShortcuts(const QString &name, const QKeySequence &Sequence)
{
setShortcuts(name, QList<QKeySequence>{Sequence});
}
void ShortcutsSettings::setShortcuts(const QString &name, const QString &sequences)
{
setShortcuts(name, parseSequenceString(sequences));
}
void ShortcutsSettings::resetAllShortcuts()
{
shortCuts = defaultShortCuts;
QSettings shortCutsFile(settingsFilePath, QSettings::IniFormat);
shortCutsFile.beginGroup(custom);
shortCutsFile.remove("");
shortCutsFile.endGroup();
emit shortCutChanged();
}
void ShortcutsSettings::clearAllShortcuts()
{
QSettings shortCutsFile(settingsFilePath, QSettings::IniFormat);
shortCutsFile.beginGroup(custom);
for (auto it = shortCuts.begin(); it != shortCuts.end(); ++it) {
it.value().setSequence(parseSequenceString(""));
shortCutsFile.setValue(it.key(), "");
}
shortCutsFile.endGroup();
emit shortCutChanged();
}
bool ShortcutsSettings::isKeyAllowed(const QString &name, const QString &sequences) const
{
// if the shortcut is not to be used in deck-editor then it doesn't matter
if (name.startsWith("Player") || name.startsWith("Replays")) {
return true;
}
QString checkSequence = sequences.split(sep).last();
QStringList forbiddenKeys{"Del", "Backspace", "Down", "Up", "Left", "Right",
"Return", "Enter", "Menu", "Ctrl+Alt+-", "Ctrl+Alt+=", "Ctrl+Alt+[",
"Ctrl+Alt+]", "Tab", "Space", "Shift+S", "Shift+Left", "Shift+Right"};
return !forbiddenKeys.contains(checkSequence);
}
/**
* Checks that the shortcut doesn't overlap with an existing shortcut
*
* @param name The name of the shortcut
* @param sequences The shortcut key sequence
* @return Whether the shortcut is valid.
*/
bool ShortcutsSettings::isValid(const QString &name, const QString &sequences) const
{
return findOverlaps(name, sequences).isEmpty();
}
/**
* Checks if the shortcut is a shortcut that is active in all windows
*/
static bool isAlwaysActiveShortcut(const QString &shortcutName)
{
return shortcutName.startsWith("MainWindow") || shortcutName.startsWith("Tabs");
}
QStringList ShortcutsSettings::findOverlaps(const QString &name, const QString &sequences) const
{
QString checkSequence = sequences.split(sep).last();
QString checkKey = name.left(name.indexOf("/"));
QStringList overlaps;
for (const auto &key : shortCuts.keys()) {
if (key.startsWith(checkKey) || isAlwaysActiveShortcut(key) || isAlwaysActiveShortcut(checkKey)) {
QString storedSequence = stringifySequence(shortCuts.value(key));
if (storedSequence.split(sep).contains(checkSequence)) {
overlaps.append(getShortcutFriendlyName(key));
}
}
}
return overlaps;
}

View file

@ -0,0 +1,737 @@
/**
* @file shortcuts_settings.h
* @ingroup CoreSettings
* @brief TODO: Document this.
*/
#ifndef SHORTCUTSSETTINGS_H
#define SHORTCUTSSETTINGS_H
#include <QApplication>
#include <QKeySequence>
#include <QLoggingCategory>
#include <QSettings>
inline Q_LOGGING_CATEGORY(ShortcutsSettingsLog, "shortcuts_settings");
class ShortcutGroup
{
public:
enum Groups
{
Main_Window,
Deck_Editor,
Game_Lobby,
Card_Counters,
Player_Counters,
Power_Toughness,
Game_Phases,
Playing_Area,
Move_selected,
View,
Move_top,
Move_bottom,
Gameplay,
Drawing,
Chat_room,
Game_window,
Load_deck,
Replays,
Tabs
};
static QString getGroupName(ShortcutGroup::Groups group)
{
switch (group) {
case Main_Window:
return QApplication::translate("shortcutsTab", "Main Window");
case Deck_Editor:
return QApplication::translate("shortcutsTab", "Deck Editor");
case Game_Lobby:
return QApplication::translate("shortcutsTab", "Game Lobby");
case Card_Counters:
return QApplication::translate("shortcutsTab", "Card Counters");
case Player_Counters:
return QApplication::translate("shortcutsTab", "Player Counters");
case Power_Toughness:
return QApplication::translate("shortcutsTab", "Power and Toughness");
case Game_Phases:
return QApplication::translate("shortcutsTab", "Game Phases");
case Playing_Area:
return QApplication::translate("shortcutsTab", "Playing Area");
case Move_selected:
return QApplication::translate("shortcutsTab", "Move Selected Card");
case View:
return QApplication::translate("shortcutsTab", "View");
case Move_top:
return QApplication::translate("shortcutsTab", "Move Top Card");
case Move_bottom:
return QApplication::translate("shortcutsTab", "Move Bottom Card");
case Gameplay:
return QApplication::translate("shortcutsTab", "Gameplay");
case Drawing:
return QApplication::translate("shortcutsTab", "Drawing");
case Chat_room:
return QApplication::translate("shortcutsTab", "Chat Room");
case Game_window:
return QApplication::translate("shortcutsTab", "Game Window");
case Load_deck:
return QApplication::translate("shortcutsTab", "Load Deck from Clipboard");
case Replays:
return QApplication::translate("shortcutsTab", "Replays");
case Tabs:
return QApplication::translate("shortcutsTab", "Tabs");
}
return {};
}
};
class ShortcutKey : public QList<QKeySequence>
{
public:
explicit ShortcutKey(const QString &_name = QString(),
QList _sequence = QList(),
ShortcutGroup::Groups _group = ShortcutGroup::Main_Window);
void setSequence(const QList &_sequence)
{
QList::operator=(_sequence);
};
QString getName() const
{
return QApplication::translate("shortcutsTab", name.toUtf8().data());
};
QString getGroupName() const
{
return ShortcutGroup::getGroupName(group);
};
private:
QString name;
ShortcutGroup::Groups group;
};
class ShortcutsSettings : public QObject
{
Q_OBJECT
public:
explicit ShortcutsSettings(const QString &settingsFilePath, QObject *parent = nullptr);
ShortcutKey getDefaultShortcut(const QString &name) const;
ShortcutKey getShortcut(const QString &name) const;
QKeySequence getSingleShortcut(const QString &name) const;
QString getDefaultShortcutString(const QString &name) const;
QString getShortcutString(const QString &name) const;
QString getShortcutFriendlyName(const QString &shortcutName) const;
QList<QString> getAllShortcutKeys() const
{
return shortCuts.keys();
};
void setShortcuts(const QString &name, const QList<QKeySequence> &Sequence);
void setShortcuts(const QString &name, const QKeySequence &Sequence);
void setShortcuts(const QString &name, const QString &sequences);
bool isKeyAllowed(const QString &name, const QString &sequences) const;
bool isValid(const QString &name, const QString &sequences) const;
QStringList findOverlaps(const QString &name, const QString &sequences) const;
void resetAllShortcuts();
void clearAllShortcuts();
void migrateShortcuts();
signals:
void shortCutChanged();
private:
const QChar sep = ';';
const QString custom = "Custom"; // name of custom group in shortCutsFile
QString settingsFilePath;
QHash<QString, ShortcutKey> shortCuts;
QString stringifySequence(const QList<QKeySequence> &Sequence) const;
QList<QKeySequence> parseSequenceString(const QString &stringSequence) const;
const QHash<QString, ShortcutKey> defaultShortCuts = {
{"MainWindow/aCheckCardUpdates", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Check for Card Updates..."),
parseSequenceString(""),
ShortcutGroup::Main_Window)},
{"MainWindow/aConnect", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Connect..."),
parseSequenceString("Ctrl+L"),
ShortcutGroup::Main_Window)},
{"MainWindow/aDisconnect", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Disconnect"),
parseSequenceString(""),
ShortcutGroup::Main_Window)},
{"MainWindow/aExit",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exit"), parseSequenceString(""), ShortcutGroup::Main_Window)},
{"MainWindow/aFullScreen", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Full screen"),
parseSequenceString("Ctrl+F"),
ShortcutGroup::Main_Window)},
{"MainWindow/aRegister", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Register..."),
parseSequenceString(""),
ShortcutGroup::Main_Window)},
{"MainWindow/aSettings", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Settings..."),
parseSequenceString("Ctrl+Shift+P"),
ShortcutGroup::Main_Window)},
{"MainWindow/aSinglePlayer", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Start a Local Game..."),
parseSequenceString("Ctrl+Shift+L"),
ShortcutGroup::Main_Window)},
{"MainWindow/aWatchReplay", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Watch Replay..."),
parseSequenceString(""),
ShortcutGroup::Main_Window)},
{"MainWindow/aStatusBar", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Show Status Bar"),
parseSequenceString(""),
ShortcutGroup::Main_Window)},
{"TabDeckEditor/aAnalyzeDeck", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Analyze Deck (deckstats.net)"),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aAnalyzeDeckTappedout",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Analyze Deck (tappedout.net)"),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aClearFilterAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Clear All Filters"),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aClearFilterOne", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Clear Selected Filter"),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aClose",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Close"), parseSequenceString(""), ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aDecrement", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Card"),
parseSequenceString("-"),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aManageSets", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Manage Sets..."),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aEditTokens", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Edit Custom Tokens..."),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aExportDeckDecklist",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Export Deck (decklist.org)"),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aExportDeckDecklistXyz",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Export Deck (decklist.xyz)"),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aIncrement", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Card"),
parseSequenceString("+"),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aLoadDeck", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load Deck..."),
parseSequenceString("Ctrl+O"),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aLoadDeckFromClipboard",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load Deck from Clipboard..."),
parseSequenceString("Ctrl+Shift+V"),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aEditDeckInClipboard",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Edit Deck in Clipboard, Annotated"),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aEditDeckInClipboardRaw",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Edit Deck in Clipboard"),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aNewDeck", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "New Deck"),
parseSequenceString("Ctrl+N"),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aOpenCustomFolder",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Open Custom Pictures Folder"),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aPrintDeck", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Print Deck..."),
parseSequenceString("Ctrl+P"),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aRemoveCard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Delete Card"),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aResetLayout", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Reset Layout"),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aSaveDeck", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Save Deck"),
parseSequenceString("Ctrl+S"),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aSaveDeckAs", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Save Deck as..."),
parseSequenceString("Ctrl+Shift+S"),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aSaveDeckToClipboard",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Save Deck to Clipboard, Annotated"),
parseSequenceString("Ctrl+Shift+C"),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aSaveDeckToClipboardNoSetInfo",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Save Deck to Clipboard, Annotated (No Set Info)"),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aSaveDeckToClipboardRaw",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Save Deck to Clipboard"),
parseSequenceString("Ctrl+Shift+R"),
ShortcutGroup::Deck_Editor)},
{"TabDeckEditor/aSaveDeckToClipboardRawNoSetInfo",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Save Deck to Clipboard (No Set Info)"),
parseSequenceString(""),
ShortcutGroup::Deck_Editor)},
{"DeckViewContainer/loadLocalButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load Local Deck..."),
parseSequenceString("Ctrl+O"),
ShortcutGroup::Game_Lobby)},
{"DeckViewContainer/loadRemoteButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load Remote Deck..."),
parseSequenceString("Ctrl+Alt+O"),
ShortcutGroup::Game_Lobby)},
{"DeckViewContainer/loadFromClipboardButton",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Load Deck from Clipboard..."),
parseSequenceString("Ctrl+Shift+V"),
ShortcutGroup::Game_Lobby)},
{"DeckViewContainer/unloadDeckButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Unload Deck"),
parseSequenceString("Ctrl+Alt+U"),
ShortcutGroup::Game_Lobby)},
{"DeckViewContainer/readyStartButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Ready to Start"),
parseSequenceString("Ctrl+Shift+S"),
ShortcutGroup::Game_Lobby)},
{"DeckViewContainer/sideboardLockButton",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Sideboard Lock"),
parseSequenceString("Ctrl+Shift+B"),
ShortcutGroup::Game_Lobby)},
{"DeckViewContainer/forceStartGameButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Force Start"),
parseSequenceString(""),
ShortcutGroup::Game_Lobby)},
{"Player/aCCMagenta", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Card Counter (F)"),
parseSequenceString(""),
ShortcutGroup::Card_Counters)},
{"Player/aRCMagenta", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Card Counter (F)"),
parseSequenceString(""),
ShortcutGroup::Card_Counters)},
{"Player/aSCMagenta", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Card Counters (F)..."),
parseSequenceString(""),
ShortcutGroup::Card_Counters)},
{"Player/aCCPurple", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Card Counter (E)"),
parseSequenceString(""),
ShortcutGroup::Card_Counters)},
{"Player/aRCPurple", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Card Counter (E)"),
parseSequenceString(""),
ShortcutGroup::Card_Counters)},
{"Player/aSCPurple", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Card Counters (E)..."),
parseSequenceString(""),
ShortcutGroup::Card_Counters)},
{"Player/aCCCyan", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Card Counter(D)"),
parseSequenceString(""),
ShortcutGroup::Card_Counters)},
{"Player/aRCCyan", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Card Counter (D)"),
parseSequenceString(""),
ShortcutGroup::Card_Counters)},
{"Player/aSCCyan", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Card Counters (D)..."),
parseSequenceString(""),
ShortcutGroup::Card_Counters)},
{"Player/aCCGreen", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Card Counter (C)"),
parseSequenceString("Ctrl+>"),
ShortcutGroup::Card_Counters)},
{"Player/aRCGreen", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Card Counter (C)"),
parseSequenceString("Ctrl+<"),
ShortcutGroup::Card_Counters)},
{"Player/aSCGreen", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Card Counters (C)..."),
parseSequenceString("Ctrl+?"),
ShortcutGroup::Card_Counters)},
{"Player/aCCYellow", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Card Counter (B)"),
parseSequenceString("Ctrl+."),
ShortcutGroup::Card_Counters)},
{"Player/aRCYellow", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Card Counter (B)"),
parseSequenceString("Ctrl+,"),
ShortcutGroup::Card_Counters)},
{"Player/aSCYellow", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Card Counters (B)..."),
parseSequenceString("Ctrl+/"),
ShortcutGroup::Card_Counters)},
{"Player/aCCRed", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Card Counter (A)"),
parseSequenceString("Alt+."),
ShortcutGroup::Card_Counters)},
{"Player/aRCRed", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Card Counter (A)"),
parseSequenceString("Alt+,"),
ShortcutGroup::Card_Counters)},
{"Player/aSCRed", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Card Counters (A)..."),
parseSequenceString("Alt+/"),
ShortcutGroup::Card_Counters)},
{"Player/aInc", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Life Counter"),
parseSequenceString("F12"),
ShortcutGroup::Player_Counters)},
{"Player/aDec", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Life Counter"),
parseSequenceString("F11"),
ShortcutGroup::Player_Counters)},
{"Player/aSet", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Life Counters..."),
parseSequenceString("Ctrl+L"),
ShortcutGroup::Player_Counters)},
{"Player/aIncCounter_w", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add White Counter"),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aDecCounter_w", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove White Counter"),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aSetCounter_w", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set White Counters..."),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aIncCounter_u", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Blue Counter"),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aDecCounter_u", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Blue Counter"),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aSetCounter_u", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Blue Counters..."),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aIncCounter_b", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Black Counter"),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aDecCounter_b", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Black Counter"),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aSetCounter_b", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Black Counters..."),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aIncCounter_r", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Red Counter"),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aDecCounter_r", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Red Counter"),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aSetCounter_r", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Red Counters..."),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aIncCounter_g", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Green Counter"),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aDecCounter_g", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Green Counter"),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aSetCounter_g", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Green Counters..."),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aIncCounter_x", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Colorless Counter"),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aDecCounter_x", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Colorless Counter"),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aSetCounter_x", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Colorless Counters..."),
parseSequenceString(""),
ShortcutGroup::Player_Counters)},
{"Player/aIncCounter_storm", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Other Counter"),
parseSequenceString("Ctrl+]"),
ShortcutGroup::Player_Counters)},
{"Player/aDecCounter_storm", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Other Counter"),
parseSequenceString("Ctrl+["),
ShortcutGroup::Player_Counters)},
{"Player/aSetCounter_storm", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Other Counters..."),
parseSequenceString("Ctrl+\\"),
ShortcutGroup::Player_Counters)},
{"Player/aIncrementAllCardCounters",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Increment all card counters"),
parseSequenceString("Ctrl+Shift+A"),
ShortcutGroup::Playing_Area)},
{"Player/aIncP", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Power (+1/+0)"),
parseSequenceString("Ctrl++;Ctrl+="),
ShortcutGroup::Power_Toughness)},
{"Player/aDecP", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Power (-1/-0)"),
parseSequenceString("Ctrl+-"),
ShortcutGroup::Power_Toughness)},
{"Player/aFlowP", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Move Toughness to Power (+1/-1)"),
parseSequenceString(""),
ShortcutGroup::Power_Toughness)},
{"Player/aIncT", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Toughness (+0/+1)"),
parseSequenceString("Alt++;Alt+="),
ShortcutGroup::Power_Toughness)},
{"Player/aDecT", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Toughness (-0/-1)"),
parseSequenceString("Alt+-"),
ShortcutGroup::Power_Toughness)},
{"Player/aFlowT", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Move Power to Toughness (-1/+1)"),
parseSequenceString(""),
ShortcutGroup::Power_Toughness)},
{"Player/aIncPT", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Power and Toughness (+1/+1)"),
parseSequenceString("Ctrl+Alt++;Ctrl+Alt+="),
ShortcutGroup::Power_Toughness)},
{"Player/aDecPT", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Power and Toughness (-1/-1)"),
parseSequenceString("Ctrl+Alt+-"),
ShortcutGroup::Power_Toughness)},
{"Player/aSetPT", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Power and Toughness..."),
parseSequenceString("Ctrl+P"),
ShortcutGroup::Power_Toughness)},
{"Player/aResetPT", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Reset Power and Toughness"),
parseSequenceString("Ctrl+Alt+0"),
ShortcutGroup::Power_Toughness)},
{"Player/phase0", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Untap"),
parseSequenceString("F5"),
ShortcutGroup::Game_Phases)},
{"Player/phase1",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Upkeep"), parseSequenceString(""), ShortcutGroup::Game_Phases)},
{"Player/phase2",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Draw"), parseSequenceString("F6"), ShortcutGroup::Game_Phases)},
{"Player/phase3", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "First Main Phase"),
parseSequenceString("F7"),
ShortcutGroup::Game_Phases)},
{"Player/phase4", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Start Combat"),
parseSequenceString("F8"),
ShortcutGroup::Game_Phases)},
{"Player/phase5",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Attack"), parseSequenceString(""), ShortcutGroup::Game_Phases)},
{"Player/phase6",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Block"), parseSequenceString(""), ShortcutGroup::Game_Phases)},
{"Player/phase7",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Damage"), parseSequenceString(""), ShortcutGroup::Game_Phases)},
{"Player/phase8", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "End Combat"),
parseSequenceString(""),
ShortcutGroup::Game_Phases)},
{"Player/phase9", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Second Main Phase"),
parseSequenceString("F9"),
ShortcutGroup::Game_Phases)},
{"Player/phase10",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "End"), parseSequenceString("F10"), ShortcutGroup::Game_Phases)},
{"Player/aNextPhase", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Next Phase"),
parseSequenceString("Ctrl+Space;Tab"),
ShortcutGroup::Game_Phases)},
{"Player/aNextPhaseAction", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Next Phase Action"),
parseSequenceString("Shift+Tab"),
ShortcutGroup::Game_Phases)},
{"Player/aNextTurn", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Next Turn"),
parseSequenceString("Ctrl+Return;Ctrl+Enter"),
ShortcutGroup::Game_Phases)},
{"Player/aHide", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Hide Card in Reveal Window"),
parseSequenceString("Alt+H"),
ShortcutGroup::Playing_Area)},
{"Player/aTap", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Tap / Untap Card"),
parseSequenceString(""),
ShortcutGroup::Playing_Area)},
{"Player/aUntapAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Untap All"),
parseSequenceString("Ctrl+U"),
ShortcutGroup::Playing_Area)},
{"Player/aDoesntUntap", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Untap"),
parseSequenceString("Alt+U"),
ShortcutGroup::Playing_Area)},
{"Player/aFlip", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Turn Card Over"),
parseSequenceString("Alt+F"),
ShortcutGroup::Playing_Area)},
{"Player/aPeek", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Peek Card"),
parseSequenceString("Alt+L"),
ShortcutGroup::Playing_Area)},
{"Player/aPlay", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Play Card"),
parseSequenceString(""),
ShortcutGroup::Playing_Area)},
{"Player/aAttach", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Attach Card..."),
parseSequenceString("Ctrl+Alt+A"),
ShortcutGroup::Playing_Area)},
{"Player/aUnattach", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Unattach Card"),
parseSequenceString("Ctrl+Alt+U"),
ShortcutGroup::Playing_Area)},
{"Player/aClone", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Clone Card"),
parseSequenceString("Ctrl+J"),
ShortcutGroup::Playing_Area)},
{"Player/aCreateToken", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Create Token..."),
parseSequenceString("Ctrl+T"),
ShortcutGroup::Playing_Area)},
{"Player/aCreateRelatedTokens", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Create All Related Tokens"),
parseSequenceString("Ctrl+Shift+T"),
ShortcutGroup::Playing_Area)},
{"Player/aCreateAnotherToken", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Create Another Token"),
parseSequenceString("Ctrl+G"),
ShortcutGroup::Playing_Area)},
{"Player/aSetAnnotation", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Annotation..."),
parseSequenceString("Alt+N"),
ShortcutGroup::Playing_Area)},
{"Player/aSelectAll", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Zone"),
parseSequenceString("Ctrl+A"),
ShortcutGroup::Playing_Area)},
{"Player/aSelectRow", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Row"),
parseSequenceString("Ctrl+Shift+X"),
ShortcutGroup::Playing_Area)},
{"Player/aSelectColumn", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Select All Cards in Column"),
parseSequenceString("Ctrl+Shift+C"),
ShortcutGroup::Playing_Area)},
{"Player/aMoveToBottomLibrary", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Bottom of Library"),
parseSequenceString("Ctrl+B"),
ShortcutGroup::Move_selected)},
{"Player/aMoveToExile", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile"),
parseSequenceString(""),
ShortcutGroup::Move_selected)},
{"Player/aMoveToGraveyard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard"),
parseSequenceString("Ctrl+Del"),
ShortcutGroup::Move_selected)},
{"Player/aMoveToHand",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Hand"), parseSequenceString(""), ShortcutGroup::Move_selected)},
{"Player/aMoveToTopLibrary", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Top of Library"),
parseSequenceString(""),
ShortcutGroup::Move_selected)},
{"Player/aPlayFacedown", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Battlefield, Face Down"),
parseSequenceString(""),
ShortcutGroup::Move_selected)},
{"Player/aPlay", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Battlefield"),
parseSequenceString(""),
ShortcutGroup::Move_selected)},
{"Player/aViewHand",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Hand"), parseSequenceString(""), ShortcutGroup::View)},
{"Player/aSortHand", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Sort Hand"),
parseSequenceString("Ctrl+Shift+H"),
ShortcutGroup::View)},
{"Player/aViewGraveyard",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard"), parseSequenceString("F4"), ShortcutGroup::View)},
{"Player/aViewLibrary",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Library"), parseSequenceString("F3"), ShortcutGroup::View)},
{"Player/aViewRfg",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile"), parseSequenceString(""), ShortcutGroup::View)},
{"Player/aViewSideboard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Sideboard"),
parseSequenceString("Ctrl+F3"),
ShortcutGroup::View)},
{"Player/aViewTopCards", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Top Cards of Library"),
parseSequenceString("Ctrl+W"),
ShortcutGroup::View)},
{"Player/aViewBottomCards", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Bottom Cards of Library"),
parseSequenceString("Ctrl+Shift+W"),
ShortcutGroup::View)},
{"Player/aCloseMostRecentZoneView", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Close Recent View"),
parseSequenceString("Esc"),
ShortcutGroup::View)},
{"Player/aMoveTopToPlay", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Stack"),
parseSequenceString("Ctrl+Y"),
ShortcutGroup::Move_top)},
{"Player/aMoveTopToPlayFaceDown", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Battlefield, Face Down"),
parseSequenceString("Ctrl+Shift+E"),
ShortcutGroup::Move_top)},
{"Player/aMoveTopCardToGraveyard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard"),
parseSequenceString("Alt+Y"),
ShortcutGroup::Move_top)},
{"Player/aMoveTopCardsToGraveyard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard (Multiple)"),
parseSequenceString("Alt+M"),
ShortcutGroup::Move_top)},
{"Player/aMoveTopCardToExile",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile"), parseSequenceString(""), ShortcutGroup::Move_top)},
{"Player/aMoveTopCardsToExile", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile (Multiple)"),
parseSequenceString(""),
ShortcutGroup::Move_top)},
{"Player/aMoveTopCardsUntil", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Stack Until Found"),
parseSequenceString("Ctrl+Shift+Y"),
ShortcutGroup::Move_top)},
{"Player/aMoveTopCardToBottom", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Bottom of Library"),
parseSequenceString(""),
ShortcutGroup::Move_top)},
{"Player/aMoveBottomToPlay",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Stack"), parseSequenceString(""), ShortcutGroup::Move_bottom)},
{"Player/aMoveBottomToPlayFaceDown", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Battlefield, Face Down"),
parseSequenceString(""),
ShortcutGroup::Move_bottom)},
{"Player/aMoveBottomCardToGrave", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard"),
parseSequenceString(""),
ShortcutGroup::Move_bottom)},
{"Player/aMoveBottomCardsToGrave", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Graveyard (Multiple)"),
parseSequenceString(""),
ShortcutGroup::Move_bottom)},
{"Player/aMoveBottomCardToExile",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile"), parseSequenceString(""), ShortcutGroup::Move_bottom)},
{"Player/aMoveBottomCardsToExile", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Exile (Multiple)"),
parseSequenceString(""),
ShortcutGroup::Move_bottom)},
{"Player/aMoveBottomCardToTop", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Top of Library"),
parseSequenceString(""),
ShortcutGroup::Move_bottom)},
{"Player/aDrawBottomCard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Draw Bottom Card"),
parseSequenceString(""),
ShortcutGroup::Move_bottom)},
{"Player/aDrawBottomCards", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Draw Multiple Cards from Bottom..."),
parseSequenceString(""),
ShortcutGroup::Move_bottom)},
{"Player/aDrawArrow", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Draw Arrow..."),
parseSequenceString("Alt+A"),
ShortcutGroup::Gameplay)},
{"Player/aRemoveLocalArrows", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Local Arrows"),
parseSequenceString("Ctrl+R"),
ShortcutGroup::Gameplay)},
{"Player/aLeaveGame", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Leave Game"),
parseSequenceString("Ctrl+Q"),
ShortcutGroup::Gameplay)},
{"Player/aConcede",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Concede"), parseSequenceString("F2"), ShortcutGroup::Gameplay)},
{"Player/aRollDie", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Roll Dice..."),
parseSequenceString("Ctrl+I"),
ShortcutGroup::Gameplay)},
{"Player/aShuffle", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Shuffle Library"),
parseSequenceString("Ctrl+S"),
ShortcutGroup::Gameplay)},
{"Player/aShuffleTopCards", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Shuffle Top Cards of Library"),
parseSequenceString(""),
ShortcutGroup::Gameplay)},
{"Player/aShuffleBottomCards", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Shuffle Bottom Cards of Library"),
parseSequenceString(""),
ShortcutGroup::Gameplay)},
{"Player/aMulligan", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Mulligan"),
parseSequenceString("Ctrl+M"),
ShortcutGroup::Drawing)},
{"Player/aDrawCard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Draw a Card"),
parseSequenceString("Ctrl+D"),
ShortcutGroup::Drawing)},
{"Player/aDrawCards", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Draw Multiple Cards..."),
parseSequenceString("Ctrl+E"),
ShortcutGroup::Drawing)},
{"Player/aUndoDraw", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Undo Draw"),
parseSequenceString("Ctrl+Shift+D"),
ShortcutGroup::Drawing)},
{"Player/aAlwaysRevealTopCard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Always Reveal Top Card"),
parseSequenceString("Ctrl+N"),
ShortcutGroup::Drawing)},
{"Player/aAlwaysLookAtTopCard", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Always Look At Top Card"),
parseSequenceString("Ctrl+Shift+N"),
ShortcutGroup::Drawing)},
{"Player/aRotateViewCW", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Rotate View Clockwise"),
parseSequenceString(""),
ShortcutGroup::Gameplay)},
{"Player/aRotateViewCCW", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Rotate View Counterclockwise"),
parseSequenceString(""),
ShortcutGroup::Gameplay)},
{"Player/unfocusTextBox", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Unfocus Text Box"),
parseSequenceString("Esc"),
ShortcutGroup::Chat_room)},
{"Player/aFocusChat", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Focus Chat"),
parseSequenceString("Shift+Return"),
ShortcutGroup::Chat_room)},
{"tab_room/aClearChat", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Clear Chat"),
parseSequenceString("F12"),
ShortcutGroup::Chat_room)},
{"Player/aResetLayout", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Reset Layout"),
parseSequenceString(""),
ShortcutGroup::Game_window)},
{"DlgLoadDeckFromClipboard/refreshButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Refresh"),
parseSequenceString("F5"),
ShortcutGroup::Load_deck)},
{"Replays/aSkipForward", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Skip Forward"),
parseSequenceString("Right"),
ShortcutGroup::Replays)},
{"Replays/aSkipBackward", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Skip Backward"),
parseSequenceString("Left"),
ShortcutGroup::Replays)},
{"Replays/aSkipForwardBig", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Skip Forward by a lot"),
parseSequenceString("Ctrl+Right"),
ShortcutGroup::Replays)},
{"Replays/aSkipBackwardBig", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Skip Backward by a lot"),
parseSequenceString("Ctrl+Left"),
ShortcutGroup::Replays)},
{"Replays/playButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Play/Pause"),
parseSequenceString("Space"),
ShortcutGroup::Replays)},
{"Replays/fastForwardButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Fast Forward"),
parseSequenceString("Ctrl+P"),
ShortcutGroup::Replays)},
{"Tabs/aTabDeckEditor",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Deck Editor"), parseSequenceString(""), ShortcutGroup::Tabs)},
{"Tabs/aTabHome",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Home"), parseSequenceString(""), ShortcutGroup::Tabs)},
{"Tabs/aTabVisualDeckStorage", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Visual Deck Storage"),
parseSequenceString(""),
ShortcutGroup::Tabs)},
{"Tabs/aTabDeckStorage",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Deck Storage"), parseSequenceString(""), ShortcutGroup::Tabs)},
{"Tabs/aTabReplays",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Replays"), parseSequenceString(""), ShortcutGroup::Tabs)},
{"Tabs/aTabServer",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Server"), parseSequenceString(""), ShortcutGroup::Tabs)},
{"Tabs/aTabAccount",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Account"), parseSequenceString(""), ShortcutGroup::Tabs)},
{"Tabs/aTabAdmin", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Administration"),
parseSequenceString(""),
ShortcutGroup::Tabs)},
{"Tabs/aTabLogs",
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Logs"), parseSequenceString(""), ShortcutGroup::Tabs)},
};
};
#endif // SHORTCUTSSETTINGS_H