Pad settings dialog improvements

This commit is contained in:
msuih 2019-09-07 13:31:48 +03:00 committed by Megamouse
parent fb8e70d7f6
commit 8f965ccd48
5 changed files with 71 additions and 3 deletions

View File

@ -0,0 +1,15 @@
{
"handlers": {
"null": "This controller is disabled and will appear as disconnected to software. Choose another handler to enable it.",
"keyboard": "While it is possible to use a keyboard as a pad in RPCS3, the use of an actual controller is strongly recommended. To bind mouse movement to a button or joystick, click on the desired button to activate it, then click and hold while dragging the mouse to a direction",
"ds3_windows": "In order to use the DualShock 3 handler, you need to install the official DualShock 3 driver first.\nSee the <a href=\"https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration\">RPCS3 Wiki</a> for instructions.",
"ds3_linux": "In order to use the DualShock 3 handler, you might need to add udev rules to let RPCS3 access the controller.\nSee the <a href=\"https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration\">RPCS3 Wiki</a> for instructions.",
"ds3_other": "The DualShock 3 handler is recommended for official DualShock 3 controllers.",
"ds4_windows": "If you have any issues with the DualShock 4 handler, it might be caused by third-party tools such as DS4Windows. It's recommended that you disable them while using this handler.",
"ds4_linux": "In order to use the DualShock 4 handler, you might need to add udev rules to let RPCS3 access the controller.\nSee the <a href=\"https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration\">RPCS3 Wiki</a> for instructions.",
"ds4_other": "The DualShock 4 handler is recommended for official DualShock 4 controllers.",
"xinput": "The XInput handler will work with Xbox controllers and many third-party PC-compatible controllers.",
"evdev": "The evdev handler should work with any controller that has linux support.\nIf your joystick is not being centered properly, read the <a href=\"https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration\">RPCS3 Wiki</a> for instructions.",
"mmjoy": "The MMJoystick handler should work with almost any controller recognized by Windows. However, it is recommended that you use the more specific handlers if you have a controller that supports them."
}
}

View File

@ -14,6 +14,7 @@
<file>Icons/list.png</file>
<file>Icons/refresh.png</file>
<file>Json/tooltips.json</file>
<file>Json/pad_settings.json</file>
<file>Icons/exit_fullscreen.png</file>
<file>Icons/open.png</file>
<file>Icons/custom_config.png</file>

View File

@ -68,6 +68,14 @@ pad_settings_dialog::pad_settings_dialog(QWidget *parent, const GameInfo *game)
setWindowTitle(tr("Gamepads Settings"));
}
// Load tooltips
QFile json_file(":/Json/pad_settings.json");
json_file.open(QIODevice::ReadOnly | QIODevice::Text);
QJsonObject json_obj = QJsonDocument::fromJson(json_file.readAll()).object();
json_file.close();
m_json_handlers = json_obj.value("handlers").toObject();
// Create tab widget for 7 players
m_tabs = new QTabWidget;
for (int i = 1; i < 8; i++)
@ -928,6 +936,43 @@ void pad_settings_dialog::ChangeInputType()
m_handler = GetHandler(g_cfg_input.player[player]->handler);
const auto device_list = m_handler->ListDevices();
// Change the description
QString description;
switch (m_handler->m_type)
{
case pad_handler::null:
description = m_json_handlers["null"].toString(); break;
case pad_handler::keyboard:
description = m_json_handlers["keyboard"].toString(); break;
#ifdef _WIN32
case pad_handler::xinput:
description = m_json_handlers["xinput"].toString(); break;
case pad_handler::mm:
description = m_json_handlers["mmjoy"].toString(); break;
case pad_handler::ds3:
description = m_json_handlers["ds3_windows"].toString(); break;
case pad_handler::ds4:
description = m_json_handlers["ds4_windows"].toString(); break;
#elif __linux__
case pad_handler::ds3:
description = m_json_handlers["ds3_linux"].toString(); break;
case pad_handler::ds4:
description = m_json_handlers["ds4_linux"].toString(); break;
#else
case pad_handler::ds3:
description = m_json_handlers["ds3_other"].toString(); break;
case pad_handler::ds4:
description = m_json_handlers["ds4_other"].toString(); break;
#endif
#ifdef HAVE_LIBEVDEV
case pad_handler::evdev:
description = (m_json_handlers["evdev"].toString()); break;
#endif
default:
description = "";
}
ui->l_description->setText(description);
// change our contextual widgets
ui->left_stack->setCurrentIndex((m_handler->m_type == pad_handler::keyboard) ? 1 : 0);
ui->right_stack->setCurrentIndex((m_handler->m_type == pad_handler::keyboard) ? 1 : 0);

View File

@ -3,6 +3,7 @@
#include <QButtonGroup>
#include <QDialog>
#include <QEvent>
#include <QJsonObject>
#include <QLabel>
#include <QTabWidget>
#include <QTimer>
@ -103,6 +104,9 @@ private:
Ui::pad_settings_dialog *ui;
std::string m_title_id;
// Tooltip things
QJsonObject m_json_handlers;
// TabWidget
QTabWidget* m_tabs = nullptr;

View File

@ -997,7 +997,7 @@
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_middle">
<layout class="QVBoxLayout" name="verticalLayout_middle" stretch="0,0,0,0,0,1">
<property name="spacing">
<number>0</number>
</property>
@ -1540,10 +1540,10 @@
<item>
<widget class="QLabel" name="l_description">
<property name="text">
<string>To use a DualShock 3 controller on Windows you can now use Sony's official drivers. To get them you'll have to install PlayStation Now, since the drivers are bundled with it.</string>
<string>This text should be replaced by an actual description.&lt;br/&gt;&lt;br/&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
@ -1551,6 +1551,9 @@
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>