Przeglądaj źródła

Add menu item for selecting the game list folder

archshift 11 lat temu
rodzic
commit
797b91a449
3 zmienionych plików z 23 dodań i 1 usunięć
  1. 11 0
      src/citra_qt/main.cpp
  2. 2 0
      src/citra_qt/main.h
  3. 10 1
      src/citra_qt/main.ui

+ 11 - 0
src/citra_qt/main.cpp

@@ -167,6 +167,7 @@ GMainWindow::GMainWindow() : emu_thread(nullptr)
     connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString)));
     connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()));
     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_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame()));
     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() {
     QAction* action = qobject_cast<QAction*>(sender());
     assert(action);

+ 2 - 0
src/citra_qt/main.h

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

+ 10 - 1
src/citra_qt/main.ui

@@ -45,7 +45,7 @@
      <x>0</x>
      <y>0</y>
      <width>1081</width>
-     <height>21</height>
+     <height>22</height>
     </rect>
    </property>
    <widget class="QMenu" name="menu_File">
@@ -60,6 +60,7 @@
     <addaction name="action_Load_File"/>
     <addaction name="action_Load_Symbol_Map"/>
     <addaction name="separator"/>
+    <addaction name="action_Select_Game_List_Root"/>
     <addaction name="menu_recent_files"/>
     <addaction name="separator"/>
     <addaction name="action_Exit"/>
@@ -182,6 +183,14 @@
     <string>Display Dock Widget Headers</string>
    </property>
   </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>
  <resources/>
  <connections>