mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-01-05 08:10:10 +01:00
* 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
110 lines
3 KiB
C++
110 lines
3 KiB
C++
#include "vfs_dialog_tab.h"
|
|
|
|
#include <QFileDialog>
|
|
#include <QCoreApplication>
|
|
#include <QHBoxLayout>
|
|
#include <QVBoxLayout>
|
|
|
|
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
|
|
|
|
vfs_dialog_tab::vfs_dialog_tab(const vfs_settings_info& settingsInfo, std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget* parent)
|
|
: QWidget(parent), m_info(settingsInfo), m_gui_settings(guiSettings), m_emu_settings(emuSettings)
|
|
{
|
|
m_dirList = new QListWidget(this);
|
|
|
|
QStringList alldirs = m_gui_settings->GetValue(m_info.listLocation).toStringList();
|
|
|
|
// We must show the currently selected config.
|
|
if (alldirs.contains(EmuConfigDir()) == false)
|
|
{
|
|
new QListWidgetItem(EmuConfigDir(), m_dirList);
|
|
}
|
|
for (const QString& dir : alldirs)
|
|
{
|
|
new QListWidgetItem(dir, m_dirList);
|
|
}
|
|
|
|
m_dirList->setMinimumWidth(m_dirList->sizeHintForColumn(0));
|
|
|
|
QHBoxLayout* selectedConfigLayout = new QHBoxLayout;
|
|
QLabel* selectedMessage = new QLabel(m_info.name + " directory:");
|
|
m_selectedConfigLabel = new QLabel();
|
|
m_selectedConfigLabel->setText(EmuConfigDir());
|
|
if (m_selectedConfigLabel->text() == "")
|
|
{
|
|
m_selectedConfigLabel->setText(EmptyPath);
|
|
}
|
|
selectedConfigLayout->addWidget(selectedMessage);
|
|
selectedConfigLayout->addWidget(m_selectedConfigLabel);
|
|
selectedConfigLayout->addStretch();
|
|
|
|
QVBoxLayout* vbox = new QVBoxLayout;
|
|
vbox->addWidget(m_dirList);
|
|
vbox->addLayout(selectedConfigLayout);
|
|
|
|
setLayout(vbox);
|
|
|
|
connect(m_dirList, &QListWidget::itemDoubleClicked, [this](QListWidgetItem* item)
|
|
{
|
|
if (item->text() == "")
|
|
{
|
|
m_selectedConfigLabel->setText(EmptyPath);
|
|
}
|
|
else
|
|
{
|
|
m_selectedConfigLabel->setText(item->text());
|
|
}
|
|
});
|
|
}
|
|
|
|
void vfs_dialog_tab::SaveSettings()
|
|
{
|
|
QStringList allDirs;
|
|
for (int i = 0; i < m_dirList->count(); ++i)
|
|
{
|
|
allDirs += m_dirList->item(i)->text();
|
|
}
|
|
|
|
m_gui_settings->SetValue(m_info.listLocation, allDirs);
|
|
if (m_selectedConfigLabel->text() == EmptyPath)
|
|
{
|
|
m_info.cfg_node->from_string("");
|
|
m_emu_settings->SetSetting(m_info.settingLoc, "");
|
|
}
|
|
else
|
|
{
|
|
m_info.cfg_node->from_string(sstr(m_selectedConfigLabel->text()));
|
|
m_emu_settings->SetSetting(m_info.settingLoc, sstr(m_selectedConfigLabel->text()));
|
|
}
|
|
m_emu_settings->SaveSettings();
|
|
}
|
|
|
|
void vfs_dialog_tab::Reset()
|
|
{
|
|
m_dirList->clear();
|
|
m_info.cfg_node->from_default();
|
|
m_selectedConfigLabel->setText(EmuConfigDir());
|
|
if (m_selectedConfigLabel->text() == "")
|
|
{
|
|
m_selectedConfigLabel->setText(EmptyPath);
|
|
}
|
|
m_dirList->addItem(new QListWidgetItem(EmuConfigDir()));
|
|
m_gui_settings->SetValue(m_info.listLocation, QStringList(EmuConfigDir()));
|
|
}
|
|
|
|
void vfs_dialog_tab::AddNewDirectory()
|
|
{
|
|
QString dir = QFileDialog::getExistingDirectory(nullptr, "Choose a directory", QCoreApplication::applicationDirPath());
|
|
if (dir != "")
|
|
{
|
|
if (dir.endsWith("/") == false) dir += '/';
|
|
new QListWidgetItem(dir, m_dirList);
|
|
m_selectedConfigLabel->setText(dir);
|
|
}
|
|
}
|
|
|
|
QString vfs_dialog_tab::EmuConfigDir()
|
|
{
|
|
return qstr(m_info.cfg_node->to_string());
|
|
}
|