From f3ec05f1ba0b69bb67859d3cb3eb85c9f981958e Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 10 Aug 2022 15:54:38 +1000 Subject: [PATCH] Qt: Add missing binding UI for PS Mouse --- src/duckstation-qt/CMakeLists.txt | 1 + .../controllerbindingwidget_mouse.ui | 183 ++++++++++++++++++ .../controllerbindingwidgets.cpp | 24 +++ src/duckstation-qt/controllerbindingwidgets.h | 19 ++ src/duckstation-qt/duckstation-qt.vcxproj | 3 + .../resources/icons/black/svg/mouse-line.svg | 1 + .../resources/icons/white/svg/mouse-line.svg | 1 + src/duckstation-qt/resources/resources.qrc | 2 + 8 files changed, 234 insertions(+) create mode 100644 src/duckstation-qt/controllerbindingwidget_mouse.ui create mode 100644 src/duckstation-qt/resources/icons/black/svg/mouse-line.svg create mode 100644 src/duckstation-qt/resources/icons/white/svg/mouse-line.svg diff --git a/src/duckstation-qt/CMakeLists.txt b/src/duckstation-qt/CMakeLists.txt index 59a15d841..b5e4da3e7 100644 --- a/src/duckstation-qt/CMakeLists.txt +++ b/src/duckstation-qt/CMakeLists.txt @@ -34,6 +34,7 @@ set(SRCS controllerbindingwidget_analog_joystick.ui controllerbindingwidget_digital_controller.ui controllerbindingwidget_guncon.ui + controllerbindingwidget_mouse.ui controllerbindingwidget_negcon.ui controllerbindingwidgets.cpp controllerbindingwidgets.h diff --git a/src/duckstation-qt/controllerbindingwidget_mouse.ui b/src/duckstation-qt/controllerbindingwidget_mouse.ui new file mode 100644 index 000000000..c652a666c --- /dev/null +++ b/src/duckstation-qt/controllerbindingwidget_mouse.ui @@ -0,0 +1,183 @@ + + + ControllerBindingWidget_Mouse + + + + 0 + 0 + 1100 + 500 + + + + + 0 + 0 + + + + + 1100 + 500 + + + + Form + + + + + + Qt::Vertical + + + + 20 + 187 + + + + + + + + Qt::Horizontal + + + + 405 + 20 + + + + + + + + Buttons + + + + + + Left + + + + 6 + + + 6 + + + 6 + + + 6 + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + PushButton + + + + + + + + + + Right + + + + 6 + + + 6 + + + 6 + + + 6 + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + PushButton + + + + + + + + + + + + + Qt::Horizontal + + + + 405 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 187 + + + + + + + + + InputBindingWidget + QPushButton +
inputbindingwidgets.h
+
+
+ + + + +
diff --git a/src/duckstation-qt/controllerbindingwidgets.cpp b/src/duckstation-qt/controllerbindingwidgets.cpp index 4547ad9c9..c1d571166 100644 --- a/src/duckstation-qt/controllerbindingwidgets.cpp +++ b/src/duckstation-qt/controllerbindingwidgets.cpp @@ -113,6 +113,9 @@ void ControllerBindingWidget::populateWidgets() case ControllerType::NeGcon: m_bindings_widget = ControllerBindingWidget_NeGcon::createInstance(this); break; + case ControllerType::PlayStationMouse: + m_bindings_widget = ControllerBindingWidget_Mouse::createInstance(this); + break; default: m_bindings_widget = new ControllerBindingWidget_Base(this); break; @@ -880,3 +883,24 @@ ControllerBindingWidget_Base* ControllerBindingWidget_GunCon::createInstance(Con } ////////////////////////////////////////////////////////////////////////// + +ControllerBindingWidget_Mouse::ControllerBindingWidget_Mouse(ControllerBindingWidget* parent) + : ControllerBindingWidget_Base(parent) +{ + m_ui.setupUi(this); + initBindingWidgets(); +} + +ControllerBindingWidget_Mouse::~ControllerBindingWidget_Mouse() {} + +QIcon ControllerBindingWidget_Mouse::getIcon() const +{ + return QIcon::fromTheme(QStringLiteral("mouse-line")); +} + +ControllerBindingWidget_Base* ControllerBindingWidget_Mouse::createInstance(ControllerBindingWidget* parent) +{ + return new ControllerBindingWidget_Mouse(parent); +} + +////////////////////////////////////////////////////////////////////////// diff --git a/src/duckstation-qt/controllerbindingwidgets.h b/src/duckstation-qt/controllerbindingwidgets.h index be0d66bcf..9350f6d0a 100644 --- a/src/duckstation-qt/controllerbindingwidgets.h +++ b/src/duckstation-qt/controllerbindingwidgets.h @@ -11,6 +11,7 @@ #include "ui_controllerbindingwidget_analog_joystick.h" #include "ui_controllerbindingwidget_digital_controller.h" #include "ui_controllerbindingwidget_guncon.h" +#include "ui_controllerbindingwidget_mouse.h" #include "ui_controllerbindingwidget_negcon.h" #include "ui_controllermacroeditwidget.h" #include "ui_controllermacrowidget.h" @@ -263,3 +264,21 @@ private: }; ////////////////////////////////////////////////////////////////////////// + +class ControllerBindingWidget_Mouse final : public ControllerBindingWidget_Base +{ + Q_OBJECT + +public: + ControllerBindingWidget_Mouse(ControllerBindingWidget* parent); + ~ControllerBindingWidget_Mouse(); + + QIcon getIcon() const override; + + static ControllerBindingWidget_Base* createInstance(ControllerBindingWidget* parent); + +private: + Ui::ControllerBindingWidget_Mouse m_ui; +}; + +////////////////////////////////////////////////////////////////////////// diff --git a/src/duckstation-qt/duckstation-qt.vcxproj b/src/duckstation-qt/duckstation-qt.vcxproj index 3b39f1196..2648d2ad7 100644 --- a/src/duckstation-qt/duckstation-qt.vcxproj +++ b/src/duckstation-qt/duckstation-qt.vcxproj @@ -176,6 +176,9 @@ Document + + Document + Document diff --git a/src/duckstation-qt/resources/icons/black/svg/mouse-line.svg b/src/duckstation-qt/resources/icons/black/svg/mouse-line.svg new file mode 100644 index 000000000..7f6e2dcac --- /dev/null +++ b/src/duckstation-qt/resources/icons/black/svg/mouse-line.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/duckstation-qt/resources/icons/white/svg/mouse-line.svg b/src/duckstation-qt/resources/icons/white/svg/mouse-line.svg new file mode 100644 index 000000000..1524cb638 --- /dev/null +++ b/src/duckstation-qt/resources/icons/white/svg/mouse-line.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/duckstation-qt/resources/resources.qrc b/src/duckstation-qt/resources/resources.qrc index 914915165..1fb62e951 100644 --- a/src/duckstation-qt/resources/resources.qrc +++ b/src/duckstation-qt/resources/resources.qrc @@ -181,6 +181,7 @@ icons/black/svg/keyboard-line.svg icons/black/svg/layout-grid-line.svg icons/black/svg/list-check.svg + icons/black/svg/mouse-line.svg icons/black/svg/paint-brush-line.svg icons/black/svg/paint-fill.svg icons/black/svg/pantone-line.svg @@ -510,6 +511,7 @@ icons/white/svg/keyboard-line.svg icons/white/svg/layout-grid-line.svg icons/white/svg/list-check.svg + icons/white/svg/mouse-line.svg icons/white/svg/paint-brush-line.svg icons/white/svg/paint-fill.svg icons/white/svg/pantone-line.svg