|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
Watch panel: column layout, expand/collapse tracking + lazy fill, runtime expansion-state map, and context menu. Inline edits to top-level rows enter via commitWatchRootSpec, which the delegate calls through the commit callback set in attach. More...
#include <lua_debugger_watch.h>
Public Slots | |
| void | onExpanded (const QModelIndex &index) |
Records the expansion of the item at index in the runtime expansion map. | |
| void | onCollapsed (const QModelIndex &index) |
Records the collapse of the item at index in the runtime expansion map. | |
| void | showContextMenu (const QPoint &pos) |
| Displays the watch row context menu at the given viewport position. | |
Public Member Functions | |
| LuaDebuggerWatchController (LuaDebuggerDialog *host) | |
| Constructs the watch controller bound to the given dialog host. | |
| void | attach (QTreeView *tree, QStandardItemModel *model) |
| Bind the tree + model and wire all watch-internal signals (typed LuaDbgWatchTreeWidget gestures, expand/collapse, context menu, inline-edit delegate, and the model/selection signals that drive the header buttons attached via attachHeaderButtons). Cross-panel concerns (variables ↔ watch sync) stay with the dialog. | |
| void | attachHeaderButtons (QToolButton *remove, QToolButton *removeAll) |
| Bind the section-header strip. Click signals are wired here; enable/disable state tracks the model and selection. Safe to call before or after attach. | |
| void | configureColumns () const |
| Configures column widths, resize modes, and visibility for the watch tree. | |
| void | pruneExpansionMap () |
| Drop expansion-map entries for watch specs no longer in the tree. | |
| void | restoreExpansionState () |
| Re-expand persisted subpaths after refilling roots from settings. | |
| QStringList | expandedSubpathsForSpec (const QString &rootSpec) const |
Look up expanded descendant keys for rootSpec (may be empty). | |
| void | refillChildren (QStandardItem *item) |
Re-query and replace all children of item. Used by the lazy-expand path and by refreshBranch after pause / step. | |
| void | refreshDisplay () |
| Refresh value/type (and expansion affordances) for all watch roots, recursing into already-expanded branches. Safe to call when no watches exist or when the debugger is not paused (rows fall back to a muted placeholder). | |
| void | refreshBranch (QStandardItem *item) |
Re-evaluate one expanded branch depth-first; preserves the controller-tracked expansion state of nested rows. No-op when item is null or its branch is collapsed. | |
| void | applyItemState (QStandardItem *item, bool liveContext, const QString &muted) |
Apply the per-row presentation for item given the current liveness context. Reads the row state, then dispatches to the matching LuaDebuggerWatchRowPresenter apply* method (the presenter owns cell text / icons / tooltips / change-highlight stamping). | |
| void | insertNewRow (const QString &initialSpec=QString(), bool openEditor=true) |
Insert a top-level watch row; optionally open the inline editor. An empty initialSpec creates a "pending new" row. Otherwise the spec must be a Variables-style path (see wslua_debugger_watch_spec_uses_path_resolution). Duplicates of an existing spec just scroll to the existing row. | |
| void | commitWatchRootSpec (QStandardItem *item, const QString &text) |
| Apply the user's edit of a top-level watch row's expression. | |
| void | deleteRows (const QList< QStandardItem * > &items) |
| Delete the given top-level watch rows from the tree. Children, non-top-level rows and stale pointers are silently ignored. Drops change-highlight baselines for the now-orphaned specs. | |
| void | removeAllTopLevelItems () |
| Confirm with the user, then remove every top-level row. | |
| void | copyValueForItem (QStandardItem *item, const QModelIndex &ix) |
Copy the (untruncated when paused) value of item to the clipboard; shared between the row context menu and the keyboard shortcut. | |
| void | duplicateRootItem (QStandardItem *item) |
Duplicate top-level watch row item below itself. | |
| QList< QStandardItem * > | selectedRootItemsForRemove () const |
| Top-level watch rows in the current selection (column 0) only; used by the section header Remove control. No currentIndex fallback, so the button does not act on a non-selected row. | |
| void | serializeTo (QVariantMap &settingsMap) |
Snapshot the live watch tree as a flat array of canonical spec strings into settingsMap (at the Watches key). Per-row expansion, editor origin, and other runtime state are tracked in QStandardItem data roles only and are not persisted. Also prunes the runtime expansion map to specs that survive in the tree. | |
| void | restoreFrom (const QVariantMap &settingsMap) |
Replace the watch tree with the contents of Watches in settingsMap. Empty / container-typed entries are dropped; scalar values are kept as expression watches even if they are not valid Lua (the next refresh will surface the error). Wipes all watch baselines (variables baselines are kept) so the first refresh starts clean. | |
| void | scheduleDeferredPlaceholder () |
| Schedule a deferred "Watch column shows —" placeholder paint after a step resume. | |
| void | invalidatePlaceholder () |
Cancel the deferred placeholder by bumping the epoch. Call from handlePause() so the imminent refresh wins over a pending post-resume placeholder. | |
Watch panel: column layout, expand/collapse tracking + lazy fill, runtime expansion-state map, and context menu. Inline edits to top-level rows enter via commitWatchRootSpec, which the delegate calls through the commit callback set in attach.
|
explicit |
Constructs the watch controller bound to the given dialog host.
| host | The parent debugger dialog that owns this controller. |
| void LuaDebuggerWatchController::applyItemState | ( | QStandardItem * | item, |
| bool | liveContext, | ||
| const QString & | muted | ||
| ) |
Apply the per-row presentation for item given the current liveness context. Reads the row state, then dispatches to the matching LuaDebuggerWatchRowPresenter apply* method (the presenter owns cell text / icons / tooltips / change-highlight stamping).
| item | The item to update. |
| liveContext | True if the debugger is currently paused and values are available. |
| muted | Placeholder string to display when values are unavailable. |
| void LuaDebuggerWatchController::attach | ( | QTreeView * | tree, |
| QStandardItemModel * | model | ||
| ) |
Bind the tree + model and wire all watch-internal signals (typed LuaDbgWatchTreeWidget gestures, expand/collapse, context menu, inline-edit delegate, and the model/selection signals that drive the header buttons attached via attachHeaderButtons). Cross-panel concerns (variables ↔ watch sync) stay with the dialog.
| tree | The tree view to bind. |
| model | The standard item model backing the tree. |
| void LuaDebuggerWatchController::attachHeaderButtons | ( | QToolButton * | remove, |
| QToolButton * | removeAll | ||
| ) |
Bind the section-header strip. Click signals are wired here; enable/disable state tracks the model and selection. Safe to call before or after attach.
| remove | The Remove Selected button. |
| removeAll | The Remove All button. |
| void LuaDebuggerWatchController::commitWatchRootSpec | ( | QStandardItem * | item, |
| const QString & | text | ||
| ) |
Apply the user's edit of a top-level watch row's expression.
Empty text removes the row (or discards a pending-new row); too-long text shows a warning and is rejected; otherwise the spec is committed, change-highlight baselines for the old and new specs are dropped, and the row is refreshed. Bound to the inline-editor delegate via the commit callback set in @ref attach.
| item | The top-level item being edited. |
| text | The new expression text entered by the user. |
| void LuaDebuggerWatchController::copyValueForItem | ( | QStandardItem * | item, |
| const QModelIndex & | ix | ||
| ) |
Copy the (untruncated when paused) value of item to the clipboard; shared between the row context menu and the keyboard shortcut.
| item | The item whose value is to be copied. |
| ix | The model index of the item. |
| void LuaDebuggerWatchController::deleteRows | ( | const QList< QStandardItem * > & | items | ) |
Delete the given top-level watch rows from the tree. Children, non-top-level rows and stale pointers are silently ignored. Drops change-highlight baselines for the now-orphaned specs.
| items | The list of top-level items to delete. |
| void LuaDebuggerWatchController::duplicateRootItem | ( | QStandardItem * | item | ) |
Duplicate top-level watch row item below itself.
| item | The top-level item to duplicate. |
| QStringList LuaDebuggerWatchController::expandedSubpathsForSpec | ( | const QString & | rootSpec | ) | const |
Look up expanded descendant keys for rootSpec (may be empty).
| rootSpec | The canonical spec string of the root watch row to query. |
| void LuaDebuggerWatchController::insertNewRow | ( | const QString & | initialSpec = QString(), |
| bool | openEditor = true |
||
| ) |
Insert a top-level watch row; optionally open the inline editor. An empty initialSpec creates a "pending new" row. Otherwise the spec must be a Variables-style path (see wslua_debugger_watch_spec_uses_path_resolution). Duplicates of an existing spec just scroll to the existing row.
| initialSpec | The expression or path to watch, or empty to create a pending row. |
| openEditor | If true, immediately opens the inline editor on the new row. |
|
slot |
Records the collapse of the item at index in the runtime expansion map.
| index | The model index of the item that was collapsed. |
|
slot |
Records the expansion of the item at index in the runtime expansion map.
| index | The model index of the item that was expanded. |
| void LuaDebuggerWatchController::refillChildren | ( | QStandardItem * | item | ) |
Re-query and replace all children of item. Used by the lazy-expand path and by refreshBranch after pause / step.
| item | The parent item whose children are to be refilled. |
| void LuaDebuggerWatchController::refreshBranch | ( | QStandardItem * | item | ) |
Re-evaluate one expanded branch depth-first; preserves the controller-tracked expansion state of nested rows. No-op when item is null or its branch is collapsed.
| item | The root item of the branch to refresh. |
| void LuaDebuggerWatchController::restoreFrom | ( | const QVariantMap & | settingsMap | ) |
Replace the watch tree with the contents of Watches in settingsMap. Empty / container-typed entries are dropped; scalar values are kept as expression watches even if they are not valid Lua (the next refresh will surface the error). Wipes all watch baselines (variables baselines are kept) so the first refresh starts clean.
| settingsMap | The map containing previously serialized watch specs. |
| void LuaDebuggerWatchController::scheduleDeferredPlaceholder | ( | ) |
Schedule a deferred "Watch column shows —" placeholder paint after a step resume.
Bumps an internal epoch and posts a single-shot timer; if a new pause arrives within WATCH_PLACEHOLDER_DEFER_MS, the next call to invalidatePlaceholder bumps the epoch again and the still-pending timer becomes a no-op. Without this defer step a typical fast single-step produces a visible value→—→value blink in every Watch row even when the value did not change.
| QList< QStandardItem * > LuaDebuggerWatchController::selectedRootItemsForRemove | ( | ) | const |
Top-level watch rows in the current selection (column 0) only; used by the section header Remove control. No currentIndex fallback, so the button does not act on a non-selected row.
| void LuaDebuggerWatchController::serializeTo | ( | QVariantMap & | settingsMap | ) |
Snapshot the live watch tree as a flat array of canonical spec strings into settingsMap (at the Watches key). Per-row expansion, editor origin, and other runtime state are tracked in QStandardItem data roles only and are not persisted. Also prunes the runtime expansion map to specs that survive in the tree.
| settingsMap | The map to write the serialized watch specs into. |
|
slot |
Displays the watch row context menu at the given viewport position.
| pos | The position (in tree viewport coordinates) at which to show the menu. |