|
Wireshark 5.1.0
The Wireshark network protocol analyzer
|
#include <theme_preview_widget.h>
Signals | |
| void | showColoringRulesChanged (bool show) |
| void | layerPicked (const ThemePreviewPick::Layer &layer) |
| void | pickMenuRequested (QMenu *menu, QAction *before, const QList< ThemePreviewPick::Layer > &layers) |
| void | childDialogClosed () |
Public Member Functions | |
| ThemePreviewWidget (QWidget *parent=nullptr) | |
| void | setPreviewColors (const QHash< ThemeManager::ThemeToken, QColor > &colors, bool declaresWindow=false) |
| void | setShowColoringRules (bool show) |
| void | setPreviewFonts (const QFont ®ular, const QFont &monospace) |
| bool | showColoringRules () const |
| ThemePreviewPicker & | picker () |
Static, hand-painted 3-pane mockup of a Wireshark capture window (filter bar + packet list + details/bytes). Used by the Font and Colors preferences page to show the user what the selected theme looks like before the change is committed.
The widget never reads from the live ThemeManager except as a fallback. Callers push a token → color hash via setPreviewColors() whenever the selection changes; missing entries fall back to the live ThemeManager value so the widget always paints something.
|
signal |
A dialog opened from the context menu was closed.
|
signal |
The user clicked a spot; layer has NoRole when it has no theme color.
|
inline |
Click-to-pick support, off by default. While on, a pickable spot shows a hand cursor, a left click emits layerPicked() and the context menu offers the colors of the spot.
|
signal |
Emitted synchronously before the context menu opens, only while picking is enabled. Receivers insert color actions before before.
| void ThemePreviewWidget::setPreviewColors | ( | const QHash< ThemeManager::ThemeToken, QColor > & | colors, |
| bool | declaresWindow = false ) |
Replaces the preview's color table. Triggers a repaint.
| colors | token → resolved QColor map, typically obtained from ThemeManager::previewTheme(). Passing an empty hash is valid — every lookup will fall back to the live ThemeManager. |
| declaresWindow | whether the previewed theme declares palette.window, as reported by ThemeManager::previewTheme(). When true the faux title bar is tinted with the previewed window color. |
| void ThemePreviewWidget::setPreviewFonts | ( | const QFont & | regular, |
| const QFont & | monospace ) |
Paints the preview with regular and monospace instead of the application fonts from FontManager, so a font choice that is not applied yet can be shown. Repaints only when the fonts change.
| void ThemePreviewWidget::setShowColoringRules | ( | bool | show | ) |
Toggles overlaying the live coloring rules on the sample packet rows.
Off by default: the preview shows theme colors only — the base background plus the selection / marked / ignored state tokens. When on, each sample row is tinted with the matching rule from the user's current color-filter set, looked up by rule name (e.g. "TCP", "HTTP", "Bad TCP"); rows whose rule is disabled or absent keep their theme color, and the state tokens still take precedence. The rule set is snapshotted at the moment it is enabled, not re-read on every repaint.
Also reachable from the right-click menu; setting it emits showColoringRulesChanged() so an external control (e.g. a checkbox on the preferences page) can stay in sync with the menu toggle.