Add $(EmulatorDir) to VFS dialog

This commit is contained in:
Robbie 2017-07-10 18:27:58 -05:00 committed by Ivan
parent 83df572604
commit 0405b860c6
5 changed files with 38 additions and 4 deletions

View File

@ -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/"}},

View File

@ -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());

View File

@ -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");

View File

@ -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();
@ -40,8 +45,15 @@ m_info(settingsInfo), m_gui_settings(guiSettings), m_emu_settings(emuSettings)
setLayout(vbox);
connect(dirList, &QListWidget::itemDoubleClicked, [this](QListWidgetItem* item)
{
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);
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()));
}

View File

@ -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;