Added save + load hotkeys

This commit is contained in:
Hamish Milne 2020-04-06 22:47:52 +01:00
parent 7ff985cef9
commit e74b44042b
4 changed files with 14 additions and 3 deletions

View file

@ -57,7 +57,7 @@ const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> Config:
// This must be in alphabetical order according to action name as it must have the same order as // This must be in alphabetical order according to action name as it must have the same order as
// UISetting::values.shortcuts, which is alphabetically ordered. // UISetting::values.shortcuts, which is alphabetically ordered.
// clang-format off // clang-format off
const std::array<UISettings::Shortcut, 21> default_hotkeys{ const std::array<UISettings::Shortcut, 23> default_hotkeys{
{{QStringLiteral("Advance Frame"), QStringLiteral("Main Window"), {QStringLiteral("\\"), Qt::ApplicationShortcut}}, {{QStringLiteral("Advance Frame"), QStringLiteral("Main Window"), {QStringLiteral("\\"), Qt::ApplicationShortcut}},
{QStringLiteral("Capture Screenshot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+P"), Qt::ApplicationShortcut}}, {QStringLiteral("Capture Screenshot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+P"), Qt::ApplicationShortcut}},
{QStringLiteral("Continue/Pause Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F4"), Qt::WindowShortcut}}, {QStringLiteral("Continue/Pause Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F4"), Qt::WindowShortcut}},
@ -73,6 +73,8 @@ const std::array<UISettings::Shortcut, 21> default_hotkeys{
{QStringLiteral("Rotate Screens Upright"), QStringLiteral("Main Window"), {QStringLiteral("F8"), Qt::WindowShortcut}}, {QStringLiteral("Rotate Screens Upright"), QStringLiteral("Main Window"), {QStringLiteral("F8"), Qt::WindowShortcut}},
{QStringLiteral("Stop Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F5"), Qt::WindowShortcut}}, {QStringLiteral("Stop Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F5"), Qt::WindowShortcut}},
{QStringLiteral("Swap Screens"), QStringLiteral("Main Window"), {QStringLiteral("F9"), Qt::WindowShortcut}}, {QStringLiteral("Swap Screens"), QStringLiteral("Main Window"), {QStringLiteral("F9"), Qt::WindowShortcut}},
{QStringLiteral("Save to Oldest Slot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+C"), Qt::WindowShortcut}},
{QStringLiteral("Load from Newest Slot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+V"), Qt::WindowShortcut}},
{QStringLiteral("Toggle Filter Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F"), Qt::WindowShortcut}}, {QStringLiteral("Toggle Filter Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F"), Qt::WindowShortcut}},
{QStringLiteral("Toggle Frame Advancing"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+A"), Qt::ApplicationShortcut}}, {QStringLiteral("Toggle Frame Advancing"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+A"), Qt::ApplicationShortcut}},
{QStringLiteral("Toggle Screen Layout"), QStringLiteral("Main Window"), {QStringLiteral("F10"), Qt::WindowShortcut}}, {QStringLiteral("Toggle Screen Layout"), QStringLiteral("Main Window"), {QStringLiteral("F10"), Qt::WindowShortcut}},

View file

@ -524,6 +524,10 @@ void GMainWindow::InitializeHotkeys() {
OnCaptureScreenshot(); OnCaptureScreenshot();
} }
}); });
connect(hotkey_registry.GetHotkey(main_window, ui.action_Load_from_Newest_Slot->text(), this),
&QShortcut::activated, ui.action_Load_from_Newest_Slot, &QAction::trigger);
connect(hotkey_registry.GetHotkey(main_window, ui.action_Save_to_Oldest_Slot->text(), this),
&QShortcut::activated, ui.action_Save_to_Oldest_Slot, &QAction::trigger);
} }
void GMainWindow::ShowUpdaterWidgets() { void GMainWindow::ShowUpdaterWidgets() {
@ -1636,7 +1640,7 @@ void GMainWindow::OnSaveState() {
assert(action); assert(action);
Core::System::GetInstance().SendSignal(Core::System::Signal::Save, action->data().toUInt()); Core::System::GetInstance().SendSignal(Core::System::Signal::Save, action->data().toUInt());
UpdateSaveStates(); newest_slot = action->data().toUInt();
} }
void GMainWindow::OnLoadState() { void GMainWindow::OnLoadState() {

View file

@ -577,7 +577,9 @@ void System::serialize(Archive& ar, const unsigned int file_version) {
ar&* memory.get(); ar&* memory.get();
ar&* kernel.get(); ar&* kernel.get();
VideoCore::serialize(ar, file_version); VideoCore::serialize(ar, file_version);
ar& Movie::GetInstance(); if (file_version >= 1) {
ar& Movie::GetInstance();
}
// This needs to be set from somewhere - might as well be here! // This needs to be set from somewhere - might as well be here!
if (Archive::is_loading::value) { if (Archive::is_loading::value) {

View file

@ -7,6 +7,7 @@
#include <memory> #include <memory>
#include <mutex> #include <mutex>
#include <string> #include <string>
#include <boost/serialization/version.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/custom_tex_cache.h" #include "core/custom_tex_cache.h"
#include "core/frontend/applets/mii_selector.h" #include "core/frontend/applets/mii_selector.h"
@ -401,3 +402,5 @@ inline AudioCore::DspInterface& DSP() {
} }
} // namespace Core } // namespace Core
BOOST_CLASS_VERSION(Core::System, 1)