From 0405b860c6abf6b36fadd62233b0e41fd741f2ae Mon Sep 17 00:00:00 2001 From: Robbie Date: Mon, 10 Jul 2017 18:27:58 -0500 Subject: [PATCH] Add $(EmulatorDir) to VFS dialog --- rpcs3/rpcs3qt/emu_settings.h | 2 ++ rpcs3/rpcs3qt/gui_settings.h | 1 + rpcs3/rpcs3qt/vfs_dialog.cpp | 7 ++++++- rpcs3/rpcs3qt/vfs_dialog_tab.cpp | 30 +++++++++++++++++++++++++++--- rpcs3/rpcs3qt/vfs_dialog_tab.h | 2 ++ 5 files changed, 38 insertions(+), 4 deletions(-) diff --git a/rpcs3/rpcs3qt/emu_settings.h b/rpcs3/rpcs3qt/emu_settings.h index 50d178a08d..9c47653a46 100644 --- a/rpcs3/rpcs3qt/emu_settings.h +++ b/rpcs3/rpcs3qt/emu_settings.h @@ -95,6 +95,7 @@ public: EnableHostRoot, // Virtual File System + emulatorLocation, dev_hdd0Location, dev_hdd1Location, dev_flashLocation, @@ -188,6 +189,7 @@ private: {EnableHostRoot, { "VFS", "Enable /host_root/"}}, // Virtual File System + { emulatorLocation, { "VFS", "$(EmulatorDir)"}}, { dev_hdd0Location, { "VFS", "/dev_hdd0/" }}, { dev_hdd1Location, { "VFS", "/dev_hdd1/" }}, { dev_flashLocation, { "VFS", "/dev_flash/"}}, diff --git a/rpcs3/rpcs3qt/gui_settings.h b/rpcs3/rpcs3qt/gui_settings.h index ec52ad907a..bf98c4ea49 100644 --- a/rpcs3/rpcs3qt/gui_settings.h +++ b/rpcs3/rpcs3qt/gui_settings.h @@ -96,6 +96,7 @@ namespace GUI const GUI_SAVE gl_marginFactor = GUI_SAVE( game_list, "marginFactor", (qreal) 0.09 ); const GUI_SAVE gl_toolBarVisible = GUI_SAVE( game_list, "toolBarVisible", false); + const GUI_SAVE fs_emulator_dir_list = GUI_SAVE(fs, "emulator_dir_list", QStringList()); const GUI_SAVE fs_dev_hdd0_list = GUI_SAVE(fs, "dev_hdd0_list", QStringList()); const GUI_SAVE fs_dev_hdd1_list = GUI_SAVE(fs, "dev_hdd1_list", QStringList()); const GUI_SAVE fs_dev_flash_list = GUI_SAVE(fs, "dev_flash_list", QStringList()); diff --git a/rpcs3/rpcs3qt/vfs_dialog.cpp b/rpcs3/rpcs3qt/vfs_dialog.cpp index 5d9f3800cc..268f25b5ff 100644 --- a/rpcs3/rpcs3qt/vfs_dialog.cpp +++ b/rpcs3/rpcs3qt/vfs_dialog.cpp @@ -13,8 +13,12 @@ vfs_dialog::vfs_dialog(QWidget* parent) : QDialog(parent), m_gui_settings(), m_emu_settings("") { tabs = new QTabWidget(); - + tabs->setUsesScrollButtons(false); + // Create tabs + vfs_dialog_tab* emulator_tab = new vfs_dialog_tab({ "$(EmulatorDir)", emu_settings::emulatorLocation, GUI::fs_emulator_dir_list, &g_cfg.vfs.emulator_dir }, + &m_gui_settings, &m_emu_settings, this); + vfs_dialog_tab* dev_hdd0_tab = new vfs_dialog_tab({ "dev_hdd0", emu_settings::dev_hdd0Location, GUI::fs_dev_hdd0_list, &g_cfg.vfs.dev_hdd0 }, &m_gui_settings, &m_emu_settings, this); @@ -27,6 +31,7 @@ vfs_dialog::vfs_dialog(QWidget* parent) : QDialog(parent), vfs_dialog_tab* dev_usb000_tab = new vfs_dialog_tab({ "dev_usb000", emu_settings::dev_usb000Location, GUI::fs_dev_usb000_list, &g_cfg.vfs.dev_usb000 }, &m_gui_settings, &m_emu_settings, this); + tabs->addTab(emulator_tab, "$(EmulatorDir)"); tabs->addTab(dev_hdd0_tab, "dev_hdd0"); tabs->addTab(dev_hdd1_tab, "dev_hdd1"); tabs->addTab(dev_flash_tab, "dev_flash"); diff --git a/rpcs3/rpcs3qt/vfs_dialog_tab.cpp b/rpcs3/rpcs3qt/vfs_dialog_tab.cpp index 84262022f2..f76eb2835f 100644 --- a/rpcs3/rpcs3qt/vfs_dialog_tab.cpp +++ b/rpcs3/rpcs3qt/vfs_dialog_tab.cpp @@ -23,12 +23,17 @@ m_info(settingsInfo), m_gui_settings(guiSettings), m_emu_settings(emuSettings) { new QListWidgetItem(dir, dirList); } + dirList->setMinimumWidth(dirList->sizeHintForColumn(0)); QHBoxLayout* selectedConfigLayout = new QHBoxLayout; QLabel* selectedMessage = new QLabel(m_info.name + " directory:"); selectedConfigLabel = new QLabel(); selectedConfigLabel->setText(EmuConfigDir()); + if (selectedConfigLabel->text() == "") + { + selectedConfigLabel->setText(EmptyPath); + } selectedConfigLayout->addWidget(selectedMessage); selectedConfigLayout->addWidget(selectedConfigLabel); selectedConfigLayout->addStretch(); @@ -41,7 +46,14 @@ m_info(settingsInfo), m_gui_settings(guiSettings), m_emu_settings(emuSettings) connect(dirList, &QListWidget::itemDoubleClicked, [this](QListWidgetItem* item) { - selectedConfigLabel->setText(item->text()); + if (item->text() == "") + { + selectedConfigLabel->setText(EmptyPath); + } + else + { + selectedConfigLabel->setText(item->text()); + } }); } @@ -54,8 +66,16 @@ void vfs_dialog_tab::SaveSettings() } m_gui_settings->SetValue(m_info.listLocation, allDirs); - m_info.cfg_node->from_string(sstr(selectedConfigLabel->text())); - m_emu_settings->SetSetting(m_info.settingLoc, sstr(selectedConfigLabel->text())); + if (selectedConfigLabel->text() == EmptyPath) + { + m_info.cfg_node->from_string(""); + m_emu_settings->SetSetting(m_info.settingLoc, ""); + } + else + { + m_info.cfg_node->from_string(sstr(selectedConfigLabel->text())); + m_emu_settings->SetSetting(m_info.settingLoc, sstr(selectedConfigLabel->text())); + } m_emu_settings->SaveSettings(); } @@ -64,6 +84,10 @@ void vfs_dialog_tab::Reset() dirList->clear(); m_info.cfg_node->from_default(); selectedConfigLabel->setText(EmuConfigDir()); + if (selectedConfigLabel->text() == "") + { + selectedConfigLabel->setText(EmptyPath); + } dirList->addItem(new QListWidgetItem(EmuConfigDir())); m_gui_settings->SetValue(m_info.listLocation, QStringList(EmuConfigDir())); } diff --git a/rpcs3/rpcs3qt/vfs_dialog_tab.h b/rpcs3/rpcs3qt/vfs_dialog_tab.h index 25210ed8eb..6c83351137 100644 --- a/rpcs3/rpcs3qt/vfs_dialog_tab.h +++ b/rpcs3/rpcs3qt/vfs_dialog_tab.h @@ -32,6 +32,8 @@ public: private: QString EmuConfigDir(); + const QString EmptyPath = "Empty Path"; + vfs_settings_info m_info; gui_settings* m_gui_settings; emu_settings* m_emu_settings;