mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-08 17:13:57 -07:00
feat(command-zone): add settings and theme support
Integrate command zones with the client settings and theming system. Settings integration: - CacheSettings: persist command zone preferences - ShortcutsSettings: keyboard shortcuts for zone actions Theme support: - ThemeManager: command zone background loading - Theme assets for Fabric, Leather, Plasma, VelvetMarble themes Visual integration: - MessageLogWidget: command zone action logging Theme assets provide consistent visual styling across all bundled themes.
This commit is contained in:
parent
4bd6ab56c5
commit
47fade7bcb
10 changed files with 169 additions and 277 deletions
|
|
@ -384,6 +384,9 @@ SettingsCache::SettingsCache()
|
||||||
createGameAsSpectator = settings->value("game/creategameasspectator", false).toBool();
|
createGameAsSpectator = settings->value("game/creategameasspectator", false).toBool();
|
||||||
defaultStartingLifeTotal = settings->value("game/defaultstartinglifetotal", 20).toInt();
|
defaultStartingLifeTotal = settings->value("game/defaultstartinglifetotal", 20).toInt();
|
||||||
shareDecklistsOnLoad = settings->value("game/sharedecklistsonload", false).toBool();
|
shareDecklistsOnLoad = settings->value("game/sharedecklistsonload", false).toBool();
|
||||||
|
enableCommandZone = settings->value("game/enablecommandzone", false).toBool();
|
||||||
|
enableCompanionZone = settings->value("game/enablecompanionzone", true).toBool();
|
||||||
|
enableBackgroundZone = settings->value("game/enablebackgroundzone", true).toBool();
|
||||||
rememberGameSettings = settings->value("game/remembergamesettings", true).toBool();
|
rememberGameSettings = settings->value("game/remembergamesettings", true).toBool();
|
||||||
clientID = settings->value("personal/clientid", CLIENT_INFO_NOT_SET).toString();
|
clientID = settings->value("personal/clientid", CLIENT_INFO_NOT_SET).toString();
|
||||||
clientVersion = settings->value("personal/clientversion", CLIENT_INFO_NOT_SET).toString();
|
clientVersion = settings->value("personal/clientversion", CLIENT_INFO_NOT_SET).toString();
|
||||||
|
|
@ -1115,257 +1118,28 @@ void SettingsCache::setClientVersion(const QString &_clientVersion)
|
||||||
|
|
||||||
QStringList SettingsCache::getCountries() const
|
QStringList SettingsCache::getCountries() const
|
||||||
{
|
{
|
||||||
static QStringList countries = QStringList() << "ad"
|
static QStringList countries =
|
||||||
<< "ae"
|
QStringList() << "ad" << "ae" << "af" << "ag" << "ai" << "al" << "am" << "ao" << "aq" << "ar" << "as" << "at"
|
||||||
<< "af"
|
<< "au" << "aw" << "ax" << "az" << "ba" << "bb" << "bd" << "be" << "bf" << "bg" << "bh" << "bi"
|
||||||
<< "ag"
|
<< "bj" << "bl" << "bm" << "bn" << "bo" << "bq" << "br" << "bs" << "bt" << "bv" << "bw" << "by"
|
||||||
<< "ai"
|
<< "bz" << "ca" << "cc" << "cd" << "cf" << "cg" << "ch" << "ci" << "ck" << "cl" << "cm" << "cn"
|
||||||
<< "al"
|
<< "co" << "cr" << "cu" << "cv" << "cw" << "cx" << "cy" << "cz" << "de" << "dj" << "dk" << "dm"
|
||||||
<< "am"
|
<< "do" << "dz" << "ec" << "ee" << "eg" << "eh" << "er" << "es" << "et" << "eu" << "fi" << "fj"
|
||||||
<< "ao"
|
<< "fk" << "fm" << "fo" << "fr" << "ga" << "gb" << "gd" << "ge" << "gf" << "gg" << "gh" << "gi"
|
||||||
<< "aq"
|
<< "gl" << "gm" << "gn" << "gp" << "gq" << "gr" << "gs" << "gt" << "gu" << "gw" << "gy" << "hk"
|
||||||
<< "ar"
|
<< "hm" << "hn" << "hr" << "ht" << "hu" << "id" << "ie" << "il" << "im" << "in" << "io" << "iq"
|
||||||
<< "as"
|
<< "ir" << "is" << "it" << "je" << "jm" << "jo" << "jp" << "ke" << "kg" << "kh" << "ki" << "km"
|
||||||
<< "at"
|
<< "kn" << "kp" << "kr" << "kw" << "ky" << "kz" << "la" << "lb" << "lc" << "li" << "lk" << "lr"
|
||||||
<< "au"
|
<< "ls" << "lt" << "lu" << "lv" << "ly" << "ma" << "mc" << "md" << "me" << "mf" << "mg" << "mh"
|
||||||
<< "aw"
|
<< "mk" << "ml" << "mm" << "mn" << "mo" << "mp" << "mq" << "mr" << "ms" << "mt" << "mu" << "mv"
|
||||||
<< "ax"
|
<< "mw" << "mx" << "my" << "mz" << "na" << "nc" << "ne" << "nf" << "ng" << "ni" << "nl" << "no"
|
||||||
<< "az"
|
<< "np" << "nr" << "nu" << "nz" << "om" << "pa" << "pe" << "pf" << "pg" << "ph" << "pk" << "pl"
|
||||||
<< "ba"
|
<< "pm" << "pn" << "pr" << "ps" << "pt" << "pw" << "py" << "qa" << "re" << "ro" << "rs" << "ru"
|
||||||
<< "bb"
|
<< "rw" << "sa" << "sb" << "sc" << "sd" << "se" << "sg" << "sh" << "si" << "sj" << "sk" << "sl"
|
||||||
<< "bd"
|
<< "sm" << "sn" << "so" << "sr" << "ss" << "st" << "sv" << "sx" << "sy" << "sz" << "tc" << "td"
|
||||||
<< "be"
|
<< "tf" << "tg" << "th" << "tj" << "tk" << "tl" << "tm" << "tn" << "to" << "tr" << "tt" << "tv"
|
||||||
<< "bf"
|
<< "tw" << "tz" << "ua" << "ug" << "um" << "us" << "uy" << "uz" << "va" << "vc" << "ve" << "vg"
|
||||||
<< "bg"
|
<< "vi" << "vn" << "vu" << "wf" << "ws" << "xk" << "ye" << "yt" << "za" << "zm" << "zw";
|
||||||
<< "bh"
|
|
||||||
<< "bi"
|
|
||||||
<< "bj"
|
|
||||||
<< "bl"
|
|
||||||
<< "bm"
|
|
||||||
<< "bn"
|
|
||||||
<< "bo"
|
|
||||||
<< "bq"
|
|
||||||
<< "br"
|
|
||||||
<< "bs"
|
|
||||||
<< "bt"
|
|
||||||
<< "bv"
|
|
||||||
<< "bw"
|
|
||||||
<< "by"
|
|
||||||
<< "bz"
|
|
||||||
<< "ca"
|
|
||||||
<< "cc"
|
|
||||||
<< "cd"
|
|
||||||
<< "cf"
|
|
||||||
<< "cg"
|
|
||||||
<< "ch"
|
|
||||||
<< "ci"
|
|
||||||
<< "ck"
|
|
||||||
<< "cl"
|
|
||||||
<< "cm"
|
|
||||||
<< "cn"
|
|
||||||
<< "co"
|
|
||||||
<< "cr"
|
|
||||||
<< "cu"
|
|
||||||
<< "cv"
|
|
||||||
<< "cw"
|
|
||||||
<< "cx"
|
|
||||||
<< "cy"
|
|
||||||
<< "cz"
|
|
||||||
<< "de"
|
|
||||||
<< "dj"
|
|
||||||
<< "dk"
|
|
||||||
<< "dm"
|
|
||||||
<< "do"
|
|
||||||
<< "dz"
|
|
||||||
<< "ec"
|
|
||||||
<< "ee"
|
|
||||||
<< "eg"
|
|
||||||
<< "eh"
|
|
||||||
<< "er"
|
|
||||||
<< "es"
|
|
||||||
<< "et"
|
|
||||||
<< "eu"
|
|
||||||
<< "fi"
|
|
||||||
<< "fj"
|
|
||||||
<< "fk"
|
|
||||||
<< "fm"
|
|
||||||
<< "fo"
|
|
||||||
<< "fr"
|
|
||||||
<< "ga"
|
|
||||||
<< "gb"
|
|
||||||
<< "gd"
|
|
||||||
<< "ge"
|
|
||||||
<< "gf"
|
|
||||||
<< "gg"
|
|
||||||
<< "gh"
|
|
||||||
<< "gi"
|
|
||||||
<< "gl"
|
|
||||||
<< "gm"
|
|
||||||
<< "gn"
|
|
||||||
<< "gp"
|
|
||||||
<< "gq"
|
|
||||||
<< "gr"
|
|
||||||
<< "gs"
|
|
||||||
<< "gt"
|
|
||||||
<< "gu"
|
|
||||||
<< "gw"
|
|
||||||
<< "gy"
|
|
||||||
<< "hk"
|
|
||||||
<< "hm"
|
|
||||||
<< "hn"
|
|
||||||
<< "hr"
|
|
||||||
<< "ht"
|
|
||||||
<< "hu"
|
|
||||||
<< "id"
|
|
||||||
<< "ie"
|
|
||||||
<< "il"
|
|
||||||
<< "im"
|
|
||||||
<< "in"
|
|
||||||
<< "io"
|
|
||||||
<< "iq"
|
|
||||||
<< "ir"
|
|
||||||
<< "is"
|
|
||||||
<< "it"
|
|
||||||
<< "je"
|
|
||||||
<< "jm"
|
|
||||||
<< "jo"
|
|
||||||
<< "jp"
|
|
||||||
<< "ke"
|
|
||||||
<< "kg"
|
|
||||||
<< "kh"
|
|
||||||
<< "ki"
|
|
||||||
<< "km"
|
|
||||||
<< "kn"
|
|
||||||
<< "kp"
|
|
||||||
<< "kr"
|
|
||||||
<< "kw"
|
|
||||||
<< "ky"
|
|
||||||
<< "kz"
|
|
||||||
<< "la"
|
|
||||||
<< "lb"
|
|
||||||
<< "lc"
|
|
||||||
<< "li"
|
|
||||||
<< "lk"
|
|
||||||
<< "lr"
|
|
||||||
<< "ls"
|
|
||||||
<< "lt"
|
|
||||||
<< "lu"
|
|
||||||
<< "lv"
|
|
||||||
<< "ly"
|
|
||||||
<< "ma"
|
|
||||||
<< "mc"
|
|
||||||
<< "md"
|
|
||||||
<< "me"
|
|
||||||
<< "mf"
|
|
||||||
<< "mg"
|
|
||||||
<< "mh"
|
|
||||||
<< "mk"
|
|
||||||
<< "ml"
|
|
||||||
<< "mm"
|
|
||||||
<< "mn"
|
|
||||||
<< "mo"
|
|
||||||
<< "mp"
|
|
||||||
<< "mq"
|
|
||||||
<< "mr"
|
|
||||||
<< "ms"
|
|
||||||
<< "mt"
|
|
||||||
<< "mu"
|
|
||||||
<< "mv"
|
|
||||||
<< "mw"
|
|
||||||
<< "mx"
|
|
||||||
<< "my"
|
|
||||||
<< "mz"
|
|
||||||
<< "na"
|
|
||||||
<< "nc"
|
|
||||||
<< "ne"
|
|
||||||
<< "nf"
|
|
||||||
<< "ng"
|
|
||||||
<< "ni"
|
|
||||||
<< "nl"
|
|
||||||
<< "no"
|
|
||||||
<< "np"
|
|
||||||
<< "nr"
|
|
||||||
<< "nu"
|
|
||||||
<< "nz"
|
|
||||||
<< "om"
|
|
||||||
<< "pa"
|
|
||||||
<< "pe"
|
|
||||||
<< "pf"
|
|
||||||
<< "pg"
|
|
||||||
<< "ph"
|
|
||||||
<< "pk"
|
|
||||||
<< "pl"
|
|
||||||
<< "pm"
|
|
||||||
<< "pn"
|
|
||||||
<< "pr"
|
|
||||||
<< "ps"
|
|
||||||
<< "pt"
|
|
||||||
<< "pw"
|
|
||||||
<< "py"
|
|
||||||
<< "qa"
|
|
||||||
<< "re"
|
|
||||||
<< "ro"
|
|
||||||
<< "rs"
|
|
||||||
<< "ru"
|
|
||||||
<< "rw"
|
|
||||||
<< "sa"
|
|
||||||
<< "sb"
|
|
||||||
<< "sc"
|
|
||||||
<< "sd"
|
|
||||||
<< "se"
|
|
||||||
<< "sg"
|
|
||||||
<< "sh"
|
|
||||||
<< "si"
|
|
||||||
<< "sj"
|
|
||||||
<< "sk"
|
|
||||||
<< "sl"
|
|
||||||
<< "sm"
|
|
||||||
<< "sn"
|
|
||||||
<< "so"
|
|
||||||
<< "sr"
|
|
||||||
<< "ss"
|
|
||||||
<< "st"
|
|
||||||
<< "sv"
|
|
||||||
<< "sx"
|
|
||||||
<< "sy"
|
|
||||||
<< "sz"
|
|
||||||
<< "tc"
|
|
||||||
<< "td"
|
|
||||||
<< "tf"
|
|
||||||
<< "tg"
|
|
||||||
<< "th"
|
|
||||||
<< "tj"
|
|
||||||
<< "tk"
|
|
||||||
<< "tl"
|
|
||||||
<< "tm"
|
|
||||||
<< "tn"
|
|
||||||
<< "to"
|
|
||||||
<< "tr"
|
|
||||||
<< "tt"
|
|
||||||
<< "tv"
|
|
||||||
<< "tw"
|
|
||||||
<< "tz"
|
|
||||||
<< "ua"
|
|
||||||
<< "ug"
|
|
||||||
<< "um"
|
|
||||||
<< "us"
|
|
||||||
<< "uy"
|
|
||||||
<< "uz"
|
|
||||||
<< "va"
|
|
||||||
<< "vc"
|
|
||||||
<< "ve"
|
|
||||||
<< "vg"
|
|
||||||
<< "vi"
|
|
||||||
<< "vn"
|
|
||||||
<< "vu"
|
|
||||||
<< "wf"
|
|
||||||
<< "ws"
|
|
||||||
<< "xk"
|
|
||||||
<< "ye"
|
|
||||||
<< "yt"
|
|
||||||
<< "za"
|
|
||||||
<< "zm"
|
|
||||||
<< "zw";
|
|
||||||
|
|
||||||
return countries;
|
return countries;
|
||||||
}
|
}
|
||||||
|
|
@ -1442,6 +1216,24 @@ void SettingsCache::setShareDecklistsOnLoad(const bool _shareDecklistsOnLoad)
|
||||||
settings->setValue("game/sharedecklistsonload", shareDecklistsOnLoad);
|
settings->setValue("game/sharedecklistsonload", shareDecklistsOnLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setEnableCommandZone(const bool _enableCommandZone)
|
||||||
|
{
|
||||||
|
enableCommandZone = _enableCommandZone;
|
||||||
|
settings->setValue("game/enablecommandzone", enableCommandZone);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setEnableCompanionZone(const bool _enableCompanionZone)
|
||||||
|
{
|
||||||
|
enableCompanionZone = _enableCompanionZone;
|
||||||
|
settings->setValue("game/enablecompanionzone", enableCompanionZone);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setEnableBackgroundZone(const bool _enableBackgroundZone)
|
||||||
|
{
|
||||||
|
enableBackgroundZone = _enableBackgroundZone;
|
||||||
|
settings->setValue("game/enablebackgroundzone", enableBackgroundZone);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setCheckUpdatesOnStartup(QT_STATE_CHANGED_T value)
|
void SettingsCache::setCheckUpdatesOnStartup(QT_STATE_CHANGED_T value)
|
||||||
{
|
{
|
||||||
checkUpdatesOnStartup = static_cast<bool>(value);
|
checkUpdatesOnStartup = static_cast<bool>(value);
|
||||||
|
|
|
||||||
|
|
@ -323,6 +323,9 @@ private:
|
||||||
bool createGameAsSpectator;
|
bool createGameAsSpectator;
|
||||||
int defaultStartingLifeTotal;
|
int defaultStartingLifeTotal;
|
||||||
bool shareDecklistsOnLoad;
|
bool shareDecklistsOnLoad;
|
||||||
|
bool enableCommandZone;
|
||||||
|
bool enableCompanionZone;
|
||||||
|
bool enableBackgroundZone;
|
||||||
int keepalive;
|
int keepalive;
|
||||||
int timeout;
|
int timeout;
|
||||||
void translateLegacySettings();
|
void translateLegacySettings();
|
||||||
|
|
@ -854,6 +857,18 @@ public:
|
||||||
{
|
{
|
||||||
return shareDecklistsOnLoad;
|
return shareDecklistsOnLoad;
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] bool getEnableCommandZone() const
|
||||||
|
{
|
||||||
|
return enableCommandZone;
|
||||||
|
}
|
||||||
|
[[nodiscard]] bool getEnableCompanionZone() const
|
||||||
|
{
|
||||||
|
return enableCompanionZone;
|
||||||
|
}
|
||||||
|
[[nodiscard]] bool getEnableBackgroundZone() const
|
||||||
|
{
|
||||||
|
return enableBackgroundZone;
|
||||||
|
}
|
||||||
[[nodiscard]] bool getCreateGameAsSpectator() const
|
[[nodiscard]] bool getCreateGameAsSpectator() const
|
||||||
{
|
{
|
||||||
return createGameAsSpectator;
|
return createGameAsSpectator;
|
||||||
|
|
@ -1088,6 +1103,9 @@ public slots:
|
||||||
void setCreateGameAsSpectator(const bool _createGameAsSpectator);
|
void setCreateGameAsSpectator(const bool _createGameAsSpectator);
|
||||||
void setDefaultStartingLifeTotal(const int _defaultStartingLifeTotal);
|
void setDefaultStartingLifeTotal(const int _defaultStartingLifeTotal);
|
||||||
void setShareDecklistsOnLoad(const bool _shareDecklistsOnLoad);
|
void setShareDecklistsOnLoad(const bool _shareDecklistsOnLoad);
|
||||||
|
void setEnableCommandZone(const bool _enableCommandZone);
|
||||||
|
void setEnableCompanionZone(const bool _enableCompanionZone);
|
||||||
|
void setEnableBackgroundZone(const bool _enableBackgroundZone);
|
||||||
void setRememberGameSettings(const bool _rememberGameSettings);
|
void setRememberGameSettings(const bool _rememberGameSettings);
|
||||||
void setCheckUpdatesOnStartup(QT_STATE_CHANGED_T value);
|
void setCheckUpdatesOnStartup(QT_STATE_CHANGED_T value);
|
||||||
void setStartupCardUpdateCheckPromptForUpdate(bool value);
|
void setStartupCardUpdateCheckPromptForUpdate(bool value);
|
||||||
|
|
|
||||||
|
|
@ -422,6 +422,18 @@ private:
|
||||||
{"Player/aSetCounter_storm", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Other Counters..."),
|
{"Player/aSetCounter_storm", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Other Counters..."),
|
||||||
parseSequenceString("Ctrl+\\"),
|
parseSequenceString("Ctrl+\\"),
|
||||||
ShortcutGroup::Player_Counters)},
|
ShortcutGroup::Player_Counters)},
|
||||||
|
{"Player/aAddCommanderTax", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Commander Tax"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Player_Counters)},
|
||||||
|
{"Player/aRemoveCommanderTax", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Commander Tax"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Player_Counters)},
|
||||||
|
{"Player/aAddPartnerTax", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Partner Tax"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Player_Counters)},
|
||||||
|
{"Player/aRemovePartnerTax", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Partner Tax"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Player_Counters)},
|
||||||
{"Player/aIncrementAllCardCounters",
|
{"Player/aIncrementAllCardCounters",
|
||||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Increment all card counters"),
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Increment all card counters"),
|
||||||
parseSequenceString("Ctrl+Shift+A"),
|
parseSequenceString("Ctrl+Shift+A"),
|
||||||
|
|
@ -560,6 +572,21 @@ private:
|
||||||
{"Player/aMoveToTopLibrary", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Top of Library"),
|
{"Player/aMoveToTopLibrary", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Top of Library"),
|
||||||
parseSequenceString(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Move_selected)},
|
ShortcutGroup::Move_selected)},
|
||||||
|
{"Player/aMoveToCommandZone", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Command Zone"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_selected)},
|
||||||
|
{"Player/aMoveToPartnerZone", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Partner Zone"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_selected)},
|
||||||
|
{"Player/aMoveToCompanionZone", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Companion Zone"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_selected)},
|
||||||
|
{"Player/aMoveToBackgroundZone", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Background Zone"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_selected)},
|
||||||
|
{"Player/aMoveToTable", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Battlefield"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Move_selected)},
|
||||||
{"Player/aPlayFacedown", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Battlefield, Face Down"),
|
{"Player/aPlayFacedown", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Battlefield, Face Down"),
|
||||||
parseSequenceString(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Move_selected)},
|
ShortcutGroup::Move_selected)},
|
||||||
|
|
@ -586,6 +613,16 @@ private:
|
||||||
{"Player/aCloseMostRecentZoneView", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Close Recent View"),
|
{"Player/aCloseMostRecentZoneView", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Close Recent View"),
|
||||||
parseSequenceString("Esc"),
|
parseSequenceString("Esc"),
|
||||||
ShortcutGroup::View)},
|
ShortcutGroup::View)},
|
||||||
|
{"Player/aViewCommandZone",
|
||||||
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Command Zone"), parseSequenceString(""), ShortcutGroup::View)},
|
||||||
|
{"Player/aViewPartnerZone",
|
||||||
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Partner Zone"), parseSequenceString(""), ShortcutGroup::View)},
|
||||||
|
{"Player/aViewCompanionZone", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Companion Zone"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::View)},
|
||||||
|
{"Player/aViewBackgroundZone", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Background Zone"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::View)},
|
||||||
{"Player/aMoveTopToPlay", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Stack"),
|
{"Player/aMoveTopToPlay", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Stack"),
|
||||||
parseSequenceString("Ctrl+Y"),
|
parseSequenceString("Ctrl+Y"),
|
||||||
ShortcutGroup::Move_top)},
|
ShortcutGroup::Move_top)},
|
||||||
|
|
@ -715,6 +752,18 @@ private:
|
||||||
{"Player/aResetLayout", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Reset Layout"),
|
{"Player/aResetLayout", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Reset Layout"),
|
||||||
parseSequenceString(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Game_window)},
|
ShortcutGroup::Game_window)},
|
||||||
|
{"Player/aTogglePartnerZoneVisibility",
|
||||||
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Partner Zone Visibility"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Game_window)},
|
||||||
|
{"Player/aToggleCompanionZoneVisibility",
|
||||||
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Companion Zone Visibility"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Game_window)},
|
||||||
|
{"Player/aToggleBackgroundZoneVisibility",
|
||||||
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Background Zone Visibility"),
|
||||||
|
parseSequenceString(""),
|
||||||
|
ShortcutGroup::Game_window)},
|
||||||
{"DlgLoadDeckFromClipboard/refreshButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Refresh"),
|
{"DlgLoadDeckFromClipboard/refreshButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Refresh"),
|
||||||
parseSequenceString("F5"),
|
parseSequenceString("F5"),
|
||||||
ShortcutGroup::Load_deck)},
|
ShortcutGroup::Load_deck)},
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,14 @@
|
||||||
#include "../board/translate_counter_name.h"
|
#include "../board/translate_counter_name.h"
|
||||||
#include "../phase.h"
|
#include "../phase.h"
|
||||||
#include "../player/player.h"
|
#include "../player/player.h"
|
||||||
|
#include "../zones/zone_names.h"
|
||||||
|
|
||||||
#include <../../client/settings/card_counter_settings.h>
|
#include <../../client/settings/card_counter_settings.h>
|
||||||
|
#include <libcockatrice/common/counter_ids.h>
|
||||||
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
|
#include <libcockatrice/protocol/pb/context_move_card.pb.h>
|
||||||
#include <libcockatrice/protocol/pb/context_mulligan.pb.h>
|
#include <libcockatrice/protocol/pb/context_mulligan.pb.h>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
static const QString TABLE_ZONE_NAME = "table";
|
|
||||||
static const QString GRAVE_ZONE_NAME = "grave";
|
|
||||||
static const QString EXILE_ZONE_NAME = "rfg";
|
|
||||||
static const QString HAND_ZONE_NAME = "hand";
|
|
||||||
static const QString DECK_ZONE_NAME = "deck";
|
|
||||||
static const QString SIDEBOARD_ZONE_NAME = "sb";
|
|
||||||
static const QString STACK_ZONE_NAME = "stack";
|
|
||||||
|
|
||||||
static QString sanitizeHtml(QString dirty)
|
static QString sanitizeHtml(QString dirty)
|
||||||
{
|
{
|
||||||
return dirty.replace("&", "&").replace("<", "<").replace(">", ">").replace("\"", """);
|
return dirty.replace("&", "&").replace("<", "<").replace(">", ">").replace("\"", """);
|
||||||
|
|
@ -37,15 +31,15 @@ MessageLogWidget::getFromStr(CardZoneLogic *zone, QString cardName, int position
|
||||||
QString fromStr;
|
QString fromStr;
|
||||||
QString zoneName = zone->getName();
|
QString zoneName = zone->getName();
|
||||||
|
|
||||||
if (zoneName == TABLE_ZONE_NAME) {
|
if (zoneName == ZoneNames::TABLE) {
|
||||||
fromStr = tr(" from play");
|
fromStr = tr(" from play");
|
||||||
} else if (zoneName == GRAVE_ZONE_NAME) {
|
} else if (zoneName == ZoneNames::GRAVE) {
|
||||||
fromStr = tr(" from their graveyard");
|
fromStr = tr(" from their graveyard");
|
||||||
} else if (zoneName == EXILE_ZONE_NAME) {
|
} else if (zoneName == ZoneNames::EXILE) {
|
||||||
fromStr = tr(" from exile");
|
fromStr = tr(" from exile");
|
||||||
} else if (zoneName == HAND_ZONE_NAME) {
|
} else if (zoneName == ZoneNames::HAND) {
|
||||||
fromStr = tr(" from their hand");
|
fromStr = tr(" from their hand");
|
||||||
} else if (zoneName == DECK_ZONE_NAME) {
|
} else if (zoneName == ZoneNames::DECK) {
|
||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
if (cardName.isEmpty()) {
|
if (cardName.isEmpty()) {
|
||||||
if (ownerChange) {
|
if (ownerChange) {
|
||||||
|
|
@ -83,10 +77,18 @@ MessageLogWidget::getFromStr(CardZoneLogic *zone, QString cardName, int position
|
||||||
fromStr = tr(" from their library");
|
fromStr = tr(" from their library");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (zoneName == SIDEBOARD_ZONE_NAME) {
|
} else if (zoneName == ZoneNames::SIDEBOARD) {
|
||||||
fromStr = tr(" from sideboard");
|
fromStr = tr(" from sideboard");
|
||||||
} else if (zoneName == STACK_ZONE_NAME) {
|
} else if (zoneName == ZoneNames::STACK) {
|
||||||
fromStr = tr(" from the stack");
|
fromStr = tr(" from the stack");
|
||||||
|
} else if (zoneName == ZoneNames::COMMAND) {
|
||||||
|
fromStr = tr(" from the command zone");
|
||||||
|
} else if (zoneName == ZoneNames::PARTNER) {
|
||||||
|
fromStr = tr(" from the partner zone");
|
||||||
|
} else if (zoneName == ZoneNames::COMPANION) {
|
||||||
|
fromStr = tr(" from the companion zone");
|
||||||
|
} else if (zoneName == ZoneNames::BACKGROUND) {
|
||||||
|
fromStr = tr(" from the background zone");
|
||||||
} else {
|
} else {
|
||||||
fromStr = tr(" from custom zone '%1'").arg(zoneName);
|
fromStr = tr(" from custom zone '%1'").arg(zoneName);
|
||||||
}
|
}
|
||||||
|
|
@ -275,9 +277,9 @@ void MessageLogWidget::logMoveCard(Player *player,
|
||||||
bool ownerChanged = startZone->getPlayer() != targetZone->getPlayer();
|
bool ownerChanged = startZone->getPlayer() != targetZone->getPlayer();
|
||||||
|
|
||||||
// do not log if moved within the same zone
|
// do not log if moved within the same zone
|
||||||
if ((startZoneName == TABLE_ZONE_NAME && targetZoneName == TABLE_ZONE_NAME && !ownerChanged) ||
|
if ((startZoneName == ZoneNames::TABLE && targetZoneName == ZoneNames::TABLE && !ownerChanged) ||
|
||||||
(startZoneName == HAND_ZONE_NAME && targetZoneName == HAND_ZONE_NAME) ||
|
(startZoneName == ZoneNames::HAND && targetZoneName == ZoneNames::HAND) ||
|
||||||
(startZoneName == EXILE_ZONE_NAME && targetZoneName == EXILE_ZONE_NAME)) {
|
(startZoneName == ZoneNames::EXILE && targetZoneName == ZoneNames::EXILE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -306,20 +308,20 @@ void MessageLogWidget::logMoveCard(Player *player,
|
||||||
|
|
||||||
QString finalStr;
|
QString finalStr;
|
||||||
std::optional<QString> fourthArg;
|
std::optional<QString> fourthArg;
|
||||||
if (targetZoneName == TABLE_ZONE_NAME) {
|
if (targetZoneName == ZoneNames::TABLE) {
|
||||||
soundEngine->playSound("play_card");
|
soundEngine->playSound("play_card");
|
||||||
if (card->getFaceDown()) {
|
if (card->getFaceDown()) {
|
||||||
finalStr = tr("%1 puts %2 into play%3 face down.");
|
finalStr = tr("%1 puts %2 into play%3 face down.");
|
||||||
} else {
|
} else {
|
||||||
finalStr = tr("%1 puts %2 into play%3.");
|
finalStr = tr("%1 puts %2 into play%3.");
|
||||||
}
|
}
|
||||||
} else if (targetZoneName == GRAVE_ZONE_NAME) {
|
} else if (targetZoneName == ZoneNames::GRAVE) {
|
||||||
finalStr = tr("%1 puts %2%3 into their graveyard.");
|
finalStr = tr("%1 puts %2%3 into their graveyard.");
|
||||||
} else if (targetZoneName == EXILE_ZONE_NAME) {
|
} else if (targetZoneName == ZoneNames::EXILE) {
|
||||||
finalStr = tr("%1 exiles %2%3.");
|
finalStr = tr("%1 exiles %2%3.");
|
||||||
} else if (targetZoneName == HAND_ZONE_NAME) {
|
} else if (targetZoneName == ZoneNames::HAND) {
|
||||||
finalStr = tr("%1 moves %2%3 to their hand.");
|
finalStr = tr("%1 moves %2%3 to their hand.");
|
||||||
} else if (targetZoneName == DECK_ZONE_NAME) {
|
} else if (targetZoneName == ZoneNames::DECK) {
|
||||||
if (newX == -1) {
|
if (newX == -1) {
|
||||||
finalStr = tr("%1 puts %2%3 into their library.");
|
finalStr = tr("%1 puts %2%3 into their library.");
|
||||||
} else if (newX >= targetZone->getCards().size()) {
|
} else if (newX >= targetZone->getCards().size()) {
|
||||||
|
|
@ -331,11 +333,19 @@ void MessageLogWidget::logMoveCard(Player *player,
|
||||||
fourthArg = QString::number(newX);
|
fourthArg = QString::number(newX);
|
||||||
finalStr = tr("%1 puts %2%3 into their library %4 cards from the top.");
|
finalStr = tr("%1 puts %2%3 into their library %4 cards from the top.");
|
||||||
}
|
}
|
||||||
} else if (targetZoneName == SIDEBOARD_ZONE_NAME) {
|
} else if (targetZoneName == ZoneNames::SIDEBOARD) {
|
||||||
finalStr = tr("%1 moves %2%3 to sideboard.");
|
finalStr = tr("%1 moves %2%3 to sideboard.");
|
||||||
} else if (targetZoneName == STACK_ZONE_NAME) {
|
} else if (targetZoneName == ZoneNames::STACK) {
|
||||||
soundEngine->playSound("play_card");
|
soundEngine->playSound("play_card");
|
||||||
finalStr = tr("%1 plays %2%3.");
|
finalStr = tr("%1 plays %2%3.");
|
||||||
|
} else if (targetZoneName == ZoneNames::COMMAND) {
|
||||||
|
finalStr = tr("%1 moves %2%3 to the command zone.");
|
||||||
|
} else if (targetZoneName == ZoneNames::PARTNER) {
|
||||||
|
finalStr = tr("%1 moves %2%3 to the partner zone.");
|
||||||
|
} else if (targetZoneName == ZoneNames::COMPANION) {
|
||||||
|
finalStr = tr("%1 moves %2%3 to the companion zone.");
|
||||||
|
} else if (targetZoneName == ZoneNames::BACKGROUND) {
|
||||||
|
finalStr = tr("%1 moves %2%3 to the background zone.");
|
||||||
} else {
|
} else {
|
||||||
fourthArg = targetZoneName;
|
fourthArg = targetZoneName;
|
||||||
finalStr = tr("%1 moves %2%3 to custom zone '%4'.");
|
finalStr = tr("%1 moves %2%3 to custom zone '%4'.");
|
||||||
|
|
@ -658,6 +668,20 @@ void MessageLogWidget::logSetCounter(Player *player, QString counterName, int va
|
||||||
}
|
}
|
||||||
|
|
||||||
QString counterDisplayName = TranslateCounterName::getDisplayName(counterName);
|
QString counterDisplayName = TranslateCounterName::getDisplayName(counterName);
|
||||||
|
|
||||||
|
// Special format for commander/partner tax (manual player action)
|
||||||
|
if (counterName == CounterNames::CommanderTax || counterName == CounterNames::PartnerTax) {
|
||||||
|
appendHtmlServerMessage(
|
||||||
|
tr("%1 sets %2 counter to %3 (%4%5).")
|
||||||
|
.arg(sanitizeHtml(player->getPlayerInfo()->getName()))
|
||||||
|
.arg(QString("<font class=\"blue\">%1</font>").arg(sanitizeHtml(counterDisplayName)))
|
||||||
|
.arg(QString("<font class=\"blue\">%1</font>").arg(value))
|
||||||
|
.arg(value > oldValue ? "+" : "")
|
||||||
|
.arg(value - oldValue));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generic counter format
|
||||||
appendHtmlServerMessage(tr("%1 sets counter %2 to %3 (%4%5).")
|
appendHtmlServerMessage(tr("%1 sets counter %2 to %3 (%4%5).")
|
||||||
.arg(sanitizeHtml(player->getPlayerInfo()->getName()))
|
.arg(sanitizeHtml(player->getPlayerInfo()->getName()))
|
||||||
.arg(QString("<font class=\"blue\">%1</font>").arg(sanitizeHtml(counterDisplayName)))
|
.arg(QString("<font class=\"blue\">%1</font>").arg(sanitizeHtml(counterDisplayName)))
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,12 @@
|
||||||
#define PLAYERZONE_BG_NAME "playerzone"
|
#define PLAYERZONE_BG_NAME "playerzone"
|
||||||
#define STACKZONE_BG_NAME "stackzone"
|
#define STACKZONE_BG_NAME "stackzone"
|
||||||
#define TABLEZONE_BG_NAME "tablezone"
|
#define TABLEZONE_BG_NAME "tablezone"
|
||||||
|
#define COMMANDZONE_BG_NAME "commandzone"
|
||||||
static const QColor HANDZONE_BG_DEFAULT = QColor(80, 100, 50);
|
static const QColor HANDZONE_BG_DEFAULT = QColor(80, 100, 50);
|
||||||
static const QColor TABLEZONE_BG_DEFAULT = QColor(70, 50, 100);
|
static const QColor TABLEZONE_BG_DEFAULT = QColor(70, 50, 100);
|
||||||
static const QColor PLAYERZONE_BG_DEFAULT = QColor(200, 200, 200);
|
static const QColor PLAYERZONE_BG_DEFAULT = QColor(200, 200, 200);
|
||||||
static const QColor STACKZONE_BG_DEFAULT = QColor(113, 43, 43);
|
static const QColor STACKZONE_BG_DEFAULT = QColor(113, 43, 43);
|
||||||
|
static const QColor COMMANDZONE_BG_DEFAULT = QColor(75, 75, 120);
|
||||||
static const QStringList DEFAULT_RESOURCE_PATHS = {":/resources"};
|
static const QStringList DEFAULT_RESOURCE_PATHS = {":/resources"};
|
||||||
|
|
||||||
struct PaletteColorInfo
|
struct PaletteColorInfo
|
||||||
|
|
@ -356,6 +358,7 @@ void ThemeManager::themeChangedSlot()
|
||||||
brushes[Role::Table] = TABLEZONE_BG_DEFAULT;
|
brushes[Role::Table] = TABLEZONE_BG_DEFAULT;
|
||||||
brushes[Role::Player] = PLAYERZONE_BG_DEFAULT;
|
brushes[Role::Player] = PLAYERZONE_BG_DEFAULT;
|
||||||
brushes[Role::Stack] = STACKZONE_BG_DEFAULT;
|
brushes[Role::Stack] = STACKZONE_BG_DEFAULT;
|
||||||
|
brushes[Role::Command] = COMMANDZONE_BG_DEFAULT;
|
||||||
} else {
|
} else {
|
||||||
// resources
|
// resources
|
||||||
QStringList resources;
|
QStringList resources;
|
||||||
|
|
@ -368,6 +371,7 @@ void ThemeManager::themeChangedSlot()
|
||||||
brushes[Role::Table] = loadBrush(TABLEZONE_BG_NAME, TABLEZONE_BG_DEFAULT);
|
brushes[Role::Table] = loadBrush(TABLEZONE_BG_NAME, TABLEZONE_BG_DEFAULT);
|
||||||
brushes[Role::Player] = loadBrush(PLAYERZONE_BG_NAME, PLAYERZONE_BG_DEFAULT);
|
brushes[Role::Player] = loadBrush(PLAYERZONE_BG_NAME, PLAYERZONE_BG_DEFAULT);
|
||||||
brushes[Role::Stack] = loadBrush(STACKZONE_BG_NAME, STACKZONE_BG_DEFAULT);
|
brushes[Role::Stack] = loadBrush(STACKZONE_BG_NAME, STACKZONE_BG_DEFAULT);
|
||||||
|
brushes[Role::Command] = loadBrush(COMMANDZONE_BG_NAME, COMMANDZONE_BG_DEFAULT);
|
||||||
}
|
}
|
||||||
for (auto &brushCache : brushesCache) {
|
for (auto &brushCache : brushesCache) {
|
||||||
brushCache.clear();
|
brushCache.clear();
|
||||||
|
|
@ -393,8 +397,12 @@ static QString roleBgName(ThemeManager::Role role)
|
||||||
case ThemeManager::Table:
|
case ThemeManager::Table:
|
||||||
return TABLEZONE_BG_NAME;
|
return TABLEZONE_BG_NAME;
|
||||||
|
|
||||||
|
case ThemeManager::Command:
|
||||||
|
return COMMANDZONE_BG_NAME;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@ public:
|
||||||
Stack,
|
Stack,
|
||||||
Table,
|
Table,
|
||||||
Player,
|
Player,
|
||||||
MaxRole = Player,
|
Command,
|
||||||
|
MaxRole = Command,
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
BIN
cockatrice/themes/Fabric/zones/commandzone.png
Normal file
BIN
cockatrice/themes/Fabric/zones/commandzone.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 220 KiB |
BIN
cockatrice/themes/Leather/zones/commandzone.png
Normal file
BIN
cockatrice/themes/Leather/zones/commandzone.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 141 KiB |
BIN
cockatrice/themes/Plasma/zones/commandzone.png
Normal file
BIN
cockatrice/themes/Plasma/zones/commandzone.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
BIN
cockatrice/themes/VelvetMarble/zones/commandzone.jpg
Normal file
BIN
cockatrice/themes/VelvetMarble/zones/commandzone.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.2 KiB |
Loading…
Add table
Add a link
Reference in a new issue