diff --git a/Source/Core/DolphinQt/GameList/GameGrid.cpp b/Source/Core/DolphinQt/GameList/GameGrid.cpp index 8bf92087bd..4b1887151d 100644 --- a/Source/Core/DolphinQt/GameList/GameGrid.cpp +++ b/Source/Core/DolphinQt/GameList/GameGrid.cpp @@ -22,7 +22,7 @@ DGameGrid::DGameGrid(QWidget* parent_widget) : m_ui->setupUi(this); SetViewStyle(STYLE_GRID); - connect(this, SIGNAL(itemActivated(QListWidgetItem*)), this, SIGNAL(StartGame())); + connect(this, &QListWidget::itemActivated, this, &DGameGrid::StartGame); } DGameGrid::~DGameGrid() diff --git a/Source/Core/DolphinQt/GameList/GameTracker.cpp b/Source/Core/DolphinQt/GameList/GameTracker.cpp index 7213024fe1..80bceacf0b 100644 --- a/Source/Core/DolphinQt/GameList/GameTracker.cpp +++ b/Source/Core/DolphinQt/GameList/GameTracker.cpp @@ -27,15 +27,15 @@ DGameTracker::DGameTracker(QWidget* parent_widget) : QStackedWidget(parent_widget), m_watcher(new QFileSystemWatcher(this)) { - connect(m_watcher, SIGNAL(directoryChanged(QString)), this, SLOT(ScanForGames())); + connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, &DGameTracker::ScanForGames); m_tree_widget = new DGameTree(this); addWidget(m_tree_widget); - connect(m_tree_widget, SIGNAL(StartGame()), this, SIGNAL(StartGame())); + connect(m_tree_widget, &DGameTree::StartGame, this, &DGameTracker::StartGame); m_grid_widget = new DGameGrid(this); addWidget(m_grid_widget); - connect(m_grid_widget, SIGNAL(StartGame()), this, SIGNAL(StartGame())); + connect(m_grid_widget, &DGameGrid::StartGame, this, &DGameTracker::StartGame); SetViewStyle(STYLE_LIST); } diff --git a/Source/Core/DolphinQt/GameList/GameTree.cpp b/Source/Core/DolphinQt/GameList/GameTree.cpp index 68dda6a419..4925af6313 100644 --- a/Source/Core/DolphinQt/GameList/GameTree.cpp +++ b/Source/Core/DolphinQt/GameList/GameTree.cpp @@ -24,7 +24,7 @@ DGameTree::DGameTree(QWidget* parent_widget) : setIconSize(QSize(BANNER_WIDTH, BANNER_HEIGHT)); sortByColumn(COL_TITLE, Qt::AscendingOrder); - connect(this, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(ItemActivated(QTreeWidgetItem*))); + connect(this, &QTreeWidget::itemActivated, this, &DGameTree::ItemActivated); } DGameTree::~DGameTree() diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 4c371678e5..b2e3a59806 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -54,30 +54,48 @@ DMainWindow::DMainWindow(QWidget* parent_widget) OnGameListStyleChanged(); // Connect all the signals/slots - connect(this, SIGNAL(CoreStateChanged(Core::EState)), this, SLOT(OnCoreStateChanged(Core::EState))); + connect(this, &DMainWindow::CoreStateChanged, this, &DMainWindow::OnCoreStateChanged); - connect(m_ui->actionOpen, SIGNAL(triggered()), this, SLOT(OnOpen())); - connect(m_ui->actionBrowse, SIGNAL(triggered()), this, SLOT(OnBrowse())); - connect(m_ui->actionExit, SIGNAL(triggered()), this, SLOT(OnExit())); + connect(m_ui->actionOpen, &QAction::triggered, this, [&]() { + QString filename = ShowFileDialog(); + if (!filename.isNull()) + StartGame(filename); + }); + connect(m_ui->actionBrowse, &QAction::triggered, this, &DMainWindow::OnBrowse); + connect(m_ui->actionExit, &QAction::triggered, this, &DMainWindow::OnExit); - connect(m_ui->actionListView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged())); - connect(m_ui->actionTreeView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged())); - connect(m_ui->actionGridView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged())); - connect(m_ui->actionIconView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged())); + connect(m_ui->actionListView, &QAction::triggered, this, &DMainWindow::OnGameListStyleChanged); + connect(m_ui->actionTreeView, &QAction::triggered, this, &DMainWindow::OnGameListStyleChanged); + connect(m_ui->actionGridView, &QAction::triggered, this, &DMainWindow::OnGameListStyleChanged); + connect(m_ui->actionIconView, &QAction::triggered, this, &DMainWindow::OnGameListStyleChanged); - connect(m_ui->actionPlay, SIGNAL(triggered()), this, SLOT(OnPlay())); - connect(m_ui->actionPlay_mnu, SIGNAL(triggered()), this, SLOT(OnPlay())); - connect(m_game_tracker, SIGNAL(StartGame()), this, SLOT(OnPlay())); - connect(m_ui->actionStop, SIGNAL(triggered()), this, SLOT(OnStop())); - connect(m_ui->actionStop_mnu, SIGNAL(triggered()), this, SLOT(OnStop())); - connect(m_ui->actionReset, SIGNAL(triggered()), this, SLOT(OnReset())); + connect(m_ui->actionPlay, &QAction::triggered, this, &DMainWindow::OnPlay); + connect(m_ui->actionPlay_mnu, &QAction::triggered, this, &DMainWindow::OnPlay); + connect(m_game_tracker, &DGameTracker::StartGame, this, &DMainWindow::OnPlay); + connect(m_ui->actionStop, &QAction::triggered, this, &DMainWindow::OnStop); + connect(m_ui->actionStop_mnu, &QAction::triggered, this, &DMainWindow::OnStop); + connect(m_ui->actionReset, &QAction::triggered, this, &DMainWindow::OnReset); - connect(m_ui->actionWebsite, SIGNAL(triggered()), this, SLOT(OnOpenWebsite())); - connect(m_ui->actionOnlineDocs, SIGNAL(triggered()), this, SLOT(OnOpenDocs())); - connect(m_ui->actionGitHub, SIGNAL(triggered()), this, SLOT(OnOpenGitHub())); - connect(m_ui->actionSystemInfo, SIGNAL(triggered()), this, SLOT(OnOpenSystemInfo())); - connect(m_ui->actionAbout, SIGNAL(triggered()), this, SLOT(OnOpenAbout())); - connect(m_ui->actionAboutQt, SIGNAL(triggered()), this, SLOT(OnOpenAboutQt())); + connect(m_ui->actionWebsite, &QAction::triggered, this, [&]() { + QDesktopServices::openUrl(QUrl(SL("https://dolphin-emu.org/"))); + }); + connect(m_ui->actionOnlineDocs, &QAction::triggered, this, [&]() { + QDesktopServices::openUrl(QUrl(SL("https://dolphin-emu.org/docs/guides/"))); + }); + connect(m_ui->actionGitHub, &QAction::triggered, this, [&]() { + QDesktopServices::openUrl(QUrl(SL("https://github.com/dolphin-emu/dolphin"))); + }); + connect(m_ui->actionSystemInfo, &QAction::triggered, this, [&]() { + DSystemInfo* dlg = new DSystemInfo(this); + dlg->open(); + }); + connect(m_ui->actionAbout, &QAction::triggered, this, [&]() { + DAboutDialog* dlg = new DAboutDialog(this); + dlg->open(); + }); + connect(m_ui->actionAboutQt, &QAction::triggered, this, [&]() { + QApplication::aboutQt(); + }); // Update GUI items emit CoreStateChanged(Core::CORE_UNINITIALIZED); @@ -182,13 +200,6 @@ void DMainWindow::DoStartPause() m_render_widget->setCursor(Qt::BlankCursor); } -void DMainWindow::OnOpen() -{ - QString filename = ShowFileDialog(); - if (!filename.isNull()) - StartGame(filename); -} - void DMainWindow::OnBrowse() { std::string path = ShowFolderDialog().toStdString(); @@ -334,36 +345,3 @@ void DMainWindow::UpdateIcons() // Play/Pause is handled in OnCoreStateChanged(). m_ui->actionStop->setIcon(Resources::GetIcon(Resources::TOOLBAR_STOP)); } - -// Help menu -void DMainWindow::OnOpenWebsite() -{ - QDesktopServices::openUrl(QUrl(SL("https://dolphin-emu.org/"))); -} - -void DMainWindow::OnOpenDocs() -{ - QDesktopServices::openUrl(QUrl(SL("https://dolphin-emu.org/docs/guides/"))); -} - -void DMainWindow::OnOpenGitHub() -{ - QDesktopServices::openUrl(QUrl(SL("https://github.com/dolphin-emu/dolphin"))); -} - -void DMainWindow::OnOpenSystemInfo() -{ - DSystemInfo* dlg = new DSystemInfo(this); - dlg->open(); -} - -void DMainWindow::OnOpenAbout() -{ - DAboutDialog* dlg = new DAboutDialog(this); - dlg->open(); -} - -void DMainWindow::OnOpenAboutQt() -{ - QApplication::aboutQt(); -} diff --git a/Source/Core/DolphinQt/MainWindow.h b/Source/Core/DolphinQt/MainWindow.h index 164e4528c5..4fe94e0b66 100644 --- a/Source/Core/DolphinQt/MainWindow.h +++ b/Source/Core/DolphinQt/MainWindow.h @@ -43,7 +43,6 @@ private slots: void OnCoreStateChanged(Core::EState state); // Main toolbar - void OnOpen(); void OnBrowse(); void OnExit(); void OnPlay(); @@ -52,14 +51,6 @@ private slots: // View menu void OnGameListStyleChanged(); - // Help menu - void OnOpenWebsite(); - void OnOpenDocs(); - void OnOpenGitHub(); - void OnOpenSystemInfo(); - void OnOpenAbout(); - void OnOpenAboutQt(); - // Misc. void UpdateIcons(); diff --git a/Source/Core/DolphinQt/SystemInfo.cpp b/Source/Core/DolphinQt/SystemInfo.cpp index ba2764593c..e8c6a04859 100644 --- a/Source/Core/DolphinQt/SystemInfo.cpp +++ b/Source/Core/DolphinQt/SystemInfo.cpp @@ -27,7 +27,7 @@ DSystemInfo::DSystemInfo(QWidget* parent_widget) : UpdateSystemInfo(); QPushButton* btn = m_ui->buttonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); - connect(btn, SIGNAL(pressed()), this, SLOT(CopyPressed())); + connect(btn, &QPushButton::pressed, this, &DSystemInfo::CopyPressed); } DSystemInfo::~DSystemInfo()