From 629f45f1a5d1a08bf7e7d9036ded5b572eb85347 Mon Sep 17 00:00:00 2001 From: Simon McFarlane Date: Sat, 2 May 2015 02:36:54 -0700 Subject: [PATCH 1/4] QT: add exit function --- Source/Core/DolphinQt/MainWindow.cpp | 16 +++++++++++++++- Source/Core/DolphinQt/MainWindow.h | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 0835f9044b..8035872b15 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -57,6 +57,7 @@ DMainWindow::DMainWindow(QWidget* parent_widget) connect(this, SIGNAL(CoreStateChanged(Core::EState)), this, SLOT(OnCoreStateChanged(Core::EState))); connect(m_ui->actionOpen, SIGNAL(triggered()), this, SLOT(OnOpen())); + connect(m_ui->actionExit, SIGNAL(triggered()), this, SLOT(OnExit())); connect(m_ui->actionListView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged())); connect(m_ui->actionTreeView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged())); @@ -165,6 +166,14 @@ void DMainWindow::OnOpen() StartGame(filename); } +void DMainWindow::OnExit() +{ + close(); + if (Core::GetState() == Core::CORE_UNINITIALIZED || m_isStopping) + return; + Stop(); +} + void DMainWindow::OnPlay() { if (Core::GetState() != Core::CORE_UNINITIALIZED) @@ -183,7 +192,7 @@ void DMainWindow::OnPlay() bool DMainWindow::OnStop() { if (Core::GetState() == Core::CORE_UNINITIALIZED || m_isStopping) - return true; // We're already stopped/stopping + return true; // Ask for confirmation in case the user accidentally clicked Stop / Escape if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop) @@ -203,6 +212,11 @@ bool DMainWindow::OnStop() } } + return Stop(); +} + +bool DMainWindow::Stop() +{ m_isStopping = true; // TODO: Movie stuff diff --git a/Source/Core/DolphinQt/MainWindow.h b/Source/Core/DolphinQt/MainWindow.h index a0671443fd..a2371b02b5 100644 --- a/Source/Core/DolphinQt/MainWindow.h +++ b/Source/Core/DolphinQt/MainWindow.h @@ -44,6 +44,7 @@ private slots: // Main toolbar void OnOpen(); + void OnExit(); void OnPlay(); // View menu @@ -67,6 +68,7 @@ private: QString RequestBootFilename(); QString ShowFileDialog(); void DoStartPause(); + bool Stop(); std::unique_ptr m_render_widget; bool m_isStopping = false; From 29a9c24b73d13b82d67bc33e027e4f0561a290ff Mon Sep 17 00:00:00 2001 From: Simon McFarlane Date: Sat, 2 May 2015 13:29:56 -0700 Subject: [PATCH 2/4] QT: Add ISO folder browser --- Source/Core/DolphinQt/MainWindow.cpp | 25 +++++++++++++++++++++++++ Source/Core/DolphinQt/MainWindow.h | 2 ++ Source/Core/DolphinQt/MainWindow.ui | 14 ++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 8035872b15..aef65812e8 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -57,6 +57,7 @@ DMainWindow::DMainWindow(QWidget* parent_widget) connect(this, SIGNAL(CoreStateChanged(Core::EState)), this, SLOT(OnCoreStateChanged(Core::EState))); 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->actionListView, SIGNAL(triggered()), this, SLOT(OnGameListStyleChanged())); @@ -143,6 +144,13 @@ QString DMainWindow::ShowFileDialog() .arg(SL("*.gcm *.iso *.ciso *.gcz *.wbfs *.elf *.dol *.dff *.tmd *.wad"))); } +QString DMainWindow::ShowFolderDialog() +{ + return QFileDialog::getExistingDirectory(this, tr("Browse for a directory to add"), + QDir::homePath(), + QFileDialog::ShowDirsOnly); +} + void DMainWindow::DoStartPause() { if (Core::GetState() == Core::CORE_RUN) @@ -166,6 +174,23 @@ void DMainWindow::OnOpen() StartGame(filename); } +void DMainWindow::OnBrowse() +{ + std::string path = ShowFolderDialog().toStdString(); + std::vector& iso_folder = SConfig::GetInstance().m_ISOFolder; + if (!path.empty()) + { + auto itResult = std::find(iso_folder.begin(), iso_folder.end(), path); + + if (itResult == iso_folder.end()) + { + iso_folder.push_back(path); + SConfig::GetInstance().SaveSettings(); + } + } + m_game_tracker->ScanForGames(); +} + void DMainWindow::OnExit() { close(); diff --git a/Source/Core/DolphinQt/MainWindow.h b/Source/Core/DolphinQt/MainWindow.h index a2371b02b5..79c5489eb5 100644 --- a/Source/Core/DolphinQt/MainWindow.h +++ b/Source/Core/DolphinQt/MainWindow.h @@ -44,6 +44,7 @@ private slots: // Main toolbar void OnOpen(); + void OnBrowse(); void OnExit(); void OnPlay(); @@ -67,6 +68,7 @@ private: // Emulation QString RequestBootFilename(); QString ShowFileDialog(); + QString ShowFolderDialog(); void DoStartPause(); bool Stop(); diff --git a/Source/Core/DolphinQt/MainWindow.ui b/Source/Core/DolphinQt/MainWindow.ui index 272dc5a65e..aac571c789 100644 --- a/Source/Core/DolphinQt/MainWindow.ui +++ b/Source/Core/DolphinQt/MainWindow.ui @@ -40,6 +40,10 @@ Fi&le + + + + @@ -199,6 +203,16 @@ &Icon view + + + &Browse for ISOs... + + + + + Exit + + From 5988750fe4ae1956a851c730584f74ede16bbfc0 Mon Sep 17 00:00:00 2001 From: Simon McFarlane Date: Sat, 2 May 2015 15:30:25 -0700 Subject: [PATCH 3/4] QT: Add Play/Pause to Emulation menu --- Source/Core/DolphinQt/MainWindow.cpp | 4 ++++ Source/Core/DolphinQt/MainWindow.ui | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index aef65812e8..175b7c45cb 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -66,8 +66,10 @@ DMainWindow::DMainWindow(QWidget* parent_widget) connect(m_ui->actionIconView, SIGNAL(triggered()), this, SLOT(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->actionWebsite, SIGNAL(triggered()), this, SLOT(OnOpenWebsite())); connect(m_ui->actionOnlineDocs, SIGNAL(triggered()), this, SLOT(OnOpenDocs())); @@ -292,11 +294,13 @@ void DMainWindow::OnCoreStateChanged(Core::EState state) { m_ui->actionPlay->setIcon(Resources::GetIcon(Resources::TOOLBAR_PAUSE)); m_ui->actionPlay->setText(tr("Pause")); + m_ui->actionPlay_mnu->setText(tr("Pause")); } else if (is_paused || is_not_initialized) { m_ui->actionPlay->setIcon(Resources::GetIcon(Resources::TOOLBAR_PLAY)); m_ui->actionPlay->setText(tr("Play")); + m_ui->actionPlay_mnu->setText(tr("Play")); } m_ui->actionStop->setEnabled(!is_not_initialized); diff --git a/Source/Core/DolphinQt/MainWindow.ui b/Source/Core/DolphinQt/MainWindow.ui index aac571c789..54fdeccc6f 100644 --- a/Source/Core/DolphinQt/MainWindow.ui +++ b/Source/Core/DolphinQt/MainWindow.ui @@ -49,6 +49,8 @@ E&mulation + + @@ -213,6 +215,16 @@ Exit + + + Play + + + + + Stop + + From 6c6fe8d724eb626d96779bee80a7359c607cc679 Mon Sep 17 00:00:00 2001 From: Simon McFarlane Date: Sat, 2 May 2015 16:18:02 -0700 Subject: [PATCH 4/4] QT: Add reset button --- Source/Core/DolphinQt/MainWindow.cpp | 8 ++++++++ Source/Core/DolphinQt/MainWindow.h | 1 + Source/Core/DolphinQt/MainWindow.ui | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 175b7c45cb..e00a35e5e1 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -14,6 +14,7 @@ #include "Core/BootManager.h" #include "Core/ConfigManager.h" +#include "Core/HW/ProcessorInterface.h" #include "DolphinQt/AboutDialog.h" #include "DolphinQt/MainWindow.h" @@ -70,6 +71,7 @@ DMainWindow::DMainWindow(QWidget* parent_widget) 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->actionWebsite, SIGNAL(triggered()), this, SLOT(OnOpenWebsite())); connect(m_ui->actionOnlineDocs, SIGNAL(triggered()), this, SLOT(OnOpenDocs())); @@ -270,6 +272,12 @@ bool DMainWindow::Stop() return true; } +void DMainWindow::OnReset() +{ + // TODO: Movie needs to be reset here + ProcessorInterface::ResetButton_Tap(); +} + void DMainWindow::OnGameListStyleChanged() { if (m_ui->actionListView->isChecked()) diff --git a/Source/Core/DolphinQt/MainWindow.h b/Source/Core/DolphinQt/MainWindow.h index 79c5489eb5..3808f77e9c 100644 --- a/Source/Core/DolphinQt/MainWindow.h +++ b/Source/Core/DolphinQt/MainWindow.h @@ -47,6 +47,7 @@ private slots: void OnBrowse(); void OnExit(); void OnPlay(); + void OnReset(); // View menu void OnGameListStyleChanged(); diff --git a/Source/Core/DolphinQt/MainWindow.ui b/Source/Core/DolphinQt/MainWindow.ui index 54fdeccc6f..38f5a038e4 100644 --- a/Source/Core/DolphinQt/MainWindow.ui +++ b/Source/Core/DolphinQt/MainWindow.ui @@ -51,6 +51,7 @@ + @@ -225,6 +226,11 @@ Stop + + + Reset + +