From 51ea52f94ba7c3671e203049ff44a901ba79a8d7 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Tue, 2 Nov 2021 22:06:00 -0400 Subject: [PATCH] Added code to init Qt TAS patterns. --- src/drivers/Qt/TasEditor/TasEditorWindow.cpp | 45 +++++++++++++++++--- src/drivers/Qt/TasEditor/TasEditorWindow.h | 1 + 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/drivers/Qt/TasEditor/TasEditorWindow.cpp b/src/drivers/Qt/TasEditor/TasEditorWindow.cpp index ab805a66..811081c0 100644 --- a/src/drivers/Qt/TasEditor/TasEditorWindow.cpp +++ b/src/drivers/Qt/TasEditor/TasEditorWindow.cpp @@ -296,6 +296,7 @@ TasEditorWindow::TasEditorWindow(QWidget *parent) mainLayout = new QVBoxLayout(); mainHBox = new QSplitter( Qt::Horizontal ); + initPatterns(); buildPianoRollDisplay(); buildSideControlPanel(); @@ -543,6 +544,44 @@ void TasEditorWindow::buildPianoRollDisplay(void) pianoRollContainerWidget->setLayout( vbox ); } //---------------------------------------------------------------------------- +void TasEditorWindow::initPatterns(void) +{ + if (patterns.size() == 0) + { + FCEU_printf("Will be using default set of patterns...\n"); + patterns.resize(4); + patternsNames.resize(4); + // Default Pattern 0: Alternating (1010...) + patternsNames[0] = "Alternating (1010...)"; + patterns[0].resize(2); + patterns[0][0] = 1; + patterns[0][1] = 0; + // Default Pattern 1: Alternating at 30FPS (11001100...) + patternsNames[1] = "Alternating at 30FPS (11001100...)"; + patterns[1].resize(4); + patterns[1][0] = 1; + patterns[1][1] = 1; + patterns[1][2] = 0; + patterns[1][3] = 0; + // Default Pattern 2: One Quarter (10001000...) + patternsNames[2] = "One Quarter (10001000...)"; + patterns[2].resize(4); + patterns[2][0] = 1; + patterns[2][1] = 0; + patterns[2][2] = 0; + patterns[2][3] = 0; + // Default Pattern 3: Tap'n'Hold (1011111111111111111111111111111111111...) + patternsNames[3] = "Tap'n'Hold (101111111...)"; + patterns[3].resize(1000); + patterns[3][0] = 1; + patterns[3][1] = 0; + for (int i = 2; i < 1000; ++i) + { + patterns[3][i] = 1; + } + } +} +//---------------------------------------------------------------------------- void TasEditorWindow::buildSideControlPanel(void) { QShortcut *shortcut; @@ -550,12 +589,6 @@ void TasEditorWindow::buildSideControlPanel(void) QHBoxLayout *hbox; QGridLayout *grid; - patternsNames.resize(4); - patternsNames[0] = "Alternating (1010...)"; - patternsNames[1] = "Alternating at 30FPS (11001100...)"; - patternsNames[2] = "One Quarter (10001000...)"; - patternsNames[3] = "Tap'n'Hold (101111111...)"; - ctlPanelMainVbox = new QVBoxLayout(); playbackGBox = new QGroupBox( tr("Playback") ); diff --git a/src/drivers/Qt/TasEditor/TasEditorWindow.h b/src/drivers/Qt/TasEditor/TasEditorWindow.h index e228814b..6f253a81 100644 --- a/src/drivers/Qt/TasEditor/TasEditorWindow.h +++ b/src/drivers/Qt/TasEditor/TasEditorWindow.h @@ -173,6 +173,7 @@ class TasEditorWindow : public QDialog QMenuBar *buildMenuBar(void); void buildPianoRollDisplay(void); void buildSideControlPanel(void); + void initPatterns(void); QMenu *recentMenu;