mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-23 10:05:10 -07:00
* [PaletteEditor] Ensure directory is writeable, don't fall back to alternate palette. Took 17 minutes * [ThemeManager] Extract system theme dir path resolution to helper, use it in default palette fetching Took 8 minutes * [ThemeManager] Expose styling again Took 3 minutes * [ThemeManager] Capture app palette before theme is applied for reverting * [ThemeManager] Simply delete custom palette instead of reverting to default * [ThemeManager] Generate and apply immediately on change. * [PaletteEditor] Block grid signals during initial loading. Took 5 minutes * Address comments Took 8 minutes * Seed accent from scheme on reset and revert Took 2 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
41 lines
No EOL
1 KiB
C++
41 lines
No EOL
1 KiB
C++
#ifndef COCKATRICE_PALETTE_GRID_WIDGET_H
|
||
#define COCKATRICE_PALETTE_GRID_WIDGET_H
|
||
|
||
#include "../theme_config.h"
|
||
#include "color_button.h"
|
||
|
||
#include <QMap>
|
||
#include <QPalette>
|
||
#include <QVBoxLayout>
|
||
#include <QWidget>
|
||
|
||
class QLabel;
|
||
class QScrollArea;
|
||
// Scrollable grid of ColorButtons — one per (ColorGroup × ColorRole) cell.
|
||
// Owns the load/read round-trip for PaletteConfig but has no file I/O itself.
|
||
class PaletteGridWidget : public QWidget
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
explicit PaletteGridWidget(QWidget *parent = nullptr);
|
||
|
||
void loadPalette(const PaletteConfig &cfg);
|
||
PaletteConfig currentPaletteConfig() const;
|
||
|
||
signals:
|
||
void paletteChanged();
|
||
|
||
private:
|
||
void buildGrid(QWidget *host);
|
||
void changeEvent(QEvent *e);
|
||
void refreshChromePalettes();
|
||
|
||
QMap<QPalette::ColorGroup, QMap<QPalette::ColorRole, ColorButton *>> colorButtons;
|
||
QScrollArea *scroll;
|
||
QWidget *gridHost;
|
||
QVBoxLayout *layout;
|
||
QVector<QLabel *> headerLabels;
|
||
QVector<QWidget *> rowShadeWidgets;
|
||
};
|
||
|
||
#endif // COCKATRICE_PALETTE_GRID_WIDGET_H
|