Owns the script tab strip and the documents inside it.
More...
#include <lua_debugger_code_editor.h>
|
| void | onTabCloseRequested (int index) |
| | Handles a request to close a specific tab.
|
| |
| void | onCurrentTabChanged (int index) |
| | Handles a change in the active tab.
|
| |
|
void | onSaveFile () |
| | Save the active script tab (toolbar action).
|
| |
|
| | LuaDebuggerCodeTabsController (LuaDebuggerDialog *host) |
| | Constructs a new LuaDebuggerCodeTabsController object.
|
| |
| void | attach (QTabWidget *tabs) |
| | Attaches the controller to the given tab widget.
|
| |
| 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.
◆ LuaDebuggerCodeTabsController()
| LuaDebuggerCodeTabsController::LuaDebuggerCodeTabsController |
( |
LuaDebuggerDialog * |
host | ) |
|
|
explicit |
◆ attach()
| void LuaDebuggerCodeTabsController::attach |
( |
QTabWidget * |
tabs | ) |
|
Attaches the controller to the given tab widget.
- Parameters
-
| tabs | Pointer to the QTabWidget managing code views. |
◆ currentCodeView()
The code editor in the active tab, or nullptr.
- Returns
- Pointer to the currently active code view.
◆ ensureUnsavedChangesHandled()
| bool LuaDebuggerCodeTabsController::ensureUnsavedChangesHandled |
( |
const QString & |
title | ) |
|
If any tab is modified, prompt to save / discard / cancel.
- Parameters
-
| title | The title for the prompt dialog. |
- Returns
false only if the user picked Cancel; true otherwise.
◆ hasUnsavedChanges()
| bool LuaDebuggerCodeTabsController::hasUnsavedChanges |
( |
| ) |
const |
True if any open tab has unsaved edits.
- Returns
- True if unsaved changes exist, false otherwise.
◆ lastOpenDirectory()
| QString LuaDebuggerCodeTabsController::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.
- Returns
- The last open directory path string.
◆ loadFile()
Load file_path into a code tab, creating one if necessary.
- Parameters
-
| file_path | The path to the file to open. |
- Returns
- The view now hosting the file, or
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.
◆ onCurrentTabChanged
| void LuaDebuggerCodeTabsController::onCurrentTabChanged |
( |
int |
index | ) |
|
|
slot |
Handles a change in the active tab.
- Parameters
-
| index | The new current tab index. |
◆ onTabCloseRequested
| void LuaDebuggerCodeTabsController::onTabCloseRequested |
( |
int |
index | ) |
|
|
slot |
Handles a request to close a specific tab.
- Parameters
-
| index | The index of the tab to close. |
◆ openInitialBreakpointFiles()
| void LuaDebuggerCodeTabsController::openInitialBreakpointFiles |
( |
const QVector< QString > & |
files | ) |
|
Open each initial breakpoint file once tabs are ready.
- Parameters
-
| files | List of file paths to open. |
◆ saveAllModified()
| bool LuaDebuggerCodeTabsController::saveAllModified |
( |
| ) |
|
Save every tab that has unsaved edits.
- Returns
false on the first failed write.
◆ saveCodeView()
Persist one editor buffer to its file path.
- Parameters
-
| view | Pointer to the code view to save. |
- Returns
- True if saved successfully, false otherwise.
◆ setLastOpenDirectory()
| void LuaDebuggerCodeTabsController::setLastOpenDirectory |
( |
const QString & |
dir | ) |
|
Remember the directory the user last opened a script from. Persists for the lifetime of the controller.
- Parameters
-
◆ tabs()
| QTabWidget * LuaDebuggerCodeTabsController::tabs |
( |
| ) |
const |
|
inline |
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.
- Returns
- Pointer to the tab widget.
◆ unsavedOpenScriptTabCount()
| qint32 LuaDebuggerCodeTabsController::unsavedOpenScriptTabCount |
( |
| ) |
const |
How many open code tabs currently have unsaved edits.
- Returns
- The number of unsaved open tabs.
◆ updateTabTextForCodeView()
Update the tab label (e.g. trailing " *") for one editor.
- Parameters
-
| view | Pointer to the code view to update. |
The documentation for this class was generated from the following files: