Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
palette_editor_dialog.h
Go to the documentation of this file.
1#ifndef COCKATRICE_PALETTE_EDITOR_DIALOG_H
2#define COCKATRICE_PALETTE_EDITOR_DIALOG_H
3
4#include "../theme_config.h"
5
6#include <QColor>
7#include <QDialog>
8#include <QMap>
9#include <QString>
10#include <qtmetamacros.h>
11
12class QTimer;
13class QLabel;
14class QComboBox;
15class QDialogButtonBox;
16class QPushButton;
18class QuickSetupPanel;
19class QFrame;
20class QWidget;
21
22class PaletteEditorDialog : public QDialog
23{
24 Q_OBJECT
25public:
26 explicit PaletteEditorDialog(const QString &themeDirPath, const QString &themeName, QWidget *parent = nullptr);
27 void loadSchemes();
28
29private slots:
30 void onSave();
31 void onApply();
32 void onReset();
33 void onRevertToDefault();
34 void onSchemeChanged(const QString &scheme);
35 void onGenerateFromAccent(const QColor &accent, int intensity);
36
37private:
38 void setupUi();
39 void retranslateUi();
41 void loadScheme(const QString &scheme); // snapshot current, switch, load
42 void seedAccentFromScheme(const QString &scheme);
43
44 // Sub-widgets
45 QWidget *header;
46 QLabel *titleLabel;
47 QLabel *editingLabel;
50 QPushButton *paletteGridToggleButton = nullptr;
51 QFrame *paletteGridSeparator = nullptr;
52 QWidget *footer;
53 QComboBox *schemeComboBox = nullptr;
54 QDialogButtonBox *buttonBox = nullptr;
55 QPushButton *resetBtn = nullptr;
56 QPushButton *saveBtn = nullptr;
57 QPushButton *closeBtn = nullptr;
58 QPushButton *revertButton = nullptr;
59
60 // State
61 QString themeDirPath;
62 QString themeName;
63 QString loadedScheme;
64 // Directory writes are directed to; may differ from themeDirPath when the
65 // latter is read-only (e.g. a built-in / system theme directory).
66 QString saveDir;
67
70
71 QTimer *autoApplyTimer = nullptr;
72
73protected:
74 void changeEvent(QEvent *e) override;
75};
76
77#endif // COCKATRICE_PALETTE_EDITOR_DIALOG_H
PaletteGridWidget * paletteGrid
Definition palette_editor_dialog.h:49
void onGenerateFromAccent(const QColor &accent, int intensity)
Definition palette_editor_dialog.cpp:252
QuickSetupPanel * quickSetupPanel
Definition palette_editor_dialog.h:48
void changeEvent(QEvent *e) override
Definition palette_editor_dialog.cpp:356
void seedAccentFromScheme(const QString &scheme)
Definition palette_editor_dialog.cpp:232
QWidget * footer
Definition palette_editor_dialog.h:52
void loadSchemes()
Definition palette_editor_dialog.cpp:206
QLabel * editingLabel
Definition palette_editor_dialog.h:47
QTimer * autoApplyTimer
Definition palette_editor_dialog.h:71
void retranslateUi()
Definition palette_editor_dialog.cpp:181
QPushButton * saveBtn
Definition palette_editor_dialog.h:56
QLabel * titleLabel
Definition palette_editor_dialog.h:46
QDialogButtonBox * buttonBox
Definition palette_editor_dialog.h:54
QMap< QString, PaletteConfig > workingConfig
Definition palette_editor_dialog.h:68
QString themeName
Definition palette_editor_dialog.h:62
void onReset()
Definition palette_editor_dialog.cpp:316
QMap< QString, PaletteConfig > savedConfig
Definition palette_editor_dialog.h:69
QPushButton * closeBtn
Definition palette_editor_dialog.h:57
void onApply()
Definition palette_editor_dialog.cpp:259
void onSave()
Definition palette_editor_dialog.cpp:264
QPushButton * paletteGridToggleButton
Definition palette_editor_dialog.h:50
void refreshChromePalettes()
Definition palette_editor_dialog.cpp:365
QString themeDirPath
Definition palette_editor_dialog.h:61
void setupUi()
Definition palette_editor_dialog.cpp:58
void onSchemeChanged(const QString &scheme)
Definition palette_editor_dialog.cpp:240
QString saveDir
Definition palette_editor_dialog.h:66
void loadScheme(const QString &scheme)
QFrame * paletteGridSeparator
Definition palette_editor_dialog.h:51
QString loadedScheme
Definition palette_editor_dialog.h:63
QComboBox * schemeComboBox
Definition palette_editor_dialog.h:53
QPushButton * resetBtn
Definition palette_editor_dialog.h:55
PaletteEditorDialog(const QString &themeDirPath, const QString &themeName, QWidget *parent=nullptr)
Definition palette_editor_dialog.cpp:30
QPushButton * revertButton
Definition palette_editor_dialog.h:58
void onRevertToDefault()
Definition palette_editor_dialog.cpp:323
QWidget * header
Definition palette_editor_dialog.h:45
Definition palette_grid_widget.h:21
Definition game.h:18
Provides a compact "Quick Setup" interface for generating theme palettes.
Definition quick_setup_panel.h:29