[Game] Add hover zoom and a tabbed card panel to the board (#7700)

* [Settings] Add hover zoom/panel triggers, delays, and double-confirm

* [Game] Smooth board hover-zoom with fade helpers

* [Game] Add hover card panel with tabbed actions

* [Game] Wire hover zoom/panel triggers through the scene

* [Game] Repaint cached zones when the hover zoom moves

`TableZone` cuts the hovered card out of its own paint so zone washes,
indicators, dimming and the land divider never draw over the zoom. It is a
`DeviceCoordinateCache` item, so the card changing geometry never dirtied it
and the stale hole stayed transparent, uncovering the black viewport as soon
as the zoom crossed a zone edge.

- Emit `hoverFootprintChanged(old, new)` from `setCardScale()` and once from
  `setHovered(false)`.
- Repaint every overlapping `TableZone` on that signal.
- Clip with the card's painted outline instead of its bounding rectangle, and
  treat a zoom covering the whole zone as "paint nothing".

* [Interface] Keep the hover panel P/T controls out of the way

The P/T set/inc/dec rows were always visible and sat under the cursor, so
clicking a card to select it could mutate its P/T instead.

- Collapse the controls to a pill on the printed P/T box, anchored on the
  drawn artwork so letterboxed and sideways cards stay aligned.
- Open the rows only from the pill and grow them upward, and re-measure the
  pill on every value so three-digit P/T does not clip.
- Close the panel when another card is hovered, and repaint the area it
  covered so no patch is left behind.

* [Interface] Address hover panel review findings

* [Game] Fix include order flagged by the format gate

The card hover widget header was included before theme_manager.h, which
clang-format rejects; the branch's format CI job failed on it.

* [Interface] Load the hover panel icons through the themed icon engine

The panel still named pre-#7595 assets (arrow_*_green, arrow_right_blue,
cogwheel) and built QIcon snapshots from themePixmap(), so the deleted names
rendered blank and every other glyph froze one palette.

Load every glyph through loadThemedIcon() with the emphasis axis the adoption
plan calls for: the category tabs take the primary level as panel wayfinding,
the action grid the quiet level because its glyphs label the button text.
Semantic tints keep their family and follow the same quiet level; Clone keeps
its sticker treatment.

* [Icons] Add an Informational semantic color family

Face-down play and the exile zone are states that are neither a gain nor a
loss, and the pre-#7595 art painted them blue (arrow_right_blue). #7595 dropped
that hue, and the icon engine has had only Positive and Negative since, so both
states fall back to neutral ink.

Add the family with the same three-level ladder the other semantic roles use:
authored roles per theme, scheme defaults otherwise, an emphasis mapping, the
palette-editor rows and the generator seed. The defaults clear the 4.5:1 label
floor on both schemes and the ladder's saturation ordering; the existing
emphasis, hue and preview tests now cover the new family. Preview sheets that
name roles resolve an unauthored one through the same default the client
paints.

* [Interface] Split the hover panel icons by emphasis and semantics

Category tabs only navigate between pages, so they take the quiet level; the
action grid is the surface the player works in and takes the primary level. Both
stay line glyphs: a filled treatment reads as a second state on every cell.

Hue marks an outcome where the glyph cannot. Play, clone and to hand are
Positive; reduce life and graveyard Negative; play face down and exile
Informational. Direction-only moves (top and bottom of library) stay neutral
because the arrow already carries the meaning.

* [Icons] Add Hidden and Marked semantic color families

Two game concepts had no hue of their own. Hidden information (a face-down
play, peeking at a card face) now has violet, and the marks a player leaves on a
card (annotation, draw arrow) now share amber instead of splitting blue and red
for the same job.

Both families follow the existing three-level ladder: authored roles per theme,
scheme defaults otherwise, an emphasis mapping, palette-editor rows and generator
seeding. The defaults clear the 4.5:1 floor on the representative platform
surfaces and keep the saturation ordering the emphasis tests assert; the hue
tests pin violet's blue-red-green dominance and amber's red-green-blue one, and
every preview sheet now renders the two families.

The hover panel grid preview is added alongside: it renders the real pages
(section headers, two-column cells, glyph over label) so the whole map can be
judged at once instead of glyph by glyph.

* [Icons] Add a Movement semantic color family

A card changing position inside the library is neither a gain, a loss nor
information, so it had no hue. Movement names it with teal and covers the three
library placements (top, bottom, X from top).

It follows the existing ladder: authored roles per theme, scheme defaults
otherwise, an emphasis mapping, palette-editor rows and generator seeding. The
defaults clear the 4.5:1 floor on the representative platform surfaces, keep
strong > base > soft saturation, and keep green > blue > red so teal cannot be
mistaken for the green gain family.

* [Interface] Give every hover panel action a semantic color

The quick actions are the panel's whole point, so a neutral glyph made the
most-used buttons the hardest to scan. Every action now names a game fact with
its hue: gain, loss, information, hidden information, a mark on the card or a
move. The line glyph stays identical, so the colour is the only difference
between neighbours.

The grid is also ordered by family so a row reads as one idea: the two state
toggles, the two gains, the two marks, the two hidden-information actions and
the two losses each share a row. Conditional actions (Peek, Unattach) sit at the
end of their pair, so a missing one leaves a hole at the section edge instead of
splitting a row. In a zone, Play and Play Face Down stay adjacent on purpose:
the same action, one of them hiding information. The move tab leads with the
three library placements (Movement), then the destinations.

