citra_qt: support multiple game directories

This commit is contained in:
BreadFish64 2018-04-19 19:56:24 -05:00
parent 88ebd844e5
commit 1a57f9488f
26 changed files with 561 additions and 132 deletions

View file

@ -202,8 +202,34 @@ void Config::ReadValues() {
qt_config->beginGroup("Paths");
UISettings::values.roms_path = qt_config->value("romsPath").toString();
UISettings::values.symbols_path = qt_config->value("symbolsPath").toString();
UISettings::values.gamedir = qt_config->value("gameListRootDir", ".").toString();
UISettings::values.gamedir_deepscan = qt_config->value("gameListDeepScan", false).toBool();
UISettings::values.game_dir_deprecated = qt_config->value("gameListRootDir", ".").toString();
UISettings::values.game_dir_deprecated_deepscan =
qt_config->value("gameListDeepScan", false).toBool();
int size = qt_config->beginReadArray("gamedirs");
for (int i = 0; i < size; ++i) {
qt_config->setArrayIndex(i);
UISettings::GameDir game_dir;
game_dir.path = qt_config->value("path").toString();
game_dir.deep_scan = qt_config->value("deep_scan", false).toBool();
game_dir.expanded = qt_config->value("expanded", true).toBool();
UISettings::values.game_dirs.append(game_dir);
}
qt_config->endArray();
// create NAND and SD card directories if empty, these are not removable through the UI, also
// carries over old game list settings if present
if (UISettings::values.game_dirs.isEmpty()) {
UISettings::GameDir game_dir;
game_dir.path = "INSTALLED";
game_dir.expanded = true;
UISettings::values.game_dirs.append(game_dir);
game_dir.path = "SYSTEM";
UISettings::values.game_dirs.append(game_dir);
if (UISettings::values.game_dir_deprecated != ".") {
game_dir.path = UISettings::values.game_dir_deprecated;
game_dir.deep_scan = UISettings::values.game_dir_deprecated_deepscan;
UISettings::values.game_dirs.append(game_dir);
}
}
UISettings::values.recent_files = qt_config->value("recentFiles").toStringList();
UISettings::values.language = qt_config->value("language", "").toString();
qt_config->endGroup();
@ -378,8 +404,15 @@ void Config::SaveValues() {
qt_config->beginGroup("Paths");
qt_config->setValue("romsPath", UISettings::values.roms_path);
qt_config->setValue("symbolsPath", UISettings::values.symbols_path);
qt_config->setValue("gameListRootDir", UISettings::values.gamedir);
qt_config->setValue("gameListDeepScan", UISettings::values.gamedir_deepscan);
qt_config->beginWriteArray("gamedirs");
for (int i = 0; i < UISettings::values.game_dirs.size(); ++i) {
qt_config->setArrayIndex(i);
const auto& game_dir = UISettings::values.game_dirs.at(i);
qt_config->setValue("path", game_dir.path);
qt_config->setValue("deep_scan", game_dir.deep_scan);
qt_config->setValue("expanded", game_dir.expanded);
}
qt_config->endArray();
qt_config->setValue("recentFiles", UISettings::values.recent_files);
qt_config->setValue("language", UISettings::values.language);
qt_config->endGroup();

View file

@ -44,7 +44,6 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
ConfigureGeneral::~ConfigureGeneral() {}
void ConfigureGeneral::setConfiguration() {
ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan);
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
ui->toggle_cpu_jit->setChecked(Settings::values.use_cpu_jit);
@ -60,7 +59,6 @@ void ConfigureGeneral::setConfiguration() {
}
void ConfigureGeneral::applyConfiguration() {
UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked();
UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked();
UISettings::values.theme =
ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString();

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>345</width>
<height>493</height>
<height>504</height>
</rect>
</property>
<property name="windowTitle">
@ -31,13 +31,6 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toggle_deepscan">
<property name="text">
<string>Search sub-directories for games</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>