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"
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);
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();
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;
950 qlonglong pausedLine_ = 0;
953 int errorFrameHideEpoch_ = 0;
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
A dialog that remembers its geometry and splitter state.
Definition geometry_state_dialog.h:20
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:989
bool changeHighlightAllowed(int stackSelectionLevel) const
Checks if change highlighting is allowed for a given stack level.
Definition lua_debugger_utils.cpp:1523
void snapshotBaselinesOnPauseEntry()
Snapshots the current values to baseline on a new pause entry.
Definition lua_debugger_utils.cpp:1283
void clearAllChangeBaselines()
Clears all change baselines for watches and variables.
Definition lua_debugger_utils.cpp:1364
void pruneChangeBaselinesToLiveWatchSpecs(QStandardItemModel *watchModel)
Prunes baselines to keep only those present in the live watch specs.
Definition lua_debugger_utils.cpp:1480
void refreshChangedValueBrushes(QTreeView *watchTree, QWidget *paletteFallback)
Refreshes the brushes used for changed values based on the application palette.
Definition lua_debugger_utils.cpp:1259
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:1318
void updatePauseEntryFrameIdentity()
Updates the identity of the current frame on pause entry.
Definition lua_debugger_utils.cpp:1297
Owns the script tab strip and the documents inside it.
Definition lua_debugger_code_editor.h:515
Editable code editor supporting gutter breakpoints and highlighting.
Definition lua_debugger_code_editor.h:136
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:1492
static int32_t currentTheme()
Get the current theme setting.
Definition lua_debugger_dialog.cpp:428
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: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:423
void childEvent(QChildEvent *event) override
Handle child widget events.
Definition lua_debugger_dialog.cpp:1046
static LuaDebuggerDialog * instanceIfExists()
Like instance but never creates the dialog; returns nullptr when no instance exists yet....
Definition lua_debugger_dialog.cpp:418
void updateWidgets()
Update all widgets based on the current debugger state.
Definition lua_debugger_dialog.cpp:1648
void handleEscapeKey()
Escape: hide inline find/go accordions if shown, else close dialog. Invoked from the script editor be...
Definition lua_debugger_dialog.cpp:1017
bool changeHighlightAllowed() const
Combined "is the change-highlight cue allowed for paint this pass?" gate. Reads the tracker policy w...
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:644
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:1635
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:1664
void updateLuaEditorAuxFrames()
Point find / goto bars at the active code tab.
Definition lua_debugger_dialog.cpp:1125
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:1630
void clearPausedStateUi()
Remove paused-state UI artifacts like stacks and highlights.
Definition lua_debugger_dialog.cpp:1428
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:1212
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:607
bool event(QEvent *event) override
Handle general events.
Definition lua_debugger_dialog.cpp:985
bool eventFilter(QObject *obj, QEvent *event) override
Filter events for child objects to intercept shortcuts.
Definition lua_debugger_dialog.cpp:1062
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:2048
static LuaDebuggerDialog * instance(QWidget *parent=nullptr)
Retrieve the singleton instance, creating it if needed.
Definition lua_debugger_dialog.cpp:630
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:2053
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:1399
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:1618
void showEvent(QShowEvent *event) override
Handle widget show events.
Definition lua_debugger_dialog.cpp:1002
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:1740
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:912
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:1170
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:922
void scheduleErrorFrameHide(int delayMs)
Schedule a delayed hide to avoid hide/show flicker on rapid re-pauses.
Definition lua_debugger_dialog.cpp:1175
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:1132
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:414
Centralised keyboard-shortcut dispatcher for the Lua debugger dialog's eventFilter().
Definition lua_debugger_utils.h:921
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:1941
bool takeDeferredReload()
If reloadDeferred_ was set, clear it and return true.
Definition lua_debugger_dialog.cpp:1897
void handlePreReload()
Handles actions required before a Lua plugin reload.
Definition lua_debugger_dialog.cpp:1907
void onReloadLuaPluginsRequested()
Slot triggered when a request to reload Lua plugins is made.
Definition lua_debugger_dialog.cpp:2024
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:71
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:1817
bool handleMainCloseIfPaused(QCloseEvent *event)
Decide whether to defer a main-window close while the Lua debugger needs to arbitrate.
Definition lua_debugger_dialog.cpp:1829
void cancelPendingClose()
Cancel any pending deferred main close.
Definition lua_debugger_dialog.cpp:1886
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:1881
void deliverDeferredMainCloseIfPending()
Re-deliver a previously deferred main-window close, if any. Idempotent.
Definition lua_debugger_dialog.cpp:1858
Opaque handle representing an active or pending capture session.
Definition capture_session.h:142