diff --git a/cockatrice/src/dialogs/dlg_settings.cpp b/cockatrice/src/dialogs/dlg_settings.cpp index 306558b5c..99f11efd6 100644 --- a/cockatrice/src/dialogs/dlg_settings.cpp +++ b/cockatrice/src/dialogs/dlg_settings.cpp @@ -487,10 +487,6 @@ AppearanceSettingsPage::AppearanceSettingsPage() auto *cardCountersLayout = new QVBoxLayout; cardCountersLayout->addLayout(cardCounterColorsLayout, 1); - cardCountersNameWarning = new QLabel; - cardCountersNameWarning->setWordWrap(true); - cardCountersLayout->addWidget(cardCountersNameWarning); - cardCountersGroupBox = new QGroupBox; cardCountersGroupBox->setLayout(cardCountersLayout); @@ -631,12 +627,10 @@ void AppearanceSettingsPage::retranslateUi() cardViewExpandedRowsMaxBox.setSuffix(tr(" rows")); cardCountersGroupBox->setTitle(tr("Card counters")); - cardCountersNameWarning->setText( - tr("Note: The names can't be changed and might not match the actual colors.")); auto &cardCounterSettings = SettingsCache::instance().cardCounters(); for (int index = 0; index < cardCounterNames.size(); ++index) { - cardCounterNames[index]->setText(cardCounterSettings.displayName(index)); + cardCounterNames[index]->setText(tr("Counter %1").arg(cardCounterSettings.displayName(index))); } handGroupBox->setTitle(tr("Hand layout")); diff --git a/cockatrice/src/dialogs/dlg_settings.h b/cockatrice/src/dialogs/dlg_settings.h index e72d817cd..32ce5a410 100644 --- a/cockatrice/src/dialogs/dlg_settings.h +++ b/cockatrice/src/dialogs/dlg_settings.h @@ -126,7 +126,6 @@ private: QGroupBox *handGroupBox; QGroupBox *tableGroupBox; QGroupBox *cardCountersGroupBox; - QLabel *cardCountersNameWarning; QList cardCounterNames; QSpinBox minPlayersForMultiColumnLayoutEdit; QSpinBox maxFontSizeForCardsEdit; diff --git a/cockatrice/src/server/message_log_widget.cpp b/cockatrice/src/server/message_log_widget.cpp index dc9d95b1f..63ed09ff6 100644 --- a/cockatrice/src/server/message_log_widget.cpp +++ b/cockatrice/src/server/message_log_widget.cpp @@ -1,4 +1,5 @@ #include "message_log_widget.h" +mCardCounters->clear(); #include "../client/sound_engine.h" #include "../client/translate_counter_name.h" @@ -609,16 +610,15 @@ void MessageLogWidget::logSetCardCounter(Player *player, QString cardName, int c QString finalStr; int delta = abs(oldValue - value); if (value > oldValue) { - finalStr = tr("%1 places %2 %3 counter(s) on %4 (now %5).", "", delta); + finalStr = tr("%1 places %2 \"%3\" counter(s) on %4 (now %5).", "", delta); } else { - finalStr = tr("%1 removes %2 %3 counter(s) from %4 (now %5).", "", delta); + finalStr = tr("%1 removes %2 \"%3\" counter(s) from %4 (now %5).", "", delta); } - QLocale locale; auto &cardCounterSettings = SettingsCache::instance().cardCounters(); appendHtmlServerMessage(finalStr.arg(sanitizeHtml(player->getName())) .arg("" + QString::number(delta) + "") - .arg(locale.toLower(cardCounterSettings.displayName(counterId))) + .arg(cardCounterSettings.displayName(counterId)) .arg(cardLink(std::move(cardName))) .arg(value)); } diff --git a/cockatrice/src/settings/card_counter_settings.cpp b/cockatrice/src/settings/card_counter_settings.cpp index 0d0640e61..f450dbbf8 100644 --- a/cockatrice/src/settings/card_counter_settings.cpp +++ b/cockatrice/src/settings/card_counter_settings.cpp @@ -40,22 +40,16 @@ QColor CardCounterSettings::color(int counterId) const QString CardCounterSettings::displayName(int counterId) const { - // These are hardcoded for now. They should become configurable at some - // point. - switch (counterId) { - case 0: - return tr("Red"); - case 1: - return tr("Yellow"); - case 2: - return tr("Green"); - case 3: - return tr("Cyan"); - case 4: - return tr("Purple"); - case 5: - return tr("Magenta"); - default: - return QString(tr("Custom %1")).arg(counterId - 5); + // 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; } diff --git a/cockatrice/src/settings/shortcuts_settings.h b/cockatrice/src/settings/shortcuts_settings.h index f1d8defc5..2175f9087 100644 --- a/cockatrice/src/settings/shortcuts_settings.h +++ b/cockatrice/src/settings/shortcuts_settings.h @@ -274,58 +274,58 @@ private: ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Sideboard Lock"), parseSequenceString("Ctrl+Shift+B"), ShortcutGroup::Game_Lobby)}, - {"Player/aCCMagenta", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Magenta Counter"), + {"Player/aCCMagenta", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Card Counter (F)"), parseSequenceString(""), ShortcutGroup::Card_Counters)}, - {"Player/aRCMagenta", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Magenta Counter"), + {"Player/aRCMagenta", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Card Counter (F)"), parseSequenceString(""), ShortcutGroup::Card_Counters)}, - {"Player/aSCMagenta", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Magenta Counters..."), + {"Player/aSCMagenta", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Card Counters (F)..."), parseSequenceString(""), ShortcutGroup::Card_Counters)}, - {"Player/aCCPurple", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Purple Counter"), + {"Player/aCCPurple", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Card Counter (E)"), parseSequenceString(""), ShortcutGroup::Card_Counters)}, - {"Player/aRCPurple", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Purple Counter"), + {"Player/aRCPurple", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Card Counter (E)"), parseSequenceString(""), ShortcutGroup::Card_Counters)}, - {"Player/aSCPurple", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Purple Counters..."), + {"Player/aSCPurple", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Card Counters (E)..."), parseSequenceString(""), ShortcutGroup::Card_Counters)}, - {"Player/aCCCyan", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Cyan Counter"), + {"Player/aCCCyan", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Card Counter(D)"), parseSequenceString(""), ShortcutGroup::Card_Counters)}, - {"Player/aRCCyan", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Cyan Counter"), + {"Player/aRCCyan", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Card Counter (D)"), parseSequenceString(""), ShortcutGroup::Card_Counters)}, - {"Player/aSCCyan", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Cyan Counters..."), + {"Player/aSCCyan", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Card Counters (D)..."), parseSequenceString(""), ShortcutGroup::Card_Counters)}, - {"Player/aCCGreen", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Green Counter"), + {"Player/aCCGreen", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Card Counter (C)"), parseSequenceString("Ctrl+>"), ShortcutGroup::Card_Counters)}, - {"Player/aRCGreen", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Green Counter"), + {"Player/aRCGreen", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Card Counter (C)"), parseSequenceString("Ctrl+<"), ShortcutGroup::Card_Counters)}, - {"Player/aSCGreen", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Green 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 Yellow Counter"), + {"Player/aCCYellow", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Card Counter (B)"), parseSequenceString("Ctrl+."), ShortcutGroup::Card_Counters)}, - {"Player/aRCYellow", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Yellow Counter"), + {"Player/aRCYellow", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Card Counter (B)"), parseSequenceString("Ctrl+,"), ShortcutGroup::Card_Counters)}, - {"Player/aSCYellow", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Yellow 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 Red Counter"), + {"Player/aCCRed", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Card Counter (A)"), parseSequenceString("Alt+."), ShortcutGroup::Card_Counters)}, - {"Player/aRCRed", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Red Counter"), + {"Player/aRCRed", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Remove Card Counter (A)"), parseSequenceString("Alt+,"), ShortcutGroup::Card_Counters)}, - {"Player/aSCRed", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Set Red 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"),