Cockatrice 2026-09-01-Development-3.1.0-beta.10
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 <QDialog>
7#include <QFrame>
8#include <QMap>
9
10class QTimer;
11
12class QLabel;
13class QComboBox;
14class QDialogButtonBox;
15class QPushButton;
17class QuickSetupPanel;
18
19class PaletteEditorDialog : public QDialog
20{
21 Q_OBJECT
22public:
23 explicit PaletteEditorDialog(const QString &themeDirPath, const QString &themeName, QWidget *parent = nullptr);
24 void loadSchemes();
25
26private slots:
27 void onSave();
28 void onApply();
29 void onReset();
30 void onRevertToDefault();
31 void onSchemeChanged(const QString &scheme);
32 void onGenerateFromAccent(const QColor &accent, int intensity);
33
34private:
35 void setupUi();
36 void retranslateUi();
38 void loadScheme(const QString &scheme); // snapshot current, switch, load
39 void seedAccentFromScheme(const QString &scheme);
40
41 // Sub-widgets
42 QWidget *header;
43 QLabel *titleLabel;
44 QLabel *editingLabel;
47 QPushButton *paletteGridToggleButton = nullptr;
48 QFrame *paletteGridSeparator = nullptr;
49 QWidget *footer;
50 QComboBox *schemeComboBox = nullptr;
51 QDialogButtonBox *buttonBox = nullptr;
52 QPushButton *resetBtn = nullptr;
53 QPushButton *saveBtn = nullptr;
54 QPushButton *closeBtn = nullptr;
55 QPushButton *revertButton = nullptr;
56
57 // State
58 QString themeDirPath;
59 QString themeName;
60 QString loadedScheme;
61 // Directory writes are directed to; may differ from themeDirPath when the
62 // latter is read-only (e.g. a built-in / system theme directory).
63 QString saveDir;
64
65 QMap<QString, PaletteConfig> workingConfig;
66 QMap<QString, PaletteConfig> savedConfig;
67
68 QTimer *autoApplyTimer = nullptr;
69
70protected:
71 void changeEvent(QEvent *e) override;
72};
73
74#endif // COCKATRICE_PALETTE_EDITOR_DIALOG_H
PaletteGridWidget * paletteGrid
Definition palette_editor_dialog.h:46
void onGenerateFromAccent(const QColor &accent, int intensity)
Definition palette_editor_dialog.cpp:269
QuickSetupPanel * quickSetupPanel
Definition palette_editor_dialog.h:45
void changeEvent(QEvent *e) override
Definition palette_editor_dialog.cpp:373
void seedAccentFromScheme(const QString &scheme)
Definition palette_editor_dialog.cpp:249
QWidget * footer
Definition palette_editor_dialog.h:49
void loadSchemes()
Definition palette_editor_dialog.cpp:223
QLabel * editingLabel
Definition palette_editor_dialog.h:44
QTimer * autoApplyTimer
Definition palette_editor_dialog.h:68
void retranslateUi()
Definition palette_editor_dialog.cpp:198
QPushButton * saveBtn
Definition palette_editor_dialog.h:53
QLabel * titleLabel
Definition palette_editor_dialog.h:43
QDialogButtonBox * buttonBox
Definition palette_editor_dialog.h:51
QMap< QString, PaletteConfig > workingConfig
Definition palette_editor_dialog.h:65
QString themeName
Definition palette_editor_dialog.h:59
void onReset()
Definition palette_editor_dialog.cpp:333
QMap< QString, PaletteConfig > savedConfig
Definition palette_editor_dialog.h:66
QPushButton * closeBtn
Definition palette_editor_dialog.h:54
void onApply()
Definition palette_editor_dialog.cpp:276
void onSave()
Definition palette_editor_dialog.cpp:281
QPushButton * paletteGridToggleButton
Definition palette_editor_dialog.h:47
void refreshChromePalettes()
Definition palette_editor_dialog.cpp:382
QString themeDirPath
Definition palette_editor_dialog.h:58
void setupUi()
Definition palette_editor_dialog.cpp:75
void onSchemeChanged(const QString &scheme)
Definition palette_editor_dialog.cpp:257
QString saveDir
Definition palette_editor_dialog.h:63
void loadScheme(const QString &scheme)
QFrame * paletteGridSeparator
Definition palette_editor_dialog.h:48
QString loadedScheme
Definition palette_editor_dialog.h:60
QComboBox * schemeComboBox
Definition palette_editor_dialog.h:50
QPushButton * resetBtn
Definition palette_editor_dialog.h:52
PaletteEditorDialog(const QString &themeDirPath, const QString &themeName, QWidget *parent=nullptr)
Definition palette_editor_dialog.cpp:40
QPushButton * revertButton
Definition palette_editor_dialog.h:55
void onRevertToDefault()
Definition palette_editor_dialog.cpp:340
QWidget * header
Definition palette_editor_dialog.h:42
Definition palette_grid_widget.h:17
Provides a compact "Quick Setup" interface for generating theme palettes.
Definition quick_setup_panel.h:28