|
|
|
@@ -1,5 +1,6 @@
|
|
|
|
|
#include "vfs_dialog.h"
|
|
|
|
|
#include "vfs_dialog.h"
|
|
|
|
|
|
|
|
|
|
#include <QDialogButtonBox>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
|
|
|
|
@@ -36,46 +37,44 @@ vfs_dialog::vfs_dialog(std::shared_ptr<gui_settings> guiSettings, std::shared_pt
|
|
|
|
|
tabs->addTab(dev_usb000_tab, "dev_usb000");
|
|
|
|
|
|
|
|
|
|
// Create buttons
|
|
|
|
|
QPushButton* resetAll = new QPushButton(tr("Reset Directories"));
|
|
|
|
|
connect(resetAll, &QAbstractButton::clicked, [=]
|
|
|
|
|
{
|
|
|
|
|
if (QMessageBox::question(this, tr("Confirm Reset"), tr("Reset all file system directories?")) != QMessageBox::Yes)
|
|
|
|
|
return;
|
|
|
|
|
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Close | QDialogButtonBox::Save | QDialogButtonBox::RestoreDefaults);
|
|
|
|
|
buttons->button(QDialogButtonBox::RestoreDefaults)->setText(tr("Reset Directories"));
|
|
|
|
|
buttons->button(QDialogButtonBox::Save)->setDefault(true);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < tabs->count(); ++i)
|
|
|
|
|
connect(buttons, &QDialogButtonBox::clicked, [=](QAbstractButton* button)
|
|
|
|
|
{
|
|
|
|
|
if (button == buttons->button(QDialogButtonBox::RestoreDefaults))
|
|
|
|
|
{
|
|
|
|
|
static_cast<vfs_dialog_tab*>(tabs->widget(i))->Reset();
|
|
|
|
|
if (QMessageBox::question(this, tr("Confirm Reset"), tr("Reset all file system directories?")) != QMessageBox::Yes)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < tabs->count(); ++i)
|
|
|
|
|
{
|
|
|
|
|
static_cast<vfs_dialog_tab*>(tabs->widget(i))->Reset();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (button == buttons->button(QDialogButtonBox::Save))
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < tabs->count(); ++i)
|
|
|
|
|
{
|
|
|
|
|
static_cast<vfs_dialog_tab*>(tabs->widget(i))->SetSettings();
|
|
|
|
|
}
|
|
|
|
|
m_emu_settings->SaveSettings();
|
|
|
|
|
accept();
|
|
|
|
|
}
|
|
|
|
|
else if (button == buttons->button(QDialogButtonBox::Close))
|
|
|
|
|
{
|
|
|
|
|
reject();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
QPushButton* save = new QPushButton(tr("Save"));
|
|
|
|
|
save->setAutoDefault(true);
|
|
|
|
|
save->setDefault(true);
|
|
|
|
|
|
|
|
|
|
connect(save, &QAbstractButton::clicked, [=]
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < tabs->count(); ++i)
|
|
|
|
|
{
|
|
|
|
|
static_cast<vfs_dialog_tab*>(tabs->widget(i))->SetSettings();
|
|
|
|
|
}
|
|
|
|
|
m_emu_settings->SaveSettings();
|
|
|
|
|
accept();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
QPushButton* close = new QPushButton(tr("Close"));
|
|
|
|
|
connect(close, &QAbstractButton::clicked, this, &QDialog::reject);
|
|
|
|
|
|
|
|
|
|
QHBoxLayout* buttons = new QHBoxLayout;
|
|
|
|
|
buttons->addWidget(resetAll);
|
|
|
|
|
buttons->addStretch();
|
|
|
|
|
buttons->addWidget(save);
|
|
|
|
|
buttons->addWidget(close);
|
|
|
|
|
|
|
|
|
|
QVBoxLayout* vbox = new QVBoxLayout;
|
|
|
|
|
vbox->addWidget(tabs);
|
|
|
|
|
vbox->addLayout(buttons);
|
|
|
|
|
vbox->addWidget(buttons);
|
|
|
|
|
|
|
|
|
|
setLayout(vbox);
|
|
|
|
|
setWindowTitle(tr("Virtual File System"));
|
|
|
|
|
setObjectName("vfs_dialog");
|
|
|
|
|
|
|
|
|
|
buttons->button(QDialogButtonBox::Save)->setFocus();
|
|
|
|
|
}
|
|
|
|
|