Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Slots | Public Member Functions | List of all members
LuaDebuggerBreakpointsController Class Reference

Owns the breakpoints panel: tree wiring, model rebuild from the engine, inline edit dispatch, header strip controls, gutter menu, and persistence. More...

#include <lua_debugger_breakpoints.h>

Inheritance diagram for LuaDebuggerBreakpointsController:

Public Slots

void onItemDoubleClicked (const QModelIndex &index)
 Double-click on a breakpoint row to edit its condition.
 
void showContextMenu (const QPoint &pos)
 Show context menu for a right-click in the breakpoint tree.
 
void onItemChanged (QStandardItem *item)
 Active-checkbox toggle from the model.
 
void onModelDataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles)
 Role-based dispatch for delegate-driven inline edits.
 
void showGutterMenu (const QString &filename, qint32 line, const QPoint &globalPos)
 Show Edit/Disable/Remove popup for a click in an editor gutter.
 

Public Member Functions

 LuaDebuggerBreakpointsController (LuaDebuggerDialog *host)
 Construct the controller with a pointer to the host dialog for coordinating updates and engine access.
 
void attach (QTreeView *tree, QStandardItemModel *model)
 Bind the tree + model and wire their signals.
 
void attachHeaderButtons (QToolButton *breakOnError, QToolButton *toggleAll, QToolButton *remove, QToolButton *removeAll, QToolButton *edit, QAction *removeAllAction)
 Bind the section-header strip and its shortcut action. Wires button clicks; safe to call before or after attach.
 
void configureColumns () const
 Configure the columns in the breakpoints tree.
 
void startInlineEdit (int row)
 Focus column 2 and open the delegate editor when editable.
 
void serializeTo (QVariantMap &settingsMap) const
 Snapshot the engine breakpoint list (file/line/active + condition / hit-count / log-message) into settingsMap under the Breakpoints key. Every per-breakpoint field is written so the JSON is fully self-describing.
 
void restoreFrom (const QVariantMap &settingsMap)
 Apply the Breakpoints array from settingsMap to the engine. Missing keys fall back to the engine's defaults; an unknown hit-count mode collapses to the default FROM.
 
void refreshFromEngine ()
 Rebuild tree rows from the engine; refreshes header chrome.
 
void clearAll ()
 Confirm-and-clear all breakpoints (header / shortcut).
 
void toggleAtLine (const QString &file, qint32 line)
 Add the breakpoint at file:@p line if absent, otherwise remove it. Drives F9 in the editor, the editor right-click "Add Breakpoint" / "Remove Breakpoint" actions, and the gutter plain-click. Adding auto-enables the debugger via LuaDebuggerDialog::ensureDebuggerEnabledForActiveBreakpoints (so a fresh row is immediately effective); removing refreshes the chrome to reflect the (possibly empty) breakpoint set. Always rebuilds the breakpoint table and gutter markers.
 
void toggleOnCodeViewLine (LuaDebuggerCodeView *codeView, qint32 line)
 Convenience overload that resolves the file path from a LuaDebuggerCodeView. Silently ignores null views or sub-1 line numbers; otherwise behaves exactly like toggleAtLine.
 
void shiftToggleAtLine (const QString &file, qint32 line)
 Pre-arm a breakpoint at file:@p line — the Shift+click gutter gesture. If absent, creates the breakpoint inactive so the user can arm a line without paying the line-hook cost until they activate it; if present, flips the active flag. Does NOT auto-enable the debugger (that pairs with the F9 active-add path; pre-arm should never silently turn debugging back on). Always rebuilds the breakpoint table and gutter markers.
 
void setActiveFromUser (const QString &file, qint32 line, bool active)
 Set the active flag of an existing breakpoint at file:@p line. Used by the gutter context menu's Enable/Disable action; auto-enables the debugger when transitioning to active so the re-armed breakpoint is immediately effective. The breakpoint table's checkbox uses a different code path (onItemChanged) on purpose — it must NOT touch the core enable state because that path is reachable during a live capture. Always rebuilds the breakpoint table and gutter markers.
 
