Wireshark 4.7.0
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
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
25class QModelIndex;
26class QPoint;
27class QStandardItem;
28class QStandardItemModel;
29class QTreeView;
30
35class LuaDebuggerFilesController : public QObject
36{
37 Q_OBJECT
38
39public:
45
52 void attach(QTreeView *tree, QStandardItemModel *model);
53
55 void configureTreeChrome() const;
56
62
68 void scanScriptDirectory(const QString &dir_path);
69
76 bool ensureEntry(const QString &file_path);
77
79 void sortModel();
80
81public slots:
87 void onItemDoubleClicked(const QModelIndex &index);
88
94 void showContextMenu(const QPoint &pos);
95
96private:
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
Top-level dialog hosting the Lua debugger UI components.
Definition lua_debugger_dialog.h:189
Files panel: plugin/script indexing, hierarchical entries, open / reveal / copy gestures,...
Definition lua_debugger_files.h:36
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
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
void scanScriptDirectory(const QString &dir_path)
Recursively walks dir_path and calls ensureEntry for every script file found.
Definition lua_debugger_files.cpp:125
void refreshAvailableScripts()
Rescans all known script locations and repopulates the model with up-to-date entries.
Definition lua_debugger_files.cpp:93
void onItemDoubleClicked(const QModelIndex &index)
Opens the script associated with the double-clicked item in the debugger editor.
Definition lua_debugger_files.cpp:301
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
void sortModel()
Sorts column 0 after discrete inserts from callbacks.
Definition lua_debugger_files.cpp:85
void configureTreeChrome() const
Configures decorations, scrollbar, and header sizing (after widgets exist).
Definition lua_debugger_files.cpp:70