]> git.sesse.net Git - pkanalytics/commitdiff
Add some navigation buttons.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 1 May 2023 08:46:40 +0000 (10:46 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 1 May 2023 08:46:40 +0000 (10:46 +0200)
mainwindow.ui
stats.cpp

index c95640fa125ea6e3891e48d8ac33b00187e902a0..a162423c1993f90bb250910666916b2cb97ecbf0 100644 (file)
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>800</width>
+    <width>1014</width>
     <height>600</height>
    </rect>
   </property>
   <widget class="QWidget" name="centralwidget">
    <layout class="QGridLayout" name="gridLayout_2">
     <item row="0" column="0">
-     <layout class="QGridLayout" name="gridLayout" rowstretch="1,0,0">
-      <item row="1" column="0">
-       <widget class="QLabel" name="timestamp">
-        <property name="text">
-         <string>1:02:03</string>
-        </property>
-       </widget>
-      </item>
+     <layout class="QGridLayout" name="gridLayout" rowstretch="1,0,0,0,0">
       <item row="0" column="0">
        <widget class="QVideoWidget" name="video" native="true">
         <property name="minimumSize">
         </property>
        </widget>
       </item>
-      <item row="2" column="0">
+      <item row="4" column="0">
        <widget class="QTableView" name="event_view"/>
       </item>
+      <item row="2" column="0">
+       <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,0,0,0,0,0,0,2">
+        <item>
+         <widget class="QLabel" name="timestamp">
+          <property name="text">
+           <string>0:00:00.000</string>
+          </property>
+          <property name="alignment">
+           <set>Qt::AlignCenter</set>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="minus10s">
+          <property name="text">
+           <string>-10s (&amp;K)</string>
+          </property>
+          <property name="shortcut">
+           <string>K</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="plus10s">
+          <property name="text">
+           <string>+10s (&amp;L)</string>
+          </property>
+          <property name="shortcut">
+           <string>L</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="minus2s">
+          <property name="text">
+           <string>-2s (&amp;←)</string>
+          </property>
+          <property name="shortcut">
+           <string>Left</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="plus2s">
+          <property name="text">
+           <string>+2s (&amp;→)</string>
+          </property>
+          <property name="shortcut">
+           <string>Right</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="minus1f">
+          <property name="text">
+           <string>-1f (&amp;,)</string>
+          </property>
+          <property name="shortcut">
+           <string>,</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="plus1f">
+          <property name="text">
+           <string>+1f (&amp;.)</string>
+          </property>
+          <property name="shortcut">
+           <string>.</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="play_pause">
+          <property name="minimumSize">
+           <size>
+            <width>110</width>
+            <height>0</height>
+           </size>
+          </property>
+          <property name="text">
+           <string>Pause (space)</string>
+          </property>
+          <property name="shortcut">
+           <string>Space</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLabel" name="status">
+          <property name="text">
+           <string>0–0 | offense | 0 passes, 0 sec possession</string>
+          </property>
+          <property name="alignment">
+           <set>Qt::AlignCenter</set>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
      </layout>
     </item>
    </layout>
     <rect>
      <x>0</x>
      <y>0</y>
-     <width>800</width>
+     <width>1014</width>
      <height>23</height>
     </rect>
    </property>
index a740c1df9d452edf7a85ac6b3b3913e68c89375f..b0ba4b3881ee5230206f9508ce23aeb04d4eaba5 100644 (file)
--- 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));
        });
 }