actionGridIcon is removed; semanticActionIcon is now the only grid ink. The
preview renders the real pages so the whole map can be judged at once.

* [Icons] Use quiet emphasis for glyphs that label rather than act

The search and info glyphs inside the search fields, and the combo-box
chevron, label or afford an action rather than performing one. At the
default secondary weight they compete with the actual controls next to
them. Paint them at quiet emphasis so they stay legible without claiming
attention.

Sites: deck editor, visual database display, visual deck storage, set
manager, settings search, in-game zone view, and the dropdown chevron.

* [Icons] Restore sticker treatment to the add, remove and delete actions

The pre-#7595 add and delete glyphs were filled shapes with an outline.
After the line migration they read as ordinary toolbar glyphs, losing the
weight their verbs had. Give the add and delete family the sticker
treatment again.

- Deck editor Add card: primary positive sticker. It is the one action
  the database panel exists for.
- Visual database Clear filters: negative sticker, matching the delete
  family.
- Filter dock Clear all: negative sticker, matching Clear one.

* [Icons] Give sharing and pinning their semantic families

Sharing is an informational act: the app already tints reveal and
make-public with the informational family, so the deck storage share
action, the replay share-code action and the visual deck storage share
button follow it.

The printing-selector pin badge marks a card as pinned. Paint it with the
marked family, the same one used for a mark left on a card, instead of
leaving it neutral.

* [Game] Dismiss the hover panel before opening a modal dialog

The hover panel is a Qt::ToolTip window, i.e. a popup: it is always on
top and holds the input grab. Actions on the panel that open a modal
dialog (Set power/toughness, Set annotation, Set counter value, token
creation) therefore opened the dialog behind the panel, where it could
not be seen or activated.

Hide the panel synchronously and defer the action to the next event-loop
turn, so the popup grab is released before the dialog's event loop
starts. The panel asks the scene to dismiss it through a new
dismissRequested signal, keeping hover timers and the covered-card fade
on the scene's side.

Reported from the P/T overlay SET button; the same path covers the
counter tab and the token tab.

* [Icons] Refine VDE and VDD emphasis and semantics

The visual database filter section and the syntax help are information
aids, so paint them with the informational family at the default
emphasis: the filter section glyph and the search field's help glyph.
The help glyph leaves quiet emphasis because it is a clickable action,
not a field label.

The visual deck editor's display-type toggle is the one control that
changes the whole view, so it takes primary emphasis.

The search glyphs stay quiet; only the help action changes.

* [Icons] Raise the visual database filter controls to primary

The six quick-filter buttons are the controls the filter section exists
for, so paint them at primary emphasis instead of the default weight.

The sort glyph carries the same informational family as the filter
glyph, in both the visual database toolbar label and the visual deck
editor's sort-criteria button.

* [Icons] Keep the display options sort glyph neutral

