Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
lua_debugger_utils.h
Go to the documentation of this file.
1/* lua_debugger_utils.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_UTILS_H
16#define LUA_DEBUGGER_UTILS_H
17
18#include <QBrush>
19#include <QChar>
20#include <QColor>
21#include <QFont>
22#include <QHash>
23#include <QIcon>
24#include <QKeySequence>
25#include <QModelIndex>
26#include <QSet>
27#include <QStandardItem>
28#include <QStandardItemModel>
29#include <QString>
30#include <QStringList>
31#include <QTreeView>
32#include <QVariant>
33#include <QtGlobal>
34
35#include "epan/wslua/wslua_debugger.h"
36
38class QFont;
39class QKeyEvent;
40class QObject;
41class QPalette;
42class QPainter;
43class QToolButton;
44class QTreeView;
45class QWidget;
46
47namespace Ui
48{
49class LuaDebuggerDialog;
50}
51
52/* ===== from internal ===== */
53
54
56
63inline QStandardItem *luaDbgWatchRootItem(QStandardItem *item)
64{
65 while (item && item->parent())
66 {
67 item = item->parent();
68 }
69 return item;
70}
71
74{
75 bool rootExpanded = false;
76 QStringList subpaths;
77};
78
88void luaDbgRecordTreeSectionRootExpansion(QHash<QString, LuaDbgTreeSectionExpansionState> &map, const QString &rootKey,
89 bool expanded);
90
100void luaDbgRecordTreeSectionSubpathExpansion(QHash<QString, LuaDbgTreeSectionExpansionState> &map,
101 const QString &rootKey, const QString &key, bool expanded);
102
110QStringList luaDbgTreeSectionExpandedSubpaths(const QHash<QString, LuaDbgTreeSectionExpansionState> &map,
111 const QString &rootKey);
112
114
121
122namespace LuaDebuggerSettingsKeys
123{
125constexpr const char *DebuggerEnabled = "debuggerEnabled";
126constexpr const char *MainSplitter = "mainSplitterState";
127constexpr const char *LeftSplitter = "leftSplitterState";
128constexpr const char *EvalSplitter = "evalSplitterState";
129constexpr const char *SectionVariables = "sectionVariables";
130constexpr const char *SectionStack = "sectionStack";
131constexpr const char *SectionFiles = "sectionFiles";
132constexpr const char *SectionBreakpoints = "sectionBreakpoints";
133constexpr const char *SectionEval = "sectionEval";
134constexpr const char *SectionWatch = "sectionWatch";
135constexpr const char *Breakpoints = "breakpoints";
136constexpr const char *Watches = "watches";
137constexpr const char *BreakOnError = "breakOnError";
138} // namespace LuaDebuggerSettingsKeys
139
140// Tree widget UserRoles (must stay stable for persisted settings / model code).
141constexpr qint32 FileTreePathRole = static_cast<qint32>(Qt::UserRole);
142constexpr qint32 FileTreeIsDirectoryRole = static_cast<qint32>(Qt::UserRole + 1);
143constexpr qint32 BreakpointFileRole = static_cast<qint32>(Qt::UserRole + 2);
144constexpr qint32 BreakpointLineRole = static_cast<qint32>(Qt::UserRole + 3);
145constexpr qint32 BreakpointConditionRole = static_cast<qint32>(Qt::UserRole + 30);
146constexpr qint32 BreakpointHitCountRole = static_cast<qint32>(Qt::UserRole + 31);
147constexpr qint32 BreakpointHitTargetRole = static_cast<qint32>(Qt::UserRole + 32);
148constexpr qint32 BreakpointConditionErrRole = static_cast<qint32>(Qt::UserRole + 33);
149constexpr qint32 BreakpointLogMessageRole = static_cast<qint32>(Qt::UserRole + 34);
150constexpr qint32 BreakpointHitModeRole = static_cast<qint32>(Qt::UserRole + 35);
151constexpr qint32 BreakpointLogAlsoPauseRole = static_cast<qint32>(Qt::UserRole + 36);
152constexpr qint32 StackItemFileRole = static_cast<qint32>(Qt::UserRole + 4);
153constexpr qint32 StackItemLineRole = static_cast<qint32>(Qt::UserRole + 5);
154constexpr qint32 StackItemNavigableRole = static_cast<qint32>(Qt::UserRole + 6);
155constexpr qint32 StackItemLevelRole = static_cast<qint32>(Qt::UserRole + 7);
156constexpr qint32 VariablePathRole = static_cast<qint32>(Qt::UserRole + 8);
157constexpr qint32 VariableTypeRole = static_cast<qint32>(Qt::UserRole + 9);
158constexpr qint32 VariableCanExpandRole = static_cast<qint32>(Qt::UserRole + 10);
159constexpr qint32 WatchSpecRole = static_cast<qint32>(Qt::UserRole + 11);
160constexpr qint32 WatchSubpathRole = static_cast<qint32>(Qt::UserRole + 13);
161constexpr qint32 WatchPendingNewRole = static_cast<qint32>(Qt::UserRole + 15);
162constexpr qint32 ChangedFlashSerialRole = static_cast<qint32>(Qt::UserRole + 20);
163
164constexpr qsizetype WATCH_TOOLTIP_MAX_CHARS = 4096;
165constexpr int WATCH_EXPR_MAX_CHARS = 65536;
166constexpr int CHANGED_FLASH_MS = 500;
167constexpr int WATCH_PLACEHOLDER_DEFER_MS = 250;
168constexpr QChar CHANGE_KEY_SEP = QChar(0x1F);
169
171constexpr int kLuaDbgEvalOutputMaxLines = 5000;
172
173extern const QKeySequence kLuaDbgCtxGoToLine;
174extern const QKeySequence kLuaDbgCtxRunToLine;
175extern const QKeySequence kLuaDbgCtxWatchEdit;
176extern const QKeySequence kLuaDbgCtxWatchCopyValue;
177extern const QKeySequence kLuaDbgCtxWatchDuplicate;
178extern const QKeySequence kLuaDbgCtxWatchRemoveAll;
179extern const QKeySequence kLuaDbgCtxAddWatch;
180extern const QKeySequence kLuaDbgCtxToggleBreakpoint;
181extern const QKeySequence kLuaDbgCtxReloadLuaPlugins;
182extern const QKeySequence kLuaDbgCtxRemoveAllBreakpoints;
183
192QKeySequence luaDbgSeqFromKeyEvent(const QKeyEvent *ke);
193
194/* ===== from item_utils ===== */
195
196namespace LuaDebuggerItems
197{
198
205inline QString rowColumnDisplayText(const QModelIndex &indexInRow, int col)
206{
207 if (!indexInRow.isValid())
208 {
209 return QString();
210 }
211 return indexInRow.sibling(indexInRow.row(), col).data(Qt::DisplayRole).toString();
212}
213
220inline QStandardItem *rowCol0(QStandardItemModel *model, QStandardItem *cell)
221{
222 if (!model || !cell)
223 {
224 return nullptr;
225 }
226 const QModelIndex ix = model->indexFromItem(cell);
227 if (!ix.isValid())
228 {
229 return nullptr;
230 }
231 return model->itemFromIndex(ix.sibling(ix.row(), 0));
232}
233
241inline QStandardItem *cellAt(QStandardItemModel *model, QStandardItem *col0, int col)
242{
243 if (!model || !col0 || col0->column() != 0)
244 {
245 return nullptr;
246 }
247 QStandardItem *par = col0->parent();
248 if (!par)
249 {
250 return model->item(col0->row(), col);
251 }
252 return par->child(col0->row(), col);
253}
254
262inline QString text(QStandardItemModel *model, QStandardItem *col0, int col)
263{
264 QStandardItem *c = cellAt(model, col0, col);
265 return c ? c->text() : QString();
266}
267
275inline void setText(QStandardItemModel *model, QStandardItem *col0, int col, const QString &t)
276{
277 QStandardItem *c = cellAt(model, col0, col);
278 if (c)
279 {
280 c->setText(t);
281 }
282}
283
291inline void setToolTip(QStandardItemModel *model, QStandardItem *col0, int col, const QString &tip)
292{
293 QStandardItem *c = cellAt(model, col0, col);
294 if (c)
295 {
296 c->setToolTip(tip);
297 }
298}
299
307inline void setFont(QStandardItemModel *model, QStandardItem *col0, int col, const QFont &font)
308{
309 QStandardItem *c = cellAt(model, col0, col);
310 if (c)
311 {
312 c->setFont(font);
313 }
314}
315
323inline void setForeground(QStandardItemModel *model, QStandardItem *col0, int col, const QBrush &brush)
324{
325 QStandardItem *c = cellAt(model, col0, col);
326 if (c)
327 {
328 c->setForeground(brush);
329 }
330}
331
339inline void setBackground(QStandardItemModel *model, QStandardItem *col0, int col, const QBrush &brush)
340{
341 QStandardItem *c = cellAt(model, col0, col);
342 if (c)
343 {
344 c->setBackground(brush);
345 }
346}
347
355inline void setIcon(QStandardItemModel *model, QStandardItem *col0, int col, const QIcon &icon)
356{
357 QStandardItem *c = cellAt(model, col0, col);
358 if (c)
359 {
360 c->setIcon(icon);
361 }
362}
363
371inline void setTextAlignment(QStandardItemModel *model, QStandardItem *col0, int col, Qt::Alignment align)
372{
373 QStandardItem *c = cellAt(model, col0, col);
374 if (c)
375 {
376 c->setTextAlignment(align);
377 }
378}
379
386inline QModelIndex indexCol0(QStandardItemModel *model, QStandardItem *col0)
387{
388 if (!model || !col0 || col0->column() != 0)
389 {
390 return QModelIndex();
391 }
392 return model->indexFromItem(col0);
393}
394
401inline bool isExpanded(QTreeView *tree, QStandardItemModel *model, QStandardItem *col0)
402{
403 const QModelIndex ix = indexCol0(model, col0);
404 return ix.isValid() && tree->isExpanded(ix);
405}
406
414inline void setExpanded(QTreeView *tree, QStandardItemModel *model, QStandardItem *col0, bool expanded)
415{
416 const QModelIndex ix = indexCol0(model, col0);
417 if (ix.isValid())
418 {
419 tree->setExpanded(ix, expanded);
420 }
421}
422
423} // namespace LuaDebuggerItems
424
425/* ===== from path_utils ===== */
426
427namespace LuaDebuggerPath
428{
429
434{
435 QColor fg;
436 QColor bg;
437};
438
450
457bool watchSpecIsGlobalScoped(const QString &spec);
458
465bool variablesPathIsGlobalScoped(const QString &path);
466
474QString changeKey(int stackLevel, const QString &path);
475
482QString watchSpecFromChangeKey(const QString &key);
483
490QString stripWatchExpressionErrorPrefix(const QString &errStr);
491
500template <class Key, class Map>
501bool shouldMarkChanged(const Map &baseline, const Key &key, const QString &newVal, bool flashNew = false)
502{
503 const auto it = baseline.constFind(key);
504 if (it != baseline.constEnd())
505 {
506 return *it != newVal;
507 }
508 return flashNew && !baseline.isEmpty();
509}
510
517QString variableSectionRootKeyFromItem(const QStandardItem *item);
518
525bool watchSpecUsesPathResolution(const QString &spec);
526
534QString variableTreeChildPath(const QString &parentPath, const QString &nameText);
535
543QString expressionWatchChildSubpath(const QString &parentSubpath, const QString &nameText);
544
551bool variableChildrenShouldSortByName(const QString &parentPath);
552
557{
558 QString name;
559 QString value;
560 QString type;
561 bool canExpand = false;
562 QString childPath;
563};
564
572VariableRowFields readVariableRowFields(const wslua_variable_t &v, const QString &parentPath);
573
582void applyVariableExpansionIndicator(QStandardItem *anchor, bool canExpand, bool enabledOnlyPlaceholder,
583 int columnCount = 3);
584
591QString watchVariablePathForSpec(const QString &spec);
592
599QString watchResolvedVariablePathForTooltip(const QString &spec);
600
608void watchRootSetVariablePathRoleFromSpec(QStandardItem *row, const QString &spec);
609
617QString watchPathOriginSuffix(const QStandardItem *item, const QString &spec);
618
625QString capWatchTooltipText(const QString &s);
626
633QString watchPathParentKey(const QString &path);
634
642void applyWatchChildRowTextAndTooltip(QStandardItem *specItem, const QString &rawVal, const QString &typeText);
643
650int watchSubpathBoundaryCount(const QString &subpath);
651
659QStandardItem *findWatchItemBySubpathOrPathKey(QStandardItem *subtree, const QString &key);
660
668QStandardItem *findVariableTreeItemByPathKey(QStandardItem *subtree, const QString &key);
669
670using TreePathKeyFinder = QStandardItem *(*)(QStandardItem *, const QString &);
671
682void reexpandTreeDescendantsByPathKeys(QTreeView *tree, QStandardItemModel *model, QStandardItem *subtree,
683 QStringList pathKeys, TreePathKeyFinder findByKey);
684
694void reexpandWatchDescendantsByPathKeys(QTreeView *tree, QStandardItemModel *model, QStandardItem *subtree,
695 QStringList pathKeys);
696
703void clearWatchFilterErrorChrome(QStandardItem *specItem, QTreeView *tree);
704
711void applyWatchFilterErrorChrome(QStandardItem *specItem, QTreeView *tree);
712
720void setupWatchRootItemFromSpec(QStandardItem *specItem, QStandardItem *valueItem, const QString &spec);
721
729QStandardItem *findVariableItemByPathRecursive(QStandardItem *node, const QString &path);
730
737QString watchItemExpansionKey(const QStandardItem *item);
738
739} // namespace LuaDebuggerPath
740
741/* ===== from header_styles ===== */
742
744extern const QString kLuaDbgHeaderToolButtonStyle;
755QIcon luaDbgCircleIcon(bool actions, const QColor &fill, const QColor &outline);
756
772void luaDbgDrawBreakpointDot(QPainter &painter, qreal dotLeft, qreal dotTop, qreal radius, bool enabled,
773 const QColor &outlineColor, bool hasExtras = false, int alpha = 255);
774
784
793
802void styleLuaDebuggerHeaderIconOnlyButton(QToolButton *btn, int side, int iconGrow = 0);
803
804/* ===== from key_router ===== */
805
827{
828public:
834
839 void attach(Ui::LuaDebuggerDialog *ui, QTreeView *breakpointsTree);
840
847 bool reserveShortcutOverride(const QKeyEvent *ke) const;
848
853 bool handleKeyPress(QObject *obj, const QKeyEvent *ke);
854
855private:
856 LuaDebuggerDialog *host_;
857 Ui::LuaDebuggerDialog *ui_ = nullptr;
858 QTreeView *breakpointsTree_ = nullptr;
859};
860
861/* ===== from change_tracker ===== */
862
895{
896 public:
901
907 void refreshChangedValueBrushes(QTreeView *watchTree, QWidget *paletteFallback);
908
913
918
923 void setPauseEntryStackLevel(int level) { pauseEntryStackLevel_ = level; }
924
932 void setPauseEntryRefresh(bool active) { isPauseEntryRefresh_ = active; }
933
944 void applyChangedVisuals(QObject *timerOwner, QStandardItem *anchor, bool changed);
945
950
956 void clearWatchBaselines();
957
962 void clearChangeBaselinesForWatchSpec(const QString &spec);
963
968 void pruneChangeBaselinesToLiveWatchSpecs(QStandardItemModel *watchModel);
969
975 bool changeHighlightAllowed(int stackSelectionLevel) const;
976
985 bool observeWatchRootValue(const QString &rootKey, const QString &value);
986
996 bool observeWatchChildParent(const QString &rootKey, const QString &parentPath);
997
1009 bool observeWatchChildValue(const QString &rootKey, const QString &childPath, const QString &value,
1010 bool parentVisited);
1011
1017 bool observeVariablesParent(const QString &parentKey);
1018
1026 bool observeVariablesValue(const QString &variablesKey, const QString &value, bool parentVisited);
1027
1028 private:
1030 QHash<QString /* rootKey */, QString> watchRootBaseline_;
1031
1033 QHash<QString /* rootKey */, QString> watchRootCurrent_;
1034
1036 QHash<QString /* rootKey */, QHash<QString /* childPath */, QString>> watchChildBaseline_;
1037
1039 QHash<QString /* rootKey */, QHash<QString /* childPath */, QString>> watchChildCurrent_;
1040
1042 QHash<QString /* variablesKey */, QString> variablesBaseline_;
1043
1045 QHash<QString /* variablesKey */, QString> variablesCurrent_;
1046
1048 QSet<QString /* variablesKey of parent */> variablesBaselineParents_;
1049
1051 QSet<QString /* variablesKey of parent */> variablesCurrentParents_;
1052
1054 QHash<QString /* rootKey */, QSet<QString /* parentPath */>> watchChildBaselineParents_;
1055
1057 QHash<QString /* rootKey */, QSet<QString /* parentPath */>> watchChildCurrentParents_;
1058
1060 QBrush changedValueBrush_;
1061
1063 QBrush changedFlashBrush_;
1064
1066 bool isPauseEntryRefresh_ = false;
1067
1069 qint32 flashSerial_ = 0;
1070
1072 int pauseEntryStackLevel_ = 0;
1073
1075 QString pauseEntryFrame0Identity_;
1076
1078 bool pauseEntryFrame0MatchesPrev_ = false;
1079};
1080
1081#endif
bool observeWatchRootValue(const QString &rootKey, const QString &value)
Record the latest value for a watch root keyed by the composite rootKey. Returns true if the new valu...
Definition lua_debugger_utils.cpp:1151
bool changeHighlightAllowed(int stackSelectionLevel) const
Checks if change highlighting is allowed for a given stack level.
Definition lua_debugger_utils.cpp:1284
LuaDebuggerChangeHighlightTracker()=default
Constructs a default LuaDebuggerChangeHighlightTracker.
void clearChangeBaselinesForWatchSpec(const QString &spec)
Clears change baselines for a specific watch specification.
Definition lua_debugger_utils.cpp:1190
void snapshotBaselinesOnPauseEntry()
Snapshots the current values to baseline on a new pause entry.
Definition lua_debugger_utils.cpp:1044
void clearAllChangeBaselines()
Clears all change baselines for watches and variables.
Definition lua_debugger_utils.cpp:1125
void pruneChangeBaselinesToLiveWatchSpecs(QStandardItemModel *watchModel)
Prunes baselines to keep only those present in the live watch specs.
Definition lua_debugger_utils.cpp:1241
void setPauseEntryRefresh(bool active)
Toggle the pause-entry refresh flag. The dialog turns it on for the duration of the pause-entry refre...
Definition lua_debugger_utils.h:932
bool observeVariablesValue(const QString &variablesKey, const QString &value, bool parentVisited)
Variables-tree counterpart to observeWatchChildValue.
Definition lua_debugger_utils.cpp:1181
void refreshChangedValueBrushes(QTreeView *watchTree, QWidget *paletteFallback)
Refreshes the brushes used for changed values based on the application palette.
Definition lua_debugger_utils.cpp:1030
bool observeVariablesParent(const QString &parentKey)
Variables-tree counterpart to observeWatchChildParent.
Definition lua_debugger_utils.cpp:1174
void applyChangedVisuals(QObject *timerOwner, QStandardItem *anchor, bool changed)
Stamp the anchor row with the change visuals; isPauseEntryRefresh_ is consulted internally so callers...
Definition lua_debugger_utils.cpp:1079
bool observeWatchChildValue(const QString &rootKey, const QString &childPath, const QString &value, bool parentVisited)
Record the latest value for a watch-child row at rootKey/childPath. parentVisited is the result of ob...
Definition lua_debugger_utils.cpp:1165
void clearWatchBaselines()
Wipe watch-side baselines (root + child value maps and visited-parent sets). Variables-tree maps are ...
Definition lua_debugger_utils.cpp:1141
bool observeWatchChildParent(const QString &rootKey, const QString &parentPath)
Record parentPath as a visited parent in the watch-child visited-parents set keyed by rootKey....
Definition lua_debugger_utils.cpp:1158
void setPauseEntryStackLevel(int level)
Sets the stack level for the pause entry.
Definition lua_debugger_utils.h:923
void updatePauseEntryFrameIdentity()
Updates the identity of the current frame on pause entry.
Definition lua_debugger_utils.cpp:1058
Top-level dialog hosting the Lua debugger UI components.
Definition lua_debugger_dialog.h:189
bool reserveShortcutOverride(const QKeyEvent *ke) const
Pre-empt a debugger-owned shortcut on QEvent::ShortcutOverride.
Definition lua_debugger_utils.cpp:845
bool handleKeyPress(QObject *obj, const QKeyEvent *ke)
Handle a QEvent::KeyPress delivered to the debugger UI.
Definition lua_debugger_utils.cpp:861
void attach(Ui::LuaDebuggerDialog *ui, QTreeView *breakpointsTree)
Wire the router to the dialog's Ui struct and breakpoints tree. Must be called once,...
Definition lua_debugger_utils.cpp:839
LuaDebuggerKeyRouter(LuaDebuggerDialog *host)
Constructs a LuaDebuggerKeyRouter with a pointer to the host dialog.
Definition lua_debugger_utils.cpp:834
QString watchItemExpansionKey(const QStandardItem *item)
Return the expansion key for a watch item.
Definition lua_debugger_utils.cpp:635
QString watchSpecFromChangeKey(const QString &key)
Return the watch specification corresponding to a change key.
Definition lua_debugger_utils.cpp:180
bool watchSpecIsGlobalScoped(const QString &spec)
Check whether a watch specification is globally scoped.
Definition lua_debugger_utils.cpp:167
QString watchVariablePathForSpec(const QString &spec)
Return the variable path for a watch specification.
Definition lua_debugger_utils.cpp:306
QString changeKey(int stackLevel, const QString &path)
Return the change key for a variable at a given stack level and path.
Definition lua_debugger_utils.cpp:178
void watchRootSetVariablePathRoleFromSpec(QStandardItem *row, const QString &spec)
Set the variable path role on a watch root row item from a watch specification.
Definition lua_debugger_utils.cpp:334
VariableRowFields readVariableRowFields(const wslua_variable_t &v, const QString &parentPath)
Read the display fields of a variable row from a Lua variable.
Definition lua_debugger_utils.cpp:258
QStandardItem * findVariableItemByPathRecursive(QStandardItem *node, const QString &path)
Find a variable item by path in a subtree, searching recursively.
Definition lua_debugger_utils.cpp:613
QString watchPathParentKey(const QString &path)
Return the parent key of a watch path.
Definition lua_debugger_utils.cpp:398
LuaDbgInvalidFilterColors invalidFilterColors()
Return the foreground and background colors used to indicate an invalid filter expression in the Lua ...
Definition lua_debugger_utils.cpp:159
void applyWatchFilterErrorChrome(QStandardItem *specItem, QTreeView *tree)
Apply filter error chrome to a watch specification item.
Definition lua_debugger_utils.cpp:579
QString stripWatchExpressionErrorPrefix(const QString &errStr)
Strip the error prefix from a watch expression error string.
Definition lua_debugger_utils.cpp:186
bool variablesPathIsGlobalScoped(const QString &path)
Check whether a variables path is globally scoped.
Definition lua_debugger_utils.cpp:173
void reexpandWatchDescendantsByPathKeys(QTreeView *tree, QStandardItemModel *model, QStandardItem *subtree, QStringList pathKeys)
Re-expand previously expanded watch descendants of a subtree by their path keys.
Definition lua_debugger_utils.cpp:559
void applyWatchChildRowTextAndTooltip(QStandardItem *specItem, const QString &rawVal, const QString &typeText)
Apply the raw value and type text to a watch child row item.
Definition lua_debugger_utils.cpp:433
QString watchResolvedVariablePathForTooltip(const QString &spec)
Return the resolved variable path for a watch tooltip.
Definition lua_debugger_utils.cpp:318
QStandardItem * findWatchItemBySubpathOrPathKey(QStandardItem *subtree, const QString &key)
Find a watch item in a subtree by its subpath or path key.
Definition lua_debugger_utils.cpp:470
void clearWatchFilterErrorChrome(QStandardItem *specItem, QTreeView *tree)
Clear the filter error chrome from a watch specification item.
Definition lua_debugger_utils.cpp:565
QString watchPathOriginSuffix(const QStandardItem *item, const QString &spec)
Return the origin suffix for a watch path tooltip.
Definition lua_debugger_utils.cpp:363
QStandardItem * findVariableTreeItemByPathKey(QStandardItem *subtree, const QString &key)
Find a variable tree item in a subtree by its path key.
Definition lua_debugger_utils.cpp:495
int watchSubpathBoundaryCount(const QString &subpath)
Return the number of subpath boundaries in a watch subpath.
Definition lua_debugger_utils.cpp:452
void applyVariableExpansionIndicator(QStandardItem *anchor, bool canExpand, bool enabledOnlyPlaceholder, int columnCount)
Apply an expansion indicator to a variable row anchor item.
Definition lua_debugger_utils.cpp:269
QString capWatchTooltipText(const QString &s)
Truncate a watch tooltip text string to a reasonable length.
Definition lua_debugger_utils.cpp:389
const QString kLuaDbgHeaderToolButtonStyle
Definition lua_debugger_utils.cpp:653
void setupWatchRootItemFromSpec(QStandardItem *specItem, QStandardItem *valueItem, const QString &spec)
Set up a watch root item from a watch specification.
Definition lua_debugger_utils.cpp:594
void reexpandTreeDescendantsByPathKeys(QTreeView *tree, QStandardItemModel *model, QStandardItem *subtree, QStringList pathKeys, TreePathKeyFinder findByKey)
Re-expand previously expanded descendants of a subtree by their path keys.
Definition lua_debugger_utils.cpp:518
QStringList luaDbgTreeSectionExpandedSubpaths(const QHash< QString, LuaDbgTreeSectionExpansionState > &map, const QString &rootKey)
Expanded-descendant subpaths recorded for rootKey, or empty.
Definition lua_debugger_utils.cpp:121
void setForeground(QStandardItemModel *model, QStandardItem *col0, int col, const QBrush &brush)
Set the foreground brush for a cell in column col for a row whose column-0 anchor is col0.
Definition lua_debugger_utils.h:323
void luaDbgRecordTreeSectionRootExpansion(QHash< QString, LuaDbgTreeSectionExpansionState > &map, const QString &rootKey, bool expanded)
Record / clear root-level expansion for rootKey in map. Mutates map in place; collapsing a root with ...
Definition lua_debugger_utils.cpp:72
QStandardItem * luaDbgWatchRootItem(QStandardItem *item)
Finds the root item of a QStandardItem hierarchy.
Definition lua_debugger_utils.h:63
void luaDbgRecordTreeSectionSubpathExpansion(QHash< QString, LuaDbgTreeSectionExpansionState > &map, const QString &rootKey, const QString &key, bool expanded)
Add / remove one descendant subpath key under rootKey in map. Mirrors luaDbgRecordTreeSectionRootExpa...
Definition lua_debugger_utils.cpp:91
void styleLuaDebuggerHeaderIconOnlyButton(QToolButton *btn, int side, int iconGrow=0)
Style a Lua debugger header icon-only button.
Definition lua_debugger_utils.cpp:719
constexpr const char * DebuggerEnabled
Definition lua_debugger_utils.h:125
void setBackground(QStandardItemModel *model, QStandardItem *col0, int col, const QBrush &brush)
Set the background brush for a cell in column col for a row whose column-0 anchor is col0.
Definition lua_debugger_utils.h:339
QString rowColumnDisplayText(const QModelIndex &indexInRow, int col)
Qt::DisplayRole text for column col in the same row as indexInRow.
Definition lua_debugger_utils.h:205
void setText(QStandardItemModel *model, QStandardItem *col0, int col, const QString &t)
Set the text for a cell in column col for a row whose column-0 anchor is col0.
Definition lua_debugger_utils.h:275
QKeySequence luaDbgSeqFromKeyEvent(const QKeyEvent *ke)
Build a key sequence from a key event for matching against QAction shortcuts. Wraps the Qt5/Qt6 modif...
Definition lua_debugger_utils.cpp:147
void setExpanded(QTreeView *tree, QStandardItemModel *model, QStandardItem *col0, bool expanded)
Set the expansion state for a cell in column col for a row whose column-0 anchor is col0.
Definition lua_debugger_utils.h:414
QIcon luaDbgCircleIcon(bool actions, const QColor &fill, const QColor &outline)
Return a Fluent circle icon for breakpoints and debugger state.
Definition lua_debugger_utils.cpp:655
void luaDbgDrawBreakpointDot(QPainter &painter, qreal dotLeft, qreal dotTop, qreal radius, bool enabled, const QColor &outlineColor, bool hasExtras=false, int alpha=255)
Draws a breakpoint dot on the given painter.
Definition lua_debugger_utils.cpp:677
LuaDbgBpHeaderIconMode
Controls the state of the header toggle icon in the Lua debugger breakpoint list.
Definition lua_debugger_utils.h:779
@ ActivateAll
Definition lua_debugger_utils.h:781
@ NoBreakpoints
Definition lua_debugger_utils.h:780
@ DeactivateAll
Definition lua_debugger_utils.h:782
void setFont(QStandardItemModel *model, QStandardItem *col0, int col, const QFont &font)
Set the font for a cell in column col for a row whose column-0 anchor is col0.
Definition lua_debugger_utils.h:307
QString luaDebuggerSettingsFilePath()
Returns the file path for Lua debugger settings.
Definition lua_debugger_utils.cpp:66
void setTextAlignment(QStandardItemModel *model, QStandardItem *col0, int col, Qt::Alignment align)
Set the text alignment for a cell in column col for a row whose column-0 anchor is col0.
Definition lua_debugger_utils.h:371
void setIcon(QStandardItemModel *model, QStandardItem *col0, int col, const QIcon &icon)
Set the icon for a cell in column col for a row whose column-0 anchor is col0.
Definition lua_debugger_utils.h:355
QModelIndex indexCol0(QStandardItemModel *model, QStandardItem *col0)
Check whether a cell in column col for a row whose column-0 anchor is col0 is expanded in the tree vi...
Definition lua_debugger_utils.h:386
QString text(QStandardItemModel *model, QStandardItem *col0, int col)
Return the text for a cell in column col for a row whose column-0 anchor is col0.
Definition lua_debugger_utils.h:262
constexpr int kLuaDbgEvalOutputMaxLines
Definition lua_debugger_utils.h:171
void setToolTip(QStandardItemModel *model, QStandardItem *col0, int col, const QString &tip)
Set the tool tip for a cell in column col for a row whose column-0 anchor is col0.
Definition lua_debugger_utils.h:291
bool shouldMarkChanged(const Map &baseline, const Key &key, const QString &newVal, bool flashNew=false)
Determine whether a variable has changed based on its current and baseline values.
Definition lua_debugger_utils.h:501
bool isExpanded(QTreeView *tree, QStandardItemModel *model, QStandardItem *col0)
Check whether a cell in column col for a row whose column-0 anchor is col0 is expanded in the tree vi...
Definition lua_debugger_utils.h:401
QStandardItem * rowCol0(QStandardItemModel *model, QStandardItem *cell)
Column-0 item for the same row as cell.
Definition lua_debugger_utils.h:220
QIcon luaDbgBreakpointHeaderIconForMode(LuaDbgBpHeaderIconMode mode)
Return the appropriate breakpoint header icon for the given mode.
Definition lua_debugger_utils.cpp:710
QStandardItem * cellAt(QStandardItemModel *model, QStandardItem *col0, int col)
Cell in column col for a row whose column-0 anchor is col0.
Definition lua_debugger_utils.h:241
Definition lua_debugger_utils.h:74
Stores the foreground and background colors used to highlight invalid filter expressions in the Lua d...
Definition lua_debugger_utils.h:434
QColor bg
Definition lua_debugger_utils.h:436
QColor fg
Definition lua_debugger_utils.h:435
Holds the display fields for a single row in a variable inspection tree view.
Definition lua_debugger_utils.h:557
QString childPath
Definition lua_debugger_utils.h:562
QString value
Definition lua_debugger_utils.h:559
bool canExpand
Definition lua_debugger_utils.h:561
QString type
Definition lua_debugger_utils.h:560
QString name
Definition lua_debugger_utils.h:558
Variable structure for inspection.
Definition wslua_debugger.h:391