reverted the ui method and added filewatcher

I implemented the filewatcher method as described by @yuriks
This commit is contained in:
noah the goodra 2017-02-09 11:22:54 -06:00
parent 400fa7f9a0
commit 13611e3f68
3 changed files with 9 additions and 10 deletions

View File

@ -230,8 +230,7 @@ void GMainWindow::ConnectWidgetEvents() {
connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap())); connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap()));
connect(ui.action_Select_Game_List_Root, SIGNAL(triggered()), this, connect(ui.action_Select_Game_List_Root, SIGNAL(triggered()), this,
SLOT(OnMenuSelectGameListRoot())); SLOT(OnMenuSelectGameListRoot()));
connect(ui.action_Refresh_Game_Directory, SIGNAL(triggered()), this, connect(&watcher, SIGNAL(directoryChanged(QString)), SLOT(RefreshGameDirectory()));
SLOT(OnMenuRefreshGameDirectory()));
connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame())); connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame()));
connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame())); connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame()));
connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame())); connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame()));
@ -490,12 +489,16 @@ void GMainWindow::OnMenuLoadSymbolMap() {
void GMainWindow::OnMenuSelectGameListRoot() { void GMainWindow::OnMenuSelectGameListRoot() {
QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory")); QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory"));
if (!UISettings::values.gamedir.isEmpty()) {
watcher.removePath(UISettings::values.gamedir);
}
if (!dir_path.isEmpty()) { if (!dir_path.isEmpty()) {
UISettings::values.gamedir = dir_path; UISettings::values.gamedir = dir_path;
game_list->PopulateAsync(dir_path, UISettings::values.gamedir_deepscan); game_list->PopulateAsync(dir_path, UISettings::values.gamedir_deepscan);
watcher.addPath(dir_path);
} }
} }
void GMainWindow::OnMenuRefreshGameDirectory() { void GMainWindow::RefreshGameDirectory() {
if (!UISettings::values.gamedir.isEmpty()) { if (!UISettings::values.gamedir.isEmpty()) {
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
} }

View File

@ -6,6 +6,7 @@
#define _CITRA_QT_MAIN_HXX_ #define _CITRA_QT_MAIN_HXX_
#include <memory> #include <memory>
#include <QFileSystemWatcher>
#include <QMainWindow> #include <QMainWindow>
#include "ui_main.h" #include "ui_main.h"
@ -123,7 +124,7 @@ private slots:
void OnMenuLoadSymbolMap(); void OnMenuLoadSymbolMap();
/// Called whenever a user selects the "File->Select Game List Root" menu item /// Called whenever a user selects the "File->Select Game List Root" menu item
void OnMenuSelectGameListRoot(); void OnMenuSelectGameListRoot();
void OnMenuRefreshGameDirectory(); void RefreshGameDirectory();
void OnMenuRecentFile(); void OnMenuRecentFile();
void OnSwapScreens(); void OnSwapScreens();
void OnConfigure(); void OnConfigure();
@ -154,6 +155,7 @@ private:
GraphicsVertexShaderWidget* graphicsVertexShaderWidget; GraphicsVertexShaderWidget* graphicsVertexShaderWidget;
GraphicsTracingWidget* graphicsTracingWidget; GraphicsTracingWidget* graphicsTracingWidget;
WaitTreeWidget* waitTreeWidget; WaitTreeWidget* waitTreeWidget;
QFileSystemWatcher watcher;
QAction* actions_recent_files[max_recent_files_item]; QAction* actions_recent_files[max_recent_files_item];
}; };

View File

@ -61,7 +61,6 @@
<addaction name="action_Load_Symbol_Map"/> <addaction name="action_Load_Symbol_Map"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="action_Select_Game_List_Root"/> <addaction name="action_Select_Game_List_Root"/>
<addaction name="action_Refresh_Game_Directory"/>
<addaction name="menu_recent_files"/> <addaction name="menu_recent_files"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="action_Exit"/> <addaction name="action_Exit"/>
@ -168,11 +167,6 @@
<string>Selects a folder to display in the game list</string> <string>Selects a folder to display in the game list</string>
</property> </property>
</action> </action>
<action name="action_Refresh_Game_Directory">
<property name="text">
<string>Refresh Game Directory</string>
</property>
</action>
</widget> </widget>
<resources/> <resources/>
<connections> <connections>