|
Wireshark 4.7.0
The Wireshark network protocol analyzer
|
Owns the script tab strip and the documents inside it. More...
#include <lua_debugger_code_editor.h>
Public Slots | |
| void | onTabCloseRequested (int index) |
| void | onCurrentTabChanged (int index) |
| void | onSaveFile () |
| Save the active script tab (toolbar action). | |
Public Member Functions | |
| LuaDebuggerCodeTabsController (LuaDebuggerDialog *host) | |
| void | attach (QTabWidget *tabs) |
| QTabWidget * | tabs () const |
| Borrowed reference to the tab strip. Exposed so other controllers (breakpoints, reload coordinator) can iterate the open editors without friending the dialog. The pointer lives as long as the dialog. | |
| QString | lastOpenDirectory () |
Directory to seed the next "Open Lua Script" dialog with. Lazily resolves to Documents (or $HOME) on first call so the controller doesn't depend on construct-time path availability. | |
| void | setLastOpenDirectory (const QString &dir) |
| Remember the directory the user last opened a script from. Persists for the lifetime of the controller. | |
| LuaDebuggerCodeView * | loadFile (const QString &file_path) |
Load file_path into a code tab, creating one if necessary. | |
| LuaDebuggerCodeView * | currentCodeView () const |
The code editor in the active tab, or nullptr. | |
| qint32 | unsavedOpenScriptTabCount () const |
| How many open code tabs currently have unsaved edits. | |
| bool | hasUnsavedChanges () const |
| True if any open tab has unsaved edits. | |
| bool | ensureUnsavedChangesHandled (const QString &title) |
| If any tab is modified, prompt to save / discard / cancel. | |
| void | clearAllDocumentModified () |
| Mark every open document as unmodified without saving. | |
| bool | saveCodeView (LuaDebuggerCodeView *view) |
| Persist one editor buffer to its file path. | |
| bool | saveAllModified () |
| Save every tab that has unsaved edits. | |
| void | updateTabTextForCodeView (LuaDebuggerCodeView *view) |
Update the tab label (e.g. trailing " *") for one editor. | |
| void | updateSaveActionState () |
| Enable Save when the current tab has unsaved edits. | |
| void | updateWindowModifiedState () |
| Reflect unsaved scripts in the window title (e.g. close hint). | |
| void | openInitialBreakpointFiles (const QVector< QString > &files) |
| Open each initial breakpoint file once tabs are ready. | |
| void | clearAllCodeHighlights () |
| Drop the current-line stripe on every open editor. | |
| void | applyThemeToAllTabs () |
| Re-apply the active syntax-highlight theme to every open editor. | |
Owns the script tab strip and the documents inside it.
Concretely, this controller is the one place that:
The dialog itself only constructs the QTabWidget and hands it over via attach; everything document-shaped lives here. Cross-controller call-backs (breakpoint toggles, "Add Watch", run-to-line, the editor context menu) flow through the host pointer to keep the controller's public surface focused on documents.
| bool LuaDebuggerCodeTabsController::ensureUnsavedChangesHandled | ( | const QString & | title | ) |
If any tab is modified, prompt to save / discard / cancel.
false only if the user picked Cancel; true otherwise. | LuaDebuggerCodeView * LuaDebuggerCodeTabsController::loadFile | ( | const QString & | file_path | ) |
Load file_path into a code tab, creating one if necessary.
nullptr if the file does not exist on disk (no tab is created in that case).Wires up the signal connections the dialog needs from each new code view (context menu, gutter menu, breakpoint toggle, modification, cursor moves) so callers do not have to. Existing tabs are reused and brought to front.
| bool LuaDebuggerCodeTabsController::saveAllModified | ( | ) |
Save every tab that has unsaved edits.
false on the first failed write.