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 + +