Cockatrice/cockatrice/src/interface/widgets/quick_settings/settings_button_widget.h
Lukas Brübach fa5133071d [Icons] Migrate UI glyphs to palette-token SVGs
Runtime inversion is not a theming system: it rotates hue, breaks duotone art
and mishandles alpha, and a QPixmap snapshot cannot follow a palette change.
Redraw the top-level UI glyph set on a 24x24 grid with `currentColor` as the
paint token, drop Inkscape/Sodipodi cruft, and delete the icons whose metaphor
was duplicated (cogwheel/gear -> settings, scale_balanced -> scales,
update.png -> reload).

Load the glyphs through `loadThemedIcon` so the engine resolves the token from
the palette on every request, and let `themePixmap` use the same resolution for
one-shot pixmaps. `loadColorAdjustedPixmap` is gone; every caller now keeps a
QIcon, which `SettingsButtonWidget::setButtonIcon` accepts instead of a QPixmap.

Content art (mana, counters, countries) keeps its authored colors.

Add a render test covering aspect ratio, palette flips, icon modes and
high-DPI pixmaps.
2026-11-04 18:29:28 +01:00

56 lines
1.1 KiB
C++

/**
* @file settings_button_widget.h
* @ingroup Widgets
* @ingroup Settings
*/
//! \todo Document this file.
#ifndef SETTINGS_BUTTON_WIDGET_H
#define SETTINGS_BUTTON_WIDGET_H
#include <QString>
#include <QWidget>
#include <qtmetamacros.h>
class QHBoxLayout;
class QIcon;
class QToolButton;
class SettingsPopupWidget;
class SettingsButtonWidget : public QWidget
{
Q_OBJECT
public:
explicit SettingsButtonWidget(QWidget *parent = nullptr);
~SettingsButtonWidget() override;
void addSettingsWidget(QWidget *toAdd) const;
void removeSettingsWidget(QWidget *toRemove) const;
void setButtonIcon(const QIcon &icon);
void setButtonText(const QString &buttonText);
void setCompact(bool compact);
bool isCompact() const
{
return compact;
}
protected:
void mousePressEvent(QMouseEvent *event) override;
private slots:
void togglePopup();
void onPopupClosed() const;
private:
QHBoxLayout *layout;
QToolButton *button;
QString buttonText;
bool compact;
public:
SettingsPopupWidget *popup;
};
#endif // SETTINGS_BUTTON_WIDGET_H