The sort button beside the display-mode toggle is not part of the
informational family. Only the visual database toolbar's sort glyph
carries informational; the display options button returns to the
default neutral weight.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-11-08 21:51:31 +01:00 • committed by GitHub
parent 6138fbd0a0
commit b1c8f156dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 3796 additions and 76 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,231 @@
/**
* @file card_hover_widget.h
* @ingroup CardWidgets
* @brief Hover popup: zoomed picture plus a vertical icon nav strip beside stacked action pages.
*
* The board card smooth-zooms first; this panel then swaps in over it with oracle
* text and every right-click action, grouped by topic.
*/
#ifndef CARDHOVERWIDGET_H
#define CARDHOVERWIDGET_H
#include <QCursor>
#include <QFrame>
#include <QPointer>
#include <QRect>
#include <QSize>
#include <QTransform>
#include <functional>
#include <libcockatrice/card/printing/exact_card.h>
class CardInfoPictureWidget;
class CardInfoTextWidget;
class CardItem;
class CardState;
class PlayerGraphicsItem;
class QVBoxLayout;
class QHBoxLayout;
class QPushButton;
class QToolButton;
class QButtonGroup;
class QStackedWidget;
class QIcon;
class QLabel;
class QLineEdit;
class QEnterEvent;
class QHideEvent;
class QPropertyAnimation;
class QResizeEvent;
class QTimer;
class CardHoverWidget : public QFrame
{
Q_OBJECT
public:
explicit CardHoverWidget(QWidget *parent = nullptr);
void setCard(CardItem *card, PlayerGraphicsItem *player);
void clearCard();
bool hasCard() const;
CardItem *getCardItem() const
{
return currentCard;
}
void positionNextTo(const QRectF &cardSceneRect, const QTransform &viewportTransform, const QWidget *viewport);
void showAnimated();
void hideAnimated();
/** @brief True while the panel is fading out towards a hide. */
bool isClosing() const;
/** @brief Refreshes the PT, counter, and annotation labels from the current card. */
void refreshDisplay();
bool isMouseOverWidget() const
{
return rect().contains(mapFromGlobal(QCursor::pos()));
}
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
void changeEvent(QEvent *event) override;
void enterEvent(QEnterEvent *event) override;
void leaveEvent(QEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
void hideEvent(QHideEvent *event) override;
signals:
void hoverEntered();
void hoverLeft();
/** @brief Asks the scene to dismiss the panel before a modal dialog opens. */
void dismissRequested();
private slots:
void onCardChanged();
void onCardDestroyed();
void applyThemeStyle();
private:
QPointer<CardItem> currentCard;
QPointer<PlayerGraphicsItem> currentPlayer;
ExactCard shownCard;
// Which side of the card the panel ended up on (drives the image-adjacent layout flip)
bool popupOnRight = true;
// Viewport area the panel covered at its last placement; used to repaint what the
// overlay window uncovers when it moves or hides.
QRect lastViewportRect;
// Coalesces rapid state-change bursts into a single refresh
QTimer *refreshTimer;
// Card image area (kept on the card-adjacent side) with overlaid controls
QHBoxLayout *mainLayout;
QWidget *imageContainer;
CardInfoPictureWidget *pic;
// Name bar overlay (top of card image)
QWidget *nameBarOverlay;
QLabel *nameLabel;
QLineEdit *nameEdit;
QLabel *annotationLabel;
// P/T overlay (bottom-right of card image): a compact value pill at rest that
// lifts its control rows out of itself while the P/T area is hovered.
QWidget *ptOverlay;
QWidget *ptControls;
QLabel *ptPillLabel;
bool ptExpanded = false;
QSize ptCompactSize;
QSize ptFullSize;
QLabel *ptPowerLabel;
QLabel *ptToughLabel;
QPushButton *btnIncP;
QPushButton *btnDecP;
QPushButton *btnIncT;
QPushButton *btnDecT;
QPushButton *btnSetPT;
QPushButton *btnResetPT;
// Vertical icon nav strip plus stacked content pages (no nested tab bars)
QWidget *sideBar;
QLabel *navNameLabel;
QToolButton *navInfoBtn;
QToolButton *navMainBtn;
QToolButton *navMoveBtn;
QToolButton *navCounterBtn;
QToolButton *navTokenBtn;
QButtonGroup *navGroup;
QStackedWidget *contentStack;
QWidget *infoPage;
QWidget *mainPage;
QWidget *movePage;
QWidget *counterPage;
QWidget *tokenPage;
QVBoxLayout *infoPageLayout;
QVBoxLayout *mainPageLayout;
QVBoxLayout *movePageLayout;
QVBoxLayout *counterPageLayout;
QVBoxLayout *tokenPageLayout;
CardInfoTextWidget *text;
// Window fade (sole reveal animation: per-layer opacity effects flashed black
// on scroll areas, so the whole panel fades as one)
QPropertyAnimation *fadeIn;
QPropertyAnimation *fadeOut;
void createImageArea();
void createNameBarOverlay();
void createPTOverlay();
void createNavBar();
QToolButton *createNavButton(const QString &title, const QIcon &icon, int pageIndex);
void createContentStack();
QWidget *makeStackPage(QVBoxLayout *&layout);
void showPage(int index);
/**
* @brief Dismisses the panel, then runs an action that opens a modal dialog.
*
* A Qt::ToolTip window is always on top and holds the input grab, so a modal
* dialog opened from inside the panel lands behind it and cannot be
* activated. Hide the panel synchronously, then defer the action so the grab
* is released before the dialog's event loop starts.
*/
void runModalAction(const std::function<void()> &action);
QLabel *createSectionHeader(const QString &text, QWidget *parent);
QLabel *createNoteLabel(const QString &text, QWidget *parent);
void connectCardSignals();
void disconnectCardSignals();
void scheduleRefresh();
void rebuildActionsForZone();
/** @brief Whether the local player may edit the current card (own card, judge, writable zone). */
bool canModifyCurrentCard() const;
void buildMainTab(const QList<CardState *> &cardList, const QString &zoneName, bool canModify);
void buildMoveTab(const QList<CardState *> &cardList, const QString &zoneName, bool canModify);
void buildCounterTab(const QList<CardState *> &cardList, const QString &zoneName, bool canModify);
void buildTokenTab(CardItem *card, bool canModify);
void addRelatedViewButtons(QVBoxLayout *layout);
void updatePTDisplay();
void positionOverlays();
/** @brief Shows/hides the P/T control rows; the value pill stays at the bottom. */
void setPTExpanded(bool expanded);
/** @brief Anchors the pill on the printed P/T box, or the expanded stack above it. */
void applyPTOverlayGeometry();
/** @brief Resting pill geometry, in @c imageContainer coordinates. */
QRect compactPillRect() const;
/** @brief Pill plus halo: the only area that opens the rows, in @c pic coordinates. */
QRect ptOpenRegion() const;
/** @brief Bottom-right band the rows stay open in (never opens them), in @c pic coordinates. */
QRect ptHoverRegion() const;
/** @brief True while the cursor is over the overlay or the printed P/T area. */
bool isCursorOverPTArea() const;
/** @brief Re-measures the resting pill from its current text. */
QSize measureCompactPTSize() const;
/** @brief Repaints the viewport area this window covers and the one it just left. */
void invalidateCoveredArea();
void clearLayout(QLayout *layout);
QPushButton *createOverlayButton(const QString &text, const QString &tooltip, const std::function<void()> &slot);
QToolButton *createGridButton(const QString &text,
const QIcon &icon,
const std::function<void()> &slot,
QWidget *parent,
const QString &tooltip = QString());
QPushButton *createSmallButton(const QString &text, const std::function<void()> &slot, QWidget *parent = nullptr);
QPushButton *createSmallButton(const QString &text,
const QString &tooltip,
const std::function<void()> &slot,
QWidget *parent = nullptr);
};
#endif // CARDHOVERWIDGET_H

View file

@ -175,6 +175,8 @@ void CardInfoPictureWidget::setScaleFactor(const int scale)
void CardInfoPictureWidget::updatePixmap()
{
pixmapDirty = true;
// The artwork rect belongs to the pixmap that is about to be loaded.
artRectCache = QRect();
update();
}
@ -252,6 +254,24 @@ void CardInfoPictureWidget::paintEvent(QPaintEvent *event)
// Draw the pre-scaled pixmap directly
painter.drawPixmap(targetRect, finalPixmap);
if (targetRect != artRectCache) {
artRectCache = targetRect;
// Overlays anchored on the artwork (rather than the widget) re-position on this.
emit artRectChanged();
}
}
/**
* @brief Rect of the drawn artwork inside this widget.
*
* Mirrors the target rect paintEvent() computes: the pixmap scaled with KeepAspectRatio and
* centred, after the optional sideways-layout rotation. Falls back to rect() until the first
* paint, which is the right answer for the usual portrait card.
*/
QRect CardInfoPictureWidget::artRect() const
{
return artRectCache.isEmpty() ? rect() : artRectCache;
}
/**

View file

@ -41,6 +41,14 @@ public:
return exactCard;
}
[[nodiscard]] QSize sizeHint() const override;
/**
* @brief Rect of the drawn artwork inside this widget.
*
* The pixmap is scaled with KeepAspectRatio and centred, and sideways-layout cards may be
* rotated, so this is usually smaller than rect(). Callers that overlay the picture (rather
* than the widget) must anchor on this. Falls back to rect() until the first paint.
*/
[[nodiscard]] QRect artRect() const;
/**
* @brief The size a card picture has at @p scaleFactor percent.
@ -60,6 +68,8 @@ signals:
void cardScaleFactorChanged(int _scale);
void cardChanged(const ExactCard &card);
void cardClicked(QMouseEvent *event, const ExactCard &card);
/** @brief Emitted when the drawn artwork rect changes (size, scale factor, rotation, card). */
void artRectChanged();
protected:
void resizeEvent(QResizeEvent *event) override;
@ -83,6 +93,8 @@ private:
double scaleFactor = 100;
QPixmap resizedPixmap;
bool pixmapDirty;
/// Last drawn artwork rect, in widget coordinates; empty until the first paint.
QRect artRectCache;
bool hoverToZoomEnabled;
bool raiseOnEnter;

