Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
theme_config.h
Go to the documentation of this file.
1#ifndef COCKATRICE_THEME_CONFIG_H
2#define COCKATRICE_THEME_CONFIG_H
3
4#include <QColor>
5#include <QMap>
6#include <QPalette>
7#include <QSharedPointer>
8#include <QString>
9#include <qtmetamacros.h>
10
11// Application-specific color roles, layered on top of the fixed QPalette role
12// set. Stored in the same palette-<scheme>.toml under an [AppColors] section
13// and editable from the palette editor, so theme authors can control colors
14// beyond what Qt's palette can express.
15namespace AppColor
16{
17Q_NAMESPACE
23Q_ENUM_NS(Role)
24} // namespace AppColor
25
27{
28 QString colorScheme;
29 QString styleName;
30
31 bool isEmpty() const;
32 QString toIni() const;
33
34 static ThemeConfig fromThemeDir(const QString &themeDirPath);
35 bool save(const QString &themeDirPath) const;
36};
37
39{
42
43 bool operator==(const PaletteConfig &rhs) const
44 {
45 return colors == rhs.colors && appColors == rhs.appColors;
46 }
47 bool operator!=(const PaletteConfig &rhs) const
48 {
49 return !(*this == rhs);
50 }
51 bool hasPalette() const;
52 QString toToml() const;
53
54 static QString fileName(const QString &colorScheme);
55
56 static PaletteConfig fromFile(const QString &filePath);
57 static PaletteConfig fromScheme(const QString &themeDirPath, const QString &colorScheme);
58 static PaletteConfig fromDefault(const QString &themeDirPath, const QString &colorScheme);
59
60 QPalette apply(QPalette base) const;
61};
62
63#endif // COCKATRICE_THEME_CONFIG_H
Definition game.h:18
Definition theme_config.h:16
Role
Definition theme_config.h:19
@ AccentSoft
Definition theme_config.h:21
@ AccentStrong
Definition theme_config.h:20
Definition theme_config.h:39
bool hasPalette() const
Definition theme_config.cpp:105
static PaletteConfig fromScheme(const QString &themeDirPath, const QString &colorScheme)
Definition theme_config.cpp:272
QString toToml() const
Definition theme_config.cpp:110
static PaletteConfig fromFile(const QString &filePath)
Definition theme_config.cpp:170
bool operator!=(const PaletteConfig &rhs) const
Definition theme_config.h:47
QMap< AppColor::Role, QColor > appColors
Definition theme_config.h:41
static QString fileName(const QString &colorScheme)
Definition theme_config.cpp:165
static PaletteConfig fromDefault(const QString &themeDirPath, const QString &colorScheme)
Definition theme_config.cpp:281
bool operator==(const PaletteConfig &rhs) const
Definition theme_config.h:43
QMap< QPalette::ColorGroup, QMap< QPalette::ColorRole, QColor > > colors
Definition theme_config.h:40
QPalette apply(QPalette base) const
Definition theme_config.cpp:298
Definition theme_config.h:27
bool isEmpty() const
Definition theme_config.cpp:16
static ThemeConfig fromThemeDir(const QString &themeDirPath)
Definition theme_config.cpp:31
bool save(const QString &themeDirPath) const
Definition theme_config.cpp:82
QString colorScheme
Definition theme_config.h:28
QString styleName
Definition theme_config.h:29
QString toIni() const
Definition theme_config.cpp:21