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