View file

@ -40,8 +40,10 @@ DeckEditorDatabaseDisplayWidget::DeckEditorDatabaseDisplayWidget(QWidget *parent
searchEdit->setObjectName("searchEdit");
searchEdit->setPlaceholderText(tr("Search by card name (or search expressions)"));
searchEdit->setClearButtonEnabled(true);
searchEdit->addAction(loadThemedIcon(QStringLiteral("icons/search")), QLineEdit::LeadingPosition);
auto help = searchEdit->addAction(loadThemedIcon(QStringLiteral("icons/info")), QLineEdit::TrailingPosition);
searchEdit->addAction(loadThemedIcon(QStringLiteral("icons/search"), IconTint::quiet()),
QLineEdit::LeadingPosition);
auto help = searchEdit->addAction(loadThemedIcon(QStringLiteral("icons/info"), IconTint::quiet()),
QLineEdit::TrailingPosition);
setFocusProxy(searchEdit);
setFocusPolicy(Qt::ClickFocus);
@ -83,7 +85,8 @@ DeckEditorDatabaseDisplayWidget::DeckEditorDatabaseDisplayWidget(QWidget *parent
&DeckEditorDatabaseDisplayWidget::onRelatedCardClicked);
aAddCard = new QAction(QString(), this);
aAddCard->setIcon(loadThemedIcon(QStringLiteral("icons/arrow_right"), AppColor::Positive));
aAddCard->setIcon(loadThemedIcon(QStringLiteral("icons/arrow_right"),
IconTint(AppColor::Positive, IconEmphasis::Primary), IconStyle::Sticker));
connect(aAddCard, &QAction::triggered, this, &DeckEditorDatabaseDisplayWidget::actAddCardToMainDeck);
auto *tbAddCard = new QToolButton(this);
tbAddCard->setDefaultAction(aAddCard);

View file

@ -68,7 +68,8 @@ void DeckEditorFilterDockWidget::createFiltersDock()
connect(aClearFilterOne, &QAction::triggered, this, &DeckEditorFilterDockWidget::actClearFilterOne);
aClearFilterAll = new QAction(QString(), this);
aClearFilterAll->setIcon(loadThemedIcon(QStringLiteral("icons/clearsearch")));
aClearFilterAll->setIcon(
loadThemedIcon(QStringLiteral("icons/clearsearch"), AppColor::Negative, IconStyle::Sticker));
connect(aClearFilterAll, &QAction::triggered, this, &DeckEditorFilterDockWidget::actClearFilterAll);
auto *filterDelOne = new QToolButton();

View file

@ -89,7 +89,8 @@ WndSets::WndSets(QWidget *parent) : QMainWindow(parent)
searchField = new LineEditUnfocusable;
searchField->setObjectName("searchEdit");
searchField->setPlaceholderText(tr("Search by set name, code, type, or release date"));
searchField->addAction(loadThemedIcon(QStringLiteral("icons/search")), LineEditUnfocusable::LeadingPosition);
searchField->addAction(loadThemedIcon(QStringLiteral("icons/search"), IconTint::quiet()),
LineEditUnfocusable::LeadingPosition);
searchField->setClearButtonEnabled(true);
setFocusProxy(searchField);

View file

@ -135,7 +135,8 @@ void SettingsView::setupUi()
// Search bar
searchEdit = new QLineEdit;
searchEdit->setClearButtonEnabled(true);
searchEdit->addAction(loadThemedIcon(QStringLiteral("icons/search")), QLineEdit::LeadingPosition);
searchEdit->addAction(loadThemedIcon(QStringLiteral("icons/search"), IconTint::quiet()),
QLineEdit::LeadingPosition);
searchEdit->installEventFilter(this);
connect(searchEdit, &QLineEdit::textChanged, this, &SettingsView::onSearchTextChanged);
searchEdit->setObjectName("settingsSearchEdit");

View file

@ -430,7 +430,8 @@ static QPixmap composePinBadgePixmap(const QSize &logicalSize, qreal devicePixel
// Inset the glyph so the backdrop reads as a badge around it, not as a border.
const int inset = qRound(logicalSize.width() * 0.16);
const QSize glyphSize = logicalSize - QSize(inset * 2, inset * 2);
const QPixmap glyph = loadThemedIcon(QStringLiteral("icons/pin")).pixmap(glyphSize, devicePixelRatio);
const QPixmap glyph =
loadThemedIcon(QStringLiteral("icons/pin"), AppColor::Marked).pixmap(glyphSize, devicePixelRatio);
if (glyph.isNull()) {
// Let the caller fall back to the textual badge instead of drawing an empty panel.
return QPixmap();

View file

@ -28,6 +28,14 @@ enum visualDeckStoragePromptForConversionIndex
visualDeckStoragePromptForConversionIndexAlways
};
// A corrupt or out-of-range stored trigger would otherwise select index -1 and leave
// the row half-hidden; clamp it back into the known trigger range.
static int clampHoverTrigger(int trigger)
{
return qBound(static_cast<int>(CardsDisplaySettings::HoverPanelTriggerHover), trigger,
static_cast<int>(CardsDisplaySettings::HoverPanelTriggerOff));
}
UserInterfaceSettingsPage::UserInterfaceSettingsPage()
{
// general settings
@ -154,6 +162,68 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
animationGroupBox = new QGroupBox;
animationGroupBox->setLayout(animationGrid);
// hover panel settings
hoverZoomTriggerSelector.addItem(QString());
hoverZoomTriggerSelector.addItem(QString());
hoverZoomTriggerSelector.addItem(QString());
hoverZoomTriggerSelector.addItem(QString());
hoverZoomTriggerSelector.addItem(QString());
hoverZoomTriggerSelector.setCurrentIndex(
clampHoverTrigger(SettingsCache::instance().cardsDisplay().getHoverZoomTrigger()));
connect(&hoverZoomTriggerSelector, &QComboBox::currentIndexChanged, &SettingsCache::instance().cardsDisplay(),
&CardsDisplaySettings::setHoverZoomTrigger);
hoverPanelTriggerSelector.addItem(QString());
hoverPanelTriggerSelector.addItem(QString());
hoverPanelTriggerSelector.addItem(QString());
hoverPanelTriggerSelector.addItem(QString());
hoverPanelTriggerSelector.addItem(QString());
hoverPanelTriggerSelector.setCurrentIndex(
clampHoverTrigger(SettingsCache::instance().cardsDisplay().getHoverPanelTrigger()));
connect(&hoverPanelTriggerSelector, &QComboBox::currentIndexChanged, &SettingsCache::instance().cardsDisplay(),
&CardsDisplaySettings::setHoverPanelTrigger);
hoverPanelDoubleConfirmCheckBox.setChecked(SettingsCache::instance().cardsDisplay().getHoverPanelDoubleConfirm());
connect(&hoverPanelDoubleConfirmCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().cardsDisplay(),
&CardsDisplaySettings::setHoverPanelDoubleConfirm);
hoverZoomDelayBox.setRange(0, 5000);
hoverZoomDelayBox.setSingleStep(50);
hoverZoomDelayBox.setSuffix(" ms");
hoverZoomDelayBox.setValue(SettingsCache::instance().cardsDisplay().getHoverZoomDelayMs());
connect(&hoverZoomDelayBox, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance().cardsDisplay(),
&CardsDisplaySettings::setHoverZoomDelayMs);
hoverPanelDelayBox.setRange(0, 5000);
hoverPanelDelayBox.setSingleStep(50);
hoverPanelDelayBox.setSuffix(" ms");
hoverPanelDelayBox.setValue(SettingsCache::instance().cardsDisplay().getHoverPanelDelayMs());
connect(&hoverPanelDelayBox, qOverload<int>(&QSpinBox::valueChanged), &SettingsCache::instance().cardsDisplay(),
&CardsDisplaySettings::setHoverPanelDelayMs);
auto *hoverPanelGrid = new QGridLayout;
hoverPanelGrid->addWidget(&hoverZoomTriggerLabel, 0, 0);
hoverPanelGrid->addWidget(&hoverZoomTriggerSelector, 0, 1);
hoverPanelGrid->addWidget(&hoverPanelTriggerLabel, 1, 0);
hoverPanelGrid->addWidget(&hoverPanelTriggerSelector, 1, 1);
hoverPanelGrid->addWidget(&hoverPanelDoubleConfirmCheckBox, 2, 0, 1, 2);
hoverPanelGrid->addWidget(&hoverZoomDelayLabel, 3, 0);
hoverPanelGrid->addWidget(&hoverZoomDelayBox, 3, 1);
hoverPanelGrid->addWidget(&hoverPanelDelayLabel, 4, 0);
hoverPanelGrid->addWidget(&hoverPanelDelayBox, 4, 1);
hoverWheelNoteLabel.setWordWrap(true);
hoverPanelGrid->addWidget(&hoverWheelNoteLabel, 5, 0, 1, 2);
connect(&hoverZoomTriggerSelector, &QComboBox::currentIndexChanged, this,
&UserInterfaceSettingsPage::updateHoverPanelUiState);
connect(&hoverPanelTriggerSelector, &QComboBox::currentIndexChanged, this,
&UserInterfaceSettingsPage::updateHoverPanelUiState);
connect(&hoverPanelDoubleConfirmCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
&UserInterfaceSettingsPage::updateHoverPanelUiState);
updateHoverPanelUiState();
hoverPanelGroupBox = new QGroupBox;
hoverPanelGroupBox->setLayout(hoverPanelGrid);
// deck editor settings
openDeckInNewTabCheckBox.setChecked(SettingsCache::instance().deckEditor().getOpenDeckInNewTab());
connect(&openDeckInNewTabCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance().deckEditor(),
@ -293,6 +363,7 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
mainLayout->addWidget(generalGroupBox);
mainLayout->addWidget(notificationsGroupBox);
mainLayout->addWidget(animationGroupBox);
mainLayout->addWidget(hoverPanelGroupBox);
mainLayout->addWidget(deckEditorGroupBox);
mainLayout->addWidget(replayGroupBox);
mainLayout->addStretch();
@ -351,6 +422,33 @@ void UserInterfaceSettingsPage::updateCommanderSpellbookUiState()
}
}
void UserInterfaceSettingsPage::updateHoverPanelUiState()
{
// Phase timers only apply to the hover trigger; double-confirm only applies when
// both phases share one trigger (repeating it).
const auto hoverTrigger = CardsDisplaySettings::HoverPanelTriggerHover;
const auto wheelTrigger = CardsDisplaySettings::HoverPanelTriggerWheel;
const auto offTrigger = CardsDisplaySettings::HoverPanelTriggerOff;
const bool zoomOnHover = hoverZoomTriggerSelector.currentIndex() == hoverTrigger;
const bool panelOnHover = hoverPanelTriggerSelector.currentIndex() == hoverTrigger;
const bool anyOff =
hoverZoomTriggerSelector.currentIndex() == offTrigger || hoverPanelTriggerSelector.currentIndex() == offTrigger;
const bool sharedTrigger =
!anyOff && hoverZoomTriggerSelector.currentIndex() == hoverPanelTriggerSelector.currentIndex();
hoverZoomDelayLabel.setVisible(zoomOnHover);
hoverZoomDelayBox.setVisible(zoomOnHover);
hoverPanelDelayLabel.setVisible(panelOnHover);
hoverPanelDelayBox.setVisible(panelOnHover);
hoverPanelDoubleConfirmCheckBox.setEnabled(sharedTrigger);
const bool panelAuto = panelOnHover && !(sharedTrigger && hoverPanelDoubleConfirmCheckBox.isChecked());
hoverPanelDelayLabel.setEnabled(panelAuto);
hoverPanelDelayBox.setEnabled(panelAuto);
// The wheel trigger consumes wheel events over cards, so the board cannot scroll there.
const bool wheelBound = hoverZoomTriggerSelector.currentIndex() == wheelTrigger ||
hoverPanelTriggerSelector.currentIndex() == wheelTrigger;
hoverWheelNoteLabel.setVisible(wheelBound);
}
void UserInterfaceSettingsPage::retranslateUi()
{
generalGroupBox->setTitle(tr("General interface settings"));
@ -380,6 +478,22 @@ void UserInterfaceSettingsPage::retranslateUi()
lifeCounterAnimationsCheckBox.setText(tr("Life counter flash"));
battlefieldFlashCheckBox.setText(tr("Battlefield flash on damage"));
hoverPanelGroupBox->setTitle(tr("Hover panel settings"));
hoverPanelTriggerLabel.setText(tr("Show the card panel on:"));
hoverZoomTriggerLabel.setText(tr("Zoom the card on:"));
for (auto *selector : {&hoverPanelTriggerSelector, &hoverZoomTriggerSelector}) {
selector->setItemText(CardsDisplaySettings::HoverPanelTriggerHover, tr("Hover"));
selector->setItemText(CardsDisplaySettings::HoverPanelTriggerRightClick, tr("Right-click"));
selector->setItemText(CardsDisplaySettings::HoverPanelTriggerWheel, tr("Mouse wheel"));
selector->setItemText(CardsDisplaySettings::HoverPanelTriggerShortcut, tr("Keyboard shortcut"));
selector->setItemText(CardsDisplaySettings::HoverPanelTriggerOff, tr("Off"));
}
hoverPanelDoubleConfirmCheckBox.setText(tr("Zoom first; repeat the action to show the panel"));
hoverZoomDelayLabel.setText(tr("Time before the zoom kicks in:"));
hoverPanelDelayLabel.setText(tr("Time before the tab panel shows up:"));
hoverWheelNoteLabel.setText(
tr("Note: the mouse wheel action replaces board scrolling over cards; scroll up to zoom back out."));
deckEditorGroupBox->setTitle(tr("Deck editor/storage settings"));
openDeckInNewTabCheckBox.setText(tr("Open deck in new tab by default"));
visualDeckEditorShowCardCountsCheckBox.setText(tr("Show card counts in Visual Deck Editor"));

View file

@ -22,6 +22,7 @@ private slots:
void enableAllAnimations();
void disableAllAnimations();
void updateCommanderSpellbookUiState();
void updateHoverPanelUiState();
private:
QCheckBox doubleClickToPlayCheckBox;
@ -47,6 +48,17 @@ private:
QCheckBox lifeCounterAnimationsCheckBox;
QCheckBox battlefieldFlashCheckBox;
QLabel hoverPanelTriggerLabel;
QComboBox hoverPanelTriggerSelector;
QLabel hoverZoomTriggerLabel;
QComboBox hoverZoomTriggerSelector;
QCheckBox hoverPanelDoubleConfirmCheckBox;
QLabel hoverZoomDelayLabel;
QSpinBox hoverZoomDelayBox;
QLabel hoverPanelDelayLabel;
QSpinBox hoverPanelDelayBox;
QLabel hoverWheelNoteLabel;
QCheckBox openDeckInNewTabCheckBox;
QLabel visualDeckStoragePromptForConversionLabel;
QComboBox visualDeckStoragePromptForConversionSelector;
@ -69,6 +81,7 @@ private:
QGroupBox *generalGroupBox;
QGroupBox *notificationsGroupBox;
QGroupBox *animationGroupBox;
QGroupBox *hoverPanelGroupBox;
QGroupBox *deckEditorGroupBox;
QGroupBox *replayGroupBox;

View file

@ -223,7 +223,7 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor,
connect(aDeleteRemoteDeck, &QAction::triggered, this, &TabDeckStorage::actDeleteRemoteDeck);
aShareDecks = new QAction(this);
aShareDecks->setIcon(loadThemedIcon(QStringLiteral("icons/share")));
aShareDecks->setIcon(loadThemedIcon(QStringLiteral("icons/share"), AppColor::Informational));
connect(aShareDecks, &QAction::triggered, this, &TabDeckStorage::actShareDecks);
aPublishDeck = new QAction(this);

View file

@ -222,7 +222,7 @@ QGroupBox *TabReplays::createRightLayout()
loadThemedIcon(QStringLiteral("icons/remove_row"), AppColor::Negative, IconStyle::Sticker));
connect(aDeleteRemoteReplay, &QAction::triggered, this, &TabReplays::actDeleteRemoteReplay);
aGetReplayCode = new QAction(this);
aGetReplayCode->setIcon(loadThemedIcon(QStringLiteral("icons/share")));
aGetReplayCode->setIcon(loadThemedIcon(QStringLiteral("icons/share"), AppColor::Informational));
connect(aGetReplayCode, &QAction::triggered, this, &TabReplays::actGetReplayCode);
aSubmitReplayCode = new QAction(this);

View file

@ -46,13 +46,15 @@ VisualDatabaseDisplayFilterToolbarWidget::VisualDatabaseDisplayFilterToolbarWidg
sortGroupBox = new QGroupBox(this);
filterGroupBox = new QGroupBox(this);
auto scalePixmap = [](const QString &prefix) { return loadThemedIcon(prefix).pixmap({20, 20}); };
auto scalePixmap = [](const QString &prefix, const IconTint &tint = {}) {
return loadThemedIcon(prefix, tint).pixmap({20, 20});
};
sortByLabel = new QLabel(this);
sortByLabel->setPixmap(scalePixmap("icons/sort_arrow_down"));
sortByLabel->setPixmap(scalePixmap("icons/sort_arrow_down", AppColor::Informational));
filterByLabel = new QLabel(this);
filterByLabel->setPixmap(scalePixmap("icons/filter"));
filterByLabel->setPixmap(scalePixmap("icons/filter", AppColor::Informational));
sortColumnCombo = new QComboBox(this);
sortColumnCombo->setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy::AdjustToContents);
@ -90,22 +92,23 @@ VisualDatabaseDisplayFilterToolbarWidget::VisualDatabaseDisplayFilterToolbarWidg
});
quickFilterSaveLoadWidget = new SettingsButtonWidget(this);
quickFilterSaveLoadWidget->setButtonIcon(loadThemedIcon(QStringLiteral("icons/floppy_disk")));
quickFilterSaveLoadWidget->setButtonIcon(loadThemedIcon(QStringLiteral("icons/floppy_disk"), IconTint::primary()));
quickFilterNameWidget = new SettingsButtonWidget(this);
quickFilterNameWidget->setButtonIcon(loadThemedIcon(QStringLiteral("icons/pen_to_square")));
quickFilterNameWidget->setButtonIcon(loadThemedIcon(QStringLiteral("icons/pen_to_square"), IconTint::primary()));
quickFilterMainTypeWidget = new SettingsButtonWidget(this);
quickFilterMainTypeWidget->setButtonIcon(loadThemedIcon(QStringLiteral("icons/circle_half_stroke")));
quickFilterMainTypeWidget->setButtonIcon(
loadThemedIcon(QStringLiteral("icons/circle_half_stroke"), IconTint::primary()));
quickFilterSubTypeWidget = new SettingsButtonWidget(this);
quickFilterSubTypeWidget->setButtonIcon(loadThemedIcon(QStringLiteral("icons/dragon")));
quickFilterSubTypeWidget->setButtonIcon(loadThemedIcon(QStringLiteral("icons/dragon"), IconTint::primary()));
quickFilterSetWidget = new SettingsButtonWidget(this);
quickFilterSetWidget->setButtonIcon(loadThemedIcon(QStringLiteral("icons/scroll")));
quickFilterSetWidget->setButtonIcon(loadThemedIcon(QStringLiteral("icons/scroll"), IconTint::primary()));
quickFilterFormatLegalityWidget = new SettingsButtonWidget(this);
quickFilterFormatLegalityWidget->setButtonIcon(loadThemedIcon(QStringLiteral("icons/scales")));
quickFilterFormatLegalityWidget->setButtonIcon(loadThemedIcon(QStringLiteral("icons/scales"), IconTint::primary()));
quickFilterTagWidget = new SettingsButtonWidget(this);
quickFilterTagWidget->setButtonIcon(loadThemedIcon(QStringLiteral("icons/tags")));

