Add keyboard shortcuts for replays (#5136)

* add keyboard shortcut for play/pause

* add keyboard shortcut for fast-forward

* make shortcuts rebindable

* run formatter
This commit is contained in:
RickyRister 2024-10-20 07:41:59 -07:00 committed by GitHub
parent fa999880ee
commit d26f96db9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 2 deletions

View file

@ -257,6 +257,12 @@ void TabGame::refreshShortcuts()
if (aFocusChat) {
aFocusChat->setShortcuts(shortcuts.getShortcut("tab_game/aFocusChat"));
}
if (replayPlayButton) {
replayPlayButton->setShortcut(shortcuts.getSingleShortcut("Replays/playButton"));
}
if (replayFastForwardButton) {
replayFastForwardButton->setShortcut(shortcuts.getSingleShortcut("Replays/fastForwardButton"));
}
}
void DeckViewContainer::loadLocalDeck()

View file

@ -28,7 +28,8 @@ public:
Drawing,
Chat_room,
Game_window,
Load_deck
Load_deck,
Replays
};
static QString getGroupName(ShortcutGroup::Groups group)
@ -68,6 +69,8 @@ public:
return QApplication::translate("shortcutsTab", "Game Window");
case Load_deck:
return QApplication::translate("shortcutsTab", "Load Deck from Clipboard");
case Replays:
return QApplication::translate("shortcutsTab", "Replays");
}
return {};
@ -586,7 +589,13 @@ private:
ShortcutGroup::Game_window)},
{"DlgLoadDeckFromClipboard/refreshButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Refresh"),
parseSequenceString("F5"),
ShortcutGroup::Load_deck)}};
ShortcutGroup::Load_deck)},
{"Replays/playButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Play/Pause"),
parseSequenceString("Space"),
ShortcutGroup::Replays)},
{"Replays/fastForwardButton", ShortcutKey(QT_TRANSLATE_NOOP("shortcutsTab", "Toggle Fast Forward"),
parseSequenceString("Ctrl+Right"),
ShortcutGroup::Replays)}};
};
#endif // SHORTCUTSSETTINGS_H