mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 17:15:09 -07:00
[AppColors] Address review comments
- PaletteEditorDialog::onSave(): compare whole PaletteConfig (colors and appColors) so a change to only AccentStrong/AccentSoft writes the file; add PaletteConfig::operator==. - appColor(): derive both roles from QPalette::Highlight unconditionally. The Fusion palettes pin Accent to near-Window values, and QPalette::Accent only exists on Qt 6.6+, so keying on it made identical themes render very differently across Qt versions. - themeChangedSlot(): merge the theme default's [AppColors] into a custom palette that predates the section instead of all-or-nothing per file; hasPalette() now counts an appColors-only file as a palette. - Add Default/palette-default-light.toml so the Default theme's Light scheme keeps the classic greens instead of falling back to the OS accent. - home_widget: restore the isBuiltInTheme() half of the Automatic condition; non-built-in themes extract button colors from their own background art. - palette_grid_widget: use appEnum.value(i) for the role cast (3 sites), append appHeader to headerLabels, fix the 'Lighted' typo.
This commit is contained in:
parent
03684bf41d
commit
7549f9c2cf
7 changed files with 107 additions and 19 deletions
|
|
@ -49,7 +49,7 @@ static const QMap<QPalette::ColorRole, const char *> ROLE_DESCRIPTIONS = {
|
|||
|
||||
static const QMap<AppColor::Role, const char *> APP_ROLE_DESCRIPTIONS = {
|
||||
{AppColor::AccentStrong, QT_TR_NOOP("Vivid primary accent (e.g. home-tab button gradient start)")},
|
||||
{AppColor::AccentSoft, QT_TR_NOOP("Lighted, desaturated accent (e.g. home-tab button gradient end)")},
|
||||
{AppColor::AccentSoft, QT_TR_NOOP("Lightened, desaturated accent (e.g. home-tab button gradient end)")},
|
||||
};
|
||||
|
||||
PaletteGridWidget::PaletteGridWidget(QWidget *parent) : QWidget(parent)
|
||||
|
|
@ -144,9 +144,10 @@ void PaletteGridWidget::buildGrid(QWidget *host)
|
|||
appHeader->setAutoFillBackground(true);
|
||||
appHeader->setContentsMargins(4, 4, 4, 4);
|
||||
grid->addWidget(appHeader, appHeaderRow, 0, 1, 4);
|
||||
headerLabels.append(appHeader);
|
||||
|
||||
for (int i = 0; i < appEnum.keyCount(); ++i) {
|
||||
auto role = static_cast<AppColor::Role>(i);
|
||||
auto role = static_cast<AppColor::Role>(appEnum.value(i));
|
||||
const int row = appHeaderRow + 1 + i;
|
||||
|
||||
if (i % 2 == 0) {
|
||||
|
|
@ -215,7 +216,7 @@ void PaletteGridWidget::loadPalette(const PaletteConfig &cfg)
|
|||
|
||||
QMetaEnum appEnum = QMetaEnum::fromType<AppColor::Role>();
|
||||
for (int i = 0; i < appEnum.keyCount(); ++i) {
|
||||
auto role = static_cast<AppColor::Role>(i);
|
||||
auto role = static_cast<AppColor::Role>(appEnum.value(i));
|
||||
QColor color = cfg.appColors.value(role);
|
||||
if (!color.isValid()) {
|
||||
color = themeManager->appColor(role);
|
||||
|
|
@ -235,7 +236,7 @@ PaletteConfig PaletteGridWidget::currentPaletteConfig() const
|
|||
|
||||
QMetaEnum appEnum = QMetaEnum::fromType<AppColor::Role>();
|
||||
for (int i = 0; i < appEnum.keyCount(); ++i) {
|
||||
auto role = static_cast<AppColor::Role>(i);
|
||||
auto role = static_cast<AppColor::Role>(appEnum.value(i));
|
||||
cfg.appColors[role] = appColorButtons[role]->getColor();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue