mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
UDPServer: Add configuration UI.
Accessed through button "Alternate Input Sources" in the "Controller Settings" dialog.
This commit is contained in:
@ -51,6 +51,10 @@ add_executable(dolphin-emu
|
||||
Config/CheatCodeEditor.h
|
||||
Config/CheatWarningWidget.cpp
|
||||
Config/CheatWarningWidget.h
|
||||
Config/ControllerInterface/CemuHookUDPServerWidget.cpp
|
||||
Config/ControllerInterface/CemuHookUDPServerWidget.h
|
||||
Config/ControllerInterface/ControllerInterfaceWindow.cpp
|
||||
Config/ControllerInterface/ControllerInterfaceWindow.h
|
||||
Config/ControllersWindow.cpp
|
||||
Config/ControllersWindow.h
|
||||
Config/FilesystemWidget.cpp
|
||||
|
@ -0,0 +1,75 @@
|
||||
// Copyright 2019 Dolphin Emulator Project5~5~5~
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "DolphinQt/Config/ControllerInterface/CemuHookUDPServerWidget.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QSpinBox>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
#include "InputCommon/ControllerInterface/CemuHookUDPServer/CemuHookUDPServer.h"
|
||||
|
||||
CemuHookUDPServerWidget::CemuHookUDPServerWidget()
|
||||
{
|
||||
CreateWidgets();
|
||||
ConnectWidgets();
|
||||
}
|
||||
|
||||
void CemuHookUDPServerWidget::CreateWidgets()
|
||||
{
|
||||
auto* main_layout = new QGridLayout;
|
||||
|
||||
m_server_enabled = new QCheckBox(tr("Enable"));
|
||||
m_server_enabled->setChecked(Config::Get(ciface::CemuHookUDPServer::Settings::SERVER_ENABLED));
|
||||
|
||||
m_server_address = new QLineEdit(
|
||||
QString::fromStdString(Config::Get(ciface::CemuHookUDPServer::Settings::SERVER_ADDRESS)));
|
||||
|
||||
m_server_port = new QSpinBox();
|
||||
m_server_port->setMaximum(65535);
|
||||
m_server_port->setValue(Config::Get(ciface::CemuHookUDPServer::Settings::SERVER_PORT));
|
||||
|
||||
auto* description =
|
||||
new QLabel(tr("UDPServer protocol enables the use of input and motion data from compatible "
|
||||
"sources, like PlayStation, Nintendo Switch and Steam controllers.<br><br>"
|
||||
"For setup instructions, "
|
||||
"<a href=\"https://wiki.dolphin-emu.org/index.php?title=UDPServer\">"
|
||||
"refer to this page</a>."));
|
||||
description->setTextFormat(Qt::RichText);
|
||||
description->setWordWrap(true);
|
||||
description->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
description->setOpenExternalLinks(true);
|
||||
|
||||
main_layout->addWidget(m_server_enabled, 1, 1);
|
||||
main_layout->addWidget(new QLabel(tr("Server IP Address")), 2, 1);
|
||||
main_layout->addWidget(m_server_address, 2, 2);
|
||||
main_layout->addWidget(new QLabel(tr("Server Port")), 3, 1);
|
||||
main_layout->addWidget(m_server_port, 3, 2);
|
||||
main_layout->addWidget(description, 4, 1, 1, 2);
|
||||
|
||||
setLayout(main_layout);
|
||||
}
|
||||
|
||||
void CemuHookUDPServerWidget::ConnectWidgets()
|
||||
{
|
||||
connect(m_server_enabled, &QCheckBox::toggled, this, [this] {
|
||||
Config::SetBaseOrCurrent(ciface::CemuHookUDPServer::Settings::SERVER_ENABLED,
|
||||
m_server_enabled->isChecked());
|
||||
});
|
||||
|
||||
connect(m_server_address, &QLineEdit::editingFinished, this, [this] {
|
||||
Config::SetBaseOrCurrent(ciface::CemuHookUDPServer::Settings::SERVER_ADDRESS,
|
||||
m_server_address->text().toStdString());
|
||||
});
|
||||
|
||||
connect(m_server_port, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
|
||||
[this] {
|
||||
Config::SetBaseOrCurrent(ciface::CemuHookUDPServer::Settings::SERVER_PORT,
|
||||
static_cast<u16>(m_server_port->value()));
|
||||
});
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
// Copyright 2019 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QCheckBox;
|
||||
class QLineEdit;
|
||||
class QSpinBox;
|
||||
|
||||
class CemuHookUDPServerWidget final : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CemuHookUDPServerWidget();
|
||||
|
||||
private:
|
||||
void CreateWidgets();
|
||||
void ConnectWidgets();
|
||||
|
||||
QCheckBox* m_server_enabled;
|
||||
QLineEdit* m_server_address;
|
||||
QSpinBox* m_server_port;
|
||||
};
|
@ -0,0 +1,47 @@
|
||||
// Copyright 2019 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QTabWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#if defined(CIFACE_USE_CEMUHOOKUDPSERVER)
|
||||
#include "DolphinQt/Config/ControllerInterface/CemuHookUDPServerWidget.h"
|
||||
#endif
|
||||
|
||||
ControllerInterfaceWindow::ControllerInterfaceWindow(QWidget* parent) : QDialog(parent)
|
||||
{
|
||||
CreateMainLayout();
|
||||
|
||||
setWindowTitle(tr("Alternate Input Sources"));
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
}
|
||||
|
||||
void ControllerInterfaceWindow::CreateMainLayout()
|
||||
{
|
||||
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
|
||||
m_tab_widget = new QTabWidget();
|
||||
#if defined(CIFACE_USE_CEMUHOOKUDPSERVER)
|
||||
m_udpserver_widget = new CemuHookUDPServerWidget();
|
||||
m_tab_widget->addTab(m_udpserver_widget, tr("UDPServer")); // TODO: use GetWrappedWidget()?
|
||||
#endif
|
||||
|
||||
auto* main_layout = new QVBoxLayout();
|
||||
if (m_tab_widget->count() > 0)
|
||||
{
|
||||
main_layout->addWidget(m_tab_widget);
|
||||
}
|
||||
else
|
||||
{
|
||||
main_layout->addWidget(new QLabel(tr("Nothing to configure")), 0,
|
||||
Qt::AlignVCenter | Qt::AlignHCenter);
|
||||
}
|
||||
main_layout->addWidget(m_button_box);
|
||||
setLayout(main_layout);
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
// Copyright 2019 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||
|
||||
#if defined(CIFACE_USE_CEMUHOOKUDPSERVER)
|
||||
class CemuHookUDPServerWidget;
|
||||
#endif
|
||||
class QTabWidget;
|
||||
class QDialogButtonBox;
|
||||
|
||||
class ControllerInterfaceWindow final : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ControllerInterfaceWindow(QWidget* parent);
|
||||
|
||||
private:
|
||||
void CreateMainLayout();
|
||||
|
||||
QTabWidget* m_tab_widget;
|
||||
QDialogButtonBox* m_button_box;
|
||||
|
||||
#if defined(CIFACE_USE_CEMUHOOKUDPSERVER)
|
||||
CemuHookUDPServerWidget* m_udpserver_widget;
|
||||
#endif
|
||||
};
|
@ -31,6 +31,7 @@
|
||||
#include "Core/IOS/IOS.h"
|
||||
#include "Core/IOS/USB/Bluetooth/BTReal.h"
|
||||
|
||||
#include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h"
|
||||
#include "DolphinQt/Config/Mapping/GCPadWiiUConfigDialog.h"
|
||||
#include "DolphinQt/Config/Mapping/MappingWindow.h"
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
@ -203,10 +204,12 @@ void ControllersWindow::CreateCommonLayout()
|
||||
{
|
||||
// i18n: This is "common" as in "shared", not the opposite of "uncommon"
|
||||
m_common_box = new QGroupBox(tr("Common"));
|
||||
m_common_layout = new QHBoxLayout();
|
||||
m_common_layout = new QVBoxLayout();
|
||||
m_common_bg_input = new QCheckBox(tr("Background Input"));
|
||||
m_common_configure_controller_interface = new QPushButton(tr("Alternate Input Sources"));
|
||||
|
||||
m_common_layout->addWidget(m_common_bg_input);
|
||||
m_common_layout->addWidget(m_common_configure_controller_interface);
|
||||
|
||||
m_common_box->setLayout(m_common_layout);
|
||||
}
|
||||
@ -219,6 +222,7 @@ void ControllersWindow::CreateMainLayout()
|
||||
layout->addWidget(m_gc_box);
|
||||
layout->addWidget(m_wiimote_box);
|
||||
layout->addWidget(m_common_box);
|
||||
layout->addStretch();
|
||||
layout->addWidget(m_button_box);
|
||||
|
||||
WrapInScrollArea(this, layout);
|
||||
@ -234,6 +238,8 @@ void ControllersWindow::ConnectWidgets()
|
||||
&ControllersWindow::OnWiimoteModeChanged);
|
||||
|
||||
connect(m_common_bg_input, &QCheckBox::toggled, this, &ControllersWindow::SaveSettings);
|
||||
connect(m_common_configure_controller_interface, &QPushButton::clicked, this,
|
||||
&ControllersWindow::OnControllerInterfaceConfigure);
|
||||
connect(m_wiimote_continuous_scanning, &QCheckBox::toggled, this,
|
||||
&ControllersWindow::SaveSettings);
|
||||
connect(m_wiimote_real_balance_board, &QCheckBox::toggled, this,
|
||||
@ -463,6 +469,14 @@ void ControllersWindow::OnWiimoteConfigure()
|
||||
window->show();
|
||||
}
|
||||
|
||||
void ControllersWindow::OnControllerInterfaceConfigure()
|
||||
{
|
||||
ControllerInterfaceWindow* window = new ControllerInterfaceWindow(this);
|
||||
window->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
window->setWindowModality(Qt::WindowModality::WindowModal);
|
||||
window->show();
|
||||
}
|
||||
|
||||
void ControllersWindow::LoadSettings()
|
||||
{
|
||||
for (size_t i = 0; i < m_wiimote_groups.size(); i++)
|
||||
|
@ -37,6 +37,7 @@ private:
|
||||
void OnWiimoteRefreshPressed();
|
||||
void OnGCPadConfigure();
|
||||
void OnWiimoteConfigure();
|
||||
void OnControllerInterfaceConfigure();
|
||||
|
||||
void CreateGamecubeLayout();
|
||||
void CreateWiimoteLayout();
|
||||
@ -75,6 +76,7 @@ private:
|
||||
|
||||
// Common
|
||||
QGroupBox* m_common_box;
|
||||
QHBoxLayout* m_common_layout;
|
||||
QVBoxLayout* m_common_layout;
|
||||
QCheckBox* m_common_bg_input;
|
||||
QPushButton* m_common_configure_controller_interface;
|
||||
};
|
||||
|
@ -44,7 +44,7 @@
|
||||
<AdditionalDependencies>avrt.lib;iphlpapi.lib;winmm.lib;setupapi.lib;opengl32.lib;glu32.lib;rpcrt4.lib;comctl32.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;Shlwapi.lib;discord-rpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)VideoInterface;$(ProjectDir)GameList;$(ProjectDir)Debugger;$(ProjectDir)Settings;$(ProjectDir)Config;$(ProjectDir)Config\Mapping;$(ProjectDir)Config\Graphics;$(ProjectDir)NetPlay;$(ProjectDir)QtUtils;$(ProjectDir)TAS;$(ProjectDir)FIFO;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)VideoInterface;$(ProjectDir)GameList;$(ProjectDir)Debugger;$(ProjectDir)Settings;$(ProjectDir)Config;$(ProjectDir)Config\Mapping;$(ProjectDir)Config\Graphics;$(ProjectDir)Config\ControllerInterface;$(ProjectDir)NetPlay;$(ProjectDir)QtUtils;$(ProjectDir)TAS;$(ProjectDir)FIFO;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>DolphinQt.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
@ -106,6 +106,8 @@
|
||||
<QtMoc Include="Config\Graphics\HacksWidget.h" />
|
||||
<QtMoc Include="Config\Graphics\PostProcessingConfigWindow.h" />
|
||||
<QtMoc Include="Config\Graphics\SoftwareRendererWidget.h" />
|
||||
<QtMoc Include="Config\ControllerInterface\CemuHookUDPServerWidget.h" />
|
||||
<QtMoc Include="Config\ControllerInterface\ControllerInterfaceWindow.h" />
|
||||
<QtMoc Include="Config\InfoWidget.h" />
|
||||
<QtMoc Include="Config\PatchesWidget.h" />
|
||||
<QtMoc Include="Config\PropertiesDialog.h" />
|
||||
@ -187,6 +189,8 @@
|
||||
<ClCompile Include="$(QtMocOutPrefix)ChunkedProgressDialog.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)CodeViewWidget.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)CodeWidget.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)CemuHookUDPServerWidget.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)ControllerInterfaceWindow.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)ControllersWindow.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)DiscordHandler.cpp" />
|
||||
<ClCompile Include="$(QtMocOutPrefix)DiscordJoinRequestDialog.cpp" />
|
||||
@ -291,6 +295,8 @@
|
||||
<ClCompile Include="Config\CheatCodeEditor.cpp" />
|
||||
<ClCompile Include="Config\ARCodeWidget.cpp" />
|
||||
<ClCompile Include="Config\CheatWarningWidget.cpp" />
|
||||
<ClCompile Include="Config\ControllerInterface\CemuHookUDPServerWidget.cpp" />
|
||||
<ClCompile Include="Config\ControllerInterface\ControllerInterfaceWindow.cpp" />
|
||||
<ClCompile Include="Config\ControllersWindow.cpp" />
|
||||
<ClCompile Include="Config\FilesystemWidget.cpp" />
|
||||
<ClCompile Include="Config\GameConfigEdit.cpp" />
|
||||
|
Reference in New Issue
Block a user