void removeAtLine (const QString &file, qint32 line)
 Remove the breakpoint at file:@p line and refresh chrome. Drives the gutter context menu's Remove action. Always rebuilds the breakpoint table and gutter markers.
 
void moveAtLine (const QString &file, qint32 fromLine, qint32 toLine)
 Move a breakpoint in file from fromLine to toLine, preserving metadata. No-op if either line is invalid, unchanged, source is absent, or destination is occupied.
 
void toggleAllActive ()
 Activate-all / deactivate-all toggle (header).
 
void updateHeaderButtonState ()
 Refresh header dot icon + button enable states.
 
bool removeRows (const QList< int > &rows)
 Remove the breakpoints in the given (deduped) model rows.
 
bool removeSelected ()
 Remove every selected breakpoint row.

 

Detailed Description

Owns the breakpoints panel: tree wiring, model rebuild from the engine, inline edit dispatch, header strip controls, gutter menu, and persistence.

The dialog only constructs the underlying widgets (model, tree, header buttons, action) and hands them to this controller via attach and attachHeaderButtons; from there every breakpoint-related slot, mutation, and chrome update lives here.

Constructor & Destructor Documentation

◆ LuaDebuggerBreakpointsController()

LuaDebuggerBreakpointsController::LuaDebuggerBreakpointsController ( LuaDebuggerDialog host)
explicit

Construct the controller with a pointer to the host dialog for coordinating updates and engine access.

Parameters
hostThe owning LuaDebuggerDialog, used to coordinate updates and access the engine. Must not be null.

Member Function Documentation

◆ attach()

void LuaDebuggerBreakpointsController::attach ( QTreeView *  tree,
QStandardItemModel *  model 
)

Bind the tree + model and wire their signals.

Parameters
treeThe QTreeView to attach.
modelThe QStandardItemModel to attach.

◆ attachHeaderButtons()

void LuaDebuggerBreakpointsController::attachHeaderButtons ( QToolButton *  breakOnError,
QToolButton *  toggleAll,
QToolButton *  remove,
QToolButton *  removeAll,
QToolButton *  edit,
QAction *  removeAllAction 
)

Bind the section-header strip and its shortcut action. Wires button clicks; safe to call before or after attach.

Parameters
breakOnErrorThe "break on error" toggle button.
toggleAllThe "toggle all active" button.
removeThe "remove selected" button.
removeAllThe "remove all" button.
editThe "edit selected" button.
removeAllActionThe "remove all" QAction, used to synchronize the enabled state with the header button.

◆ moveAtLine()

void LuaDebuggerBreakpointsController::moveAtLine ( const QString &  file,
qint32  fromLine,
qint32  toLine 
)

Move a breakpoint in file from fromLine to toLine, preserving metadata. No-op if either line is invalid, unchanged, source is absent, or destination is occupied.

Parameters
fileThe source file of the breakpoint to move.
fromLineThe current line number of the breakpoint to move.
toLineThe new line number to move the breakpoint to.

◆ onItemChanged

void LuaDebuggerBreakpointsController::onItemChanged ( QStandardItem *  item)
slot

Active-checkbox toggle from the model.

Parameters
itemThe item that changed; only triggers if the column is the Active column and the change is a user toggle of the checkbox.

◆ onItemDoubleClicked

void LuaDebuggerBreakpointsController::onItemDoubleClicked ( const QModelIndex &  index)
slot

Double-click on a breakpoint row to edit its condition.

Parameters
indexThe model index of the double-clicked cell; only the row is used, and only if the column is the Location column.

◆ onModelDataChanged

void LuaDebuggerBreakpointsController::onModelDataChanged ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight,
const QVector< int > &  roles 
)
slot

Role-based dispatch for delegate-driven inline edits.

