Add menu item for selecting the game list folder

This commit is contained in:
archshift 2015-09-06 15:33:57 -07:00
parent 6e1bb58ee8
commit 797b91a449
3 changed files with 23 additions and 1 deletions

View File

@ -167,6 +167,7 @@ GMainWindow::GMainWindow() : emu_thread(nullptr)
connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString))); connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString)));
connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile())); connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()));
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, SLOT(OnMenuSelectGameListRoot()));
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()));
@ -380,6 +381,16 @@ void GMainWindow::OnMenuLoadSymbolMap() {
} }
} }
void GMainWindow::OnMenuSelectGameListRoot() {
QSettings settings;
QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory"));
if (!dir_path.isEmpty()) {
settings.setValue("gameListRootDir", dir_path);
game_list->PopulateAsync(dir_path, settings.value("gameListDeepScan").toBool());
}
}
void GMainWindow::OnMenuRecentFile() { void GMainWindow::OnMenuRecentFile() {
QAction* action = qobject_cast<QAction*>(sender()); QAction* action = qobject_cast<QAction*>(sender());
assert(action); assert(action);

View File

@ -92,6 +92,8 @@ private slots:
void OnGameListLoadFile(QString game_path); void OnGameListLoadFile(QString game_path);
void OnMenuLoadFile(); void OnMenuLoadFile();
void OnMenuLoadSymbolMap(); void OnMenuLoadSymbolMap();
/// Called whenever a user selects the "File->Select Game List Root" menu item
void OnMenuSelectGameListRoot();
void OnMenuRecentFile(); void OnMenuRecentFile();
void OnOpenHotkeysDialog(); void OnOpenHotkeysDialog();
void OnConfigure(); void OnConfigure();

View File

@ -45,7 +45,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1081</width> <width>1081</width>
<height>21</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menu_File"> <widget class="QMenu" name="menu_File">
@ -60,6 +60,7 @@
<addaction name="action_Load_File"/> <addaction name="action_Load_File"/>
<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="menu_recent_files"/> <addaction name="menu_recent_files"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="action_Exit"/> <addaction name="action_Exit"/>
@ -182,6 +183,14 @@
<string>Display Dock Widget Headers</string> <string>Display Dock Widget Headers</string>
</property> </property>
</action> </action>
<action name="action_Select_Game_List_Root">
<property name="text">
<string>Select Game Directory...</string>
</property>
<property name="toolTip">
<string>Selects a folder to display in the game list</string>
</property>
</action>
</widget> </widget>
<resources/> <resources/>
<connections> <connections>