mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-17 16:02:14 -07:00
feat: Configurable colors for card counter
This patch adds support for: - User-defined colors for card counters; - 3 additional types of card counters. The colors used for counters is stored locally and not shared with other users. This is intentional as the feature is likely to be used for improved accessibility. In order to preserve backwards-compatibility, and because I don't have a better idea, counters keep their existing color-based names (Red, Green, Yellow) in menus and in the message log. For consistency, the new counters also get assigned color-based names (Cyan, Purple, Magenta). This choice is a compromise, as allowing user-defined names for counters raises many additional (UI/UX) questions that I don't know how to answer. A good long-term solution would be to include counter names as part of a game definition system and hence would be in scope for #1740. The choice of adding 3 additional types of counters and the Cyan, Purple and Magenta names are not random. The existing code for determining counter colors goes: Red, Green, Yellow, Cyan, Purple, Magenta, Black (unreadable) and thus 6 is the maximum number of counters that existing versions of Cockatrice are able to support. This way, released clients get a degraded experience (cannot interact with the new counters, messages in the server log say "Player X places 1 on Card (now 1)" without specifying 1 of what), but do see the counters properly. Fixes #2020
This commit is contained in:
parent
77d13090b5
commit
cb423dbfbc
12 changed files with 241 additions and 36 deletions
30
cockatrice/src/settings/card_counter_settings.h
Normal file
30
cockatrice/src/settings/card_counter_settings.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef CARD_COUNTER_SETTINGS_H
|
||||
#define CARD_COUNTER_SETTINGS_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class QSettings;
|
||||
class QColor;
|
||||
|
||||
class CardCounterSettings : public QObject
|
||||
{
|
||||
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);
|
||||
|
||||
private:
|
||||
QSettings *m_settings;
|
||||
};
|
||||
|
||||
#endif // CARD_COUNTER_SETTINGS_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue