From ffe8aacdc1cf35ea0bcba7d523da3a6069ed35f1 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Mon, 1 Nov 2021 23:48:51 -0400 Subject: [PATCH] Hooked up TAS playback button functionality for Qt GUI. --- src/drivers/Qt/TasEditor/TasEditorWindow.cpp | 63 ++++++++++++++++++++ src/drivers/Qt/TasEditor/TasEditorWindow.h | 7 +++ 2 files changed, 70 insertions(+) diff --git a/src/drivers/Qt/TasEditor/TasEditorWindow.cpp b/src/drivers/Qt/TasEditor/TasEditorWindow.cpp index 58ebcc2c..2cd45589 100644 --- a/src/drivers/Qt/TasEditor/TasEditorWindow.cpp +++ b/src/drivers/Qt/TasEditor/TasEditorWindow.cpp @@ -490,6 +490,7 @@ void TasEditorWindow::buildPianoRollDisplay(void) //---------------------------------------------------------------------------- void TasEditorWindow::buildSideControlPanel(void) { + QShortcut *shortcut; QVBoxLayout *vbox; QHBoxLayout *hbox; QGridLayout *grid; @@ -627,6 +628,28 @@ void TasEditorWindow::buildSideControlPanel(void) connect( rec2PBtn , &QRadioButton::clicked, [ this ] { recordInputChanged( MULTITRACK_RECORDING_2P ); } ); connect( rec3PBtn , &QRadioButton::clicked, [ this ] { recordInputChanged( MULTITRACK_RECORDING_3P ); } ); connect( rec4PBtn , &QRadioButton::clicked, [ this ] { recordInputChanged( MULTITRACK_RECORDING_4P ); } ); + + connect( rewindMkrBtn, SIGNAL(clicked(void)), this, SLOT(playbackFrameRewindFull(void)) ); + connect( rewindFrmBtn, SIGNAL(clicked(void)), this, SLOT(playbackFrameRewind(void)) ); + connect( playPauseBtn, SIGNAL(clicked(void)), this, SLOT(playbackPauseCB(void)) ); + connect( advFrmBtn , SIGNAL(clicked(void)), this, SLOT(playbackFrameForward(void)) ); + connect( advMkrBtn , SIGNAL(clicked(void)), this, SLOT(playbackFrameForwardFull(void))); + + shortcut = new QShortcut( QKeySequence("Pause"), this); + connect( shortcut, SIGNAL(activated(void)), this, SLOT(playbackPauseCB(void)) ); + + shortcut = new QShortcut( QKeySequence("Shift+Up"), this); + connect( shortcut, SIGNAL(activated(void)), this, SLOT(playbackFrameRewind(void)) ); + + shortcut = new QShortcut( QKeySequence("Shift+Down"), this); + connect( shortcut, SIGNAL(activated(void)), this, SLOT(playbackFrameForward(void)) ); + + shortcut = new QShortcut( QKeySequence("Shift+PgUp"), this); + connect( shortcut, SIGNAL(activated(void)), this, SLOT(playbackFrameRewindFull(void)) ); + + shortcut = new QShortcut( QKeySequence("Shift+PgDown"), this); + connect( shortcut, SIGNAL(activated(void)), this, SLOT(playbackFrameForwardFull(void)) ); + } //---------------------------------------------------------------------------- int TasEditorWindow::initModules(void) @@ -1090,6 +1113,46 @@ void TasEditorWindow::recordInputChanged(int input) recorder.multitrackRecordingJoypadNumber = input; } //---------------------------------------------------------------------------- +void TasEditorWindow::playbackPauseCB(void) +{ + fceuWrapperLock(); + playback.toggleEmulationPause(); + pianoRoll->update(); + fceuWrapperUnLock(); +} +//---------------------------------------------------------------------------- +void TasEditorWindow::playbackFrameRewind(void) +{ + fceuWrapperLock(); + playback.handleRewindFrame(); + pianoRoll->update(); + fceuWrapperUnLock(); +} +//---------------------------------------------------------------------------- +void TasEditorWindow::playbackFrameForward(void) +{ + fceuWrapperLock(); + playback.handleForwardFrame(); + pianoRoll->update(); + fceuWrapperUnLock(); +} +//---------------------------------------------------------------------------- +void TasEditorWindow::playbackFrameRewindFull(void) +{ + fceuWrapperLock(); + playback.handleRewindFull(); + pianoRoll->update(); + fceuWrapperUnLock(); +} +//---------------------------------------------------------------------------- +void TasEditorWindow::playbackFrameForwardFull(void) +{ + fceuWrapperLock(); + playback.handleForwardFull(); + pianoRoll->update(); + fceuWrapperUnLock(); +} +//---------------------------------------------------------------------------- //---------------------------------------------------------------------------- //---- TAS Piano Roll Widget //---------------------------------------------------------------------------- diff --git a/src/drivers/Qt/TasEditor/TasEditorWindow.h b/src/drivers/Qt/TasEditor/TasEditorWindow.h index e52addf1..51edbe10 100644 --- a/src/drivers/Qt/TasEditor/TasEditorWindow.h +++ b/src/drivers/Qt/TasEditor/TasEditorWindow.h @@ -30,6 +30,7 @@ #include #include #include +#include #include "Qt/TasEditor/taseditor_config.h" #include "Qt/TasEditor/taseditor_project.h" @@ -197,6 +198,7 @@ class TasEditorWindow : public QDialog QPushButton *nextMkrBtn; QPushButton *similarBtn; QPushButton *moreBtn; + private: int initModules(void); @@ -218,6 +220,11 @@ class TasEditorWindow : public QDialog void recordInputChanged(int); void superImposedChanged(int); void usePatternChanged(int); + void playbackPauseCB(void); + void playbackFrameRewind(void); + void playbackFrameForward(void); + void playbackFrameRewindFull(void); + void playbackFrameForwardFull(void); friend class RECORDER; };