mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 22:42:14 -07:00
Use letters for card counter names
This commit is contained in:
parent
e7b28322c1
commit
1cb5220485
5 changed files with 34 additions and 47 deletions
|
|
@ -487,10 +487,6 @@ AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
auto *cardCountersLayout = new QVBoxLayout;
|
auto *cardCountersLayout = new QVBoxLayout;
|
||||||
cardCountersLayout->addLayout(cardCounterColorsLayout, 1);
|
cardCountersLayout->addLayout(cardCounterColorsLayout, 1);
|
||||||
|
|
||||||
cardCountersNameWarning = new QLabel;
|
|
||||||
cardCountersNameWarning->setWordWrap(true);
|
|
||||||
cardCountersLayout->addWidget(cardCountersNameWarning);
|
|
||||||
|
|
||||||
cardCountersGroupBox = new QGroupBox;
|
cardCountersGroupBox = new QGroupBox;
|
||||||
cardCountersGroupBox->setLayout(cardCountersLayout);
|
cardCountersGroupBox->setLayout(cardCountersLayout);
|
||||||
|
|
||||||
|
|
@ -631,12 +627,10 @@ void AppearanceSettingsPage::retranslateUi()
|
||||||
cardViewExpandedRowsMaxBox.setSuffix(tr(" rows"));
|
cardViewExpandedRowsMaxBox.setSuffix(tr(" rows"));
|
||||||
|
|
||||||
cardCountersGroupBox->setTitle(tr("Card counters"));
|
cardCountersGroupBox->setTitle(tr("Card counters"));
|
||||||
cardCountersNameWarning->setText(
|
|
||||||
tr("<b>Note:</b> The names can't be changed and might not match the actual colors."));
|
|
||||||
|
|
||||||
auto &cardCounterSettings = SettingsCache::instance().cardCounters();
|
auto &cardCounterSettings = SettingsCache::instance().cardCounters();
|
||||||
for (int index = 0; index < cardCounterNames.size(); ++index) {
|
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"));
|
handGroupBox->setTitle(tr("Hand layout"));
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,6 @@ private:
|
||||||
QGroupBox *handGroupBox;
|
QGroupBox *handGroupBox;
|
||||||
QGroupBox *tableGroupBox;
|
QGroupBox *tableGroupBox;
|
||||||
QGroupBox *cardCountersGroupBox;
|
QGroupBox *cardCountersGroupBox;
|
||||||
QLabel *cardCountersNameWarning;
|
|
||||||
QList<QLabel *> cardCounterNames;
|
QList<QLabel *> cardCounterNames;
|
||||||
QSpinBox minPlayersForMultiColumnLayoutEdit;
|
QSpinBox minPlayersForMultiColumnLayoutEdit;
|
||||||
QSpinBox maxFontSizeForCardsEdit;
|
QSpinBox maxFontSizeForCardsEdit;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "message_log_widget.h"
|
#include "message_log_widget.h"
|
||||||
|
mCardCounters->clear();
|
||||||
|
|
||||||
#include "../client/sound_engine.h"
|
#include "../client/sound_engine.h"
|
||||||
#include "../client/translate_counter_name.h"
|
#include "../client/translate_counter_name.h"
|
||||||
|
|
@ -609,16 +610,15 @@ void MessageLogWidget::logSetCardCounter(Player *player, QString cardName, int c
|
||||||
QString finalStr;
|
QString finalStr;
|
||||||
int delta = abs(oldValue - value);
|
int delta = abs(oldValue - value);
|
||||||
if (value > oldValue) {
|
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 {
|
} 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();
|
auto &cardCounterSettings = SettingsCache::instance().cardCounters();
|
||||||
appendHtmlServerMessage(finalStr.arg(sanitizeHtml(player->getName()))
|
appendHtmlServerMessage(finalStr.arg(sanitizeHtml(player->getName()))
|
||||||
.arg("<font class=\"blue\">" + QString::number(delta) + "</font>")
|
.arg("<font class=\"blue\">" + QString::number(delta) + "</font>")
|
||||||
.arg(locale.toLower(cardCounterSettings.displayName(counterId)))
|
.arg(cardCounterSettings.displayName(counterId))
|
||||||
.arg(cardLink(std::move(cardName)))
|
.arg(cardLink(std::move(cardName)))
|
||||||
.arg(value));
|
.arg(value));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,22 +40,16 @@ QColor CardCounterSettings::color(int counterId) const
|
||||||
|
|
||||||
QString CardCounterSettings::displayName(int counterId) const
|
QString CardCounterSettings::displayName(int counterId) const
|
||||||
{
|
{
|
||||||
// These are hardcoded for now. They should become configurable at some
|
// Currently, card counters name are fixed to A, B, ..., Z, AA, AB, ...
|
||||||
// point.
|
|
||||||
switch (counterId) {
|
auto nChars = 1 + counterId / 26;
|
||||||
case 0:
|
QString str;
|
||||||
return tr("Red");
|
str.resize(nChars);
|
||||||
case 1:
|
|
||||||
return tr("Yellow");
|
for (auto it = str.rbegin(); it != str.rend(); ++it) {
|
||||||
case 2:
|
*it = QChar('A' + (counterId) % 26);
|
||||||
return tr("Green");
|
counterId /= 26;
|
||||||
case 3:
|
|
||||||
return tr("Cyan");
|
|
||||||
case 4:
|
|
||||||
return tr("Purple");
|
|
||||||
case 5:
|
|
||||||
return tr("Magenta");
|
|
||||||
default:
|
|
||||||
return QString(tr("Custom %1")).arg(counterId - 5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -274,58 +274,58 @@ private:
|
||||||
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Sideboard Lock"),
|
ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Sideboard Lock"),
|
||||||
parseSequenceString("Ctrl+Shift+B"),
|
parseSequenceString("Ctrl+Shift+B"),
|
||||||
ShortcutGroup::Game_Lobby)},
|
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(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Card_Counters)},
|
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(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Card_Counters)},
|
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(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Card_Counters)},
|
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(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Card_Counters)},
|
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(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Card_Counters)},
|
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(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Card_Counters)},
|
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(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Card_Counters)},
|
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(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Card_Counters)},
|
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(""),
|
parseSequenceString(""),
|
||||||
ShortcutGroup::Card_Counters)},
|
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+>"),
|
parseSequenceString("Ctrl+>"),
|
||||||
ShortcutGroup::Card_Counters)},
|
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+<"),
|
parseSequenceString("Ctrl+<"),
|
||||||
ShortcutGroup::Card_Counters)},
|
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+?"),
|
parseSequenceString("Ctrl+?"),
|
||||||
ShortcutGroup::Card_Counters)},
|
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+."),
|
parseSequenceString("Ctrl+."),
|
||||||
ShortcutGroup::Card_Counters)},
|
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+,"),
|
parseSequenceString("Ctrl+,"),
|
||||||
ShortcutGroup::Card_Counters)},
|
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+/"),
|
parseSequenceString("Ctrl+/"),
|
||||||
ShortcutGroup::Card_Counters)},
|
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+."),
|
parseSequenceString("Alt+."),
|
||||||
ShortcutGroup::Card_Counters)},
|
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+,"),
|
parseSequenceString("Alt+,"),
|
||||||
ShortcutGroup::Card_Counters)},
|
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+/"),
|
parseSequenceString("Alt+/"),
|
||||||
ShortcutGroup::Card_Counters)},
|
ShortcutGroup::Card_Counters)},
|
||||||
{"Player/aInc", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Life Counter"),
|
{"Player/aInc", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Add Life Counter"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue