summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2018-08-02 22:04:52 -0400
committerGravatar Lioncash2018-08-02 22:18:33 -0400
commitdb340f640274da26dec7a60fe00a9814d4165dcd (patch)
tree5e66c3beb2205987994ea1a7afcff45d982f129b
parentMerge pull request #896 from lioncash/audio-out (diff)
downloadyuzu-db340f640274da26dec7a60fe00a9814d4165dcd.tar.gz
yuzu-db340f640274da26dec7a60fe00a9814d4165dcd.tar.xz
yuzu-db340f640274da26dec7a60fe00a9814d4165dcd.zip
yuzu: Use Qt 5 signal/slots where applicable
Makes the signal/slot connections type-safe instead of string-based.
-rw-r--r--src/yuzu/debugger/graphics/graphics_breakpoint_observer.cpp6
-rw-r--r--src/yuzu/debugger/graphics/graphics_breakpoint_observer.h8
-rw-r--r--src/yuzu/debugger/graphics/graphics_breakpoints.cpp26
-rw-r--r--src/yuzu/debugger/graphics/graphics_breakpoints.h11
-rw-r--r--src/yuzu/debugger/graphics/graphics_breakpoints_p.h1
-rw-r--r--src/yuzu/debugger/graphics/graphics_surface.cpp34
-rw-r--r--src/yuzu/debugger/graphics/graphics_surface.h9
7 files changed, 49 insertions, 46 deletions
diff --git a/src/yuzu/debugger/graphics/graphics_breakpoint_observer.cpp b/src/yuzu/debugger/graphics/graphics_breakpoint_observer.cpp
index d6d61a739..5f459ccfb 100644
--- a/src/yuzu/debugger/graphics/graphics_breakpoint_observer.cpp
+++ b/src/yuzu/debugger/graphics/graphics_breakpoint_observer.cpp
@@ -10,12 +10,12 @@ BreakPointObserverDock::BreakPointObserverDock(std::shared_ptr<Tegra::DebugConte
10 : QDockWidget(title, parent), BreakPointObserver(debug_context) { 10 : QDockWidget(title, parent), BreakPointObserver(debug_context) {
11 qRegisterMetaType<Tegra::DebugContext::Event>("Tegra::DebugContext::Event"); 11 qRegisterMetaType<Tegra::DebugContext::Event>("Tegra::DebugContext::Event");
12 12
13 connect(this, SIGNAL(Resumed()), this, SLOT(OnResumed())); 13 connect(this, &BreakPointObserverDock::Resumed, this, &BreakPointObserverDock::OnResumed);
14 14
15 // NOTE: This signal is emitted from a non-GUI thread, but connect() takes 15 // NOTE: This signal is emitted from a non-GUI thread, but connect() takes
16 // care of delaying its handling to the GUI thread. 16 // care of delaying its handling to the GUI thread.
17 connect(this, SIGNAL(BreakPointHit(Tegra::DebugContext::Event, void*)), this, 17 connect(this, &BreakPointObserverDock::BreakPointHit, this,
18 SLOT(OnBreakPointHit(Tegra::DebugContext::Event, void*)), Qt::BlockingQueuedConnection); 18 &BreakPointObserverDock::OnBreakPointHit, Qt::BlockingQueuedConnection);
19} 19}
20 20
21void BreakPointObserverDock::OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) { 21void BreakPointObserverDock::OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) {
diff --git a/src/yuzu/debugger/graphics/graphics_breakpoint_observer.h b/src/yuzu/debugger/graphics/graphics_breakpoint_observer.h
index 9d05493cf..ab32f0115 100644
--- a/src/yuzu/debugger/graphics/graphics_breakpoint_observer.h
+++ b/src/yuzu/debugger/graphics/graphics_breakpoint_observer.h
@@ -23,11 +23,11 @@ public:
23 void OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) override; 23 void OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) override;
24 void OnMaxwellResume() override; 24 void OnMaxwellResume() override;
25 25
26private slots:
27 virtual void OnBreakPointHit(Tegra::DebugContext::Event event, void* data) = 0;
28 virtual void OnResumed() = 0;
29
30signals: 26signals:
31 void Resumed(); 27 void Resumed();
32 void BreakPointHit(Tegra::DebugContext::Event event, void* data); 28 void BreakPointHit(Tegra::DebugContext::Event event, void* data);
29
30private:
31 virtual void OnBreakPointHit(Tegra::DebugContext::Event event, void* data) = 0;
32 virtual void OnResumed() = 0;
33}; 33};
diff --git a/src/yuzu/debugger/graphics/graphics_breakpoints.cpp b/src/yuzu/debugger/graphics/graphics_breakpoints.cpp
index f98cc8152..eb16a38a0 100644
--- a/src/yuzu/debugger/graphics/graphics_breakpoints.cpp
+++ b/src/yuzu/debugger/graphics/graphics_breakpoints.cpp
@@ -144,21 +144,25 @@ GraphicsBreakPointsWidget::GraphicsBreakPointsWidget(
144 144
145 qRegisterMetaType<Tegra::DebugContext::Event>("Tegra::DebugContext::Event"); 145 qRegisterMetaType<Tegra::DebugContext::Event>("Tegra::DebugContext::Event");
146 146
147 connect(breakpoint_list, SIGNAL(doubleClicked(const QModelIndex&)), this, 147 connect(breakpoint_list, &QTreeView::doubleClicked, this,
148 SLOT(OnItemDoubleClicked(const QModelIndex&))); 148 &GraphicsBreakPointsWidget::OnItemDoubleClicked);
149 149
150 connect(resume_button, SIGNAL(clicked()), this, SLOT(OnResumeRequested())); 150 connect(resume_button, &QPushButton::clicked, this,
151 &GraphicsBreakPointsWidget::OnResumeRequested);
151 152
152 connect(this, SIGNAL(BreakPointHit(Tegra::DebugContext::Event, void*)), this, 153 connect(this, &GraphicsBreakPointsWidget::BreakPointHit, this,
153 SLOT(OnBreakPointHit(Tegra::DebugContext::Event, void*)), Qt::BlockingQueuedConnection); 154 &GraphicsBreakPointsWidget::OnBreakPointHit, Qt::BlockingQueuedConnection);
154 connect(this, SIGNAL(Resumed()), this, SLOT(OnResumed())); 155 connect(this, &GraphicsBreakPointsWidget::Resumed, this, &GraphicsBreakPointsWidget::OnResumed);
155 156
156 connect(this, SIGNAL(BreakPointHit(Tegra::DebugContext::Event, void*)), breakpoint_model, 157 connect(this, &GraphicsBreakPointsWidget::BreakPointHit, breakpoint_model,
157 SLOT(OnBreakPointHit(Tegra::DebugContext::Event)), Qt::BlockingQueuedConnection); 158 &BreakPointModel::OnBreakPointHit, Qt::BlockingQueuedConnection);
158 connect(this, SIGNAL(Resumed()), breakpoint_model, SLOT(OnResumed())); 159 connect(this, &GraphicsBreakPointsWidget::Resumed, breakpoint_model,
160 &BreakPointModel::OnResumed);
159 161
160 connect(this, SIGNAL(BreakPointsChanged(const QModelIndex&, const QModelIndex&)), 162 connect(this, &GraphicsBreakPointsWidget::BreakPointsChanged,
161 breakpoint_model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&))); 163 [this](const QModelIndex& top_left, const QModelIndex& bottom_right) {
164 breakpoint_model->dataChanged(top_left, bottom_right);
165 });
162 166
163 QWidget* main_widget = new QWidget; 167 QWidget* main_widget = new QWidget;
164 auto main_layout = new QVBoxLayout; 168 auto main_layout = new QVBoxLayout;
diff --git a/src/yuzu/debugger/graphics/graphics_breakpoints.h b/src/yuzu/debugger/graphics/graphics_breakpoints.h
index ae0ede2e8..a920a2ae5 100644
--- a/src/yuzu/debugger/graphics/graphics_breakpoints.h
+++ b/src/yuzu/debugger/graphics/graphics_breakpoints.h
@@ -26,18 +26,17 @@ public:
26 void OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) override; 26 void OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) override;
27 void OnMaxwellResume() override; 27 void OnMaxwellResume() override;
28 28
29public slots:
30 void OnBreakPointHit(Tegra::DebugContext::Event event, void* data);
31 void OnItemDoubleClicked(const QModelIndex&);
32 void OnResumeRequested();
33 void OnResumed();
34
35signals: 29signals:
36 void Resumed(); 30 void Resumed();
37 void BreakPointHit(Tegra::DebugContext::Event event, void* data); 31 void BreakPointHit(Tegra::DebugContext::Event event, void* data);
38 void BreakPointsChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight); 32 void BreakPointsChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
39 33
40private: 34private:
35 void OnBreakPointHit(Tegra::DebugContext::Event event, void* data);
36 void OnItemDoubleClicked(const QModelIndex&);
37 void OnResumeRequested();
38 void OnResumed();
39
41 QLabel* status_text; 40 QLabel* status_text;
42 QPushButton* resume_button; 41 QPushButton* resume_button;
43 42
diff --git a/src/yuzu/debugger/graphics/graphics_breakpoints_p.h b/src/yuzu/debugger/graphics/graphics_breakpoints_p.h
index 35a6876ae..7112b87e6 100644
--- a/src/yuzu/debugger/graphics/graphics_breakpoints_p.h
+++ b/src/yuzu/debugger/graphics/graphics_breakpoints_p.h
@@ -25,7 +25,6 @@ public:
25 25
26 bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override; 26 bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
27 27
28public slots:
29 void OnBreakPointHit(Tegra::DebugContext::Event event); 28 void OnBreakPointHit(Tegra::DebugContext::Event event);
30 void OnResumed(); 29 void OnResumed();
31 30
diff --git a/src/yuzu/debugger/graphics/graphics_surface.cpp b/src/yuzu/debugger/graphics/graphics_surface.cpp
index c41ff693b..ff3efcdaa 100644
--- a/src/yuzu/debugger/graphics/graphics_surface.cpp
+++ b/src/yuzu/debugger/graphics/graphics_surface.cpp
@@ -153,22 +153,24 @@ GraphicsSurfaceWidget::GraphicsSurfaceWidget(std::shared_ptr<Tegra::DebugContext
153 save_surface = new QPushButton(QIcon::fromTheme("document-save"), tr("Save")); 153 save_surface = new QPushButton(QIcon::fromTheme("document-save"), tr("Save"));
154 154
155 // Connections 155 // Connections
156 connect(this, SIGNAL(Update()), this, SLOT(OnUpdate())); 156 connect(this, &GraphicsSurfaceWidget::Update, this, &GraphicsSurfaceWidget::OnUpdate);
157 connect(surface_source_list, SIGNAL(currentIndexChanged(int)), this, 157 connect(surface_source_list,
158 SLOT(OnSurfaceSourceChanged(int))); 158 static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
159 connect(surface_address_control, SIGNAL(ValueChanged(qint64)), this, 159 &GraphicsSurfaceWidget::OnSurfaceSourceChanged);
160 SLOT(OnSurfaceAddressChanged(qint64))); 160 connect(surface_address_control, &CSpinBox::ValueChanged, this,
161 connect(surface_width_control, SIGNAL(valueChanged(int)), this, 161 &GraphicsSurfaceWidget::OnSurfaceAddressChanged);
162 SLOT(OnSurfaceWidthChanged(int))); 162 connect(surface_width_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
163 connect(surface_height_control, SIGNAL(valueChanged(int)), this, 163 this, &GraphicsSurfaceWidget::OnSurfaceWidthChanged);
164 SLOT(OnSurfaceHeightChanged(int))); 164 connect(surface_height_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
165 connect(surface_format_control, SIGNAL(currentIndexChanged(int)), this, 165 this, &GraphicsSurfaceWidget::OnSurfaceHeightChanged);
166 SLOT(OnSurfaceFormatChanged(int))); 166 connect(surface_format_control,
167 connect(surface_picker_x_control, SIGNAL(valueChanged(int)), this, 167 static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
168 SLOT(OnSurfacePickerXChanged(int))); 168 &GraphicsSurfaceWidget::OnSurfaceFormatChanged);
169 connect(surface_picker_y_control, SIGNAL(valueChanged(int)), this, 169 connect(surface_picker_x_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
170 SLOT(OnSurfacePickerYChanged(int))); 170 this, &GraphicsSurfaceWidget::OnSurfacePickerXChanged);
171 connect(save_surface, SIGNAL(clicked()), this, SLOT(SaveSurface())); 171 connect(surface_picker_y_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
172 this, &GraphicsSurfaceWidget::OnSurfacePickerYChanged);
173 connect(save_surface, &QPushButton::clicked, this, &GraphicsSurfaceWidget::SaveSurface);
172 174
173 auto main_widget = new QWidget; 175 auto main_widget = new QWidget;
174 auto main_layout = new QVBoxLayout; 176 auto main_layout = new QVBoxLayout;
diff --git a/src/yuzu/debugger/graphics/graphics_surface.h b/src/yuzu/debugger/graphics/graphics_surface.h
index 6a344bdfc..58f9db465 100644
--- a/src/yuzu/debugger/graphics/graphics_surface.h
+++ b/src/yuzu/debugger/graphics/graphics_surface.h
@@ -65,16 +65,15 @@ public slots:
65 void OnSurfacePickerYChanged(int new_value); 65 void OnSurfacePickerYChanged(int new_value);
66 void OnUpdate(); 66 void OnUpdate();
67 67
68private slots: 68signals:
69 void Update();
70
71private:
69 void OnBreakPointHit(Tegra::DebugContext::Event event, void* data) override; 72 void OnBreakPointHit(Tegra::DebugContext::Event event, void* data) override;
70 void OnResumed() override; 73 void OnResumed() override;
71 74
72 void SaveSurface(); 75 void SaveSurface();
73 76
74signals:
75 void Update();
76
77private:
78 QComboBox* surface_source_list; 77 QComboBox* surface_source_list;
79 CSpinBox* surface_address_control; 78 CSpinBox* surface_address_control;
80 QSpinBox* surface_width_control; 79 QSpinBox* surface_width_control;