Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
lua_debugger_variables.h
Go to the documentation of this file.
1/* lua_debugger_variables.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_VARIABLES_H
16#define LUA_DEBUGGER_VARIABLES_H
17
18#include <QHash>
19#include <QObject>
20#include <QString>
21
22#include "lua_debugger_utils.h"
23
25class QModelIndex;
26class QPoint;
27class QStandardItem;
28class QStandardItemModel;
29class QTreeView;
30
33{
34constexpr int Name = 0;
35constexpr int Value = 1;
36constexpr int Type = 2;
37constexpr int Count = 3;
38} // namespace VariablesColumn
39
44class LuaDebuggerVariablesController : public QObject
45{
46 Q_OBJECT
47
48 public:
54
60 void attach(QTreeView *tree, QStandardItemModel *model);
61
65 void configureColumns() const;
66
70 void restoreExpansionState() const;
71
76 void rebuildFromEngine();
77
87 void fetchAndAppend(QStandardItem *parent, const QString &path);
88
94 QStandardItem *findItemByPath(const QString &path) const;
95
100 QHash<QString, LuaDbgTreeSectionExpansionState> &expansionMap() { return expansion_; }
101
106 const QHash<QString, LuaDbgTreeSectionExpansionState> &expansionMap() const { return expansion_; }
107
108 public slots:
113 void showContextMenu(const QPoint &pos);
114
119 void onExpanded(const QModelIndex &index);
120
125 void onCollapsed(const QModelIndex &index);
126
127 private:
129 LuaDebuggerDialog *host_ = nullptr;
130
132 QTreeView *tree_ = nullptr;
133
135 QStandardItemModel *model_ = nullptr;
136
138 QHash<QString, LuaDbgTreeSectionExpansionState> expansion_;
139};
140
141#endif
Top-level dialog hosting the Lua debugger UI components.
Definition lua_debugger_dialog.h:189
Variables panel: column sizing, expansion persistence, lazy child fill on expand, context menu,...
Definition lua_debugger_variables.h:45
void rebuildFromEngine()
Clear the model, re-fetch Locals/Globals/Upvalues from the engine, and re-apply persisted expansion.
Definition lua_debugger_variables.cpp:60
void onCollapsed(const QModelIndex &index)
Handles the event when a tree node is collapsed.
Definition lua_debugger_variables.cpp:340
void fetchAndAppend(QStandardItem *parent, const QString &path)
Append children of path under parent (or as new top-level rows when parent is null)....
Definition lua_debugger_variables.cpp:70
QStandardItem * findItemByPath(const QString &path) const
Finds a tree item based on its path.
Definition lua_debugger_variables.cpp:224
void showContextMenu(const QPoint &pos)
Displays the context menu for the variables tree.
Definition lua_debugger_variables.cpp:242
const QHash< QString, LuaDbgTreeSectionExpansionState > & expansionMap() const
Retrieves the read-only expansion state map.
Definition lua_debugger_variables.h:106
void restoreExpansionState() const
Re-expand Locals/Globals/Upvalues after a variables refresh.
Definition lua_debugger_variables.cpp:184
void attach(QTreeView *tree, QStandardItemModel *model)
Attaches the controller to the given tree view and model.
Definition lua_debugger_variables.cpp:38
QHash< QString, LuaDbgTreeSectionExpansionState > & expansionMap()
Retrieves the mutable expansion state map.
Definition lua_debugger_variables.h:100
void onExpanded(const QModelIndex &index)
Handles the event when a tree node is expanded.
Definition lua_debugger_variables.cpp:309
void configureColumns() const
Configures the tree view columns for the variables panel.
Definition lua_debugger_variables.cpp:46
Column indices for the Variables tree model.
Definition lua_debugger_variables.h:33