| 1 | // Copyright 2019 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h" |
| 5 | |
| 6 | #include <QDialogButtonBox> |
| 7 | #include <QLabel> |
| 8 | #include <QTabWidget> |
| 9 | #include <QVBoxLayout> |
| 10 | |
| 11 | #if defined(CIFACE_USE_DUALSHOCKUDPCLIENT) |
| 12 | #include "DolphinQt/Config/ControllerInterface/DualShockUDPClientWidget.h" |
| 13 | #endif |
| 14 | |
| 15 | ControllerInterfaceWindow::ControllerInterfaceWindow(QWidget* parent) : QDialog(parent) |
| 16 | { |
| 17 | CreateMainLayout(); |
| 18 | |
| 19 | setWindowTitle(tr("Alternate Input Sources")); |
| 20 | } |
| 21 | |
| 22 | void ControllerInterfaceWindow::CreateMainLayout() |
| 23 | { |
| 24 | m_button_box = new QDialogButtonBox(QDialogButtonBox::Close); |
| 25 | connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject); |
| 26 | |
| 27 | m_tab_widget = new QTabWidget(); |
| 28 | #if defined(CIFACE_USE_DUALSHOCKUDPCLIENT) |
| 29 | m_dsuclient_widget = new DualShockUDPClientWidget(); |
| 30 | m_tab_widget->addTab(m_dsuclient_widget, tr("DSU Client")); // TODO: use GetWrappedWidget()? |
| 31 | #endif |
| 32 | |
| 33 | auto* main_layout = new QVBoxLayout(); |
| 34 | if (m_tab_widget->count() > 0) |
| 35 | { |
| 36 | main_layout->addWidget(m_tab_widget); |
| 37 | } |
| 38 | else |
| 39 | { |
| 40 | main_layout->addWidget(new QLabel(tr("Nothing to configure")), 0, |
| 41 | Qt::AlignVCenter | Qt::AlignHCenter); |
| 42 | } |
| 43 | main_layout->addWidget(m_button_box); |
| 44 | setLayout(main_layout); |
| 45 | } |