citra_qt: Migrate to Qt 5 signal/slot connection syntax where applicable

This is more type-safe than the string-based signal/slot syntax that was
being used. It also makes the connections throughout the UI code consistent.
This commit is contained in:
Lioncash 2017-12-17 16:24:19 -05:00
parent 4c3a4ab664
commit a73f135868
No known key found for this signature in database
GPG key ID: 419930C33C5AB6CC
13 changed files with 98 additions and 88 deletions

View file

@ -10,7 +10,8 @@ extern GraphicsDebugger g_debugger;
GPUCommandStreamItemModel::GPUCommandStreamItemModel(QObject* parent)
: QAbstractListModel(parent), command_count(0) {
connect(this, SIGNAL(GXCommandFinished(int)), this, SLOT(OnGXCommandFinishedInternal(int)));
connect(this, &GPUCommandStreamItemModel::GXCommandFinished, this,
&GPUCommandStreamItemModel::OnGXCommandFinishedInternal);
}
int GPUCommandStreamItemModel::rowCount(const QModelIndex& parent) const {

View file

@ -10,12 +10,12 @@ BreakPointObserverDock::BreakPointObserverDock(std::shared_ptr<Pica::DebugContex
: QDockWidget(title, parent), BreakPointObserver(debug_context) {
qRegisterMetaType<Pica::DebugContext::Event>("Pica::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
// care of delaying its handling to the GUI thread.
connect(this, SIGNAL(BreakPointHit(Pica::DebugContext::Event, void*)), this,
SLOT(OnBreakPointHit(Pica::DebugContext::Event, void*)), Qt::BlockingQueuedConnection);
connect(this, &BreakPointObserverDock::BreakPointHit, this,
&BreakPointObserverDock::OnBreakPointHit, Qt::BlockingQueuedConnection);
}
void BreakPointObserverDock::OnPicaBreakPointHit(Pica::DebugContext::Event event, void* data) {

View file

@ -145,21 +145,25 @@ GraphicsBreakPointsWidget::GraphicsBreakPointsWidget(
qRegisterMetaType<Pica::DebugContext::Event>("Pica::DebugContext::Event");
connect(breakpoint_list, SIGNAL(doubleClicked(const QModelIndex&)), this,
SLOT(OnItemDoubleClicked(const QModelIndex&)));
connect(breakpoint_list, &QTreeView::doubleClicked, this,
&GraphicsBreakPointsWidget::OnItemDoubleClicked);
connect(resume_button, SIGNAL(clicked()), this, SLOT(OnResumeRequested()));
connect(resume_button, &QPushButton::clicked, this,
&GraphicsBreakPointsWidget::OnResumeRequested);
connect(this, SIGNAL(BreakPointHit(Pica::DebugContext::Event, void*)), this,
SLOT(OnBreakPointHit(Pica::DebugContext::Event, void*)), Qt::BlockingQueuedConnection);
connect(this, SIGNAL(Resumed()), this, SLOT(OnResumed()));
connect(this, &GraphicsBreakPointsWidget::BreakPointHit, this,
&GraphicsBreakPointsWidget::OnBreakPointHit, Qt::BlockingQueuedConnection);
connect(this, &GraphicsBreakPointsWidget::Resumed, this, &GraphicsBreakPointsWidget::OnResumed);
connect(this, SIGNAL(BreakPointHit(Pica::DebugContext::Event, void*)), breakpoint_model,
SLOT(OnBreakPointHit(Pica::DebugContext::Event)), Qt::BlockingQueuedConnection);
connect(this, SIGNAL(Resumed()), breakpoint_model, SLOT(OnResumed()));
connect(this, &GraphicsBreakPointsWidget::BreakPointHit, breakpoint_model,
&BreakPointModel::OnBreakPointHit, Qt::BlockingQueuedConnection);
connect(this, &GraphicsBreakPointsWidget::Resumed, breakpoint_model,
&BreakPointModel::OnResumed);
connect(this, SIGNAL(BreakPointsChanged(const QModelIndex&, const QModelIndex&)),
breakpoint_model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)));
connect(this, &GraphicsBreakPointsWidget::BreakPointsChanged,
[this](const QModelIndex& top_left, const QModelIndex& bottom_right) {
breakpoint_model->dataChanged(top_left, bottom_right);
});
QWidget* main_widget = new QWidget;
auto main_layout = new QVBoxLayout;

View file

@ -194,20 +194,19 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent)
list_widget->setUniformRowHeights(true);
list_widget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
connect(list_widget->selectionModel(),
SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)), this,
SLOT(SetCommandInfo(const QModelIndex&)));
connect(list_widget, SIGNAL(doubleClicked(const QModelIndex&)), this,
SLOT(OnCommandDoubleClicked(const QModelIndex&)));
connect(list_widget->selectionModel(), &QItemSelectionModel::currentChanged, this,
&GPUCommandListWidget::SetCommandInfo);
connect(list_widget, &QTreeView::doubleClicked, this,
&GPUCommandListWidget::OnCommandDoubleClicked);
toggle_tracing = new QPushButton(tr("Start Tracing"));
QPushButton* copy_all = new QPushButton(tr("Copy All"));
connect(toggle_tracing, SIGNAL(clicked()), this, SLOT(OnToggleTracing()));
connect(this, SIGNAL(TracingFinished(const Pica::DebugUtils::PicaTrace&)), model,
SLOT(OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace&)));
connect(toggle_tracing, &QPushButton::clicked, this, &GPUCommandListWidget::OnToggleTracing);
connect(this, &GPUCommandListWidget::TracingFinished, model,
&GPUCommandListModel::OnPicaTraceFinished);
connect(copy_all, SIGNAL(clicked()), this, SLOT(CopyAllToClipboard()));
connect(copy_all, &QPushButton::clicked, this, &GPUCommandListWidget::CopyAllToClipboard);
command_info_widget = nullptr;

