rpcsx/rpcs3/rpcs3qt/vfs_dialog.cpp

88 lines
2.9 KiB
C++
Raw Normal View History

#include "vfs_dialog.h"
#include <QPushButton>
[Qt/Input] Improve pad_settings_dialog a bit (#3611) * Input: further work on remapping Xinput and begin work on remapping DS4 * Input: Improve pad_settings_dialog a bit and begin Remapping for XInput * Input: begin evdev remapping and change all handlers to use cfg::string * Input: finish work on remapping evdev and some more crap * Input: finish work on remapping Xinput and DS4 * Input: add DS4 Colors to DS4 config * Input: Improve DS4 deadzone scaling Jarves made some mistakes, so I'll fix them in the follow up commit * Input: fix Jarves fixes on DS4 deadzone and remove unnecessary usage of toUtf8 * Input: add primitive batterychecks to XInput and DS4 * Input: add mmjoystick remapping * Input: Fix evdev and some Vibration issues * Input: adjust capabilities to fix stick input for games like LoS 2 also fix threshold slider minimum also add ps button to all the handlers * Input: Further evdev work based on danilaml code review and own debugging: Fixed path issue, <= 0 issue, some captures, const, axis with same codes. Adds a map to each device that differentiates negative and positive axis mappings. adjusted rest of the file to tabs (ListDevices and beginning of threadProc) * Input: use 20ms vibration update time for xbox one elite controllers. * Input: Fix return type of Clamp() * Input: Evdev Fix * Input: Evdev Optional GetNextButtonPress presumably better than the other * Input: review changes * Input: evdev: fix wrong index in axis handling move bindpadtodevice down to keep consistency between handlers and not get crazy * Input: evdev: fix expensive add_device in GetNextButtonPress * cleanup * Input: mmjoy: fix type * Input: evdev: final fixes * Input: evdev: exclude unnecessary buttons while mapping Xbox 360 or DS4 * Input: add deadzone preview by passing necessary values in callback use 0.5 of max value for threshold in pad dialog * Input: get rid of all-uppercase variables
2017-11-27 22:31:15 +01:00
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
2017-09-19 20:07:04 +02:00
vfs_dialog::vfs_dialog(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget* parent)
: QDialog(parent), m_gui_settings(guiSettings), m_emu_settings(emuSettings)
{
QTabWidget* tabs = new QTabWidget();
2017-07-11 01:27:58 +02:00
tabs->setUsesScrollButtons(false);
2017-09-19 20:07:04 +02:00
m_emu_settings->LoadSettings();
// 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 },
2017-09-19 20:07:04 +02:00
m_gui_settings, m_emu_settings, this);
2017-07-11 01:27:58 +02:00
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 },
2017-09-19 20:07:04 +02:00
m_gui_settings, m_emu_settings, this);
vfs_dialog_tab* dev_hdd1_tab = new vfs_dialog_tab({ "dev_hdd1", emu_settings::dev_hdd1Location, gui::fs_dev_hdd1_list, &g_cfg.vfs.dev_hdd1 },
2017-09-19 20:07:04 +02:00
m_gui_settings, m_emu_settings, this);
2018-06-23 08:26:11 +02:00
vfs_dialog_tab* dev_flash_tab = new vfs_dialog_tab({ "dev_flash", emu_settings::dev_flashLocation, gui::fs_dev_flash_list, &g_cfg.vfs.dev_flash },
m_gui_settings, m_emu_settings, this);
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 },
2017-09-19 20:07:04 +02:00
m_gui_settings, m_emu_settings, this);
2017-07-11 01:27:58 +02:00
tabs->addTab(emulator_tab, "$(EmulatorDir)");
tabs->addTab(dev_hdd0_tab, "dev_hdd0");
tabs->addTab(dev_hdd1_tab, "dev_hdd1");
2018-06-23 08:26:11 +02:00
tabs->addTab(dev_flash_tab, "dev_flash");
tabs->addTab(dev_usb000_tab, "dev_usb000");
// Create buttons
QPushButton* addDir = new QPushButton(tr("Add New Directory"));
connect(addDir, &QAbstractButton::pressed, [=]
{
static_cast<vfs_dialog_tab*>(tabs->currentWidget())->AddNewDirectory();
});
QPushButton* reset = new QPushButton(tr("Reset"));
connect(reset, &QAbstractButton::pressed, [=]
{
static_cast<vfs_dialog_tab*>(tabs->currentWidget())->Reset();
});
QPushButton* resetAll = new QPushButton(tr("Reset All"));
connect(resetAll, &QAbstractButton::pressed, [=]
{
for (int i = 0; i < tabs->count(); ++i)
{
static_cast<vfs_dialog_tab*>(tabs->widget(i))->Reset();
}
});
QPushButton* okay = new QPushButton(tr("Okay"));
2017-07-10 15:43:57 +02:00
okay->setAutoDefault(true);
okay->setDefault(true);
connect(okay, &QAbstractButton::pressed, [=]
{
for (int i = 0; i < tabs->count(); ++i)
{
static_cast<vfs_dialog_tab*>(tabs->widget(i))->SetSettings();
}
m_emu_settings->SaveSettings();
accept();
});
QHBoxLayout* buttons = new QHBoxLayout;
buttons->addWidget(addDir);
buttons->addWidget(reset);
buttons->addWidget(resetAll);
buttons->addStretch();
buttons->addWidget(okay);
QVBoxLayout* vbox = new QVBoxLayout;
vbox->addWidget(tabs);
vbox->addLayout(buttons);
setLayout(vbox);
setWindowTitle(tr("Virtual File System"));
setObjectName("vfs_dialog");
}