Wireshark 4.7.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
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{
50}
51
52/* ===== from internal ===== */
53
54
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
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
433{
434 QColor fg;
435 QColor bg;
436};
437
449
456bool watchSpecIsGlobalScoped(const QString &spec);
457
464bool variablesPathIsGlobalScoped(const QString &path);
465
473QString changeKey(int stackLevel, const QString &path);
474
481QString watchSpecFromChangeKey(const QString &key);
482
489QString stripWatchExpressionErrorPrefix(const QString &errStr);
490
499template <class Key, class Map>
500bool shouldMarkChanged(const Map &baseline, const Key &key, const QString &newVal, bool flashNew = false)
501{
502 const auto it = baseline.constFind(key);
503 if (it != baseline.constEnd())
504 {
505 return *it != newVal;
506 }
507 return flashNew && !baseline.isEmpty();
508}
509
516QString variableSectionRootKeyFromItem(const QStandardItem *item);
517
524bool watchSpecUsesPathResolution(const QString &spec);
525
533QString variableTreeChildPath(const QString &parentPath, const QString &nameText);
534
542QString expressionWatchChildSubpath(const QString &parentSubpath, const QString &nameText);
543
550bool variableChildrenShouldSortByName(const QString &parentPath);
551
553{
554 QString name;
555 QString value;
556 QString type;
557 bool canExpand = false;
558 QString childPath;
559};
560
568VariableRowFields readVariableRowFields(const wslua_variable_t &v, const QString &parentPath);
569
578void applyVariableExpansionIndicator(QStandardItem *anchor, bool canExpand, bool enabledOnlyPlaceholder,
579 int columnCount = 3);
580
587QString watchVariablePathForSpec(const QString &spec);
588
595QString watchResolvedVariablePathForTooltip(const QString &spec);
596
604void watchRootSetVariablePathRoleFromSpec(QStandardItem *row, const QString &spec);
605
613QString watchPathOriginSuffix(const QStandardItem *item, const QString &spec);
614
621QString capWatchTooltipText(const QString &s);
622
629QString watchPathParentKey(const QString &path);
630
638void applyWatchChildRowTextAndTooltip(QStandardItem *specItem, const QString &rawVal, const QString &typeText);
639
646int watchSubpathBoundaryCount(const QString &subpath);
647
655QStandardItem *findWatchItemBySubpathOrPathKey(QStandardItem *subtree, const QString &key);
656
664QStandardItem *findVariableTreeItemByPathKey(QStandardItem *subtree, const QString &key);
665
666using TreePathKeyFinder = QStandardItem *(*)(QStandardItem *, const QString &);
667
678void reexpandTreeDescendantsByPathKeys(QTreeView *tree, QStandardItemModel *model, QStandardItem *subtree,
679 QStringList pathKeys, TreePathKeyFinder findByKey);
680
690void reexpandWatchDescendantsByPathKeys(QTreeView *tree, QStandardItemModel *model, QStandardItem *subtree,
691 QStringList pathKeys);
692
699void clearWatchFilterErrorChrome(QStandardItem *specItem, QTreeView *tree);
700
707void applyWatchFilterErrorChrome(QStandardItem *specItem, QTreeView *tree);
708
716void setupWatchRootItemFromSpec(QStandardItem *specItem, QStandardItem *valueItem, const QString &spec);
717
725QStandardItem *findVariableItemByPathRecursive(QStandardItem *node, const QString &path);
726
733QString watchItemExpansionKey(const QStandardItem *item);
734
735} // namespace LuaDebuggerPath
736
737/* ===== from header_styles ===== */
738
747QIcon luaDbgMakeSelectionAwareIcon(const QIcon &base, const QPalette &palette);
748
749
764QIcon luaDbgPaintedGlyphIcon(const QString &glyph, int side, qreal dpr,
765 const QFont &baseFont, const QColor &color,
766 int margin = 1);
767
788QIcon luaDbgPaintedGlyphButtonIcon(const QString &glyph, int side, qreal dpr,
789 const QFont &baseFont, const QPalette &palette,
790 int margin = 2);
791
793extern const QString kLuaDbgHeaderPlus;
794extern const QString kLuaDbgHeaderMinus;
797extern const QString kLuaDbgHeaderEdit;
800extern const QString kLuaDbgRowLog;
803extern const QString kLuaDbgRowExtras;
806extern const QString kLuaDbgHeaderRemoveAll;
807extern const QString kLuaDbgHeaderToolButtonStyle;
808
820void luaDbgDrawBreakpointDot(QPainter &painter, qreal dotLeft, qreal dotTop, qreal radius, bool enabled,
821 bool hasExtras = false, int alpha = 255);
822
832
842QIcon luaDbgBreakpointHeaderIconForMode(const QFont *editorFont, LuaDbgBpHeaderIconMode mode, int headerSide,
843 qreal dpr);
844
851void styleLuaDebuggerHeaderBreakpointToggleButton(QToolButton *btn, int side);
852
861void styleLuaDebuggerHeaderFittedTextButton(QToolButton *btn, int side, const QFont &titleFont,
862 const QStringList &glyphs);
863
871void styleLuaDebuggerHeaderPlusMinusButton(QToolButton *btn, int side, const QFont &titleFont);
872
879void styleLuaDebuggerHeaderIconOnlyButton(QToolButton *btn, int side);
880
895QIcon luaDbgErrorBreakHeaderIcon(bool checked, int side, qreal dpr,
896 const QFont &titleFont, const QPalette &palette);
897
898/* ===== from key_router ===== */
899
921{
922public:
928
933 void attach(Ui::LuaDebuggerDialog *ui, QTreeView *breakpointsTree);
934
941 bool reserveShortcutOverride(const QKeyEvent *ke) const;
942
947 bool handleKeyPress(QObject *obj, const QKeyEvent *ke);
948
949private:
950 LuaDebuggerDialog *host_;
951 Ui::LuaDebuggerDialog *ui_ = nullptr;
952 QTreeView *breakpointsTree_ = nullptr;
953};
954
955/* ===== from change_tracker ===== */
956
989{
990 public:
995
1001 void refreshChangedValueBrushes(QTreeView *watchTree, QWidget *paletteFallback);
1002
1007
1012
1017 void setPauseEntryStackLevel(int level) { pauseEntryStackLevel_ = level; }
1018
1026 void setPauseEntryRefresh(bool active) { isPauseEntryRefresh_ = active; }
1027
1038 void applyChangedVisuals(QObject *timerOwner, QStandardItem *anchor, bool changed);
1039
1044
1050 void clearWatchBaselines();
1051
1056 void clearChangeBaselinesForWatchSpec(const QString &spec);
1057
1062 void pruneChangeBaselinesToLiveWatchSpecs(QStandardItemModel *watchModel);
1063
1069 bool changeHighlightAllowed(int stackSelectionLevel) const;
1070
1079 bool observeWatchRootValue(const QString &rootKey, const QString &value);
1080
1090 bool observeWatchChildParent(const QString &rootKey, const QString &parentPath);
1091
1103 bool observeWatchChildValue(const QString &rootKey, const QString &childPath, const QString &value,
1104 bool parentVisited);
1105
1111 bool observeVariablesParent(const QString &parentKey);
1112
1120 bool observeVariablesValue(const QString &variablesKey, const QString &value, bool parentVisited);
1121
1122 private:
1124 QHash<QString /* rootKey */, QString> watchRootBaseline_;
1125
1127 QHash<QString /* rootKey */, QString> watchRootCurrent_;
1128
1130 QHash<QString /* rootKey */, QHash<QString /* childPath */, QString>> watchChildBaseline_;
1131
1133 QHash<QString /* rootKey */, QHash<QString /* childPath */, QString>> watchChildCurrent_;
1134
1136 QHash<QString /* variablesKey */, QString> variablesBaseline_;
1137
1139 QHash<QString /* variablesKey */, QString> variablesCurrent_;
1140
1142 QSet<QString /* variablesKey of parent */> variablesBaselineParents_;
1143
1145 QSet<QString /* variablesKey of parent */> variablesCurrentParents_;
1146
1148 QHash<QString /* rootKey */, QSet<QString /* parentPath */>> watchChildBaselineParents_;
1149
1151 QHash<QString /* rootKey */, QSet<QString /* parentPath */>> watchChildCurrentParents_;
1152
1154 QBrush changedValueBrush_;
1155
1157 QBrush changedFlashBrush_;
1158
1160 bool isPauseEntryRefresh_ = false;
1161
1163 qint32 flashSerial_ = 0;
1164
1166 int pauseEntryStackLevel_ = 0;
1167
1169 QString pauseEntryFrame0Identity_;
1170
1172 bool pauseEntryFrame0MatchesPrev_ = false;
1173};
1174
1175#endif
"Value changed since last pause" highlighter for the Watch and Variables trees.
Definition lua_debugger_utils.h:989
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:1390
bool changeHighlightAllowed(int stackSelectionLevel) const
Checks if change highlighting is allowed for a given stack level.
Definition lua_debugger_utils.cpp:1523
LuaDebuggerChangeHighlightTracker()=default
Constructs a default LuaDebuggerChangeHighlightTracker.
void clearChangeBaselinesForWatchSpec(const QString &spec)
Clears change baselines for a specific watch specification.
Definition lua_debugger_utils.cpp:1429
void snapshotBaselinesOnPauseEntry()
Snapshots the current values to baseline on a new pause entry.
Definition lua_debugger_utils.cpp:1283
void clearAllChangeBaselines()
Clears all change baselines for watches and variables.
Definition lua_debugger_utils.cpp:1364
void pruneChangeBaselinesToLiveWatchSpecs(QStandardItemModel *watchModel)
Prunes baselines to keep only those present in the live watch specs.
Definition lua_debugger_utils.cpp:1480
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:1026
bool observeVariablesValue(const QString &variablesKey, const QString &value, bool parentVisited)
Variables-tree counterpart to observeWatchChildValue.
Definition lua_debugger_utils.cpp:1420
void refreshChangedValueBrushes(QTreeView *watchTree, QWidget *paletteFallback)
Refreshes the brushes used for changed values based on the application palette.
Definition lua_debugger_utils.cpp:1259
bool observeVariablesParent(const QString &parentKey)
Variables-tree counterpart to observeWatchChildParent.
Definition lua_debugger_utils.cpp:1413
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:1318
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:1404
void clearWatchBaselines()
Wipe watch-side baselines (root + child value maps and visited-parent sets). Variables-tree maps are ...
Definition lua_debugger_utils.cpp:1380
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:1397
void setPauseEntryStackLevel(int level)
Sets the stack level for the pause entry.
Definition lua_debugger_utils.h:1017
void updatePauseEntryFrameIdentity()
Updates the identity of the current frame on pause entry.
Definition lua_debugger_utils.cpp:1297
Top-level dialog hosting the Lua debugger UI components.
Definition lua_debugger_dialog.h:189
Centralised keyboard-shortcut dispatcher for the Lua debugger dialog's eventFilter().
Definition lua_debugger_utils.h:921
bool reserveShortcutOverride(const QKeyEvent *ke) const
Pre-empt a debugger-owned shortcut on QEvent::ShortcutOverride.
Definition lua_debugger_utils.cpp:1079
bool handleKeyPress(QObject *obj, const QKeyEvent *ke)
Handle a QEvent::KeyPress delivered to the debugger UI.
Definition lua_debugger_utils.cpp:1095
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:1073
QString watchItemExpansionKey(const QStandardItem *item)
Return the expansion key for a watch item.
Definition lua_debugger_utils.cpp:639
QString watchSpecFromChangeKey(const QString &key)
Return the watch specification corresponding to a change key.
Definition lua_debugger_utils.cpp:184
bool watchSpecIsGlobalScoped(const QString &spec)
Check whether a watch specification is globally scoped.
Definition lua_debugger_utils.cpp:171
QString watchVariablePathForSpec(const QString &spec)
Return the variable path for a watch specification.
Definition lua_debugger_utils.cpp:310
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:182
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:338
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:262
QStandardItem * findVariableItemByPathRecursive(QStandardItem *node, const QString &path)
Find a variable item by path in a subtree, searching recursively.
Definition lua_debugger_utils.cpp:617
QString watchPathParentKey(const QString &path)
Return the parent key of a watch path.
Definition lua_debugger_utils.cpp:402
LuaDbgInvalidFilterColors invalidFilterColors()
Return the foreground and background colors used to indicate an invalid filter expression in the Lua ...
Definition lua_debugger_utils.cpp:163
void applyWatchFilterErrorChrome(QStandardItem *specItem, QTreeView *tree)
Apply filter error chrome to a watch specification item.
Definition lua_debugger_utils.cpp:583
QString stripWatchExpressionErrorPrefix(const QString &errStr)
Strip the error prefix from a watch expression error string.
Definition lua_debugger_utils.cpp:190
bool variablesPathIsGlobalScoped(const QString &path)
Check whether a variables path is globally scoped.
Definition lua_debugger_utils.cpp:177
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:563
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:437
QString watchResolvedVariablePathForTooltip(const QString &spec)
Return the resolved variable path for a watch tooltip.
Definition lua_debugger_utils.cpp:322
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:474
void clearWatchFilterErrorChrome(QStandardItem *specItem, QTreeView *tree)
Clear the filter error chrome from a watch specification item.
Definition lua_debugger_utils.cpp:569
QString watchPathOriginSuffix(const QStandardItem *item, const QString &spec)
Return the origin suffix for a watch path tooltip.
Definition lua_debugger_utils.cpp:367
QStandardItem * findVariableTreeItemByPathKey(QStandardItem *subtree, const QString &key)
Find a variable tree item in a subtree by its path key.
Definition lua_debugger_utils.cpp:499
int watchSubpathBoundaryCount(const QString &subpath)
Return the number of subpath boundaries in a watch subpath.
Definition lua_debugger_utils.cpp:456
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:273
QString capWatchTooltipText(const QString &s)
Truncate a watch tooltip text string to a reasonable length.
Definition lua_debugger_utils.cpp:393
void setupWatchRootItemFromSpec(QStandardItem *specItem, QStandardItem *valueItem, const QString &spec)
Set up a watch root item from a watch specification.
Definition lua_debugger_utils.cpp:598
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:522
const QString kLuaDbgHeaderEdit
Definition lua_debugger_utils.cpp:659
QStringList luaDbgTreeSectionExpandedSubpaths(const QHash< QString, LuaDbgTreeSectionExpansionState > &map, const QString &rootKey)
Expanded-descendant subpaths recorded for rootKey, or empty.
Definition lua_debugger_utils.cpp:121
const QString kLuaDbgRowExtras
Definition lua_debugger_utils.cpp:662
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:740
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:836
const QString kLuaDbgHeaderPlus
Definition lua_debugger_utils.cpp:657
const QString kLuaDbgHeaderRemoveAll
Definition lua_debugger_utils.cpp:660
void styleLuaDebuggerHeaderBreakpointToggleButton(QToolButton *btn, int side)
Style a Lua debugger header breakpoint toggle button.
Definition lua_debugger_utils.cpp:827
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:666
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:699
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:827
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:887
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:901
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:934
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:881
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:815
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:500
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
const QString kLuaDbgRowLog
Definition lua_debugger_utils.cpp:661
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
Definition lua_debugger_utils.h:433
Definition lua_debugger_utils.h:553
Variable structure for inspection.
Definition wslua_debugger.h:401