summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-01-18 21:07:17 -0500
committerGravatar GitHub2018-01-18 21:07:17 -0500
commit6b4f37b544acf80dba72b02edea0b10eeeb39148 (patch)
treea2101a82095970dd41690a65d8a5c474d73ba81b /src
parentui: Rename almost all classes in configuration_input.ui (#99) (diff)
parentqt: Migrate to Qt 5 signal/slot connection syntax where applicable (diff)
downloadyuzu-6b4f37b544acf80dba72b02edea0b10eeeb39148.tar.gz
yuzu-6b4f37b544acf80dba72b02edea0b10eeeb39148.tar.xz
yuzu-6b4f37b544acf80dba72b02edea0b10eeeb39148.zip
Merge pull request #107 from lioncash/qt
qt: Migrate to Qt 5 signal/slot connection syntax where applicable
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/bootmanager.cpp4
-rw-r--r--src/yuzu/debugger/profiler.cpp5
-rw-r--r--src/yuzu/game_list.cpp5
-rw-r--r--src/yuzu/main.cpp46
-rw-r--r--src/yuzu/util/spinbox.cpp2
5 files changed, 31 insertions, 31 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index b9dc4943a..469988d63 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -289,6 +289,6 @@ void GRenderWindow::showEvent(QShowEvent* event) {
289 QWidget::showEvent(event); 289 QWidget::showEvent(event);
290 290
291 // windowHandle() is not initialized until the Window is shown, so we connect it here. 291 // windowHandle() is not initialized until the Window is shown, so we connect it here.
292 connect(this->windowHandle(), SIGNAL(screenChanged(QScreen*)), this, 292 connect(windowHandle(), &QWindow::screenChanged, this, &GRenderWindow::OnFramebufferSizeChanged,
293 SLOT(OnFramebufferSizeChanged()), Qt::UniqueConnection); 293 Qt::UniqueConnection);
294} 294}
diff --git a/src/yuzu/debugger/profiler.cpp b/src/yuzu/debugger/profiler.cpp
index cc9babe84..8b30e0a85 100644
--- a/src/yuzu/debugger/profiler.cpp
+++ b/src/yuzu/debugger/profiler.cpp
@@ -74,7 +74,7 @@ QAction* MicroProfileDialog::toggleViewAction() {
74 toggle_view_action = new QAction(windowTitle(), this); 74 toggle_view_action = new QAction(windowTitle(), this);
75 toggle_view_action->setCheckable(true); 75 toggle_view_action->setCheckable(true);
76 toggle_view_action->setChecked(isVisible()); 76 toggle_view_action->setChecked(isVisible());
77 connect(toggle_view_action, SIGNAL(toggled(bool)), SLOT(setVisible(bool))); 77 connect(toggle_view_action, &QAction::toggled, this, &MicroProfileDialog::setVisible);
78 } 78 }
79 79
80 return toggle_view_action; 80 return toggle_view_action;
@@ -107,7 +107,8 @@ MicroProfileWidget::MicroProfileWidget(QWidget* parent) : QWidget(parent) {
107 MicroProfileSetDisplayMode(1); // Timers screen 107 MicroProfileSetDisplayMode(1); // Timers screen
108 MicroProfileInitUI(); 108 MicroProfileInitUI();
109 109
110 connect(&update_timer, SIGNAL(timeout()), SLOT(update())); 110 connect(&update_timer, &QTimer::timeout, this,
111 static_cast<void (MicroProfileWidget::*)()>(&MicroProfileWidget::update));
111} 112}
112 113
113void MicroProfileWidget::paintEvent(QPaintEvent* ev) { 114void MicroProfileWidget::paintEvent(QPaintEvent* ev) {
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index 6d7c409d0..76ced4de4 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -114,8 +114,7 @@ GameList::SearchField::SearchField(GameList* parent) : QWidget{parent} {
114 edit_filter->setPlaceholderText(tr("Enter pattern to filter")); 114 edit_filter->setPlaceholderText(tr("Enter pattern to filter"));
115 edit_filter->installEventFilter(keyReleaseEater); 115 edit_filter->installEventFilter(keyReleaseEater);
116 edit_filter->setClearButtonEnabled(true); 116 edit_filter->setClearButtonEnabled(true);
117 connect(edit_filter, SIGNAL(textChanged(const QString&)), parent, 117 connect(edit_filter, &QLineEdit::textChanged, parent, &GameList::onTextChanged);
118 SLOT(onTextChanged(const QString&)));
119 label_filter_result = new QLabel; 118 label_filter_result = new QLabel;
120 button_filter_close = new QToolButton(this); 119 button_filter_close = new QToolButton(this);
121 button_filter_close->setText("X"); 120 button_filter_close->setText("X");
@@ -124,7 +123,7 @@ GameList::SearchField::SearchField(GameList* parent) : QWidget{parent} {
124 "#000000; font-weight: bold; background: #F0F0F0; }" 123 "#000000; font-weight: bold; background: #F0F0F0; }"
125 "QToolButton:hover{ border: none; padding: 0px; color: " 124 "QToolButton:hover{ border: none; padding: 0px; color: "
126 "#EEEEEE; font-weight: bold; background: #E81123}"); 125 "#EEEEEE; font-weight: bold; background: #E81123}");
127 connect(button_filter_close, SIGNAL(clicked()), parent, SLOT(onFilterCloseClicked())); 126 connect(button_filter_close, &QToolButton::clicked, parent, &GameList::onFilterCloseClicked);
128 layout_filter->setSpacing(10); 127 layout_filter->setSpacing(10);
129 layout_filter->addWidget(label_filter); 128 layout_filter->addWidget(label_filter);
130 layout_filter->addWidget(edit_filter); 129 layout_filter->addWidget(edit_filter);
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 31f2825ee..e5252abdc 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -175,7 +175,7 @@ void GMainWindow::InitializeRecentFileMenuActions() {
175 for (int i = 0; i < max_recent_files_item; ++i) { 175 for (int i = 0; i < max_recent_files_item; ++i) {
176 actions_recent_files[i] = new QAction(this); 176 actions_recent_files[i] = new QAction(this);
177 actions_recent_files[i]->setVisible(false); 177 actions_recent_files[i]->setVisible(false);
178 connect(actions_recent_files[i], SIGNAL(triggered()), this, SLOT(OnMenuRecentFile())); 178 connect(actions_recent_files[i], &QAction::triggered, this, &GMainWindow::OnMenuRecentFile);
179 179
180 ui.menu_recent_files->addAction(actions_recent_files[i]); 180 ui.menu_recent_files->addAction(actions_recent_files[i]);
181 } 181 }
@@ -190,10 +190,10 @@ void GMainWindow::InitializeHotkeys() {
190 RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence::Cancel, Qt::ApplicationShortcut); 190 RegisterHotkey("Main Window", "Exit Fullscreen", QKeySequence::Cancel, Qt::ApplicationShortcut);
191 LoadHotkeys(); 191 LoadHotkeys();
192 192
193 connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, 193 connect(GetHotkey("Main Window", "Load File", this), &QShortcut::activated, this,
194 SLOT(OnMenuLoadFile())); 194 &GMainWindow::OnMenuLoadFile);
195 connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, 195 connect(GetHotkey("Main Window", "Start Emulation", this), &QShortcut::activated, this,
196 SLOT(OnStartGame())); 196 &GMainWindow::OnStartGame);
197 connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activated, 197 connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activated,
198 ui.action_Fullscreen, &QAction::trigger); 198 ui.action_Fullscreen, &QAction::trigger);
199 connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activatedAmbiguously, 199 connect(GetHotkey("Main Window", "Fullscreen", render_window), &QShortcut::activatedAmbiguously,
@@ -245,13 +245,14 @@ void GMainWindow::RestoreUIState() {
245} 245}
246 246
247void GMainWindow::ConnectWidgetEvents() { 247void GMainWindow::ConnectWidgetEvents() {
248 connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString))); 248 connect(game_list, &GameList::GameChosen, this, &GMainWindow::OnGameListLoadFile);
249 connect(game_list, SIGNAL(OpenSaveFolderRequested(u64)), this, 249 connect(game_list, &GameList::OpenSaveFolderRequested, this,
250 SLOT(OnGameListOpenSaveFolder(u64))); 250 &GMainWindow::OnGameListOpenSaveFolder);
251 251
252 connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, 252 connect(this, &GMainWindow::EmulationStarting, render_window,
253 SLOT(OnEmulationStarting(EmuThread*))); 253 &GRenderWindow::OnEmulationStarting);
254 connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); 254 connect(this, &GMainWindow::EmulationStopping, render_window,
255 &GRenderWindow::OnEmulationStopping);
255 256
256 connect(&status_bar_update_timer, &QTimer::timeout, this, &GMainWindow::UpdateStatusBar); 257 connect(&status_bar_update_timer, &QTimer::timeout, this, &GMainWindow::UpdateStatusBar);
257} 258}
@@ -398,17 +399,17 @@ void GMainWindow::BootGame(const QString& filename) {
398 render_window->moveContext(); 399 render_window->moveContext();
399 emu_thread->start(); 400 emu_thread->start();
400 401
401 connect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame())); 402 connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
402 // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views 403 // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views
403 // before the CPU continues 404 // before the CPU continues
404 connect(emu_thread.get(), SIGNAL(DebugModeEntered()), registersWidget, 405 connect(emu_thread.get(), &EmuThread::DebugModeEntered, registersWidget,
405 SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection); 406 &RegistersWidget::OnDebugModeEntered, Qt::BlockingQueuedConnection);
406 connect(emu_thread.get(), SIGNAL(DebugModeEntered()), waitTreeWidget, 407 connect(emu_thread.get(), &EmuThread::DebugModeEntered, waitTreeWidget,
407 SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection); 408 &WaitTreeWidget::OnDebugModeEntered, Qt::BlockingQueuedConnection);
408 connect(emu_thread.get(), SIGNAL(DebugModeLeft()), registersWidget, SLOT(OnDebugModeLeft()), 409 connect(emu_thread.get(), &EmuThread::DebugModeLeft, registersWidget,
409 Qt::BlockingQueuedConnection); 410 &RegistersWidget::OnDebugModeLeft, Qt::BlockingQueuedConnection);
410 connect(emu_thread.get(), SIGNAL(DebugModeLeft()), waitTreeWidget, SLOT(OnDebugModeLeft()), 411 connect(emu_thread.get(), &EmuThread::DebugModeLeft, waitTreeWidget,
411 Qt::BlockingQueuedConnection); 412 &WaitTreeWidget::OnDebugModeLeft, Qt::BlockingQueuedConnection);
412 413
413 // Update the GUI 414 // Update the GUI
414 registersWidget->OnDebugModeEntered(); 415 registersWidget->OnDebugModeEntered();
@@ -437,7 +438,7 @@ void GMainWindow::ShutdownGame() {
437 emu_thread = nullptr; 438 emu_thread = nullptr;
438 439
439 // The emulation is stopped, so closing the window or not does not matter anymore 440 // The emulation is stopped, so closing the window or not does not matter anymore
440 disconnect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame())); 441 disconnect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
441 442
442 // Update the GUI 443 // Update the GUI
443 ui.action_Start->setEnabled(false); 444 ui.action_Start->setEnabled(false);
@@ -548,8 +549,7 @@ void GMainWindow::OnStartGame() {
548 emu_thread->SetRunning(true); 549 emu_thread->SetRunning(true);
549 qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus"); 550 qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus");
550 qRegisterMetaType<std::string>("std::string"); 551 qRegisterMetaType<std::string>("std::string");
551 connect(emu_thread.get(), SIGNAL(ErrorThrown(Core::System::ResultStatus, std::string)), this, 552 connect(emu_thread.get(), &EmuThread::ErrorThrown, this, &GMainWindow::OnCoreError);
552 SLOT(OnCoreError(Core::System::ResultStatus, std::string)));
553 553
554 ui.action_Start->setEnabled(false); 554 ui.action_Start->setEnabled(false);
555 ui.action_Start->setText(tr("Continue")); 555 ui.action_Start->setText(tr("Continue"));
diff --git a/src/yuzu/util/spinbox.cpp b/src/yuzu/util/spinbox.cpp
index 92753ec1c..14ef1e884 100644
--- a/src/yuzu/util/spinbox.cpp
+++ b/src/yuzu/util/spinbox.cpp
@@ -39,7 +39,7 @@ CSpinBox::CSpinBox(QWidget* parent)
39 // TODO: Might be nice to not immediately call the slot. 39 // TODO: Might be nice to not immediately call the slot.
40 // Think of an address that is being replaced by a different one, in which case a lot 40 // Think of an address that is being replaced by a different one, in which case a lot
41 // invalid intermediate addresses would be read from during editing. 41 // invalid intermediate addresses would be read from during editing.
42 connect(lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(OnEditingFinished())); 42 connect(lineEdit(), &QLineEdit::textEdited, this, &CSpinBox::OnEditingFinished);
43 43
44 UpdateText(); 44 UpdateText();
45} 45}