|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
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>
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. | |
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.
|
explicit |
Construct the controller with a pointer to the host dialog for coordinating updates and engine access.
| host | The owning LuaDebuggerDialog, used to coordinate updates and access the engine. Must not be null. |
| void LuaDebuggerBreakpointsController::attach | ( | QTreeView * | tree, |
| QStandardItemModel * | model | ||
| ) |
Bind the tree + model and wire their signals.
| tree | The QTreeView to attach. |
| model | The QStandardItemModel to attach. |
| 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.
| breakOnError | The "break on error" toggle button. |
| toggleAll | The "toggle all active" button. |
| remove | The "remove selected" button. |
| removeAll | The "remove all" button. |
| edit | The "edit selected" button. |
| removeAllAction | The "remove all" QAction, used to synchronize the enabled state with the header button. |
| 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.
| file | The source file of the breakpoint to move. |
| fromLine | The current line number of the breakpoint to move. |
| toLine | The new line number to move the breakpoint to. |
|
slot |
Active-checkbox toggle from the model.
| item | The item that changed; only triggers if the column is the Active column and the change is a user toggle of the checkbox. |
|
slot |
Double-click on a breakpoint row to edit its condition.
| index | The model index of the double-clicked cell; only the row is used, and only if the column is the Location column. |
|
slot |
Role-based dispatch for delegate-driven inline edits.
| topLeft | The 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. |
| bottomRight | The 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. |
| roles | The roles that changed; only triggers if the change includes the EditRole and excludes the BreakpointModelRole, to distinguish user edits from programmatic setData during |
| 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.
| file | The source file of the breakpoint to remove. |
| line | The line number of the breakpoint to remove. |
| 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.
| settingsMap | The map to read the Breakpoints array from. The caller is responsible for extracting settingsMap from the main settings under the LuaDebugger key. |
| 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.
| settingsMap | The map to write the Breakpoints array into. The caller is responsible for writing settingsMap into the main settings under the LuaDebugger key. |
| 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.
| file | The source file of the breakpoint to activate. |
| line | The line number of the breakpoint to activate. |
| active | The new active state to set on the breakpoint. |
| 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.
| file | The source file of the breakpoint to pre-arm or toggle. |
| line | The line number of the breakpoint to pre-arm or toggle. |
|
slot |
Show context menu for a right-click in the breakpoint tree.
| pos | The position of the right-click, in viewport coordinates. |
|
slot |
Show Edit/Disable/Remove popup for a click in an editor gutter.
| filename | The name of the file containing the gutter click. |
| line | The line number of the gutter click. |
| globalPos | The position of the click in global coordinates. |
| 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.
| codeView | The code view hosting the breakpoint line. |
| line | The line number to toggle the breakpoint on (1-based). |