From a3aac7e9d69de0ddaa721c398d6a39f35a6c947b Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 1 May 2023 10:46:40 +0200 Subject: [PATCH] Add some navigation buttons. --- mainwindow.ui | 115 +++++++++++++++++++++++++++++++++++++++++++++----- stats.cpp | 29 ++++++------- 2 files changed, 116 insertions(+), 28 deletions(-) diff --git a/mainwindow.ui b/mainwindow.ui index c95640f..a162423 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -6,7 +6,7 @@ 0 0 - 800 + 1014 600 @@ -16,14 +16,7 @@ - - - - - 1:02:03 - - - + @@ -34,9 +27,109 @@ - + + + + + + + 0:00:00.000 + + + Qt::AlignCenter + + + + + + + -10s (&K) + + + K + + + + + + + +10s (&L) + + + L + + + + + + + -2s (&←) + + + Left + + + + + + + +2s (&→) + + + Right + + + + + + + -1f (&,) + + + , + + + + + + + +1f (&.) + + + . + + + + + + + + 110 + 0 + + + + Pause (space) + + + Space + + + + + + + 0–0 | offense | 0 passes, 0 sec possession + + + Qt::AlignCenter + + + + + @@ -46,7 +139,7 @@ 0 0 - 800 + 1014 23 diff --git a/stats.cpp b/stats.cpp index a740c1d..b0ba4b3 100644 --- a/stats.cpp +++ b/stats.cpp @@ -195,34 +195,29 @@ MainWindow::MainWindow() player->setVideoOutput(ui->video); - QShortcut *key_k = new QShortcut(QKeySequence(Qt::Key_K), this); - connect(key_k, &QShortcut::activated, [this]() { seek(-10000); }); + connect(ui->minus10s, &QPushButton::clicked, [this]() { seek(-10000); }); + connect(ui->plus10s, &QPushButton::clicked, [this]() { seek(10000); }); - QShortcut *key_l = new QShortcut(QKeySequence(Qt::Key_L), this); - connect(key_l, &QShortcut::activated, [this]() { seek(10000); }); - - QShortcut *key_left = new QShortcut(QKeySequence(Qt::Key_Left), this); - connect(key_left, &QShortcut::activated, [this]() { seek(-1000); }); - - QShortcut *key_right = new QShortcut(QKeySequence(Qt::Key_Right), this); - connect(key_right, &QShortcut::activated, [this]() { seek(1000); }); + connect(ui->minus2s, &QPushButton::clicked, [this]() { seek(-2000); }); + connect(ui->plus2s, &QPushButton::clicked, [this]() { seek(2000); }); // TODO: Would be nice to actually have a frame... - QShortcut *key_comma = new QShortcut(QKeySequence(Qt::Key_Comma), this); - connect(key_comma, &QShortcut::activated, [this]() { seek(-20); }); + connect(ui->minus1f, &QPushButton::clicked, [this]() { seek(-20); }); + connect(ui->plus1f, &QPushButton::clicked, [this]() { seek(20); }); - QShortcut *key_period = new QShortcut(QKeySequence(Qt::Key_Period), this); - connect(key_period, &QShortcut::activated, [this]() { seek(20); }); - - QShortcut *key_space = new QShortcut(QKeySequence(Qt::Key_Space), this); - connect(key_space, &QShortcut::activated, [this]() { + connect(ui->play_pause, &QPushButton::clicked, [this]() { if (playing) { player->pause(); + ui->play_pause->setText("Play (space)"); } else { player->setPlaybackRate(1.0); player->play(); + ui->play_pause->setText("Pause (space)"); } playing = !playing; + + // Needs to be set anew when we modify setText(), evidently. + ui->play_pause->setShortcut(QCoreApplication::translate("MainWindow", "Space", nullptr)); }); } -- 2.39.5