mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-09 22:18:58 +01:00
DolphinQt: Add separate Free Look tab for rotation
This commit is contained in:
parent
d53ab32506
commit
ddba5a3dfa
@ -122,6 +122,8 @@ add_executable(dolphin-emu
|
||||
Config/LogWidget.h
|
||||
Config/Mapping/FreeLookGeneral.cpp
|
||||
Config/Mapping/FreeLookGeneral.h
|
||||
Config/Mapping/FreeLookRotation.cpp
|
||||
Config/Mapping/FreeLookRotation.h
|
||||
Config/Mapping/GCKeyboardEmu.cpp
|
||||
Config/Mapping/GCKeyboardEmu.h
|
||||
Config/Mapping/GCMicrophone.cpp
|
||||
|
62
Source/Core/DolphinQt/Config/Mapping/FreeLookRotation.cpp
Normal file
62
Source/Core/DolphinQt/Config/Mapping/FreeLookRotation.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
// Copyright 2021 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "DolphinQt/Config/Mapping/FreeLookRotation.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "Core/FreeLookManager.h"
|
||||
#include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h"
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
||||
FreeLookRotation::FreeLookRotation(MappingWindow* window) : MappingWidget(window)
|
||||
{
|
||||
CreateMainLayout();
|
||||
}
|
||||
|
||||
void FreeLookRotation::CreateMainLayout()
|
||||
{
|
||||
m_main_layout = new QGridLayout;
|
||||
|
||||
auto* alternate_input_layout = new QHBoxLayout();
|
||||
auto* note_label = new QLabel(
|
||||
tr("Note: motion input may require configuring alternate input sources before use."));
|
||||
note_label->setWordWrap(true);
|
||||
auto* alternate_input_sources_button = new QPushButton(tr("Alternate Input Sources"));
|
||||
alternate_input_layout->addWidget(note_label, 1);
|
||||
alternate_input_layout->addWidget(alternate_input_sources_button, 0, Qt::AlignRight);
|
||||
connect(alternate_input_sources_button, &QPushButton::clicked, this, [this] {
|
||||
ControllerInterfaceWindow* window = new ControllerInterfaceWindow(this);
|
||||
window->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
window->setWindowModality(Qt::WindowModality::WindowModal);
|
||||
window->show();
|
||||
});
|
||||
m_main_layout->addLayout(alternate_input_layout, 0, 0, 1, -1);
|
||||
|
||||
m_main_layout->addWidget(
|
||||
CreateGroupBox(tr("Incremental Rotation (rad/sec)"),
|
||||
FreeLook::GetInputGroup(GetPort(), FreeLookGroup::Rotation)),
|
||||
1, 0);
|
||||
|
||||
setLayout(m_main_layout);
|
||||
}
|
||||
|
||||
InputConfig* FreeLookRotation::GetConfig()
|
||||
{
|
||||
return FreeLook::GetInputConfig();
|
||||
}
|
||||
|
||||
void FreeLookRotation::LoadSettings()
|
||||
{
|
||||
FreeLook::LoadInputConfig();
|
||||
}
|
||||
|
||||
void FreeLookRotation::SaveSettings()
|
||||
{
|
||||
FreeLook::GetInputConfig()->SaveConfig();
|
||||
}
|
26
Source/Core/DolphinQt/Config/Mapping/FreeLookRotation.h
Normal file
26
Source/Core/DolphinQt/Config/Mapping/FreeLookRotation.h
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright 2021 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DolphinQt/Config/Mapping/MappingWidget.h"
|
||||
|
||||
class QGridLayout;
|
||||
|
||||
class FreeLookRotation final : public MappingWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FreeLookRotation(MappingWindow* window);
|
||||
|
||||
InputConfig* GetConfig() override;
|
||||
|
||||
private:
|
||||
void LoadSettings() override;
|
||||
void SaveSettings() override;
|
||||
void CreateMainLayout();
|
||||
|
||||
// Main
|
||||
QGridLayout* m_main_layout;
|
||||
};
|
@ -23,6 +23,7 @@
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "DolphinQt/Config/Mapping/FreeLookGeneral.h"
|
||||
#include "DolphinQt/Config/Mapping/FreeLookRotation.h"
|
||||
#include "DolphinQt/Config/Mapping/GCKeyboardEmu.h"
|
||||
#include "DolphinQt/Config/Mapping/GCMicrophone.h"
|
||||
#include "DolphinQt/Config/Mapping/GCPadEmu.h"
|
||||
@ -436,6 +437,7 @@ void MappingWindow::SetMappingType(MappingWindow::Type type)
|
||||
{
|
||||
widget = new FreeLookGeneral(this);
|
||||
AddWidget(tr("General"), widget);
|
||||
AddWidget(tr("Rotation"), new FreeLookRotation(this));
|
||||
setWindowTitle(tr("Free Look Controller %1").arg(GetPort() + 1));
|
||||
}
|
||||
break;
|
||||
|
@ -80,6 +80,7 @@
|
||||
<ClCompile Include="Config\LogConfigWidget.cpp" />
|
||||
<ClCompile Include="Config\LogWidget.cpp" />
|
||||
<ClCompile Include="Config\Mapping\FreeLookGeneral.cpp" />
|
||||
<ClCompile Include="Config\Mapping\FreeLookRotation.cpp" />
|
||||
<ClCompile Include="Config\Mapping\GCKeyboardEmu.cpp" />
|
||||
<ClCompile Include="Config\Mapping\GCMicrophone.cpp" />
|
||||
<ClCompile Include="Config\Mapping\GCPadEmu.cpp" />
|
||||
@ -254,6 +255,7 @@
|
||||
<QtMoc Include="Config\LogConfigWidget.h" />
|
||||
<QtMoc Include="Config\LogWidget.h" />
|
||||
<QtMoc Include="Config\Mapping\FreeLookGeneral.h" />
|
||||
<QtMoc Include="Config\Mapping\FreeLookRotation.h" />
|
||||
<QtMoc Include="Config\Mapping\GCKeyboardEmu.h" />
|
||||
<QtMoc Include="Config\Mapping\GCMicrophone.h" />
|
||||
<QtMoc Include="Config\Mapping\GCPadEmu.h" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user