Wireshark 4.7.3
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 <[email protected]>
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{
124constexpr const char *Theme = "theme";
126constexpr const char *DebuggerEnabled = "debuggerEnabled";
127constexpr const char *MainSplitter = "mainSplitterState";
128constexpr const char *LeftSplitter = "leftSplitterState";
129constexpr const char *EvalSplitter = "evalSplitterState";
130constexpr const char *SectionVariables = "sectionVariables";
131constexpr const char *SectionStack = "sectionStack";
132constexpr const char *SectionFiles = "sectionFiles";
133constexpr const char *SectionBreakpoints = "sectionBreakpoints";
134constexpr const char *SectionEval = "sectionEval";
135constexpr const char *SectionSettings = "sectionSettings";
136constexpr const char *SectionWatch = "sectionWatch";
137constexpr const char *Breakpoints = "breakpoints";
138constexpr const char *Watches = "watches";
139constexpr const char *BreakOnError = "breakOnError";
140} // namespace LuaDebuggerSettingsKeys
141
142// Tree widget UserRoles (must stay stable for persisted settings / model code).
143constexpr qint32 FileTreePathRole = static_cast<qint32>(Qt::UserRole);
144constexpr qint32 FileTreeIsDirectoryRole = static_cast<qint32>(Qt::UserRole + 1);
145constexpr qint32 BreakpointFileRole = static_cast<qint32>(Qt::UserRole + 2);
146constexpr qint32 BreakpointLineRole = static_cast<qint32>(Qt::UserRole + 3);
147constexpr qint32 BreakpointConditionRole = static_cast<qint32>(Qt::UserRole + 30);
148constexpr qint32 BreakpointHitCountRole = static_cast<qint32>(Qt::UserRole + 31);
149constexpr qint32 BreakpointHitTargetRole = static_cast<qint32>(Qt::UserRole + 32);
150constexpr qint32 BreakpointConditionErrRole = static_cast<qint32>(Qt::UserRole + 33);
151constexpr qint32 BreakpointLogMessageRole = static_cast<qint32>(Qt::UserRole + 34);
152constexpr qint32 BreakpointHitModeRole = static_cast<qint32>(Qt::UserRole + 35);
153constexpr qint32 BreakpointLogAlsoPauseRole = static_cast<qint32>(Qt::UserRole + 36);
154constexpr qint32 StackItemFileRole = static_cast<qint32>(Qt::UserRole + 4);
155constexpr qint32 StackItemLineRole = static_cast<qint32>(Qt::UserRole + 5);
156constexpr qint32 StackItemNavigableRole = static_cast<qint32>(Qt::UserRole + 6);
157constexpr qint32 StackItemLevelRole = static_cast<qint32>(Qt::UserRole + 7);
158constexpr qint32 VariablePathRole = static_cast<qint32>(Qt::UserRole + 8);
159constexpr qint32 VariableTypeRole = static_cast<qint32>(Qt::UserRole + 9);
160constexpr qint32 VariableCanExpandRole = static_cast<qint32>(Qt::UserRole + 10);
161constexpr qint32 WatchSpecRole = static_cast<qint32>(Qt::UserRole + 11);
162constexpr qint32 WatchSubpathRole = static_cast<qint32>(Qt::UserRole + 13);
163constexpr qint32 WatchPendingNewRole = static_cast<qint32>(Qt::UserRole + 15);
164constexpr qint32 ChangedFlashSerialRole = static_cast<qint32>(Qt::UserRole + 20);
165
166constexpr qsizetype WATCH_TOOLTIP_MAX_CHARS = 4096;
167constexpr int WATCH_EXPR_MAX_CHARS = 65536;
168constexpr int CHANGED_FLASH_MS = 500;
169constexpr int WATCH_PLACEHOLDER_DEFER_MS = 250;
170constexpr QChar CHANGE_KEY_SEP = QChar(0x1F);
171
173constexpr int kLuaDbgEvalOutputMaxLines = 5000;
174
175extern const QKeySequence kLuaDbgCtxGoToLine;
176extern const QKeySequence kLuaDbgCtxRunToLine;
177extern const QKeySequence kLuaDbgCtxWatchEdit;
178extern const QKeySequence kLuaDbgCtxWatchCopyValue;
179extern const QKeySequence kLuaDbgCtxWatchDuplicate;
180extern const QKeySequence kLuaDbgCtxWatchRemoveAll;
181extern const QKeySequence kLuaDbgCtxAddWatch;
182extern const QKeySequence kLuaDbgCtxToggleBreakpoint;
183extern const QKeySequence kLuaDbgCtxReloadLuaPlugins;
184extern const QKeySequence kLuaDbgCtxRemoveAllBreakpoints;
185
194QKeySequence luaDbgSeqFromKeyEvent(const QKeyEvent *ke);
195
196/* ===== from item_utils ===== */
197
198namespace LuaDebuggerItems
199{
200
207inline QString rowColumnDisplayText(const QModelIndex &indexInRow, int col)
208{
209 if (!indexInRow.isValid())
210 {
211 return QString();
212 }
213 return indexInRow.sibling(indexInRow.row(), col).data(Qt::DisplayRole).toString();
214}
215
222inline QStandardItem *rowCol0(QStandardItemModel *model, QStandardItem *cell)
223{
224 if (!model || !cell)
225 {
226 return nullptr;
227 }
228 const QModelIndex ix = model->indexFromItem(cell);
229 if (!ix.isValid())
230 {
231 return nullptr;
232 }
233 return model->itemFromIndex(ix.sibling(ix.row(), 0));
234}
235
243inline QStandardItem *cellAt(QStandardItemModel *model, QStandardItem *col0, int col)
244{
245 if (!model || !col0 || col0->column() != 0)
246 {
247 return nullptr;
248 }
249 QStandardItem *par = col0->parent();
250 if (!par)
251 {
252 return model->item(col0->row(), col);
253 }
254 return par->child(col0->row(), col);
255}
256
264inline QString text(QStandardItemModel *model, QStandardItem *col0, int col)
265{
266 QStandardItem *c = cellAt(model, col0, col);
267 return c ? c->text() : QString();
268}
269
277inline void setText(QStandardItemModel *model, QStandardItem *col0, int col, const QString &t)
278{
279 QStandardItem *c = cellAt(model, col0, col);
280 if (c)
281 {
282 c->setText(t);
283 }
284}
285
293inline void setToolTip(QStandardItemModel *model, QStandardItem *col0, int col, const QString &tip)
294{
295 QStandardItem *c = cellAt(model, col0, col);
296 if (c)
297 {
298 c->setToolTip(tip);
299 }
300}
301
309inline void setFont(QStandardItemModel *model, QStandardItem *col0, int col, const QFont &font)
310{
311 QStandardItem *c = cellAt(model, col0, col);
312 if (c)
313 {
314 c->setFont(font);
315 }
316}
317
325inline void setForeground(QStandardItemModel *model, QStandardItem *col0, int col, const QBrush &brush)
326{
327 QStandardItem *c = cellAt(model, col0, col);
328 if (c)
329 {
330 c->setForeground(brush);
331 }
332}
333
341inline void setBackground(QStandardItemModel *model, QStandardItem *col0, int col, const QBrush &brush)
342{
343 QStandardItem *c = cellAt(model, col0, col);
344 if (c)
345 {
346 c->setBackground(brush);
347 }
348}
349
357inline void setIcon(QStandardItemModel *model, QStandardItem *col0, int col, const QIcon &icon)
358{
359 QStandardItem *c = cellAt(model, col0, col);
360 if (c)
361 {
362 c->setIcon(icon);
363 }
364}
365
373inline void setTextAlignment(QStandardItemModel *model, QStandardItem *col0, int col, Qt::Alignment align)
374{
375 QStandardItem *c = cellAt(model, col0, col);
376 if (c)
377 {
378 c->setTextAlignment(align);
379 }
380}
381
388inline QModelIndex indexCol0(QStandardItemModel *model, QStandardItem *col0)
389{
390 if (!model || !col0 || col0->column() != 0)
391 {
392 return QModelIndex();
393 }
394 return model->indexFromItem(col0);
395}
396
403inline bool isExpanded(QTreeView *tree, QStandardItemModel *model, QStandardItem *col0)
404{
405 const QModelIndex ix = indexCol0(model, col0);
406 return ix.isValid() && tree->isExpanded(ix);
407}
408
416inline void setExpanded(QTreeView *tree, QStandardItemModel *model, QStandardItem *col0, bool expanded)
417{
418 const QModelIndex ix = indexCol0(model, col0);
419 if (ix.isValid())
420 {
421 tree->setExpanded(ix, expanded);
422 }
423}
424
425} // namespace LuaDebuggerItems
426
427/* ===== from path_utils ===== */
428
429namespace LuaDebuggerPath
430{
431
436{
437 QColor fg;
438 QColor bg;
439};
440
452
459bool watchSpecIsGlobalScoped(const QString &spec);
460
467bool variablesPathIsGlobalScoped(const QString &path);
468
476QString changeKey(int stackLevel, const QString &path);
477
484QString watchSpecFromChangeKey(const QString &key);
485
492QString stripWatchExpressionErrorPrefix(const QString &errStr);
493
502template <class Key, class Map>
503bool shouldMarkChanged(const Map &baseline, const Key &key, const QString &newVal, bool flashNew = false)
504{
505 const auto it = baseline.constFind(key);
506 if (it != baseline.constEnd())
507 {
508 return *it != newVal;
509 }
510 return flashNew && !baseline.isEmpty();
511}
512
519QString variableSectionRootKeyFromItem(const QStandardItem *item);
520
527bool watchSpecUsesPathResolution(const QString &spec);
528
536QString variableTreeChildPath(const QString &parentPath, const QString &nameText);
537
545QString expressionWatchChildSubpath(const QString &parentSubpath, const QString &nameText);
546
553bool variableChildrenShouldSortByName(const QString &parentPath);
554
559{
560 QString name;
561 QString value;
562 QString type;
563 bool canExpand = false;
564 QString childPath;
565};
566
574VariableRowFields readVariableRowFields(const wslua_variable_t &v, const QString &parentPath);
575
584void applyVariableExpansionIndicator(QStandardItem *anchor, bool canExpand, bool enabledOnlyPlaceholder,
585 int columnCount = 3);
586
593QString watchVariablePathForSpec(const QString &spec);
594
601QString watchResolvedVariablePathForTooltip(const QString &spec);
602
610void watchRootSetVariablePathRoleFromSpec(QStandardItem *row, const QString &spec);
611
619QString watchPathOriginSuffix(const QStandardItem *item, const QString &spec);
620
627QString capWatchTooltipText(const QString &s);
628
635QString watchPathParentKey(const QString &path);
636
644void applyWatchChildRowTextAndTooltip(QStandardItem *specItem, const QString &rawVal, const QString &typeText);
645
652int watchSubpathBoundaryCount(const QString &subpath);
653
661QStandardItem *findWatchItemBySubpathOrPathKey(QStandardItem *subtree, const QString &key);
662
670QStandardItem *findVariableTreeItemByPathKey(QStandardItem *subtree, const QString &key);
671
672using TreePathKeyFinder = QStandardItem *(*)(QStandardItem *, const QString &);
673
684void reexpandTreeDescendantsByPathKeys(QTreeView *tree, QStandardItemModel *model, QStandardItem *subtree,
685 QStringList pathKeys, TreePathKeyFinder findByKey);
686
696void reexpandWatchDescendantsByPathKeys(QTreeView *tree, QStandardItemModel *model, QStandardItem *subtree,
697 QStringList pathKeys);
698
705void clearWatchFilterErrorChrome(QStandardItem *specItem, QTreeView *tree);
706
713void applyWatchFilterErrorChrome(QStandardItem *specItem, QTreeView *tree);
714
722void setupWatchRootItemFromSpec(QStandardItem *specItem, QStandardItem *valueItem, const QString &spec);
723
731QStandardItem *findVariableItemByPathRecursive(QStandardItem *node, const QString &path);
732
739QString watchItemExpansionKey(const QStandardItem *item);
740
741} // namespace LuaDebuggerPath
742
743/* ===== from header_styles ===== */
744
753QIcon luaDbgMakeSelectionAwareIcon(const QIcon &base, const QPalette &palette);
754
755
770QIcon luaDbgPaintedGlyphIcon(const QString &glyph, int side, qreal dpr,
771 const QFont &baseFont, const QColor &color,
772 int margin = 1);
773
794QIcon luaDbgPaintedGlyphButtonIcon(const QString &glyph, int side, qreal dpr,
795 const QFont &baseFont, const QPalette &palette,
796 int margin = 2);
797
799extern const QString kLuaDbgHeaderPlus;
800extern const QString kLuaDbgHeaderMinus;
803extern const QString kLuaDbgHeaderEdit;
806extern const QString kLuaDbgRowLog;
809extern const QString kLuaDbgRowExtras;
812extern const QString kLuaDbgHeaderRemoveAll;
813extern const QString kLuaDbgHeaderToolButtonStyle;
814
826void luaDbgDrawBreakpointDot(QPainter &painter, qreal dotLeft, qreal dotTop, qreal radius, bool enabled,
827 bool hasExtras = false, int alpha = 255);
828
838
848QIcon luaDbgBreakpointHeaderIconForMode(const QFont *editorFont, LuaDbgBpHeaderIconMode mode, int headerSide,
849 qreal dpr);
850
857void styleLuaDebuggerHeaderBreakpointToggleButton(QToolButton *btn, int side);
858
867void styleLuaDebuggerHeaderFittedTextButton(QToolButton *btn, int side, const QFont &titleFont,
868 const QStringList &glyphs);
869
877void styleLuaDebuggerHeaderPlusMinusButton(QToolButton *btn, int side, const QFont &titleFont);
878
885void styleLuaDebuggerHeaderIconOnlyButton(QToolButton *btn, int side);
886
901QIcon luaDbgErrorBreakHeaderIcon(bool checked, int side, qreal dpr,
902 const QFont &titleFont, const QPalette &palette);
903
904/* ===== from key_router ===== */
905
927{
928public:
934
939 void attach(Ui::LuaDebuggerDialog *ui, QTreeView *breakpointsTree);
940
947 bool reserveShortcutOverride(const QKeyEvent *ke) const;
948
953 bool handleKeyPress(QObject *obj, const QKeyEvent *ke);
954
955private:
956 LuaDebuggerDialog *host_;
957 Ui::LuaDebuggerDialog *ui_ = nullptr;
958 QTreeView *breakpointsTree_ = nullptr;
959};
960
961/* ===== from change_tracker ===== */
962
995{
996 public:
1001
1007 void refreshChangedValueBrushes(QTreeView *watchTree, QWidget *paletteFallback);
1008
1013
1018
1023 void setPauseEntryStackLevel(int level) { pauseEntryStackLevel_ = level; }
1024
1032 void setPauseEntryRefresh(bool active) { isPauseEntryRefresh_ = active; }
1033
1044 void applyChangedVisuals(QObject *timerOwner, QStandardItem *anchor, bool changed);
1045
1050
1056 void clearWatchBaselines();
1057
1062 void clearChangeBaselinesForWatchSpec(const QString &spec);
1063
1068 void pruneChangeBaselinesToLiveWatchSpecs(QStandardItemModel *watchModel);
1069
1075 bool changeHighlightAllowed(int stackSelectionLevel) const;
1076
1085 bool observeWatchRootValue(const QString &rootKey, const QString &value);
1086
1096 bool observeWatchChildParent(const QString &rootKey, const QString &parentPath);
1097
1109 bool observeWatchChildValue(const QString &rootKey, const QString &childPath, const QString &value,
1110 bool parentVisited);
1111
1117 bool observeVariablesParent(const QString &parentKey);
1118
1126 bool observeVariablesValue(const QString &variablesKey, const QString &value, bool parentVisited);
1127
1128 private:
1130 QHash<QString /* rootKey */, QString> watchRootBaseline_;
1131
1133 QHash<QString /* rootKey */, QString> watchRootCurrent_;
1134
1136 QHash<QString /* rootKey */, QHash<QString /* childPath */, QString>> watchChildBaseline_;
1137
1139 QHash<QString /* rootKey */, QHash<QString /* childPath */, QString>> watchChildCurrent_;
1140
1142 QHash<QString /* variablesKey */, QString> variablesBaseline_;
1143
1145 QHash<QString /* variablesKey */, QString> variablesCurrent_;
1146
1148 QSet<QString /* variablesKey of parent */> variablesBaselineParents_;
1149
1151 QSet<QString /* variablesKey of parent */> variablesCurrentParents_;
1152
1154 QHash<QString /* rootKey */, QSet<QString /* parentPath */>> watchChildBaselineParents_;
1155
1157 QHash<QString /* rootKey */, QSet<QString /* parentPath */>> watchChildCurrentParents_;
1158
1160 QBrush changedValueBrush_;
1161
1163 QBrush changedFlashBrush_;
1164
1166 bool isPauseEntryRefresh_ = false;
1167
1169 qint32 flashSerial_ = 0;
1170
1172 int pauseEntryStackLevel_ = 0;
1173
1175 QString pauseEntryFrame0Identity_;
1176
1178 bool pauseEntryFrame0MatchesPrev_ = false;
1179};
1180
1181#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:1391
bool changeHighlightAllowed(int stackSelectionLevel) const
Checks if change highlighting is allowed for a given stack level.
Definition lua_debugger_utils.cpp:1524
LuaDebuggerChangeHighlightTracker()=default
Constructs a default LuaDebuggerChangeHighlightTracker.
void clearChangeBaselinesForWatchSpec(const QString &spec)
Clears change baselines for a specific watch specification.
Definition lua_debugger_utils.cpp:1430
void snapshotBaselinesOnPauseEntry()
Snapshots the current values to baseline on a new pause entry.
Definition lua_debugger_utils.cpp:1284
void clearAllChangeBaselines()
Clears all change baselines for watches and variables.
Definition lua_debugger_utils.cpp:1365
void pruneChangeBaselinesToLiveWatchSpecs(QStandardItemModel *watchModel)
Prunes baselines to keep only those present in the live watch specs.
Definition lua_debugger_utils.cpp:1481
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:1032
bool observeVariablesValue(const QString &variablesKey, const QString &value, bool parentVisited)
Variables-tree counterpart to observeWatchChildValue.
Definition lua_debugger_utils.cpp:1421
void refreshChangedValueBrushes(QTreeView *watchTree, QWidget *paletteFallback)
Refreshes the brushes used for changed values based on the application palette.
Definition lua_debugger_utils.cpp:1260
bool observeVariablesParent(const QString &parentKey)
Variables-tree counterpart to observeWatchChildParent.
Definition lua_debugger_utils.cpp:1414
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:1319
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:1405
void clearWatchBaselines()
Wipe watch-side baselines (root + child value maps and visited-parent sets). Variables-tree maps are ...
Definition lua_debugger_utils.cpp:1381
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:1398
void setPauseEntryStackLevel(int level)
Sets the stack level for the pause entry.
Definition lua_debugger_utils.h:1023
void updatePauseEntryFrameIdentity()
Updates the identity of the current frame on pause entry.
Definition lua_debugger_utils.cpp:1298
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:1075
bool handleKeyPress(QObject *obj, const QKeyEvent *ke)
Handle a QEvent::KeyPress delivered to the debugger UI.
Definition lua_debugger_utils.cpp:1091
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:1069
LuaDebuggerKeyRouter(LuaDebuggerDialog *host)
Constructs a LuaDebuggerKeyRouter with a pointer to the host dialog.
Definition lua_debugger_utils.cpp:1064
QString watchItemExpansionKey(const QStandardItem *item)
Return the expansion key for a watch item.
Definition lua_debugger_utils.cpp:635
const QString kLuaDbgHeaderEdit
Definition lua_debugger_utils.cpp:655
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
const QString kLuaDbgRowExtras
Definition lua_debugger_utils.cpp:658
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
const QString kLuaDbgHeaderPlus
Definition lua_debugger_utils.cpp:653
const QString kLuaDbgHeaderRemoveAll
Definition lua_debugger_utils.cpp:656
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
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
const QString kLuaDbgRowLog
Definition lua_debugger_utils.cpp:657
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:325
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
QIcon luaDbgPaintedGlyphIcon(const QString &glyph, int side, qreal dpr, const QFont &baseFont, const QColor &color, int margin=1)
Paint a glyph centred into a square pixmap and return it as an icon.
Definition lua_debugger_utils.cpp:736
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 styleLuaDebuggerHeaderFittedTextButton(QToolButton *btn, int side, const QFont &titleFont, const QStringList &glyphs)
Style a Lua debugger header button with fitted text glyphs.
Definition lua_debugger_utils.cpp:832
void styleLuaDebuggerHeaderBreakpointToggleButton(QToolButton *btn, int side)
Style a Lua debugger header breakpoint toggle button.
Definition lua_debugger_utils.cpp:823
constexpr const char * DebuggerEnabled
Definition lua_debugger_utils.h:126
void luaDbgDrawBreakpointDot(QPainter &painter, qreal dotLeft, qreal dotTop, qreal radius, bool enabled, bool hasExtras=false, int alpha=255)
Draws a breakpoint dot on the given painter.
Definition lua_debugger_utils.cpp:662
QIcon luaDbgBreakpointHeaderIconForMode(const QFont *editorFont, LuaDbgBpHeaderIconMode mode, int headerSide, qreal dpr)
Return the appropriate breakpoint header icon for the given mode.
Definition lua_debugger_utils.cpp:695
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:341
QString rowColumnDisplayText(const QModelIndex &indexInRow, int col)
Qt::DisplayRole text for column col in the same row as indexInRow.
Definition lua_debugger_utils.h:207
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:277
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:416
LuaDbgBpHeaderIconMode
Controls the state of the header toggle icon in the Lua debugger breakpoint list.
Definition lua_debugger_utils.h:833
@ ActivateAll
Definition lua_debugger_utils.h:835
@ NoBreakpoints
Definition lua_debugger_utils.h:834
@ DeactivateAll
Definition lua_debugger_utils.h:836
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:309
QString luaDebuggerSettingsFilePath()
Returns the file path for Lua debugger settings.
Definition lua_debugger_utils.cpp:66
void styleLuaDebuggerHeaderIconOnlyButton(QToolButton *btn, int side)
Style a Lua debugger header icon-only button.
Definition lua_debugger_utils.cpp:883
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:373
QIcon luaDbgErrorBreakHeaderIcon(bool checked, int side, qreal dpr, const QFont &titleFont, const QPalette &palette)
Build a colored Break-on-Error toggle icon for the breakpoints section header.
Definition lua_debugger_utils.cpp:897
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:357
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:388
QIcon luaDbgMakeSelectionAwareIcon(const QIcon &base, const QPalette &palette)
Create a selection-aware icon for tree icons (breakpoints, variables, and watch) that applies a selec...
Definition lua_debugger_utils.cpp:930
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:264
constexpr int kLuaDbgEvalOutputMaxLines
Definition lua_debugger_utils.h:173
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:293
void styleLuaDebuggerHeaderPlusMinusButton(QToolButton *btn, int side, const QFont &titleFont)
Style a Lua debugger header plus/minus button.
Definition lua_debugger_utils.cpp:877
QIcon luaDbgPaintedGlyphButtonIcon(const QString &glyph, int side, qreal dpr, const QFont &baseFont, const QPalette &palette, int margin=2)
Creates an icon for a painted glyph button.
Definition lua_debugger_utils.cpp:811
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:503
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:403
QStandardItem * rowCol0(QStandardItemModel *model, QStandardItem *cell)
Column-0 item for the same row as cell.
Definition lua_debugger_utils.h:222
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:243
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:436
QColor bg
Definition lua_debugger_utils.h:438
QColor fg
Definition lua_debugger_utils.h:437
Holds the display fields for a single row in a variable inspection tree view.
Definition lua_debugger_utils.h:559
QString childPath
Definition lua_debugger_utils.h:564
QString value
Definition lua_debugger_utils.h:561
bool canExpand
Definition lua_debugger_utils.h:563
QString type
Definition lua_debugger_utils.h:562
QString name
Definition lua_debugger_utils.h:560
Variable structure for inspection.
Definition wslua_debugger.h:401