View file

@ -81,8 +81,10 @@ VisualDatabaseDisplayWidget::VisualDatabaseDisplayWidget(QWidget *parent,
searchEdit->setObjectName("searchEdit");
searchEdit->setPlaceholderText(tr("Search by card name (or search expressions)"));
searchEdit->setClearButtonEnabled(true);
searchEdit->addAction(loadThemedIcon(QStringLiteral("icons/search")), QLineEdit::LeadingPosition);
auto help = searchEdit->addAction(loadThemedIcon(QStringLiteral("icons/info")), QLineEdit::TrailingPosition);
searchEdit->addAction(loadThemedIcon(QStringLiteral("icons/search"), IconTint::quiet()),
QLineEdit::LeadingPosition);
auto help = searchEdit->addAction(loadThemedIcon(QStringLiteral("icons/info"), AppColor::Informational),
QLineEdit::TrailingPosition);
connect(help, &QAction::triggered, this, [this] { createSearchSyntaxHelpWindow(searchEdit); });
setFocusProxy(searchEdit);
@ -156,7 +158,7 @@ VisualDatabaseDisplayWidget::VisualDatabaseDisplayWidget(QWidget *parent,
clearFilterWidget = new QToolButton();
clearFilterWidget->setFixedSize(32, 32);
clearFilterWidget->setIcon(loadThemedIcon(QStringLiteral("icons/delete"), AppColor::Negative));
clearFilterWidget->setIcon(loadThemedIcon(QStringLiteral("icons/delete"), AppColor::Negative, IconStyle::Sticker));
connect(clearFilterWidget, &QToolButton::clicked, this, [this] {
filterModel->blockSignals(true);
filterModel->filterTree()->blockSignals(true);

View file

@ -119,11 +119,11 @@ void VisualDeckDisplayOptionsWidget::updateDisplayTypeButton()
switch (currentDisplayType) {
case DisplayType::Flat:
displayTypeButton->setButtonText(tr("Toggle Layout: Flat"));
displayTypeButton->setButtonIcon(loadThemedIcon(QStringLiteral("icons/scroll")));
displayTypeButton->setButtonIcon(loadThemedIcon(QStringLiteral("icons/scroll"), IconTint::primary()));
break;
case DisplayType::Overlap:
displayTypeButton->setButtonText(tr("Toggle Layout: Overlap"));
displayTypeButton->setButtonIcon(loadThemedIcon(QStringLiteral("icons/scales")));
displayTypeButton->setButtonIcon(loadThemedIcon(QStringLiteral("icons/scales"), IconTint::primary()));
break;
}
}

View file

@ -27,9 +27,10 @@ VisualDeckStorageSearchWidget::VisualDeckStorageSearchWidget(QWidget *parent) :
searchBar = new QLineEdit(this);
searchBar->setPlaceholderText(tr("Search by filename (or search expression)"));
searchBar->setClearButtonEnabled(true);
searchBar->addAction(loadThemedIcon(QStringLiteral("icons/search")), QLineEdit::LeadingPosition);
searchBar->addAction(loadThemedIcon(QStringLiteral("icons/search"), IconTint::quiet()), QLineEdit::LeadingPosition);
auto help = searchBar->addAction(loadThemedIcon(QStringLiteral("icons/info")), QLineEdit::TrailingPosition);
auto help = searchBar->addAction(loadThemedIcon(QStringLiteral("icons/info"), IconTint::quiet()),
QLineEdit::TrailingPosition);
connect(help, &QAction::triggered, this, [this] { createDeckSearchSyntaxHelpWindow(searchBar); });
layout->addWidget(searchBar);

View file

@ -67,7 +67,7 @@ VisualDeckStorageWidget::VisualDeckStorageWidget(QWidget *parent) : QWidget(pare
connect(refreshButton, &QPushButton::clicked, this, &VisualDeckStorageWidget::refreshIfPossible);
shareButton = new QToolButton(this);
shareButton->setIcon(loadThemedIcon(QStringLiteral("icons/share")));
shareButton->setIcon(loadThemedIcon(QStringLiteral("icons/share"), AppColor::Informational));
shareButton->setFixedSize(32, 32);
shareButton->setVisible(false);
connect(shareButton, &QPushButton::clicked, this, &VisualDeckStorageWidget::shareRequested);