| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
lua_debugger_pause.h
Go to the documentation of this file.
1/* lua_debugger_pause.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
16#ifndef LUA_DEBUGGER_PAUSE_H
17#define LUA_DEBUGGER_PAUSE_H
18
19#include <QList>
20#include <QObject>
21#include <QPointer>
22#include <QString>
23#include <QWidget>
24
25 class LuaDebuggerDialog;
26 class LuaDebuggerPauseOverlay;
27 class QAction;
28 class QEvent;
29 class QEventLoop;
30 class QPaintEvent;
31
32/* ===== pause_controller ===== */
33
39 class LuaDebuggerPauseController : public QObject
40{
41 public:
46 explicit LuaDebuggerPauseController(LuaDebuggerDialog *host);
47
52 bool hasActiveLoop() const { return activeLoop_ != nullptr; }
53
58 QEventLoop *activeLoop() const { return activeLoop_; }
59
64 void setActiveLoop(QEventLoop *loop) { activeLoop_ = loop; }
65
69 void clearActiveLoop() { activeLoop_ = nullptr; }
70
74 void quitLoop();
75
79 void beginOuterFreeze();
80
84 void endFreeze();
85
86 private:
88 LuaDebuggerDialog *host_ = nullptr;
89
91 QEventLoop *activeLoop_ = nullptr;
92
94 QList<QPointer<QWidget>> frozenTopLevels_;
95
97 QList<QPointer<QAction>> frozenActions_;
98
100 QPointer<QWidget> frozenCentralWidget_;
101
103 QPointer<LuaDebuggerPauseOverlay> pauseOverlay_;
104
106 QObject *pauseInputFilter_ = nullptr;
107
109 bool pauseUnfrozen_ = true;
110};
111
112/* ===== pause_overlay ===== */
113
146 class LuaDebuggerPauseOverlay : public QWidget
147{
148 Q_OBJECT
149
150 public:
155 explicit LuaDebuggerPauseOverlay(QWidget *parent);
156
160 ~LuaDebuggerPauseOverlay() override;
161
162 protected:
167 void paintEvent(QPaintEvent *event) override;
168
175 bool eventFilter(QObject *obj, QEvent *event) override;
176
177 private:
179 QString title_text_;
180
182 QString subtext_text_;
183};
184
185/* ===== pause_key_filter ===== */
186
191 class LuaDebuggerPauseInputFilter : public QObject
192{
193 public:
200 explicit LuaDebuggerPauseInputFilter(QWidget *debugger_dialog, QWidget *main_window, QObject *parent = nullptr);
201
208 bool eventFilter(QObject *watched, QEvent *event) override;
209
210 private:
216 bool isAllowedDuringPause(const QWidget *w) const;
217
219 QWidget *debugger_dialog_;
220
222 QWidget *main_window_;
223};
224
225#endif
LuaDebuggerDialog
Top-level dialog hosting the Lua debugger UI components.
Definition lua_debugger_dialog.h:189
LuaDebuggerPauseController::clearActiveLoop
void clearActiveLoop()
Clears the reference to the active nested event loop.
Definition lua_debugger_pause.h:69
LuaDebuggerPauseController::hasActiveLoop
bool hasActiveLoop() const
Checks if there is an active nested event loop.
Definition lua_debugger_pause.h:52
LuaDebuggerPauseController::endFreeze
void endFreeze()
Ends the application-wide outer freeze, restoring interactivity.
Definition lua_debugger_pause.cpp:191
LuaDebuggerPauseController::setActiveLoop
void setActiveLoop(QEventLoop *loop)
Sets the active nested event loop.
Definition lua_debugger_pause.h:64
LuaDebuggerPauseController::quitLoop
void quitLoop()
Quits the currently active nested event loop if one exists.
Definition lua_debugger_pause.cpp:87
LuaDebuggerPauseController::activeLoop
QEventLoop * activeLoop() const
Retrieves the currently active nested event loop.
Definition lua_debugger_pause.h:58
LuaDebuggerPauseController::LuaDebuggerPauseController
LuaDebuggerPauseController(LuaDebuggerDialog *host)
Constructs a new LuaDebuggerPauseController object.
Definition lua_debugger_pause.cpp:85
LuaDebuggerPauseController::beginOuterFreeze
void beginOuterFreeze()
Begins the application-wide outer freeze during a pause.
Definition lua_debugger_pause.cpp:95
LuaDebuggerPauseInputFilter::LuaDebuggerPauseInputFilter
LuaDebuggerPauseInputFilter(QWidget *debugger_dialog, QWidget *main_window, QObject *parent=nullptr)
Constructs a new LuaDebuggerPauseInputFilter object.
Definition lua_debugger_pause.cpp:405
LuaDebuggerPauseInputFilter::eventFilter
bool eventFilter(QObject *watched, QEvent *event) override
Filters input events globally during a debugger pause.
Definition lua_debugger_pause.cpp:411
LuaDebuggerPauseOverlay
Translucent overlay shown over the main window while the Lua debugger is paused.
Definition lua_debugger_pause.h:147
LuaDebuggerPauseOverlay::paintEvent
void paintEvent(QPaintEvent *event) override
Handles paint events to draw the overlay.
Definition lua_debugger_pause.cpp:324
LuaDebuggerPauseOverlay::eventFilter
bool eventFilter(QObject *obj, QEvent *event) override
Filters events on the parent widget to handle resizing.
Definition lua_debugger_pause.cpp:311
LuaDebuggerPauseOverlay::~LuaDebuggerPauseOverlay
~LuaDebuggerPauseOverlay() override
Destroys the LuaDebuggerPauseOverlay object.
LuaDebuggerPauseOverlay::LuaDebuggerPauseOverlay
LuaDebuggerPauseOverlay(QWidget *parent)
Constructs a new LuaDebuggerPauseOverlay object.
Definition lua_debugger_pause.cpp:281