mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-12-15 15:25:31 +00:00
yuzu: Use Qt 5 signal/slots where applicable
Makes the signal/slot connections type-safe instead of string-based.
This commit is contained in:
parent
a03c644aed
commit
db340f6402
|
@ -10,12 +10,12 @@ BreakPointObserverDock::BreakPointObserverDock(std::shared_ptr<Tegra::DebugConte
|
||||||
: QDockWidget(title, parent), BreakPointObserver(debug_context) {
|
: QDockWidget(title, parent), BreakPointObserver(debug_context) {
|
||||||
qRegisterMetaType<Tegra::DebugContext::Event>("Tegra::DebugContext::Event");
|
qRegisterMetaType<Tegra::DebugContext::Event>("Tegra::DebugContext::Event");
|
||||||
|
|
||||||
connect(this, SIGNAL(Resumed()), this, SLOT(OnResumed()));
|
connect(this, &BreakPointObserverDock::Resumed, this, &BreakPointObserverDock::OnResumed);
|
||||||
|
|
||||||
// NOTE: This signal is emitted from a non-GUI thread, but connect() takes
|
// NOTE: This signal is emitted from a non-GUI thread, but connect() takes
|
||||||
// care of delaying its handling to the GUI thread.
|
// care of delaying its handling to the GUI thread.
|
||||||
connect(this, SIGNAL(BreakPointHit(Tegra::DebugContext::Event, void*)), this,
|
connect(this, &BreakPointObserverDock::BreakPointHit, this,
|
||||||
SLOT(OnBreakPointHit(Tegra::DebugContext::Event, void*)), Qt::BlockingQueuedConnection);
|
&BreakPointObserverDock::OnBreakPointHit, Qt::BlockingQueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakPointObserverDock::OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) {
|
void BreakPointObserverDock::OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) {
|
||||||
|
|
|
@ -23,11 +23,11 @@ public:
|
||||||
void OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) override;
|
void OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) override;
|
||||||
void OnMaxwellResume() override;
|
void OnMaxwellResume() override;
|
||||||
|
|
||||||
private slots:
|
|
||||||
virtual void OnBreakPointHit(Tegra::DebugContext::Event event, void* data) = 0;
|
|
||||||
virtual void OnResumed() = 0;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Resumed();
|
void Resumed();
|
||||||
void BreakPointHit(Tegra::DebugContext::Event event, void* data);
|
void BreakPointHit(Tegra::DebugContext::Event event, void* data);
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual void OnBreakPointHit(Tegra::DebugContext::Event event, void* data) = 0;
|
||||||
|
virtual void OnResumed() = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -144,21 +144,25 @@ GraphicsBreakPointsWidget::GraphicsBreakPointsWidget(
|
||||||
|
|
||||||
qRegisterMetaType<Tegra::DebugContext::Event>("Tegra::DebugContext::Event");
|
qRegisterMetaType<Tegra::DebugContext::Event>("Tegra::DebugContext::Event");
|
||||||
|
|
||||||
connect(breakpoint_list, SIGNAL(doubleClicked(const QModelIndex&)), this,
|
connect(breakpoint_list, &QTreeView::doubleClicked, this,
|
||||||
SLOT(OnItemDoubleClicked(const QModelIndex&)));
|
&GraphicsBreakPointsWidget::OnItemDoubleClicked);
|
||||||
|
|
||||||
connect(resume_button, SIGNAL(clicked()), this, SLOT(OnResumeRequested()));
|
connect(resume_button, &QPushButton::clicked, this,
|
||||||
|
&GraphicsBreakPointsWidget::OnResumeRequested);
|
||||||
|
|
||||||
connect(this, SIGNAL(BreakPointHit(Tegra::DebugContext::Event, void*)), this,
|
connect(this, &GraphicsBreakPointsWidget::BreakPointHit, this,
|
||||||
SLOT(OnBreakPointHit(Tegra::DebugContext::Event, void*)), Qt::BlockingQueuedConnection);
|
&GraphicsBreakPointsWidget::OnBreakPointHit, Qt::BlockingQueuedConnection);
|
||||||
connect(this, SIGNAL(Resumed()), this, SLOT(OnResumed()));
|
connect(this, &GraphicsBreakPointsWidget::Resumed, this, &GraphicsBreakPointsWidget::OnResumed);
|
||||||
|
|
||||||
connect(this, SIGNAL(BreakPointHit(Tegra::DebugContext::Event, void*)), breakpoint_model,
|
connect(this, &GraphicsBreakPointsWidget::BreakPointHit, breakpoint_model,
|
||||||
SLOT(OnBreakPointHit(Tegra::DebugContext::Event)), Qt::BlockingQueuedConnection);
|
&BreakPointModel::OnBreakPointHit, Qt::BlockingQueuedConnection);
|
||||||
connect(this, SIGNAL(Resumed()), breakpoint_model, SLOT(OnResumed()));
|
connect(this, &GraphicsBreakPointsWidget::Resumed, breakpoint_model,
|
||||||
|
&BreakPointModel::OnResumed);
|
||||||
|
|
||||||
connect(this, SIGNAL(BreakPointsChanged(const QModelIndex&, const QModelIndex&)),
|
connect(this, &GraphicsBreakPointsWidget::BreakPointsChanged,
|
||||||
breakpoint_model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)));
|
[this](const QModelIndex& top_left, const QModelIndex& bottom_right) {
|
||||||
|
breakpoint_model->dataChanged(top_left, bottom_right);
|
||||||
|
});
|
||||||
|
|
||||||
QWidget* main_widget = new QWidget;
|
QWidget* main_widget = new QWidget;
|
||||||
auto main_layout = new QVBoxLayout;
|
auto main_layout = new QVBoxLayout;
|
||||||
|
|
|
@ -26,18 +26,17 @@ public:
|
||||||
void OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) override;
|
void OnMaxwellBreakPointHit(Tegra::DebugContext::Event event, void* data) override;
|
||||||
void OnMaxwellResume() override;
|
void OnMaxwellResume() override;
|
||||||
|
|
||||||
public slots:
|
|
||||||
void OnBreakPointHit(Tegra::DebugContext::Event event, void* data);
|
|
||||||
void OnItemDoubleClicked(const QModelIndex&);
|
|
||||||
void OnResumeRequested();
|
|
||||||
void OnResumed();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Resumed();
|
void Resumed();
|
||||||
void BreakPointHit(Tegra::DebugContext::Event event, void* data);
|
void BreakPointHit(Tegra::DebugContext::Event event, void* data);
|
||||||
void BreakPointsChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
void BreakPointsChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void OnBreakPointHit(Tegra::DebugContext::Event event, void* data);
|
||||||
|
void OnItemDoubleClicked(const QModelIndex&);
|
||||||
|
void OnResumeRequested();
|
||||||
|
void OnResumed();
|
||||||
|
|
||||||
QLabel* status_text;
|
QLabel* status_text;
|
||||||
QPushButton* resume_button;
|
QPushButton* resume_button;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ public:
|
||||||
|
|
||||||
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
|
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
|
||||||
|
|
||||||
public slots:
|
|
||||||
void OnBreakPointHit(Tegra::DebugContext::Event event);
|
void OnBreakPointHit(Tegra::DebugContext::Event event);
|
||||||
void OnResumed();
|
void OnResumed();
|
||||||
|
|
||||||
|
|
|
@ -153,22 +153,24 @@ GraphicsSurfaceWidget::GraphicsSurfaceWidget(std::shared_ptr<Tegra::DebugContext
|
||||||
save_surface = new QPushButton(QIcon::fromTheme("document-save"), tr("Save"));
|
save_surface = new QPushButton(QIcon::fromTheme("document-save"), tr("Save"));
|
||||||
|
|
||||||
// Connections
|
// Connections
|
||||||
connect(this, SIGNAL(Update()), this, SLOT(OnUpdate()));
|
connect(this, &GraphicsSurfaceWidget::Update, this, &GraphicsSurfaceWidget::OnUpdate);
|
||||||
connect(surface_source_list, SIGNAL(currentIndexChanged(int)), this,
|
connect(surface_source_list,
|
||||||
SLOT(OnSurfaceSourceChanged(int)));
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
connect(surface_address_control, SIGNAL(ValueChanged(qint64)), this,
|
&GraphicsSurfaceWidget::OnSurfaceSourceChanged);
|
||||||
SLOT(OnSurfaceAddressChanged(qint64)));
|
connect(surface_address_control, &CSpinBox::ValueChanged, this,
|
||||||
connect(surface_width_control, SIGNAL(valueChanged(int)), this,
|
&GraphicsSurfaceWidget::OnSurfaceAddressChanged);
|
||||||
SLOT(OnSurfaceWidthChanged(int)));
|
connect(surface_width_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||||
connect(surface_height_control, SIGNAL(valueChanged(int)), this,
|
this, &GraphicsSurfaceWidget::OnSurfaceWidthChanged);
|
||||||
SLOT(OnSurfaceHeightChanged(int)));
|
connect(surface_height_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||||
connect(surface_format_control, SIGNAL(currentIndexChanged(int)), this,
|
this, &GraphicsSurfaceWidget::OnSurfaceHeightChanged);
|
||||||
SLOT(OnSurfaceFormatChanged(int)));
|
connect(surface_format_control,
|
||||||
connect(surface_picker_x_control, SIGNAL(valueChanged(int)), this,
|
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
SLOT(OnSurfacePickerXChanged(int)));
|
&GraphicsSurfaceWidget::OnSurfaceFormatChanged);
|
||||||
connect(surface_picker_y_control, SIGNAL(valueChanged(int)), this,
|
connect(surface_picker_x_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||||
SLOT(OnSurfacePickerYChanged(int)));
|
this, &GraphicsSurfaceWidget::OnSurfacePickerXChanged);
|
||||||
connect(save_surface, SIGNAL(clicked()), this, SLOT(SaveSurface()));
|
connect(surface_picker_y_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||||
|
this, &GraphicsSurfaceWidget::OnSurfacePickerYChanged);
|
||||||
|
connect(save_surface, &QPushButton::clicked, this, &GraphicsSurfaceWidget::SaveSurface);
|
||||||
|
|
||||||
auto main_widget = new QWidget;
|
auto main_widget = new QWidget;
|
||||||
auto main_layout = new QVBoxLayout;
|
auto main_layout = new QVBoxLayout;
|
||||||
|
|
|
@ -65,16 +65,15 @@ public slots:
|
||||||
void OnSurfacePickerYChanged(int new_value);
|
void OnSurfacePickerYChanged(int new_value);
|
||||||
void OnUpdate();
|
void OnUpdate();
|
||||||
|
|
||||||
private slots:
|
signals:
|
||||||
|
void Update();
|
||||||
|
|
||||||
|
private:
|
||||||
void OnBreakPointHit(Tegra::DebugContext::Event event, void* data) override;
|
void OnBreakPointHit(Tegra::DebugContext::Event event, void* data) override;
|
||||||
void OnResumed() override;
|
void OnResumed() override;
|
||||||
|
|
||||||
void SaveSurface();
|
void SaveSurface();
|
||||||
|
|
||||||
signals:
|
|
||||||
void Update();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QComboBox* surface_source_list;
|
QComboBox* surface_source_list;
|
||||||
CSpinBox* surface_address_control;
|
CSpinBox* surface_address_control;
|
||||||
QSpinBox* surface_width_control;
|
QSpinBox* surface_width_control;
|
||||||
|
|
Loading…
Reference in a new issue