Compare commits

...

1 Commits

Author SHA1 Message Date
Jungy
bc2559ef84 Add Configure Custome Keys Directory to File Menu
Addressing Issue #1226, this should allow moving the Keys directory to a
different location if desired.
2019-02-13 01:55:53 -05:00
4 changed files with 38 additions and 4 deletions

View File

@@ -405,6 +405,13 @@ void Config::ReadValues() {
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)))
.toString()
.toStdString());
FileUtil::GetUserPath(
FileUtil::UserPath::KeysDir,
qt_config
->value("keys_directory",
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::KeysDir)))
.toString()
.toStdString());
qt_config->endGroup();
qt_config->beginGroup("Core");
@@ -653,6 +660,8 @@ void Config::SaveValues() {
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)));
qt_config->setValue("sdmc_directory",
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir)));
qt_config->setValue("keys_directory",
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::KeysDir)));
qt_config->endGroup();
qt_config->beginGroup("System");

View File

@@ -659,6 +659,8 @@ void GMainWindow::ConnectMenuEvents() {
[this] { OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget::NAND); });
connect(ui.action_Select_SDMC_Directory, &QAction::triggered, this,
[this] { OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget::SDMC); });
connect(ui.action_Select_Keys_Directory, &QAction::triggered, this,
[this] { OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget::Keys); });
connect(ui.action_Exit, &QAction::triggered, this, &QMainWindow::close);
connect(ui.action_Load_Amiibo, &QAction::triggered, this, &GMainWindow::OnLoadAmiibo);
@@ -1447,12 +1449,27 @@ void GMainWindow::OnMenuSelectGameListRoot() {
}
void GMainWindow::OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget target) {
const char* directory_name;
FileUtil::UserPath path;
switch (target) {
case EmulatedDirectoryTarget::SDMC:
directory_name = "SD Card";
path = FileUtil::UserPath::SDMCDir;
break;
case EmulatedDirectoryTarget::NAND:
directory_name = "NAND";
path = FileUtil::UserPath::NANDDir;
break;
default:
directory_name = "keys";
path = FileUtil::UserPath::KeysDir;
}
const auto res = QMessageBox::information(
this, tr("Changing Emulated Directory"),
tr("You are about to change the emulated %1 directory of the system. Please note "
"that this does not also move the contents of the previous directory to the "
"new one and you will have to do that yourself.")
.arg(target == EmulatedDirectoryTarget::SDMC ? tr("SD card") : tr("NAND")),
.arg(tr(directory_name)),
QMessageBox::StandardButtons{QMessageBox::Ok, QMessageBox::Cancel});
if (res == QMessageBox::Cancel)
@@ -1460,9 +1477,7 @@ void GMainWindow::OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget target)
QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory"));
if (!dir_path.isEmpty()) {
FileUtil::GetUserPath(target == EmulatedDirectoryTarget::SDMC ? FileUtil::UserPath::SDMCDir
: FileUtil::UserPath::NANDDir,
dir_path.toStdString());
FileUtil::GetUserPath(path, dir_path.toStdString());
Service::FileSystem::CreateFactories(*vfs);
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
}

View File

@@ -48,6 +48,7 @@ class DebugContext;
enum class EmulatedDirectoryTarget {
NAND,
SDMC,
Keys,
};
enum class ReinitializeKeyBehavior {

View File

@@ -67,6 +67,7 @@
<addaction name="separator"/>
<addaction name="action_Select_NAND_Directory"/>
<addaction name="action_Select_SDMC_Directory"/>
<addaction name="action_Select_Keys_Directory"/>
<addaction name="separator"/>
<addaction name="action_Load_Amiibo"/>
<addaction name="separator"/>
@@ -246,6 +247,14 @@
<string>Selects a folder to use as the root of the emulated SD card</string>
</property>
</action>
<action name="action_Select_Keys_Directory">
<property name="text">
<string>Select Keys Directory...</string>
</property>
<property name="toolTip">
<string>Selects a folder to use as the root of the keys</string>
</property>
</action>
<action name="action_Fullscreen">
<property name="checkable">
<bool>true</bool>