diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 64d6ac696..a67069172 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -230,8 +230,7 @@ void GMainWindow::ConnectWidgetEvents() { connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap())); connect(ui.action_Select_Game_List_Root, SIGNAL(triggered()), this, SLOT(OnMenuSelectGameListRoot())); - connect(ui.action_Refresh_Game_Directory, SIGNAL(triggered()), this, - SLOT(OnMenuRefreshGameDirectory())); + connect(&watcher, SIGNAL(directoryChanged(QString)), SLOT(RefreshGameDirectory())); connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame())); connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame())); connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame())); @@ -490,12 +489,16 @@ void GMainWindow::OnMenuLoadSymbolMap() { void GMainWindow::OnMenuSelectGameListRoot() { QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory")); + if (!UISettings::values.gamedir.isEmpty()) { + watcher.removePath(UISettings::values.gamedir); + } if (!dir_path.isEmpty()) { UISettings::values.gamedir = dir_path; game_list->PopulateAsync(dir_path, UISettings::values.gamedir_deepscan); + watcher.addPath(dir_path); } } -void GMainWindow::OnMenuRefreshGameDirectory() { +void GMainWindow::RefreshGameDirectory() { if (!UISettings::values.gamedir.isEmpty()) { game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); } diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index f3a9cc11d..36aa327cb 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -6,6 +6,7 @@ #define _CITRA_QT_MAIN_HXX_ #include +#include #include #include "ui_main.h" @@ -123,7 +124,7 @@ private slots: void OnMenuLoadSymbolMap(); /// Called whenever a user selects the "File->Select Game List Root" menu item void OnMenuSelectGameListRoot(); - void OnMenuRefreshGameDirectory(); + void RefreshGameDirectory(); void OnMenuRecentFile(); void OnSwapScreens(); void OnConfigure(); @@ -154,6 +155,7 @@ private: GraphicsVertexShaderWidget* graphicsVertexShaderWidget; GraphicsTracingWidget* graphicsTracingWidget; WaitTreeWidget* waitTreeWidget; + QFileSystemWatcher watcher; QAction* actions_recent_files[max_recent_files_item]; }; diff --git a/src/citra_qt/main.ui b/src/citra_qt/main.ui index f425677c7..adfa3689e 100644 --- a/src/citra_qt/main.ui +++ b/src/citra_qt/main.ui @@ -61,7 +61,6 @@ - @@ -168,11 +167,6 @@ Selects a folder to display in the game list - - - Refresh Game Directory - -