Parameters
topLeftThe top-left index of the changed data range; only triggers if the column is the Location column and the change is a user edit of the condition string.
bottomRightThe bottom-right index of the changed data range; only triggers if the column is the Location column and the change is a user edit of the condition string.
rolesThe roles that changed; only triggers if the change includes the EditRole and excludes the BreakpointModelRole, to distinguish user edits from programmatic setData during

◆ removeAtLine()

void LuaDebuggerBreakpointsController::removeAtLine ( const QString &  file,
qint32  line 
)

Remove the breakpoint at file:@p line and refresh chrome. Drives the gutter context menu's Remove action. Always rebuilds the breakpoint table and gutter markers.

Parameters
fileThe source file of the breakpoint to remove.
lineThe line number of the breakpoint to remove.

◆ restoreFrom()

void LuaDebuggerBreakpointsController::restoreFrom ( const QVariantMap &  settingsMap)

Apply the Breakpoints array from settingsMap to the engine. Missing keys fall back to the engine's defaults; an unknown hit-count mode collapses to the default FROM.

Parameters
settingsMapThe map to read the Breakpoints array from. The caller is responsible for extracting settingsMap from the main settings under the LuaDebugger key.

◆ serializeTo()

void LuaDebuggerBreakpointsController::serializeTo ( QVariantMap &  settingsMap) const

Snapshot the engine breakpoint list (file/line/active + condition / hit-count / log-message) into settingsMap under the Breakpoints key. Every per-breakpoint field is written so the JSON is fully self-describing.

Parameters
settingsMapThe map to write the Breakpoints array into. The caller is responsible for writing settingsMap into the main settings under the LuaDebugger key.

◆ setActiveFromUser()

void LuaDebuggerBreakpointsController::setActiveFromUser ( const QString &  file,
qint32  line,
bool  active 
)

Set the active flag of an existing breakpoint at file:@p line. Used by the gutter context menu's Enable/Disable action; auto-enables the debugger when transitioning to active so the re-armed breakpoint is immediately effective. The breakpoint table's checkbox uses a different code path (onItemChanged) on purpose — it must NOT touch the core enable state because that path is reachable during a live capture. Always rebuilds the breakpoint table and gutter markers.

Parameters
fileThe source file of the breakpoint to activate.
lineThe line number of the breakpoint to activate.
activeThe new active state to set on the breakpoint.

◆ shiftToggleAtLine()

void LuaDebuggerBreakpointsController::shiftToggleAtLine ( const QString &  file,
qint32  line 
)

Pre-arm a breakpoint at file:@p line — the Shift+click gutter gesture. If absent, creates the breakpoint inactive so the user can arm a line without paying the line-hook cost until they activate it; if present, flips the active flag. Does NOT auto-enable the debugger (that pairs with the F9 active-add path; pre-arm should never silently turn debugging back on). Always rebuilds the breakpoint table and gutter markers.

Parameters
fileThe source file of the breakpoint to pre-arm or toggle.
lineThe line number of the breakpoint to pre-arm or toggle.

◆ showContextMenu

void LuaDebuggerBreakpointsController::showContextMenu ( const QPoint &  pos)
slot

Show context menu for a right-click in the breakpoint tree.

Parameters
posThe position of the right-click, in viewport coordinates.

◆ showGutterMenu

void LuaDebuggerBreakpointsController::showGutterMenu ( const QString &  filename,
qint32  line,
const QPoint &  globalPos 
)
slot

Show Edit/Disable/Remove popup for a click in an editor gutter.

Parameters
filenameThe name of the file containing the gutter click.
lineThe line number of the gutter click.
globalPosThe position of the click in global coordinates.

◆ toggleOnCodeViewLine()

void LuaDebuggerBreakpointsController::toggleOnCodeViewLine ( LuaDebuggerCodeView codeView,
qint32  line 
)

Convenience overload that resolves the file path from a LuaDebuggerCodeView. Silently ignores null views or sub-1 line numbers; otherwise behaves exactly like toggleAtLine.

Parameters
codeViewThe code view hosting the breakpoint line.
lineThe line number to toggle the breakpoint on (1-based).

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