From 9c26a1a458b3c291061c0f4671fcf253b1611134 Mon Sep 17 00:00:00 2001 From: spycrab Date: Sun, 3 Jun 2018 12:41:58 +0200 Subject: [PATCH] Qt/Hotkeys: Implement missing "Other State Management" tab --- Source/Core/DolphinQt2/CMakeLists.txt | 1 + .../Config/Mapping/HotkeyStatesOther.cpp | 44 +++++++++++++++++++ .../Config/Mapping/HotkeyStatesOther.h | 23 ++++++++++ .../Config/Mapping/MappingWindow.cpp | 2 + Source/Core/DolphinQt2/DolphinQt2.vcxproj | 3 ++ 5 files changed, 73 insertions(+) create mode 100644 Source/Core/DolphinQt2/Config/Mapping/HotkeyStatesOther.cpp create mode 100644 Source/Core/DolphinQt2/Config/Mapping/HotkeyStatesOther.h diff --git a/Source/Core/DolphinQt2/CMakeLists.txt b/Source/Core/DolphinQt2/CMakeLists.txt index 16eaadb2d7..e78fe5f628 100644 --- a/Source/Core/DolphinQt2/CMakeLists.txt +++ b/Source/Core/DolphinQt2/CMakeLists.txt @@ -54,6 +54,7 @@ add_executable(dolphin-emu Config/Mapping/HotkeyGeneral.cpp Config/Mapping/HotkeyGraphics.cpp Config/Mapping/HotkeyStates.cpp + Config/Mapping/HotkeyStatesOther.cpp Config/Mapping/HotkeyTAS.cpp Config/Mapping/HotkeyWii.cpp Config/Mapping/IOWindow.cpp diff --git a/Source/Core/DolphinQt2/Config/Mapping/HotkeyStatesOther.cpp b/Source/Core/DolphinQt2/Config/Mapping/HotkeyStatesOther.cpp new file mode 100644 index 0000000000..bbb1159893 --- /dev/null +++ b/Source/Core/DolphinQt2/Config/Mapping/HotkeyStatesOther.cpp @@ -0,0 +1,44 @@ +// Copyright 2018 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "DolphinQt2/Config/Mapping/HotkeyStatesOther.h" + +#include +#include + +#include "Core/HotkeyManager.h" + +HotkeyStatesOther::HotkeyStatesOther(MappingWindow* window) : MappingWidget(window) +{ + CreateMainLayout(); +} + +void HotkeyStatesOther::CreateMainLayout() +{ + auto* layout = new QHBoxLayout; + + layout->addWidget( + CreateGroupBox(tr("Select Last State"), HotkeyManagerEmu::GetHotkeyGroup(HKGP_SELECT_STATE))); + layout->addWidget(CreateGroupBox(tr("Load Last State"), + HotkeyManagerEmu::GetHotkeyGroup(HKGP_LOAD_LAST_STATE))); + layout->addWidget( + CreateGroupBox(tr("Other State Hotkeys"), HotkeyManagerEmu::GetHotkeyGroup(HKGP_STATE_MISC))); + + setLayout(layout); +} + +InputConfig* HotkeyStatesOther::GetConfig() +{ + return HotkeyManagerEmu::GetConfig(); +} + +void HotkeyStatesOther::LoadSettings() +{ + HotkeyManagerEmu::LoadConfig(); +} + +void HotkeyStatesOther::SaveSettings() +{ + HotkeyManagerEmu::GetConfig()->SaveConfig(); +} diff --git a/Source/Core/DolphinQt2/Config/Mapping/HotkeyStatesOther.h b/Source/Core/DolphinQt2/Config/Mapping/HotkeyStatesOther.h new file mode 100644 index 0000000000..4b71122abe --- /dev/null +++ b/Source/Core/DolphinQt2/Config/Mapping/HotkeyStatesOther.h @@ -0,0 +1,23 @@ +// Copyright 2018 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include "DolphinQt2/Config/Mapping/MappingWidget.h" + +class QHBoxLayout; + +class HotkeyStatesOther final : public MappingWidget +{ + Q_OBJECT +public: + explicit HotkeyStatesOther(MappingWindow* window); + + InputConfig* GetConfig() override; + +private: + void LoadSettings() override; + void SaveSettings() override; + void CreateMainLayout(); +}; diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp b/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp index d642f17f78..c405512e17 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp @@ -29,6 +29,7 @@ #include "DolphinQt2/Config/Mapping/HotkeyGeneral.h" #include "DolphinQt2/Config/Mapping/HotkeyGraphics.h" #include "DolphinQt2/Config/Mapping/HotkeyStates.h" +#include "DolphinQt2/Config/Mapping/HotkeyStatesOther.h" #include "DolphinQt2/Config/Mapping/HotkeyTAS.h" #include "DolphinQt2/Config/Mapping/HotkeyWii.h" #include "DolphinQt2/Config/Mapping/WiimoteEmuExtension.h" @@ -318,6 +319,7 @@ void MappingWindow::SetMappingType(MappingWindow::Type type) AddWidget(tr("Graphics"), new HotkeyGraphics(this)); AddWidget(tr("3D"), new Hotkey3D(this)); AddWidget(tr("Save and Load State"), new HotkeyStates(this)); + AddWidget(tr("Other State Management"), new HotkeyStatesOther(this)); setWindowTitle(tr("Hotkey Settings")); break; } diff --git a/Source/Core/DolphinQt2/DolphinQt2.vcxproj b/Source/Core/DolphinQt2/DolphinQt2.vcxproj index decbae647a..9f6311f423 100644 --- a/Source/Core/DolphinQt2/DolphinQt2.vcxproj +++ b/Source/Core/DolphinQt2/DolphinQt2.vcxproj @@ -74,6 +74,7 @@ + @@ -207,6 +208,7 @@ + @@ -285,6 +287,7 @@ +