| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Public Member Functions | List of all members
LuaDebuggerChangeHighlightTracker Class Reference

"Value changed since last pause" highlighter for the Watch and Variables trees. More...

`#include <lua_debugger_utils.h>`

## Public Member Functions
| LuaDebuggerChangeHighlightTracker ()=default
| Constructs a default LuaDebuggerChangeHighlightTracker.
void | refreshChangedValueBrushes (QTreeView *watchTree, QWidget *paletteFallback)
| Refreshes the brushes used for changed values based on the application palette.
void | snapshotBaselinesOnPauseEntry ()
| Snapshots the current values to baseline on a new pause entry.
void | updatePauseEntryFrameIdentity ()
| Updates the identity of the current frame on pause entry.
void | setPauseEntryStackLevel (int level)
| Sets the stack level for the pause entry.
void | setPauseEntryRefresh (bool active)
| Toggle the pause-entry refresh flag. The dialog turns it on for the duration of the pause-entry refresh sequence (so changed rows get the one-shot row flash on top of the persistent bold accent) and off again afterwards.
void | applyChangedVisuals (QObject *timerOwner, QStandardItem *anchor, bool changed)
| Stamp the `anchor` row with the change visuals; isPauseEntryRefresh_ is consulted internally so callers no longer have to thread it through.
void | clearAllChangeBaselines ()
| Clears all change baselines for watches and variables.
void | clearWatchBaselines ()
| Wipe watch-side baselines (root + child value maps and visited-parent sets). Variables-tree maps are kept; they are not tied to watch specs and remain valid across watch list rebuilds.
void | clearChangeBaselinesForWatchSpec (const QString &spec)
| Clears change baselines for a specific watch specification.
void | pruneChangeBaselinesToLiveWatchSpecs (QStandardItemModel *watchModel)
| Prunes baselines to keep only those present in the live watch specs.
bool | changeHighlightAllowed (int stackSelectionLevel) const
| Checks if change highlighting is allowed for a given stack level.
bool | observeWatchRootValue (const QString &rootKey, const QString &value)
| Record the latest `value` for a watch root keyed by the composite `rootKey`. Returns `true` if the new value differs from the previous baseline (a brand-new row never reads as changed).
bool | observeWatchChildParent (const QString &rootKey, const QString &parentPath)
| Record `parentPath` as a visited parent in the watch-child visited-parents set keyed by `rootKey`. Returns `true` if the same parent was visited at the previous pause; `false` on first-time expansion. Used as the `flashNew` gate for child rows.
bool | observeWatchChildValue (const QString &rootKey, const QString &childPath, const QString &value, bool parentVisited)
| Record the latest `value` for a watch-child row at `rootKey/`childPath`.` `parentVisited` is the result of observeWatchChildParent for the matching parent and gates the "child appeared since last pause" branch.
bool | observeVariablesParent (const QString &parentKey)
| Variables-tree counterpart to observeWatchChildParent.
bool | observeVariablesValue (const QString &variablesKey, const QString &value, bool parentVisited)
| Variables-tree counterpart to observeWatchChildValue.

## Detailed Description

"Value changed since last pause" highlighter for the Watch and Variables trees.

Owns five related concerns:

- Baseline / current value maps for watch roots, watch children, and variables rows; rotated on pause entry via snapshotBaselinesOnPauseEntry.
- Visited-parent companion sets so a "first child appears under an already-visited parent" event reads as a real change instead of the more common "first-time expansion" case.
- The "is this paint inside a pause-entry refresh?" gate that decides whether changes get the one-shot row-flash on top of the persistent bold-accent.
- The frame-identity check (pauseEntryFrame0MatchesPrev_) that suppresses the cue across calls / returns when the same numeric stack level points at a different Lua function than at the previous pause.
- The accent + flash brushes themselves, derived from the active palette in refreshChangedValueBrushes.

Callers do not poke at the baseline / current hashes directly; the `observe*` helpers update the current map and return whether the new value differs from baseline (also taking the parent-visited gate into account where appropriate). Then applyChangedVisuals stamps the row with the matching visuals using the current pause-entry flag.

That contract intentionally hides `isPauseEntryRefresh_` and the value maps from the rest of the dialog so the controllers stay focused on "which row, which value" instead of "which map, which gate".

## Member Function Documentation

## ◆ applyChangedVisuals()

void LuaDebuggerChangeHighlightTracker::applyChangedVisuals | ( | QObject * | timerOwner,
|  | QStandardItem * | anchor,
|  | bool | changed )

Stamp the `anchor` row with the change visuals; isPauseEntryRefresh_ is consulted internally so callers no longer have to thread it through.

Parameters

  timerOwner | Receives flash-clear timers.
  anchor | Any cell in the row to stamp; the helper walks sibling cells in the same row.
  changed | True if the value differs from baseline (typically obtained from one of the `observe*` helpers).

