Wireshark 4.7.0
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:

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
timerOwnerReceives flash-clear timers.
anchorAny cell in the row to stamp; the helper walks sibling cells in the same row.
changedTrue 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
stackSelectionLevelThe 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
specThe watch specification to clear baselines for.

◆ observeVariablesParent()

bool LuaDebuggerChangeHighlightTracker::observeVariablesParent ( const QString &  parentKey)

Variables-tree counterpart to observeWatchChildParent.

Parameters
parentKeyThe 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
variablesKeyThe key identifying the variable.
valueThe current string value.
parentVisitedTrue 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
rootKeyThe composite key identifying the watch root.
parentPathThe 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
rootKeyThe composite key identifying the watch root.
childPathThe path of the child value.
valueThe current string value.
parentVisitedTrue 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
rootKeyThe composite key identifying the watch root.
valueThe 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
watchModelPointer 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
watchTreePointer to the watch tree view to derive palette properties from.
paletteFallbackPointer 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
activeTrue 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
levelThe stack level to set.

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