From 57fe65d6f96adf80e9ff06ba424e40a7de99b6a3 Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sun, 28 Jan 2024 23:06:44 -0700 Subject: [PATCH] Update shortcuts --- src/main.cpp | 2 +- src/main.qml | 28 +++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3d9b847..bd24f0e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -64,7 +64,7 @@ int main(int argc, char *argv[]){ // This is defined in qml.qrc QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - if (engine.rootObjects().isEmpty()){ + if(engine.rootObjects().isEmpty()){ qDebug() << "Nothing to display"; return -1; } diff --git a/src/main.qml b/src/main.qml index 830860b..e437de2 100644 --- a/src/main.qml +++ b/src/main.qml @@ -459,7 +459,7 @@ ApplicationWindow { } Shortcut { enabled: stateController.state !== "loading" - sequences: [StandardKey.Cancel, Qt.Key_Backspace] + sequences: [StandardKey.Cancel, "Backspace"] autoRepeat: false onActivated: backButton.clicked() } @@ -475,5 +475,31 @@ ApplicationWindow { autoRepeat: false onActivated: gameboy.reset() } + Shortcut { + enabled: stateController.state === "loaded" + sequences: ["Ctrl-P", "MediaTogglePlayPause"] + autoRepeat: false + onActivated: gameboy.toggle() + } + Shortcut { + enabled: stateController.state === "loaded" + sequences: ["Pause", "MediaPause"] + autoRepeat: false + onActivated:{ + if(gameboy.running && !gameboy.paused){ + gameboy.toggle(); + } + } + } + Shortcut { + enabled: stateController.state === "loaded" + sequences: ["Play", "MediaPlay"] + autoRepeat: false + onActivated:{ + if(gameboy.running && gameboy.paused){ + gameboy.toggle(); + } + } + } } }