mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 11:36:13 +00:00
Qt: use Qt standard button layout in vfs_dialog
This commit is contained in:
parent
f97ed7738d
commit
04a6b065b4
4 changed files with 34 additions and 35 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "vfs_dialog_tab.h"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "vfs_dialog_tab.h"
|
||||
#include "vfs_dialog_tab.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QCoreApplication>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Emu/System.h"
|
||||
|
|
Loading…
Add table
Reference in a new issue