## ◆ changeHighlightAllowed()

bool LuaDebuggerChangeHighlightTracker::changeHighlightAllowed | ( | int | stackSelectionLevel | ) | const

Checks if change highlighting is allowed for a given stack level.

Parameters

  stackSelectionLevel | The stack level currently selected.

Returns
  True if highlights are allowed, false otherwise.

## ◆ clearChangeBaselinesForWatchSpec()

void LuaDebuggerChangeHighlightTracker::clearChangeBaselinesForWatchSpec | ( | const QString & | spec | ) |

Clears change baselines for a specific watch specification.

Parameters

  spec | The watch specification to clear baselines for.

## ◆ observeVariablesParent()

bool LuaDebuggerChangeHighlightTracker::observeVariablesParent | ( | const QString & | parentKey | ) |

Variables-tree counterpart to observeWatchChildParent.

Parameters

  parentKey | The key of the variables tree parent.

Returns
  True if the parent was visited in the previous baseline, false otherwise.

## ◆ observeVariablesValue()

bool LuaDebuggerChangeHighlightTracker::observeVariablesValue | ( | const QString & | variablesKey,
|  | const QString & | value,
|  | bool | parentVisited )

Variables-tree counterpart to observeWatchChildValue.

Parameters

  variablesKey | The key identifying the variable.
  value | The current string value.
  parentVisited | True if the parent was previously visited.

Returns
  True if the variable value changed or newly appeared, false otherwise.

## ◆ observeWatchChildParent()

bool LuaDebuggerChangeHighlightTracker::observeWatchChildParent | ( | const QString & | rootKey,
|  | const QString & | parentPath )

Record `parentPath` as a visited parent in the watch-child visited-parents set keyed by `rootKey`. Returns `true` if the same parent was visited at the previous pause; `false` on first-time expansion. Used as the `flashNew` gate for child rows.

Parameters

  rootKey | The composite key identifying the watch root.
  parentPath | The path of the parent to observe.

Returns
  True if the parent was visited in the previous baseline, false otherwise.

## ◆ observeWatchChildValue()

bool LuaDebuggerChangeHighlightTracker::observeWatchChildValue | ( | const QString & | rootKey,
|  | const QString & | childPath,
|  | const QString & | value,
|  | bool | parentVisited )

Record the latest `value` for a watch-child row at `rootKey/`childPath`.` `parentVisited` is the result of observeWatchChildParent for the matching parent and gates the "child appeared since last pause" branch.

Parameters

  rootKey | The composite key identifying the watch root.
  childPath | The path of the child value.
  value | The current string value.
  parentVisited | True if the parent was previously visited.

Returns
  True if the child value changed or newly appeared, false otherwise.

## ◆ observeWatchRootValue()

bool LuaDebuggerChangeHighlightTracker::observeWatchRootValue | ( | const QString & | rootKey,
|  | const QString & | value )

Record the latest `value` for a watch root keyed by the composite `rootKey`. Returns `true` if the new value differs from the previous baseline (a brand-new row never reads as changed).

Parameters

  rootKey | The composite key identifying the watch root.
  value | The current string value.

Returns
  True if the value differs from baseline, false otherwise.

## ◆ pruneChangeBaselinesToLiveWatchSpecs()

void LuaDebuggerChangeHighlightTracker::pruneChangeBaselinesToLiveWatchSpecs | ( | QStandardItemModel * | watchModel | ) |

Prunes baselines to keep only those present in the live watch specs.

Parameters

  watchModel | Pointer to the current watch model containing live specs.

## ◆ refreshChangedValueBrushes()

void LuaDebuggerChangeHighlightTracker::refreshChangedValueBrushes | ( | QTreeView * | watchTree,
|  | QWidget * | paletteFallback )

Refreshes the brushes used for changed values based on the application palette.

Parameters

  watchTree | Pointer to the watch tree view to derive palette properties from.
  paletteFallback | Pointer to a fallback widget to use if watchTree is unavailable.

## ◆ setPauseEntryRefresh()

void LuaDebuggerChangeHighlightTracker::setPauseEntryRefresh | ( | bool | active | ) |
| inline

Toggle the pause-entry refresh flag. The dialog turns it on for the duration of the pause-entry refresh sequence (so changed rows get the one-shot row flash on top of the persistent bold accent) and off again afterwards.

Parameters

  active | True to enable the pause-entry refresh state, false to disable.

## ◆ setPauseEntryStackLevel()

void LuaDebuggerChangeHighlightTracker::setPauseEntryStackLevel | ( | int | level | ) |
| inline

Sets the stack level for the pause entry.

Parameters

  level | The stack level to set.

The documentation for this class was generated from the following files:

- /builds/wireshark/wireshark/ui/qt/lua_debugger/lua_debugger_utils.h
- /builds/wireshark/wireshark/ui/qt/lua_debugger/lua_debugger_utils.cpp