mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-16 04:07:51 +00:00
DolphinQt: Move "Controllers" to main settings window.
This commit is contained in:
parent
8665b22822
commit
b9bea58f0f
@ -69,8 +69,8 @@ add_executable(dolphin-emu
|
||||
Config/ControllerInterface/DualShockUDPClientWidget.h
|
||||
Config/ControllerInterface/ServerStringValidator.cpp
|
||||
Config/ControllerInterface/ServerStringValidator.h
|
||||
Config/ControllersWindow.cpp
|
||||
Config/ControllersWindow.h
|
||||
Config/ControllersPane.cpp
|
||||
Config/ControllersPane.h
|
||||
Config/FilesystemWidget.cpp
|
||||
Config/FilesystemWidget.h
|
||||
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 <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);
|
||||
};
|
||||
|
@ -68,7 +68,7 @@
|
||||
<ClCompile Include="Config\ControllerInterface\DualShockUDPClientAddServerDialog.cpp" />
|
||||
<ClCompile Include="Config\ControllerInterface\DualShockUDPClientWidget.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\FreeLookWidget.cpp" />
|
||||
<ClCompile Include="Config\FreeLookWindow.cpp" />
|
||||
@ -293,7 +293,7 @@
|
||||
<QtMoc Include="Config\ControllerInterface\DualShockUDPClientAddServerDialog.h" />
|
||||
<QtMoc Include="Config\ControllerInterface\DualShockUDPClientWidget.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\FreeLookWidget.h" />
|
||||
<QtMoc Include="Config\FreeLookWindow.h" />
|
||||
|
@ -77,7 +77,6 @@
|
||||
#include "DolphinQt/AboutDialog.h"
|
||||
#include "DolphinQt/Achievements/AchievementsWindow.h"
|
||||
#include "DolphinQt/CheatsManager.h"
|
||||
#include "DolphinQt/Config/ControllersWindow.h"
|
||||
#include "DolphinQt/Config/FreeLookWindow.h"
|
||||
#include "DolphinQt/Config/Graphics/GraphicsWindow.h"
|
||||
#include "DolphinQt/Config/LogConfigWidget.h"
|
||||
@ -1283,16 +1282,8 @@ void MainWindow::HideRenderWidget(bool reinit, bool is_exit)
|
||||
|
||||
void MainWindow::ShowControllersWindow()
|
||||
{
|
||||
if (!m_controllers_window)
|
||||
{
|
||||
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();
|
||||
ShowSettingsWindow();
|
||||
m_settings_window->SelectPane(SettingsWindowPaneIndex::Controllers);
|
||||
}
|
||||
|
||||
void MainWindow::ShowFreeLookWindow()
|
||||
@ -1331,13 +1322,13 @@ void MainWindow::ShowSettingsWindow()
|
||||
void MainWindow::ShowAudioWindow()
|
||||
{
|
||||
ShowSettingsWindow();
|
||||
m_settings_window->SelectAudioPane();
|
||||
m_settings_window->SelectPane(SettingsWindowPaneIndex::Audio);
|
||||
}
|
||||
|
||||
void MainWindow::ShowGeneralWindow()
|
||||
{
|
||||
ShowSettingsWindow();
|
||||
m_settings_window->SelectGeneralPane();
|
||||
m_settings_window->SelectPane(SettingsWindowPaneIndex::General);
|
||||
}
|
||||
|
||||
void MainWindow::ShowAboutDialog()
|
||||
|
@ -27,7 +27,6 @@ class BreakpointWidget;
|
||||
struct BootParameters;
|
||||
class CheatsManager;
|
||||
class CodeWidget;
|
||||
class ControllersWindow;
|
||||
class DiscordHandler;
|
||||
class DragEnterEvent;
|
||||
class FIFOPlayerWindow;
|
||||
@ -246,7 +245,6 @@ private:
|
||||
u32 m_state_slot = 1;
|
||||
std::unique_ptr<BootParameters> m_pending_boot;
|
||||
|
||||
ControllersWindow* m_controllers_window = nullptr;
|
||||
SettingsWindow* m_settings_window = nullptr;
|
||||
GraphicsWindow* m_graphics_window = nullptr;
|
||||
FIFOPlayerWindow* m_fifo_window = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user