View file

@ -118,22 +118,24 @@ GraphicsSurfaceWidget::GraphicsSurfaceWidget(std::shared_ptr<Pica::DebugContext>
save_surface = new QPushButton(QIcon::fromTheme("document-save"), tr("Save"));
// Connections
connect(this, SIGNAL(Update()), this, SLOT(OnUpdate()));
connect(surface_source_list, SIGNAL(currentIndexChanged(int)), this,
SLOT(OnSurfaceSourceChanged(int)));
connect(surface_address_control, SIGNAL(ValueChanged(qint64)), this,
SLOT(OnSurfaceAddressChanged(qint64)));
connect(surface_width_control, SIGNAL(valueChanged(int)), this,
SLOT(OnSurfaceWidthChanged(int)));
connect(surface_height_control, SIGNAL(valueChanged(int)), this,
SLOT(OnSurfaceHeightChanged(int)));
connect(surface_format_control, SIGNAL(currentIndexChanged(int)), this,
SLOT(OnSurfaceFormatChanged(int)));
connect(surface_picker_x_control, SIGNAL(valueChanged(int)), this,
SLOT(OnSurfacePickerXChanged(int)));
connect(surface_picker_y_control, SIGNAL(valueChanged(int)), this,
SLOT(OnSurfacePickerYChanged(int)));
connect(save_surface, SIGNAL(clicked()), this, SLOT(SaveSurface()));
connect(this, &GraphicsSurfaceWidget::Update, this, &GraphicsSurfaceWidget::OnUpdate);
connect(surface_source_list,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&GraphicsSurfaceWidget::OnSurfaceSourceChanged);
connect(surface_address_control, &CSpinBox::ValueChanged, this,
&GraphicsSurfaceWidget::OnSurfaceAddressChanged);
connect(surface_width_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
this, &GraphicsSurfaceWidget::OnSurfaceWidthChanged);
connect(surface_height_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
this, &GraphicsSurfaceWidget::OnSurfaceHeightChanged);
connect(surface_format_control,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&GraphicsSurfaceWidget::OnSurfaceFormatChanged);
connect(surface_picker_x_control, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
this, &GraphicsSurfaceWidget::OnSurfacePickerXChanged);
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_layout = new QVBoxLayout;

View file

@ -31,15 +31,15 @@ GraphicsTracingWidget::GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext>
new QPushButton(QIcon::fromTheme("document-save"), tr("Stop and Save"));
QPushButton* abort_recording = new QPushButton(tr("Abort Recording"));
connect(this, SIGNAL(SetStartTracingButtonEnabled(bool)), start_recording,
SLOT(setVisible(bool)));
connect(this, SIGNAL(SetStopTracingButtonEnabled(bool)), stop_recording,
SLOT(setVisible(bool)));
connect(this, SIGNAL(SetAbortTracingButtonEnabled(bool)), abort_recording,
SLOT(setVisible(bool)));
connect(start_recording, SIGNAL(clicked()), this, SLOT(StartRecording()));
connect(stop_recording, SIGNAL(clicked()), this, SLOT(StopRecording()));
connect(abort_recording, SIGNAL(clicked()), this, SLOT(AbortRecording()));
connect(this, &GraphicsTracingWidget::SetStartTracingButtonEnabled, start_recording,
&QPushButton::setVisible);
connect(this, &GraphicsTracingWidget::SetStopTracingButtonEnabled, stop_recording,
&QPushButton::setVisible);
connect(this, &GraphicsTracingWidget::SetAbortTracingButtonEnabled, abort_recording,
&QPushButton::setVisible);
connect(start_recording, &QPushButton::clicked, this, &GraphicsTracingWidget::StartRecording);
connect(stop_recording, &QPushButton::clicked, this, &GraphicsTracingWidget::StopRecording);
connect(abort_recording, &QPushButton::clicked, this, &GraphicsTracingWidget::AbortRecording);
stop_recording->setVisible(false);
abort_recording->setVisible(false);

View file

@ -393,15 +393,18 @@ GraphicsVertexShaderWidget::GraphicsVertexShaderWidget(
cycle_index = new QSpinBox;
connect(dump_shader, SIGNAL(clicked()), this, SLOT(DumpShader()));
connect(dump_shader, &QPushButton::clicked, this, &GraphicsVertexShaderWidget::DumpShader);
connect(cycle_index, SIGNAL(valueChanged(int)), this, SLOT(OnCycleIndexChanged(int)));
connect(cycle_index, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
&GraphicsVertexShaderWidget::OnCycleIndexChanged);
for (unsigned i = 0; i < ARRAY_SIZE(input_data); ++i) {
connect(input_data[i], SIGNAL(textEdited(const QString&)), input_data_mapper, SLOT(map()));
connect(input_data[i], &QLineEdit::textEdited, input_data_mapper,
static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
input_data_mapper->setMapping(input_data[i], i);
}
connect(input_data_mapper, SIGNAL(mapped(int)), this, SLOT(OnInputAttributeChanged(int)));
connect(input_data_mapper, static_cast<void (QSignalMapper::*)(int)>(&QSignalMapper::mapped),
this, &GraphicsVertexShaderWidget::OnInputAttributeChanged);
auto main_widget = new QWidget;
auto main_layout = new QVBoxLayout;

View file

@ -74,7 +74,7 @@ QAction* MicroProfileDialog::toggleViewAction() {
toggle_view_action = new QAction(windowTitle(), this);
toggle_view_action->setCheckable(true);
toggle_view_action->setChecked(isVisible());
connect(toggle_view_action, SIGNAL(toggled(bool)), SLOT(setVisible(bool)));
connect(toggle_view_action, &QAction::toggled, this, &MicroProfileDialog::setVisible);
}
return toggle_view_action;
@ -107,7 +107,8 @@ MicroProfileWidget::MicroProfileWidget(QWidget* parent) : QWidget(parent) {
MicroProfileSetDisplayMode(1); // Timers screen
MicroProfileInitUI();
connect(&update_timer, SIGNAL(timeout()), SLOT(update()));
connect(&update_timer, &QTimer::timeout, this,
static_cast<void (MicroProfileWidget::*)()>(&MicroProfileWidget::update));
}
void MicroProfileWidget::paintEvent(QPaintEvent* ev) {