| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <QDockWidget> |
| 7 |
|
| 8 |
#include "Common/CommonTypes.h" |
| 9 |
|
| 10 |
class QAction; |
| 11 |
class QCloseEvent; |
| 12 |
class QShowEvent; |
| 13 |
class QTableWidget; |
| 14 |
class QTableWidgetItem; |
| 15 |
class QToolBar; |
| 16 |
|
| 17 |
namespace Core |
| 18 |
{ |
| 19 |
class CPUThreadGuard; |
| 20 |
class System; |
| 21 |
} |
| 22 |
|
| 23 |
class WatchWidget : public QDockWidget |
| 24 |
{ |
| 25 |
Q_OBJECT |
| 26 |
public: |
| 27 |
explicit WatchWidget(QWidget* parent = nullptr); |
| 28 |
~WatchWidget() override; |
| 29 |
|
| 30 |
void AddWatch(const QString& name, u32 addr); |
| 31 |
signals: |
| 32 |
void RequestMemoryBreakpoint(u32 addr); |
| 33 |
void ShowMemory(u32 addr); |
| 34 |
|
| 35 |
protected: |
| 36 |
void closeEvent(QCloseEvent*) override; |
| 37 |
void showEvent(QShowEvent* event) override; |
| 38 |
|
| 39 |
private: |
| 40 |
void CreateWidgets(); |
| 41 |
void ConnectWidgets(); |
| 42 |
|
| 43 |
void OnDelete(); |
| 44 |
void OnClear(); |
| 45 |
void OnNewWatch(); |
| 46 |
|
| 47 |
void OnLoad(); |
| 48 |
void OnSave(); |
| 49 |
|
| 50 |
void UpdateButtonsEnabled(); |
| 51 |
void Update(); |
| 52 |
void SetEmptyRow(int row); |
| 53 |
|
| 54 |
void ShowContextMenu(); |
| 55 |
void OnItemChanged(QTableWidgetItem* item); |
| 56 |
void LockWatchAddress(const Core::CPUThreadGuard& guard, u32 address); |
| 57 |
void DeleteSelectedWatches(); |
| 58 |
void DeleteWatch(const Core::CPUThreadGuard& guard, int row); |
| 59 |
void DeleteWatchAndUpdate(int row); |
| 60 |
void AddWatchBreakpoint(int row); |
| 61 |
void ShowInMemory(int row); |
| 62 |
void UpdateIcons(); |
| 63 |
void LockSelectedWatches(); |
| 64 |
void UnlockSelectedWatches(); |
| 65 |
|
| 66 |
Core::System& m_system; |
| 67 |
|
| 68 |
QAction* m_new; |
| 69 |
QAction* m_delete; |
| 70 |
QAction* m_clear; |
| 71 |
QAction* m_load; |
| 72 |
QAction* m_save; |
| 73 |
QToolBar* m_toolbar; |
| 74 |
QTableWidget* m_table; |
| 75 |
|
| 76 |
bool m_updating = false; |
| 77 |
|
| 78 |
static constexpr int NUM_COLUMNS = 7; |
| 79 |
static constexpr int COLUMN_INDEX_LABEL = 0; |
| 80 |
static constexpr int COLUMN_INDEX_ADDRESS = 1; |
| 81 |
static constexpr int COLUMN_INDEX_HEX = 2; |
| 82 |
static constexpr int COLUMN_INDEX_DECIMAL = 3; |
| 83 |
static constexpr int COLUMN_INDEX_STRING = 4; |
| 84 |
static constexpr int COLUMN_INDEX_FLOAT = 5; |
| 85 |
static constexpr int COLUMN_INDEX_LOCK = 6; |
| 86 |
}; |