mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 16:31:28 +12: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 <QPushButton>
|
||||||
#include <QMessageBox>
|
#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");
|
tabs->addTab(dev_usb000_tab, "dev_usb000");
|
||||||
|
|
||||||
// Create buttons
|
// Create buttons
|
||||||
QPushButton* resetAll = new QPushButton(tr("Reset Directories"));
|
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Close | QDialogButtonBox::Save | QDialogButtonBox::RestoreDefaults);
|
||||||
connect(resetAll, &QAbstractButton::clicked, [=]
|
buttons->button(QDialogButtonBox::RestoreDefaults)->setText(tr("Reset Directories"));
|
||||||
{
|
buttons->button(QDialogButtonBox::Save)->setDefault(true);
|
||||||
if (QMessageBox::question(this, tr("Confirm Reset"), tr("Reset all file system directories?")) != QMessageBox::Yes)
|
|
||||||
return;
|
|
||||||
|
|
||||||
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;
|
QVBoxLayout* vbox = new QVBoxLayout;
|
||||||
vbox->addWidget(tabs);
|
vbox->addWidget(tabs);
|
||||||
vbox->addLayout(buttons);
|
vbox->addWidget(buttons);
|
||||||
|
|
||||||
setLayout(vbox);
|
setLayout(vbox);
|
||||||
setWindowTitle(tr("Virtual File System"));
|
setWindowTitle(tr("Virtual File System"));
|
||||||
setObjectName("vfs_dialog");
|
setObjectName("vfs_dialog");
|
||||||
|
|
||||||
|
buttons->button(QDialogButtonBox::Save)->setFocus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "vfs_dialog_tab.h"
|
#include "vfs_dialog_tab.h"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "vfs_dialog_tab.h"
|
#include "vfs_dialog_tab.h"
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "Emu/System.h"
|
#include "Emu/System.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue