Skip to content

Commit

Permalink
Update shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems committed Jan 29, 2024
1 parent 3c474da commit 57fe65d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
28 changes: 27 additions & 1 deletion src/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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();
}
}
}
}
}

0 comments on commit 57fe65d

Please sign in to comment.