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"
70class LuaDebuggerDialog;
118 void enterReloadUiStateIfEnabled();
123 void exitReloadUiState();
128 void reloadAllScriptFilesFromDisk();
131 bool reloadDeferred_ =
false;
132 bool reloadUiActive_ =
false;
133 bool reloadUiRequestWasEnabled_ =
false;
246 void handlePause(
const char *file_path, int64_t line);
298 return changeHighlight_.changeHighlightAllowed(stackController_.selectionLevel());
310 changeHighlight_.applyChangedVisuals(
this, valueCell, changed);
538 void onDebuggerToggled(
bool checked);
547 void onMonospaceFontUpdated(
const QFont &font);
550 void onMainAppInitialized();
553 void onPreferencesChanged();
556 void onColorsChanged();
568 void drainPendingLogs();
584 void drainBreakpointStateUpdates();
590 void onThemeChanged(
int idx);
596 void onEditorGoToLine();
603 void onVariablesCurrentItemChanged(
const QModelIndex ¤t,
const QModelIndex &previous);
610 void onWatchCurrentItemChanged(
const QModelIndex ¤t,
const QModelIndex &previous);
622 void updateLeftPanelStretch();
626 Ui::LuaDebuggerDialog *ui;
652 static int32_t currentTheme_;
655 void wireFilesPanel();
657 void wireStackPanel();
659 void wireVariablesPanel();
661 void wireWatchPanel();
663 void wireBreakpointsPanel();
665 void wireEvaluatePanel();
712 void resetStackForPauseEntry();
714 void clearStackPanel();
717 QCheckBox *enabledCheckBox;
745 QTreeView *variablesTree;
747 QStandardItemModel *variablesModel;
749 QTreeView *watchTree;
751 QStandardItemModel *watchModel;
753 QTreeView *stackTree;
755 QStandardItemModel *stackModel;
759 QStandardItemModel *fileModel;
761 QTreeView *breakpointsTree;
763 QStandardItemModel *breakpointsModel;
767 QPlainTextEdit *evalInputEdit;
769 QPlainTextEdit *evalOutputEdit;
771 QPushButton *evalButton;
773 QPushButton *evalClearButton;
782 QSplitter *evalSplitter_ =
nullptr;
786 QComboBox *themeComboBox;
789 QToolButton *breakpointHeaderToggleButton_ =
nullptr;
791 QToolButton *breakpointHeaderRemoveButton_ =
nullptr;
793 QToolButton *breakpointHeaderRemoveAllButton_ =
nullptr;
795 QToolButton *breakpointHeaderBreakOnErrorButton_ =
nullptr;
802 QToolButton *breakpointHeaderEditButton_ =
nullptr;
805 QAction *actionRemoveAllBreakpoints_ =
nullptr;
812 void showAccordionFrame(
AccordionFrame *frame,
bool toggle =
false);
818 void installDescendantShortcutFilters();
821 void syncDebuggerToggleWithCore();
827 enum class DebuggerUiStatus
843 DebuggerUiStatus currentDebuggerUiStatus()
const;
846 void updateEnabledCheckboxIcon();
849 void updateStatusLabel();
852 void applyCodeViewThemes();
855 void updateStyleSheets();
860 void resumeDebuggerAndExitLoop();
871 void endPauseFreeze();
877 void runDebuggerStep(
void (*step_fn)(
void));
880 void createCollapsibleSections();
885 LuaDebuggerSettingsStore settingsStore_;
888 bool luaDebuggerJsonSaved_{
false};
893 void saveSettingsFile();
896 void applyDialogSettings();
899 void storeDialogSettings();
906 QStandardItem *findVariablesItemByPath(
const QString &path)
const;
913 QStandardItem *findWatchRootForVariablePath(
const QString &path)
const;
921 static void expandAncestorsOf(QTreeView *tree, QStandardItemModel *model, QStandardItem *item);
924 bool syncWatchVariablesSelection_ =
false;
927 LuaDebuggerChangeHighlightTracker changeHighlight_;
950 qlonglong pausedLine_ = 0;
953 int errorFrameHideEpoch_ = 0;
956 void refreshChangedValueBrushes() { changeHighlight_.refreshChangedValueBrushes(watchTree,
this); }
959 void snapshotBaselinesOnPauseEntry() { changeHighlight_.snapshotBaselinesOnPauseEntry(); }
962 void clearAllChangeBaselines() { changeHighlight_.clearAllChangeBaselines(); }
965 void pruneChangeBaselinesToLiveWatchSpecs() { changeHighlight_.pruneChangeBaselinesToLiveWatchSpecs(watchModel); }
968 void updatePauseEntryFrameIdentity() { changeHighlight_.updatePauseEntryFrameIdentity(); }
A QFrame that shows and hides itself with a slide animation.
Definition accordion_frame.h:21
A collapsible section widget for use in a QSplitter.
Definition collapsible_section.h:31
GeometryStateDialog(QWidget *parent, Qt::WindowFlags f=Qt::Window)
Constructs a new GeometryStateDialog with the specified parent and window flags.
Definition geometry_state_dialog.h:91
Owns the breakpoints panel: tree wiring, model rebuild from the engine, inline edit dispatch,...
Definition lua_debugger_breakpoints.h:349
"Value changed since last pause" highlighter for the Watch and Variables trees.
Definition lua_debugger_utils.h:995
Owns the script tab strip and the documents inside it.
Definition lua_debugger_code_editor.h:519
Editable code editor supporting gutter breakpoints and highlighting.
Definition lua_debugger_code_editor.h:140
Top-level dialog hosting the Lua debugger UI components.
Definition lua_debugger_dialog.h:189
LuaDebuggerBreakpointsController & breakpointsController()
Gets the breakpoints controller.
Definition lua_debugger_dialog.h:336
void refreshDebuggerStateUi()
Refresh checkbox sync + all debugger state chrome/widgets.
Definition lua_debugger_dialog.cpp:1488
static int32_t currentTheme()
Get the current theme setting.
Definition lua_debugger_dialog.cpp:427
LuaDebuggerLuaReloadCoordinator & reloadCoordinator()
Gets the Lua reload coordinator.
Definition lua_debugger_dialog.h:340
LuaDebuggerEvalController & evalController()
Gets the evaluation controller.
Definition lua_debugger_dialog.h:342
void syncVariablesTreeToCurrentWatch()
Select the Variables row matching the current Watch row, or clear the Variables selection when no mat...
Definition lua_debugger_watch.cpp:1975
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:422
void childEvent(QChildEvent *event) override
Handle child widget events.
Definition lua_debugger_dialog.cpp:1042
static LuaDebuggerDialog * instanceIfExists()
Like instance but never creates the dialog; returns nullptr when no instance exists yet....
Definition lua_debugger_dialog.cpp:417
void updateWidgets()
Update all widgets based on the current debugger state.
Definition lua_debugger_dialog.cpp:1644
void handleEscapeKey()
Escape: hide inline find/go accordions if shown, else close dialog. Invoked from the script editor be...
Definition lua_debugger_dialog.cpp:1013
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:296
void handlePause(const char *file_path, int64_t line)
React to the debugger pausing execution at a breakpoint.
Definition lua_debugger_dialog.cpp:640
QString pausedFile() const
Source file path (normalized) of the line the debugger is paused on; empty when not paused....
Definition lua_debugger_dialog.h:352
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:287
bool tearDownPauseLoopForReload()
Tear down an active pause loop because the Lua engine is about to be reloaded under us....
Definition lua_debugger_dialog.cpp:1631
LuaDebuggerChangeHighlightTracker & changeHighlight()
Borrowed reference to the change-highlight tracker. Used by controllers that compute "changed since l...
Definition lua_debugger_dialog.h:270
void ensureDebuggerEnabledForActiveBreakpoints()
Enable the debugger if any active breakpoint requires it.
Definition lua_debugger_dialog.cpp:1660
void updateLuaEditorAuxFrames()
Point find / goto bars at the active code tab.
Definition lua_debugger_dialog.cpp:1121
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:1626
void clearPausedStateUi()
Remove paused-state UI artifacts like stacks and highlights.
Definition lua_debugger_dialog.cpp:1424
QCheckBox * enabledToggle()
Borrowed reference to the toggle that mirrors the core's enable/disable state; the reload coordinator...
Definition lua_debugger_dialog.h:367
LuaDebuggerFontPolicy & fontPolicy()
Gets the font policy.
Definition lua_debugger_dialog.h:344
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:1208
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:603
bool event(QEvent *event) override
Handle general events.
Definition lua_debugger_dialog.cpp:981
bool eventFilter(QObject *obj, QEvent *event) override
Filter events for child objects to intercept shortcuts.
Definition lua_debugger_dialog.cpp:1058
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:2035
static LuaDebuggerDialog * instance(QWidget *parent=nullptr)
Retrieve the singleton instance, creating it if needed.
Definition lua_debugger_dialog.cpp:626
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:2040
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:1395
LuaDebuggerCodeTabsController & codeTabsController()
Gets the code tabs controller.
Definition lua_debugger_dialog.h:330
LuaDebuggerVariablesController & variablesController()
Gets the variables controller.
Definition lua_debugger_dialog.h:328
void updateContinueActionState()
Enable or disable the Continue action based on debugger state.
Definition lua_debugger_dialog.cpp:1614
void showEvent(QShowEvent *event) override
Handle widget show events.
Definition lua_debugger_dialog.cpp:998
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:1736
LuaDebuggerStackController & stackController()
Borrowed reference to the stack controller. Used by Watch / Variables / Eval to read the currently in...
Definition lua_debugger_dialog.h:278
void reject() override
Close from Esc or programmatic reject(); queues close() so closeEvent() runs (unsaved-scripts prompt ...
Definition lua_debugger_dialog.cpp:908
LuaDebuggerDialog(QWidget *parent=nullptr)
Construct the dialog and initialize all child widgets.
Definition lua_debugger_dialog.cpp:432
LuaDebuggerPauseController & pauseController()
Gets the pause controller.
Definition lua_debugger_dialog.h:338
void cancelErrorFrameHide()
Cancel any pending delayed hide token.
Definition lua_debugger_dialog.cpp:1166
LuaDebuggerWatchController & watchController()
Gets the watch controller.
Definition lua_debugger_dialog.h:334
qlonglong pausedLine() const
Line number of the pause; zero when the debugger is not paused. Paired with pausedFile.
Definition lua_debugger_dialog.h:359
void closeEvent(QCloseEvent *event) override
Flush state and resume execution when the dialog closes.
Definition lua_debugger_dialog.cpp:918
void scheduleErrorFrameHide(int delayMs)
Schedule a delayed hide to avoid hide/show flicker on rapid re-pauses.
Definition lua_debugger_dialog.cpp:1171
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:308
void updatePausedErrorFrame()
Populate/hide the inline error frame for paused break-on-error states.
Definition lua_debugger_dialog.cpp:1128
LuaDebuggerFilesController & filesController()
Gets the files controller.
Definition lua_debugger_dialog.h:332
Manages the debugger's eval panel: enabling/disabling controls based on pause state,...
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:418
Centralised keyboard-shortcut dispatcher for the Lua debugger dialog's eventFilter().
Definition lua_debugger_utils.h:927
Coordinates Lua plugin reload: pre/post core callbacks, deferred reload after pause,...
Definition lua_debugger_dialog.h:82
void handlePostReload()
Handles actions required after a Lua plugin reload.
Definition lua_debugger_dialog.cpp:1937
bool takeDeferredReload()
If reloadDeferred_ was set, clear it and return true.
Definition lua_debugger_dialog.cpp:1893
void handlePreReload()
Handles actions required before a Lua plugin reload.
Definition lua_debugger_dialog.cpp:1903
LuaDebuggerLuaReloadCoordinator(LuaDebuggerDialog *host)
Constructs a LuaDebuggerLuaReloadCoordinator.
Definition lua_debugger_dialog.cpp:1889
void onReloadLuaPluginsRequested()
Slot triggered when a request to reload Lua plugins is made.
Definition lua_debugger_dialog.cpp:2020
Owns the nested pause QEventLoop pointer and the application-wide freeze (disabled top-levels,...
Definition lua_debugger_pause.h:40
Stack trace panel: column layout, rebuild from the engine, selection → variables frame,...
Definition lua_debugger_stack.h:41
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:330
Pause-aware arbitration for main-window close while the Lua debugger is involved.
Definition lua_debugger_dialog.cpp:1813
bool handleMainCloseIfPaused(QCloseEvent *event)
Decide whether to defer a main-window close while the Lua debugger needs to arbitrate.
Definition lua_debugger_dialog.cpp:1825
void cancelPendingClose()
Cancel any pending deferred main close.
Definition lua_debugger_dialog.cpp:1882
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:1877
void deliverDeferredMainCloseIfPending()
Re-deliver a previously deferred main-window close, if any. Idempotent.
Definition lua_debugger_dialog.cpp:1854
Opaque handle representing an active or pending capture session.
Definition capture_session.h:156