mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
Merge pull request #13730 from jordan-woyak/controllers-on-main-config-dialog
DolphinQt: Move "Controllers" to main settings window.
This commit is contained in:
35
Source/Core/DolphinQt/Config/ControllersPane.cpp
Normal file
35
Source/Core/DolphinQt/Config/ControllersPane.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright 2025 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "DolphinQt/Config/ControllersPane.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "DolphinQt/Config/CommonControllersWidget.h"
|
||||
#include "DolphinQt/Config/GamecubeControllersWidget.h"
|
||||
#include "DolphinQt/Config/WiimoteControllersWidget.h"
|
||||
|
||||
ControllersPane::ControllersPane()
|
||||
{
|
||||
CreateMainLayout();
|
||||
}
|
||||
|
||||
void ControllersPane::showEvent(QShowEvent* event)
|
||||
{
|
||||
QWidget::showEvent(event);
|
||||
|
||||
m_wiimote_controllers->UpdateBluetoothAvailableStatus();
|
||||
}
|
||||
|
||||
void ControllersPane::CreateMainLayout()
|
||||
{
|
||||
auto* const layout = new QVBoxLayout{this};
|
||||
|
||||
auto* const gamecube_controllers = new GamecubeControllersWidget(this);
|
||||
m_wiimote_controllers = new WiimoteControllersWidget(this);
|
||||
auto* const common = new CommonControllersWidget(this);
|
||||
|
||||
layout->addWidget(gamecube_controllers);
|
||||
layout->addWidget(m_wiimote_controllers);
|
||||
layout->addWidget(common);
|
||||
}
|
23
Source/Core/DolphinQt/Config/ControllersPane.h
Normal file
23
Source/Core/DolphinQt/Config/ControllersPane.h
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright 2025 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class WiimoteControllersWidget;
|
||||
|
||||
class ControllersPane final : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ControllersPane();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
private:
|
||||
void CreateMainLayout();
|
||||
|
||||
WiimoteControllersWidget* m_wiimote_controllers;
|
||||
};
|
@ -1,51 +0,0 @@
|
||||
// Copyright 2017 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "DolphinQt/Config/ControllersWindow.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "DolphinQt/Config/CommonControllersWidget.h"
|
||||
#include "DolphinQt/Config/GamecubeControllersWidget.h"
|
||||
#include "DolphinQt/Config/WiimoteControllersWidget.h"
|
||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
|
||||
ControllersWindow::ControllersWindow(QWidget* parent) : QDialog(parent)
|
||||
{
|
||||
setWindowTitle(tr("Controller Settings"));
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
m_gamecube_controllers = new GamecubeControllersWidget(this);
|
||||
m_wiimote_controllers = new WiimoteControllersWidget(this);
|
||||
m_common = new CommonControllersWidget(this);
|
||||
CreateMainLayout();
|
||||
ConnectWidgets();
|
||||
}
|
||||
|
||||
void ControllersWindow::showEvent(QShowEvent* event)
|
||||
{
|
||||
QDialog::showEvent(event);
|
||||
m_wiimote_controllers->UpdateBluetoothAvailableStatus();
|
||||
}
|
||||
|
||||
void ControllersWindow::CreateMainLayout()
|
||||
{
|
||||
auto* layout = new QVBoxLayout();
|
||||
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||
|
||||
layout->addWidget(m_gamecube_controllers);
|
||||
layout->addWidget(m_wiimote_controllers);
|
||||
layout->addWidget(m_common);
|
||||
layout->addStretch();
|
||||
layout->addWidget(m_button_box);
|
||||
|
||||
WrapInScrollArea(this, layout);
|
||||
QtUtils::AdjustSizeWithinScreen(this);
|
||||
}
|
||||
|
||||
void ControllersWindow::ConnectWidgets()
|
||||
{
|
||||
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
// Copyright 2017 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class CommonControllersWidget;
|
||||
class GamecubeControllersWidget;
|
||||
class QDialogButtonBox;
|
||||
class QShowEvent;
|
||||
class WiimoteControllersWidget;
|
||||
|
||||
class ControllersWindow final : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ControllersWindow(QWidget* parent);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent* event) override;
|
||||
|
||||
private:
|
||||
void CreateMainLayout();
|
||||
void ConnectWidgets();
|
||||
|
||||
QDialogButtonBox* m_button_box;
|
||||
GamecubeControllersWidget* m_gamecube_controllers;
|
||||
WiimoteControllersWidget* m_wiimote_controllers;
|
||||
CommonControllersWidget* m_common;
|
||||
};
|
@ -9,6 +9,9 @@
|
||||
#include <QStackedWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Common/EnumUtils.h"
|
||||
|
||||
#include "DolphinQt/Config/ControllersPane.h"
|
||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
#include "DolphinQt/Settings/AdvancedPane.h"
|
||||
@ -133,7 +136,9 @@ SettingsWindow::SettingsWindow(QWidget* parent) : StackedSettingsWindow{parent}
|
||||
{
|
||||
setWindowTitle(tr("Settings"));
|
||||
|
||||
// If you change the order, don't forget to update the SettingsWindowPaneIndex enum.
|
||||
AddWrappedPane(new GeneralPane, tr("General"));
|
||||
AddWrappedPane(new ControllersPane, tr("Controllers"));
|
||||
AddWrappedPane(new InterfacePane, tr("Interface"));
|
||||
AddWrappedPane(new AudioPane, tr("Audio"));
|
||||
AddWrappedPane(new PathPane, tr("Paths"));
|
||||
@ -144,12 +149,7 @@ SettingsWindow::SettingsWindow(QWidget* parent) : StackedSettingsWindow{parent}
|
||||
OnDoneCreatingPanes();
|
||||
}
|
||||
|
||||
void SettingsWindow::SelectAudioPane()
|
||||
void SettingsWindow::SelectPane(SettingsWindowPaneIndex index)
|
||||
{
|
||||
ActivatePane(static_cast<int>(TabIndex::Audio));
|
||||
}
|
||||
|
||||
void SettingsWindow::SelectGeneralPane()
|
||||
{
|
||||
ActivatePane(static_cast<int>(TabIndex::General));
|
||||
ActivatePane(Common::ToUnderlying(index));
|
||||
}
|
||||
|
@ -31,10 +31,16 @@ private:
|
||||
QListWidget* m_navigation_list;
|
||||
};
|
||||
|
||||
enum class TabIndex
|
||||
enum class SettingsWindowPaneIndex : int
|
||||
{
|
||||
General = 0,
|
||||
Audio = 2
|
||||
Controllers,
|
||||
Interface,
|
||||
Audio,
|
||||
Paths,
|
||||
GameCube,
|
||||
Wii,
|
||||
Advanced,
|
||||
};
|
||||
|
||||
class SettingsWindow final : public StackedSettingsWindow
|
||||
@ -43,6 +49,5 @@ class SettingsWindow final : public StackedSettingsWindow
|
||||
public:
|
||||
explicit SettingsWindow(QWidget* parent = nullptr);
|
||||
|
||||
void SelectGeneralPane();
|
||||
void SelectAudioPane();
|
||||
void SelectPane(SettingsWindowPaneIndex);
|
||||
};
|
||||
|
Reference in New Issue
Block a user