2017-05-09 16:49:10 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-05-09 16:49:10 +00:00
|
|
|
|
2018-07-06 22:40:15 +00:00
|
|
|
#include "DolphinQt/Config/ControllersWindow.h"
|
2018-05-28 01:11:27 +00:00
|
|
|
|
2017-05-09 16:49:10 +00:00
|
|
|
#include <QDialogButtonBox>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
2021-01-23 18:16:56 +00:00
|
|
|
#include "DolphinQt/Config/CommonControllersWidget.h"
|
2021-01-23 18:44:21 +00:00
|
|
|
#include "DolphinQt/Config/GamecubeControllersWidget.h"
|
2021-01-23 19:05:04 +00:00
|
|
|
#include "DolphinQt/Config/WiimoteControllersWidget.h"
|
2018-07-06 22:40:15 +00:00
|
|
|
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
2017-05-09 16:49:10 +00:00
|
|
|
|
2017-05-27 02:49:20 +00:00
|
|
|
ControllersWindow::ControllersWindow(QWidget* parent) : QDialog(parent)
|
2017-05-09 16:49:10 +00:00
|
|
|
{
|
|
|
|
setWindowTitle(tr("Controller Settings"));
|
2017-06-30 00:52:53 +00:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2017-05-09 16:49:10 +00:00
|
|
|
|
2021-01-23 18:44:21 +00:00
|
|
|
m_gamecube_controllers = new GamecubeControllersWidget(this);
|
2021-01-23 19:05:04 +00:00
|
|
|
m_wiimote_controllers = new WiimoteControllersWidget(this);
|
2021-01-23 18:16:56 +00:00
|
|
|
m_common = new CommonControllersWidget(this);
|
2017-05-09 16:49:10 +00:00
|
|
|
CreateMainLayout();
|
|
|
|
ConnectWidgets();
|
|
|
|
}
|
|
|
|
|
2023-02-23 04:10:23 +00:00
|
|
|
void ControllersWindow::showEvent(QShowEvent* event)
|
|
|
|
{
|
|
|
|
QDialog::showEvent(event);
|
|
|
|
m_wiimote_controllers->UpdateBluetoothAvailableStatus();
|
|
|
|
}
|
|
|
|
|
2017-05-09 16:49:10 +00:00
|
|
|
void ControllersWindow::CreateMainLayout()
|
|
|
|
{
|
2018-03-17 15:07:51 +00:00
|
|
|
auto* layout = new QVBoxLayout();
|
2018-03-20 09:12:11 +00:00
|
|
|
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
|
2017-05-09 16:49:10 +00:00
|
|
|
|
2021-01-23 18:44:21 +00:00
|
|
|
layout->addWidget(m_gamecube_controllers);
|
2021-01-23 19:05:04 +00:00
|
|
|
layout->addWidget(m_wiimote_controllers);
|
2021-01-23 18:16:56 +00:00
|
|
|
layout->addWidget(m_common);
|
2019-10-22 23:49:48 +00:00
|
|
|
layout->addStretch();
|
2018-03-17 15:07:51 +00:00
|
|
|
layout->addWidget(m_button_box);
|
2017-05-09 16:49:10 +00:00
|
|
|
|
2018-03-17 15:07:51 +00:00
|
|
|
WrapInScrollArea(this, layout);
|
2017-05-09 16:49:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ControllersWindow::ConnectWidgets()
|
|
|
|
{
|
2018-03-20 09:12:11 +00:00
|
|
|
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
2017-05-09 16:49:10 +00:00
|
|
|
}
|