DolphinQt: Move Free Look out of Graphics/Hotkey and into its own configuration window. Launched from a new menu option - "Free Look Settings". The HotKeyScheduler still calls the Free Look functionality to reduce the total number of threads

This commit is contained in:
iwubcode
2020-06-12 00:27:34 -05:00
parent 9ac6090c9a
commit 9a744ab25b
18 changed files with 323 additions and 93 deletions

View File

@ -0,0 +1,48 @@
// Copyright 2020 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "DolphinQt/Config/Mapping/FreeLookGeneral.h"
#include <QGridLayout>
#include <QGroupBox>
#include "Core/FreeLookManager.h"
#include "InputCommon/InputConfig.h"
FreeLookGeneral::FreeLookGeneral(MappingWindow* window) : MappingWidget(window)
{
CreateMainLayout();
}
void FreeLookGeneral::CreateMainLayout()
{
auto* layout = new QGridLayout;
layout->addWidget(
CreateGroupBox(tr("Move"), FreeLook::GetInputGroup(GetPort(), FreeLookGroup::Move)), 0, 0);
layout->addWidget(
CreateGroupBox(tr("Speed"), FreeLook::GetInputGroup(GetPort(), FreeLookGroup::Speed)), 0, 1);
layout->addWidget(CreateGroupBox(tr("Field of View"),
FreeLook::GetInputGroup(GetPort(), FreeLookGroup::FieldOfView)),
0, 2);
layout->addWidget(
CreateGroupBox(tr("Other"), FreeLook::GetInputGroup(GetPort(), FreeLookGroup::Other)), 0, 3);
setLayout(layout);
}
void FreeLookGeneral::LoadSettings()
{
FreeLook::LoadInputConfig();
}
void FreeLookGeneral::SaveSettings()
{
FreeLook::GetInputConfig()->SaveConfig();
}
InputConfig* FreeLookGeneral::GetConfig()
{
return FreeLook::GetInputConfig();
}

View File

@ -0,0 +1,21 @@
// Copyright 2020 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "DolphinQt/Config/Mapping/MappingWidget.h"
class FreeLookGeneral final : public MappingWidget
{
Q_OBJECT
public:
explicit FreeLookGeneral(MappingWindow* window);
InputConfig* GetConfig() override;
private:
void LoadSettings() override;
void SaveSettings() override;
void CreateMainLayout();
};

View File

@ -18,12 +18,12 @@ void HotkeyGraphics::CreateMainLayout()
{
m_main_layout = new QGridLayout();
m_main_layout->addWidget(
CreateGroupBox(tr("Freelook"), HotkeyManagerEmu::GetHotkeyGroup(HKGP_FREELOOK)), 0, 0, -1, 1);
m_main_layout->addWidget(CreateGroupBox(tr("Graphics Toggles"),
HotkeyManagerEmu::GetHotkeyGroup(HKGP_GRAPHICS_TOGGLES)),
0, 1);
0, 0, -1, 1);
m_main_layout->addWidget(
CreateGroupBox(tr("FreeLook"), HotkeyManagerEmu::GetHotkeyGroup(HKGP_FREELOOK)), 0, 1);
m_main_layout->addWidget(
CreateGroupBox(tr("Internal Resolution"), HotkeyManagerEmu::GetHotkeyGroup(HKGP_IR)), 1, 1);

View File

@ -21,6 +21,7 @@
#include "Common/IniFile.h"
#include "Common/StringUtil.h"
#include "DolphinQt/Config/Mapping/FreeLookGeneral.h"
#include "DolphinQt/Config/Mapping/GCKeyboardEmu.h"
#include "DolphinQt/Config/Mapping/GCMicrophone.h"
#include "DolphinQt/Config/Mapping/GCPadEmu.h"
@ -428,6 +429,13 @@ void MappingWindow::SetMappingType(MappingWindow::Type type)
setWindowTitle(tr("Hotkey Settings"));
break;
}
case Type::MAPPING_FREELOOK:
{
widget = new FreeLookGeneral(this);
AddWidget(tr("General"), widget);
setWindowTitle(tr("Free Look Controller %1").arg(GetPort() + 1));
}
break;
default:
return;
}

View File

@ -42,7 +42,9 @@ public:
// Wii
MAPPING_WIIMOTE_EMU,
// Hotkeys
MAPPING_HOTKEYS
MAPPING_HOTKEYS,
// Freelook
MAPPING_FREELOOK,
};
explicit MappingWindow(QWidget* parent, Type type, int port_num);