16#ifndef LUA_DEBUGGER_DIALOG_H
17#define LUA_DEBUGGER_DIALOG_H
25#include <QKeySequence>
30#include <QPlainTextEdit>
36#include <QStandardItem>
37#include <QStandardItemModel>
42#include "epan/wslua/wslua_debugger.h"
88 void handlePreReload();
89 void handlePostReload();
91 bool reloadUiActive()
const {
return reloadUiActive_; }
97 void onReloadLuaPluginsRequested();
100 void enterReloadUiStateIfEnabled();
101 void exitReloadUiState();
102 void reloadAllScriptFilesFromDisk();
105 bool reloadDeferred_ =
false;
106 bool reloadUiActive_ =
false;
107 bool reloadUiSavedCheckboxChecked_ =
false;
108 bool reloadUiSavedCheckboxEnabled_ =
true;
109 bool reloadUiRequestWasEnabled_ =
false;
219 void handlePause(
const char *file_path, int64_t line);
256 return changeHighlight_.changeHighlightAllowed(stackController_.
selectionLevel());
371 void showEvent(QShowEvent *event)
override;
372 bool event(QEvent *event)
override;
373 bool eventFilter(QObject *obj, QEvent *event)
override;
374 void childEvent(QChildEvent *event)
override;
391 void onDebuggerToggled(
bool checked);
395 void onMonospaceFontUpdated(
const QFont &font);
397 void onMainAppInitialized();
399 void onPreferencesChanged();
401 void onColorsChanged();
412 void drainPendingLogs();
414 void onThemeChanged(
int idx);
418 void onEditorGoToLine();
420 void onVariablesCurrentItemChanged(
const QModelIndex ¤t,
const QModelIndex &previous);
422 void onWatchCurrentItemChanged(
const QModelIndex ¤t,
const QModelIndex &previous);
433 void updateLeftPanelStretch();
436 Ui::LuaDebuggerDialog *ui;
451 static int32_t currentTheme_;
453 void wireFilesPanel();
454 void wireStackPanel();
455 void wireVariablesPanel();
456 void wireWatchPanel();
457 void wireBreakpointsPanel();
458 void wireEvaluatePanel();
474 void resetStackForPauseEntry();
475 void clearStackPanel();
477 QCheckBox *enabledCheckBox;
494 QTreeView *variablesTree;
495 QStandardItemModel *variablesModel;
496 QTreeView *watchTree;
497 QStandardItemModel *watchModel;
498 QTreeView *stackTree;
499 QStandardItemModel *stackModel;
501 QStandardItemModel *fileModel;
502 QTreeView *breakpointsTree;
503 QStandardItemModel *breakpointsModel;
506 QPlainTextEdit *evalInputEdit;
507 QPlainTextEdit *evalOutputEdit;
508 QPushButton *evalButton;
509 QPushButton *evalClearButton;
517 QSplitter *evalSplitter_ =
nullptr;
520 QComboBox *themeComboBox;
522 QToolButton *breakpointHeaderToggleButton_ =
nullptr;
524 QToolButton *breakpointHeaderRemoveButton_ =
nullptr;
525 QToolButton *breakpointHeaderRemoveAllButton_ =
nullptr;
532 QToolButton *breakpointHeaderEditButton_ =
nullptr;
534 QAction *actionRemoveAllBreakpoints_ =
nullptr;
537 void showAccordionFrame(
AccordionFrame *frame,
bool toggle =
false);
541 void installDescendantShortcutFilters();
543 void syncDebuggerToggleWithCore();
546 enum class DebuggerUiStatus
553 DebuggerUiStatus currentDebuggerUiStatus()
const;
555 void updateEnabledCheckboxIcon();
557 void updateStatusLabel();
559 void applyCodeViewThemes();
561 void updateStyleSheets();
564 void resumeDebuggerAndExitLoop();
574 void endPauseFreeze();
579 void runDebuggerStep(
void (*step_fn)(
void));
581 void createCollapsibleSections();
587 bool luaDebuggerJsonSaved_{
false};
590 void saveSettingsFile();
592 void applyDialogSettings();
594 void storeDialogSettings();
596 QStandardItem *findVariablesItemByPath(
const QString &path)
const;
597 QStandardItem *findWatchRootForVariablePath(
const QString &path)
const;
598 static void expandAncestorsOf(QTreeView *tree, QStandardItemModel *model, QStandardItem *item);
600 bool syncWatchVariablesSelection_ =
false;
623 qlonglong pausedLine_ = 0;
625 void refreshChangedValueBrushes() { changeHighlight_.refreshChangedValueBrushes(watchTree,
this); }
627 void snapshotBaselinesOnPauseEntry() { changeHighlight_.snapshotBaselinesOnPauseEntry(); }
629 void clearAllChangeBaselines() { changeHighlight_.clearAllChangeBaselines(); }
631 void pruneChangeBaselinesToLiveWatchSpecs() { changeHighlight_.pruneChangeBaselinesToLiveWatchSpecs(watchModel); }
633 void updatePauseEntryFrameIdentity() { changeHighlight_.updatePauseEntryFrameIdentity(); }
Definition accordion_frame.h:18
A collapsible section widget for use in a QSplitter.
Definition collapsible_section.h:31
Definition geometry_state_dialog.h:17
Owns the breakpoints panel: tree wiring, model rebuild from the engine, inline edit dispatch,...
Definition lua_debugger_breakpoints.h:265
"Value changed since last pause" highlighter for the Watch and Variables trees.
Definition lua_debugger_utils.h:534
void applyChangedVisuals(QObject *timerOwner, QStandardItem *anchor, bool changed)
Stamp the anchor row with the change visuals; isPauseEntryRefresh_ is consulted internally so callers...
Definition lua_debugger_utils.cpp:1246
Owns the script tab strip and the documents inside it.
Definition lua_debugger_code_editor.h:370
Editable code editor supporting gutter breakpoints and highlighting.
Definition lua_debugger_code_editor.h:127
Top-level dialog hosting the Lua debugger UI components.
Definition lua_debugger_dialog.h:165
void refreshDebuggerStateUi()
Refresh checkbox sync + all debugger state chrome/widgets.
Definition lua_debugger_dialog.cpp:1398
static int32_t currentTheme()
Get the current theme setting.
Definition lua_debugger_dialog.cpp:407
void syncVariablesTreeToCurrentWatch()
Select the Variables row matching the current Watch row, or clear the Variables selection when no mat...
Definition lua_debugger_watch.cpp:1988
static bool handleMainCloseIfPaused(QCloseEvent *event)
If the debugger is paused or owns unsaved scripts, defer the supplied main-window close event so the ...
Definition lua_debugger_dialog.cpp:402
static LuaDebuggerDialog * instanceIfExists()
Like instance but never creates the dialog; returns nullptr when no instance exists yet....
Definition lua_debugger_dialog.cpp:397
void updateWidgets()
Update all widgets based on the current debugger state.
Definition lua_debugger_dialog.cpp:1558
void handleEscapeKey()
Escape: hide inline find/go accordions if shown, else close dialog. Invoked from the script editor be...
Definition lua_debugger_dialog.cpp:988
bool changeHighlightAllowed() const
Combined "is the change-highlight cue allowed for paint this pass?" gate. Reads the tracker policy wi...
Definition lua_debugger_dialog.h:254
void handlePause(const char *file_path, int64_t line)
React to the debugger pausing execution at a breakpoint.
Definition lua_debugger_dialog.cpp:622
QString pausedFile() const
Source file path (normalized) of the line the debugger is paused on; empty when not paused....
Definition lua_debugger_dialog.h:291
bool isDebuggerPaused() const
True while the dialog is in a pause-entry / nested event-loop UI. Mirrors the C side's wslua_debugger...
Definition lua_debugger_dialog.h:248
bool tearDownPauseLoopForReload()
Tear down an active pause loop because the Lua engine is about to be reloaded under us....
Definition lua_debugger_dialog.cpp:1545
LuaDebuggerChangeHighlightTracker & changeHighlight()
Borrowed reference to the change-highlight tracker. Used by controllers that compute "changed since l...
Definition lua_debugger_dialog.h:237
void ensureDebuggerEnabledForActiveBreakpoints()
Enable the debugger if any active breakpoint requires it.
Definition lua_debugger_dialog.cpp:1574
void updateLuaEditorAuxFrames()
Point find / goto bars at the active code tab.
Definition lua_debugger_dialog.cpp:1096
void setSaveActionEnabled(bool enabled)
Toggle the toolbar Save Script action's enabled state. Surfaced as a typed setter so the code-tabs co...
Definition lua_debugger_dialog.cpp:1540
void clearPausedStateUi()
Remove paused-state UI artifacts like stacks and highlights.
Definition lua_debugger_dialog.cpp:1331
QCheckBox * enabledToggle()
Borrowed reference to the toggle that mirrors the core's enable/disable state; the reload coordinator...
Definition lua_debugger_dialog.h:299
void onCodeViewContextMenu(const QPoint &pos)
Build and show the editor context menu (right-click in a code tab). Routed through Qt's signal/slot m...
Definition lua_debugger_dialog.cpp:1115
void refreshVariablesForCurrentStackFrame()
Rebuild the variables tree after the stack frame for inspection changed.
Definition lua_debugger_variables.cpp:405
~LuaDebuggerDialog()
Destroy the dialog and disconnect debugger callbacks.
Definition lua_debugger_dialog.cpp:585
void addWatchFromSpec(const QString &watchSpec)
Add a watch from an expression/path spec without opening the inline editor. Convenience used by the e...
Definition lua_debugger_watch.cpp:2067
static LuaDebuggerDialog * instance(QWidget *parent=nullptr)
Retrieve the singleton instance, creating it if needed.
Definition lua_debugger_dialog.cpp:608
QKeySequence addWatchShortcut() const
Shortcut bound to the Add Watch toolbar action. Watch / Variables context menus mirror it on their "A...
Definition lua_debugger_watch.cpp:2072
QString normalizedFilePath(const QString &file_path) const
Normalize a path by trimming prefixes and resolving symbolic components. Public so controllers and th...
Definition lua_debugger_dialog.cpp:1302
void updateContinueActionState()
Enable or disable the Continue action based on debugger state.
Definition lua_debugger_dialog.cpp:1528
void runToCurrentLineInPausedEditor(LuaDebuggerCodeView *codeView, qint32 line)
Run-to-line dispatch from the focused paused editor. Public so LuaDebuggerKeyRouter can fire it from ...
Definition lua_debugger_dialog.cpp:1648
LuaDebuggerStackController & stackController()
Borrowed reference to the stack controller. Used by Watch / Variables / Eval to read the currently in...
Definition lua_debugger_dialog.h:242
void reject() override
Close from Esc or programmatic reject(); queues close() so closeEvent() runs (unsaved-scripts prompt ...
Definition lua_debugger_dialog.cpp:888
qlonglong pausedLine() const
Line number of the pause; zero when the debugger is not paused. Paired with pausedFile.
Definition lua_debugger_dialog.h:294
void closeEvent(QCloseEvent *event) override
Flush state and resume execution when the dialog closes.
Definition lua_debugger_dialog.cpp:898
void applyChangedVisuals(QStandardItem *valueCell, bool changed)
Stamp valueCell with the change-highlight visuals; the dialog supplies itself as the timer owner so t...
Definition lua_debugger_dialog.h:262
Evaluate panel: enable/disable by pause state, run expressions, clear I/O, and append batched logpoin...
Definition lua_debugger_evaluate.h:30
Files panel: plugin/script indexing, hierarchical entries, open / reveal / copy gestures,...
Definition lua_debugger_files.h:36
Owns the dialog's font story end-to-end.
Definition lua_debugger_code_editor.h:300
Centralised keyboard-shortcut dispatcher for the Lua debugger dialog's eventFilter().
Definition lua_debugger_utils.h:470
Coordinates Lua plugin reload: pre/post core callbacks, deferred reload after pause,...
Definition lua_debugger_dialog.h:82
bool takeDeferredReload()
If reloadDeferred_ was set, clear it and return true.
Definition lua_debugger_dialog.cpp:1784
Owns the nested pause QEventLoop pointer and the application-wide freeze (disabled top-levels,...
Definition lua_debugger_pause.h:40
In-memory Lua debugger UI settings backed by lua_debugger.json (global personal config,...
Definition lua_debugger_settings.h:26
Stack trace panel: column layout, rebuild from the engine, selection → variables frame,...
Definition lua_debugger_stack.h:41
int selectionLevel() const
Stack frame index whose locals/upvalues currently drive the Variables and Watch panels (0 = topmost /...
Definition lua_debugger_stack.h:57
Variables panel: column sizing, expansion persistence, lazy child fill on expand, context menu,...
Definition lua_debugger_variables.h:45
Watch panel: column layout, expand/collapse tracking + lazy fill, runtime expansion-state map,...
Definition lua_debugger_watch.h:217
Pause-aware arbitration for main-window close while the Lua debugger is involved.
Definition lua_debugger_dialog.cpp:1704
bool handleMainCloseIfPaused(QCloseEvent *event)
Decide whether to defer a main-window close while the Lua debugger needs to arbitrate.
Definition lua_debugger_dialog.cpp:1716
void cancelPendingClose()
Cancel any pending deferred main close.
Definition lua_debugger_dialog.cpp:1773
void markQuitRequested()
Record a debugger-initiated quit (Ctrl+Q from the debugger window) so that the main window will be cl...
Definition lua_debugger_dialog.cpp:1768
void deliverDeferredMainCloseIfPending()
Re-deliver a previously deferred main-window close, if any. Idempotent.
Definition lua_debugger_dialog.cpp:1745
Definition capture_session.h:136