mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-28 01:49:33 -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:
@ -69,8 +69,8 @@ add_executable(dolphin-emu
|
|||||||
Config/ControllerInterface/DualShockUDPClientWidget.h
|
Config/ControllerInterface/DualShockUDPClientWidget.h
|
||||||
Config/ControllerInterface/ServerStringValidator.cpp
|
Config/ControllerInterface/ServerStringValidator.cpp
|
||||||
Config/ControllerInterface/ServerStringValidator.h
|
Config/ControllerInterface/ServerStringValidator.h
|
||||||
Config/ControllersWindow.cpp
|
Config/ControllersPane.cpp
|
||||||
Config/ControllersWindow.h
|
Config/ControllersPane.h
|
||||||
Config/FilesystemWidget.cpp
|
Config/FilesystemWidget.cpp
|
||||||
Config/FilesystemWidget.h
|
Config/FilesystemWidget.h
|
||||||
Config/FreeLookWidget.cpp
|
Config/FreeLookWidget.cpp
|
||||||
|
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 <QStackedWidget>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
#include "Common/EnumUtils.h"
|
||||||
|
|
||||||
|
#include "DolphinQt/Config/ControllersPane.h"
|
||||||
#include "DolphinQt/QtUtils/QtUtils.h"
|
#include "DolphinQt/QtUtils/QtUtils.h"
|
||||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||||
#include "DolphinQt/Settings/AdvancedPane.h"
|
#include "DolphinQt/Settings/AdvancedPane.h"
|
||||||
@ -133,7 +136,9 @@ SettingsWindow::SettingsWindow(QWidget* parent) : StackedSettingsWindow{parent}
|
|||||||
{
|
{
|
||||||
setWindowTitle(tr("Settings"));
|
setWindowTitle(tr("Settings"));
|
||||||
|
|
||||||
|
// If you change the order, don't forget to update the SettingsWindowPaneIndex enum.
|
||||||
AddWrappedPane(new GeneralPane, tr("General"));
|
AddWrappedPane(new GeneralPane, tr("General"));
|
||||||
|
AddWrappedPane(new ControllersPane, tr("Controllers"));
|
||||||
AddWrappedPane(new InterfacePane, tr("Interface"));
|
AddWrappedPane(new InterfacePane, tr("Interface"));
|
||||||
AddWrappedPane(new AudioPane, tr("Audio"));
|
AddWrappedPane(new AudioPane, tr("Audio"));
|
||||||
AddWrappedPane(new PathPane, tr("Paths"));
|
AddWrappedPane(new PathPane, tr("Paths"));
|
||||||
@ -144,12 +149,7 @@ SettingsWindow::SettingsWindow(QWidget* parent) : StackedSettingsWindow{parent}
|
|||||||
OnDoneCreatingPanes();
|
OnDoneCreatingPanes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsWindow::SelectAudioPane()
|
void SettingsWindow::SelectPane(SettingsWindowPaneIndex index)
|
||||||
{
|
{
|
||||||
ActivatePane(static_cast<int>(TabIndex::Audio));
|
ActivatePane(Common::ToUnderlying(index));
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsWindow::SelectGeneralPane()
|
|
||||||
{
|
|
||||||
ActivatePane(static_cast<int>(TabIndex::General));
|
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,16 @@ private:
|
|||||||
QListWidget* m_navigation_list;
|
QListWidget* m_navigation_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class TabIndex
|
enum class SettingsWindowPaneIndex : int
|
||||||
{
|
{
|
||||||
General = 0,
|
General = 0,
|
||||||
Audio = 2
|
Controllers,
|
||||||
|
Interface,
|
||||||
|
Audio,
|
||||||
|
Paths,
|
||||||
|
GameCube,
|
||||||
|
Wii,
|
||||||
|
Advanced,
|
||||||
};
|
};
|
||||||
|
|
||||||
class SettingsWindow final : public StackedSettingsWindow
|
class SettingsWindow final : public StackedSettingsWindow
|
||||||
@ -43,6 +49,5 @@ class SettingsWindow final : public StackedSettingsWindow
|
|||||||
public:
|
public:
|
||||||
explicit SettingsWindow(QWidget* parent = nullptr);
|
explicit SettingsWindow(QWidget* parent = nullptr);
|
||||||
|
|
||||||
void SelectGeneralPane();
|
void SelectPane(SettingsWindowPaneIndex);
|
||||||
void SelectAudioPane();
|
|
||||||
};
|
};
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
<ClCompile Include="Config\ControllerInterface\DualShockUDPClientAddServerDialog.cpp" />
|
<ClCompile Include="Config\ControllerInterface\DualShockUDPClientAddServerDialog.cpp" />
|
||||||
<ClCompile Include="Config\ControllerInterface\DualShockUDPClientWidget.cpp" />
|
<ClCompile Include="Config\ControllerInterface\DualShockUDPClientWidget.cpp" />
|
||||||
<ClCompile Include="Config\ControllerInterface\ServerStringValidator.cpp" />
|
<ClCompile Include="Config\ControllerInterface\ServerStringValidator.cpp" />
|
||||||
<ClCompile Include="Config\ControllersWindow.cpp" />
|
<ClCompile Include="Config\ControllersPane.cpp" />
|
||||||
<ClCompile Include="Config\FilesystemWidget.cpp" />
|
<ClCompile Include="Config\FilesystemWidget.cpp" />
|
||||||
<ClCompile Include="Config\FreeLookWidget.cpp" />
|
<ClCompile Include="Config\FreeLookWidget.cpp" />
|
||||||
<ClCompile Include="Config\FreeLookWindow.cpp" />
|
<ClCompile Include="Config\FreeLookWindow.cpp" />
|
||||||
@ -293,7 +293,7 @@
|
|||||||
<QtMoc Include="Config\ControllerInterface\DualShockUDPClientAddServerDialog.h" />
|
<QtMoc Include="Config\ControllerInterface\DualShockUDPClientAddServerDialog.h" />
|
||||||
<QtMoc Include="Config\ControllerInterface\DualShockUDPClientWidget.h" />
|
<QtMoc Include="Config\ControllerInterface\DualShockUDPClientWidget.h" />
|
||||||
<QtMoc Include="Config\ControllerInterface\ServerStringValidator.h" />
|
<QtMoc Include="Config\ControllerInterface\ServerStringValidator.h" />
|
||||||
<QtMoc Include="Config\ControllersWindow.h" />
|
<QtMoc Include="Config\ControllersPane.h" />
|
||||||
<QtMoc Include="Config\FilesystemWidget.h" />
|
<QtMoc Include="Config\FilesystemWidget.h" />
|
||||||
<QtMoc Include="Config\FreeLookWidget.h" />
|
<QtMoc Include="Config\FreeLookWidget.h" />
|
||||||
<QtMoc Include="Config\FreeLookWindow.h" />
|
<QtMoc Include="Config\FreeLookWindow.h" />
|
||||||
|
@ -77,7 +77,6 @@
|
|||||||
#include "DolphinQt/AboutDialog.h"
|
#include "DolphinQt/AboutDialog.h"
|
||||||
#include "DolphinQt/Achievements/AchievementsWindow.h"
|
#include "DolphinQt/Achievements/AchievementsWindow.h"
|
||||||
#include "DolphinQt/CheatsManager.h"
|
#include "DolphinQt/CheatsManager.h"
|
||||||
#include "DolphinQt/Config/ControllersWindow.h"
|
|
||||||
#include "DolphinQt/Config/FreeLookWindow.h"
|
#include "DolphinQt/Config/FreeLookWindow.h"
|
||||||
#include "DolphinQt/Config/Graphics/GraphicsWindow.h"
|
#include "DolphinQt/Config/Graphics/GraphicsWindow.h"
|
||||||
#include "DolphinQt/Config/LogConfigWidget.h"
|
#include "DolphinQt/Config/LogConfigWidget.h"
|
||||||
@ -1283,16 +1282,8 @@ void MainWindow::HideRenderWidget(bool reinit, bool is_exit)
|
|||||||
|
|
||||||
void MainWindow::ShowControllersWindow()
|
void MainWindow::ShowControllersWindow()
|
||||||
{
|
{
|
||||||
if (!m_controllers_window)
|
ShowSettingsWindow();
|
||||||
{
|
m_settings_window->SelectPane(SettingsWindowPaneIndex::Controllers);
|
||||||
m_controllers_window = new ControllersWindow(this);
|
|
||||||
InstallHotkeyFilter(m_controllers_window);
|
|
||||||
}
|
|
||||||
|
|
||||||
SetQWidgetWindowDecorations(m_controllers_window);
|
|
||||||
m_controllers_window->show();
|
|
||||||
m_controllers_window->raise();
|
|
||||||
m_controllers_window->activateWindow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ShowFreeLookWindow()
|
void MainWindow::ShowFreeLookWindow()
|
||||||
@ -1331,13 +1322,13 @@ void MainWindow::ShowSettingsWindow()
|
|||||||
void MainWindow::ShowAudioWindow()
|
void MainWindow::ShowAudioWindow()
|
||||||
{
|
{
|
||||||
ShowSettingsWindow();
|
ShowSettingsWindow();
|
||||||
m_settings_window->SelectAudioPane();
|
m_settings_window->SelectPane(SettingsWindowPaneIndex::Audio);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ShowGeneralWindow()
|
void MainWindow::ShowGeneralWindow()
|
||||||
{
|
{
|
||||||
ShowSettingsWindow();
|
ShowSettingsWindow();
|
||||||
m_settings_window->SelectGeneralPane();
|
m_settings_window->SelectPane(SettingsWindowPaneIndex::General);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ShowAboutDialog()
|
void MainWindow::ShowAboutDialog()
|
||||||
|
@ -27,7 +27,6 @@ class BreakpointWidget;
|
|||||||
struct BootParameters;
|
struct BootParameters;
|
||||||
class CheatsManager;
|
class CheatsManager;
|
||||||
class CodeWidget;
|
class CodeWidget;
|
||||||
class ControllersWindow;
|
|
||||||
class DiscordHandler;
|
class DiscordHandler;
|
||||||
class DragEnterEvent;
|
class DragEnterEvent;
|
||||||
class FIFOPlayerWindow;
|
class FIFOPlayerWindow;
|
||||||
@ -246,7 +245,6 @@ private:
|
|||||||
u32 m_state_slot = 1;
|
u32 m_state_slot = 1;
|
||||||
std::unique_ptr<BootParameters> m_pending_boot;
|
std::unique_ptr<BootParameters> m_pending_boot;
|
||||||
|
|
||||||
ControllersWindow* m_controllers_window = nullptr;
|
|
||||||
SettingsWindow* m_settings_window = nullptr;
|
SettingsWindow* m_settings_window = nullptr;
|
||||||
GraphicsWindow* m_graphics_window = nullptr;
|
GraphicsWindow* m_graphics_window = nullptr;
|
||||||
FIFOPlayerWindow* m_fifo_window = nullptr;
|
FIFOPlayerWindow* m_fifo_window = nullptr;
|
||||||
|
Reference in New Issue
Block a user