| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
lua_debugger_files.h
Go to the documentation of this file.
1/* lua_debugger_files.h
2 *
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9
14
15#ifndef LUA_DEBUGGER_FILES_H
16#define LUA_DEBUGGER_FILES_H
17
18#include <QIcon>
19#include <QObject>
20#include <QPair>
21#include <QString>
22#include <QVector>
23
24 class LuaDebuggerDialog;
25 class QModelIndex;
26 class QPoint;
27 class QStandardItem;
28 class QStandardItemModel;
29 class QTreeView;
30
35 class LuaDebuggerFilesController : public QObject
36{
37 Q_OBJECT
38
39 public:
44 explicit LuaDebuggerFilesController(LuaDebuggerDialog *host);
45
52 void attach(QTreeView *tree, QStandardItemModel *model);
53
55 void configureTreeChrome() const;
56
61 void refreshAvailableScripts();
62
68 void scanScriptDirectory(const QString &dir_path);
69
76 bool ensureEntry(const QString &file_path);
77
79 void sortModel();
80
81 public slots:
87 void onItemDoubleClicked(const QModelIndex &index);
88
94 void showContextMenu(const QPoint &pos);
95
96 private:
104 QStandardItem *findChildItemByPath(QStandardItem *parent, const QString &path) const;
105
113 bool appendPathComponents(const QString &absolute_path, QVector<QPair<QString, QString>> &components) const;
114
116 LuaDebuggerDialog *host_ = nullptr;
117
119 QTreeView *tree_ = nullptr;
120
122 QStandardItemModel *model_ = nullptr;
123
128 QIcon folderIcon_;
129
131 QIcon fileIcon_;
132};
133
134#endif
LuaDebuggerDialog
Top-level dialog hosting the Lua debugger UI components.
Definition lua_debugger_dialog.h:189
LuaDebuggerFilesController::attach
void attach(QTreeView *tree, QStandardItemModel *model)
Binds the controller to the tree view and model, and loads stock icons ready for the first ensureEntr...
Definition lua_debugger_files.cpp:56
LuaDebuggerFilesController::LuaDebuggerFilesController
LuaDebuggerFilesController(LuaDebuggerDialog *host)
Constructs the controller and binds it to its host dialog.
Definition lua_debugger_files.cpp:68
LuaDebuggerFilesController::showContextMenu
void showContextMenu(const QPoint &pos)
Displays a context menu offering open, reveal, and copy actions for the item under the cursor.
Definition lua_debugger_files.cpp:319
LuaDebuggerFilesController::scanScriptDirectory
void scanScriptDirectory(const QString &dir_path)
Recursively walks dir_path and calls ensureEntry for every script file found.
Definition lua_debugger_files.cpp:125
LuaDebuggerFilesController::refreshAvailableScripts
void refreshAvailableScripts()
Rescans all known script locations and repopulates the model with up-to-date entries.
Definition lua_debugger_files.cpp:93
LuaDebuggerFilesController::onItemDoubleClicked
void onItemDoubleClicked(const QModelIndex &index)
Opens the script associated with the double-clicked item in the debugger editor.
Definition lua_debugger_files.cpp:301
LuaDebuggerFilesController::ensureEntry
bool ensureEntry(const QString &file_path)
Ensures a leaf row exists for file_path, creating intermediate folder rows as needed.
Definition lua_debugger_files.cpp:145
LuaDebuggerFilesController::sortModel
void sortModel()
Sorts column 0 after discrete inserts from callbacks.
Definition lua_debugger_files.cpp:85
LuaDebuggerFilesController::configureTreeChrome
void configureTreeChrome() const
Configures decorations, scrollbar, and header sizing (after widgets exist).
Definition lua_debugger_files.cpp:70