]> git.sesse.net Git - ultimatescore/commitdiff
Add a third clock.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 14 Oct 2019 22:40:37 +0000 (00:40 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 14 Oct 2019 22:40:37 +0000 (00:40 +0200)
carousel.js
client/mainwindow.cpp
client/mainwindow.h
client/mainwindow.ui
score.html
score.js
score.scss

index aa195c603fe54b3446e82e6c8d1be558a1e6b333..7066ba4cb0e336707e9bc93abd3d81f9d6db3f86 100644 (file)
@@ -752,3 +752,17 @@ function hidematch2()
        document.getElementById('scorebug2').style = css;
        document.getElementById('clockbug2').style = css;
 }
+
+function showmatch3()
+{
+       let css = "-webkit-animation: fade-in 1.0s ease; -webkit-animation-fill-mode: both;";
+       document.getElementById('scorebug3').style = css;
+       document.getElementById('clockbug3').style = css;
+}
+
+function hidematch3()
+{
+       let css = "-webkit-animation: fade-out 1.0s ease; -webkit-animation-fill-mode: both;";
+       document.getElementById('scorebug3').style = css;
+       document.getElementById('clockbug3').style = css;
+}
index 0c2ac48888f953aab19de6086e9c6724903417ed..7e96d22d6d7b88604dcc9d2e38c2ff70197bf3d4 100644 (file)
@@ -100,10 +100,12 @@ MainWindow::MainWindow(QWidget *parent) :
 
        udp_thread = std::thread(&MainWindow::udp_thread_func, this, 6000);
        udp_thread2 = std::thread(&MainWindow::udp_thread_func, this, 6001);
+       udp_thread3 = std::thread(&MainWindow::udp_thread_func, this, 6002);
 
        connect(ui->ws_disconnect_btn, &QPushButton::clicked, this, &MainWindow::ws_disconnect_clicked);
        connect(ui->set_initials_btn, &QPushButton::clicked, this, &MainWindow::set_initials_clicked);
        connect(ui->set_match_2_initials_btn, &QPushButton::clicked, this, &MainWindow::set_match_2_initials_clicked);
+       connect(ui->set_match_3_initials_btn, &QPushButton::clicked, this, &MainWindow::set_match_3_initials_clicked);
        connect(ui->set_color_btn, &QPushButton::clicked, this, &MainWindow::set_color_clicked);
        connect(ui->set_score_btn, &QPushButton::clicked, this, &MainWindow::set_score_clicked);
        connect(ui->set_all_scorebug_btn, &QPushButton::clicked, this, &MainWindow::set_all_scorebug_clicked);
@@ -120,6 +122,8 @@ MainWindow::MainWindow(QWidget *parent) :
        connect(ui->hide_clock_btn, &QPushButton::clicked, this, &MainWindow::hide_clock_clicked);
        connect(ui->show_match_2_btn, &QPushButton::clicked, this, &MainWindow::show_match_2_clicked);
        connect(ui->hide_match_2_btn, &QPushButton::clicked, this, &MainWindow::hide_match_2_clicked);
+       connect(ui->show_match_3_btn, &QPushButton::clicked, this, &MainWindow::show_match_3_clicked);
+       connect(ui->hide_match_3_btn, &QPushButton::clicked, this, &MainWindow::hide_match_3_clicked);
 
        connect(ui->set_comment_btn, &QPushButton::clicked, this, &MainWindow::set_comment_clicked);
        connect(ui->set_and_show_comment_btn, &QPushButton::clicked, this, &MainWindow::set_and_show_comment_clicked);
@@ -179,6 +183,15 @@ void MainWindow::set_match_2_initials_clicked()
        ws->send_command("eval setteams2()");
 }
 
+void MainWindow::set_match_3_initials_clicked()
+{
+       map<string, string> param;
+       param["team1"] = escape_html(ui->match_3_initials_1_edit->text().toStdString());
+       param["team2"] = escape_html(ui->match_3_initials_2_edit->text().toStdString());
+       ws->send_command("update " + serialize_as_json(param));
+       ws->send_command("eval setteams2()");
+}
+
 void MainWindow::set_color_clicked()
 {
        map<string, string> param;
@@ -259,6 +272,16 @@ void MainWindow::hide_match_2_clicked()
        ws->send_command("eval hidematch2()");
 }
 
+void MainWindow::show_match_3_clicked()
+{
+       ws->send_command("eval showmatch3()");
+}
+
+void MainWindow::hide_match_3_clicked()
+{
+       ws->send_command("eval hidematch3()");
+}
+
 void MainWindow::set_comment_clicked()
 {
        map<string, string> param;
@@ -478,7 +501,11 @@ int parse_score(char ch1, char ch2, char ch3)
 void MainWindow::bt6000_message_received(const string &msg, int port)
 {
        fprintf(stderr, "BT6000 message: '%s' (port %d)\n", msg.c_str(), port);
-       if (port == 6001) {
+       if (port == 6002) {
+               if (!ui->bt6000_3_enable->isChecked()) {
+                       return;
+               }
+       } else if (port == 6001) {
                if (!ui->bt6000_2_enable->isChecked()) {
                        return;
                }
index 968ef4daabbc41d0a1cebe9018fb516c741c5c37..e215da5a70553dafbef34b77a999e1a5ce43817a 100644 (file)
@@ -27,6 +27,7 @@ private:
        void ws_disconnect_clicked();
        void set_initials_clicked();
        void set_match_2_initials_clicked();
+       void set_match_3_initials_clicked();
        void set_color_clicked();
        void set_score_clicked();
        void set_all_scorebug_clicked();
@@ -39,6 +40,8 @@ private:
        void hide_clock_clicked();
        void show_match_2_clicked();
        void hide_match_2_clicked();
+       void show_match_3_clicked();
+       void hide_match_3_clicked();
        void set_comment_clicked();
        void set_and_show_comment_clicked();
        void hide_comment_clicked();
@@ -63,6 +66,7 @@ private:
 
        std::thread udp_thread;
        std::thread udp_thread2;
+       std::thread udp_thread3;
 };
 
 #endif // MAINWINDOW_H
index 2ce9b6a75feba8389f2ed2a36eb3db63fd2c22ac..88318919bf39be5847029b895ce95c74ef87f19e 100644 (file)
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>805</width>
+    <width>891</width>
     <height>597</height>
    </rect>
   </property>
           </property>
          </widget>
         </item>
+        <item>
+         <widget class="QCheckBox" name="bt6000_3_enable">
+          <property name="text">
+           <string>Score 3 UDP</string>
+          </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
        </layout>
       </item>
       <item>
        <layout class="QHBoxLayout" name="horizontalLayout_3">
         <item>
          <layout class="QGridLayout" name="gridLayout">
-          <item row="4" column="2">
+          <item row="4" column="3">
            <layout class="QHBoxLayout" name="horizontalLayout_4">
             <item>
              <widget class="QPushButton" name="goal_2_btn">
             </property>
            </widget>
           </item>
-          <item row="3" column="2">
+          <item row="3" column="3">
            <widget class="QSpinBox" name="score_2_box"/>
           </item>
-          <item row="3" column="3">
+          <item row="3" column="4">
            <widget class="QPushButton" name="set_score_btn">
             <property name="text">
              <string>Set</string>
             </property>
            </widget>
           </item>
-          <item row="1" column="1">
+          <item row="1" column="2">
            <widget class="QLineEdit" name="initials_1_edit">
             <property name="text">
              <string>PCL</string>
             </property>
            </widget>
           </item>
-          <item row="4" column="1">
+          <item row="4" column="2">
            <layout class="QHBoxLayout" name="horizontalLayout_5">
             <item>
              <widget class="QPushButton" name="goal_1_btn">
             </item>
            </layout>
           </item>
-          <item row="2" column="1">
+          <item row="2" column="2">
            <widget class="QLineEdit" name="color_1_edit">
             <property name="text">
              <string>red</string>
             </property>
            </widget>
           </item>
-          <item row="3" column="1">
+          <item row="3" column="2">
            <widget class="QSpinBox" name="score_1_box"/>
           </item>
-          <item row="0" column="2">
+          <item row="0" column="3">
            <widget class="QLabel" name="label_4">
             <property name="text">
              <string>Team 2</string>
             </property>
            </widget>
           </item>
-          <item row="0" column="1">
+          <item row="0" column="2">
            <widget class="QLabel" name="label_3">
             <property name="text">
              <string>Team 1</string>
             </property>
            </widget>
           </item>
-          <item row="1" column="2">
+          <item row="1" column="3">
            <widget class="QLineEdit" name="initials_2_edit">
             <property name="text">
              <string>TFK</string>
             </property>
            </widget>
           </item>
-          <item row="1" column="3">
+          <item row="1" column="4">
            <widget class="QPushButton" name="set_initials_btn">
             <property name="text">
              <string>Set</string>
             </property>
            </widget>
           </item>
-          <item row="2" column="2">
+          <item row="2" column="3">
            <widget class="QLineEdit" name="color_2_edit">
             <property name="text">
              <string>yellow</string>
             </property>
            </widget>
           </item>
-          <item row="2" column="3">
+          <item row="2" column="4">
            <widget class="QPushButton" name="set_color_btn">
             <property name="text">
              <string>Set</string>
             </property>
            </widget>
           </item>
-          <item row="4" column="3">
+          <item row="4" column="4">
            <widget class="QPushButton" name="set_all_scorebug_btn">
             <property name="text">
              <string>Set all</string>
             </property>
            </widget>
           </item>
-          <item row="5" column="1">
+          <item row="5" column="2">
            <widget class="QLineEdit" name="match_2_initials_1_edit">
             <property name="text">
              <string>PCL</string>
             </property>
            </widget>
           </item>
-          <item row="5" column="2">
+          <item row="5" column="3">
            <widget class="QLineEdit" name="match_2_initials_2_edit">
             <property name="text">
              <string>TFK</string>
             </property>
            </widget>
           </item>
-          <item row="5" column="3">
+          <item row="5" column="4">
            <widget class="QPushButton" name="set_match_2_initials_btn">
             <property name="text">
              <string>Set</string>
             </property>
            </widget>
           </item>
+          <item row="6" column="0">
+           <widget class="QLabel" name="label_16">
+            <property name="text">
+             <string>Match 3</string>
+            </property>
+           </widget>
+          </item>
+          <item row="6" column="2">
+           <widget class="QLineEdit" name="match_3_initials_1_edit">
+            <property name="text">
+             <string>PCL</string>
+            </property>
+           </widget>
+          </item>
+          <item row="6" column="3">
+           <widget class="QLineEdit" name="match_3_initials_2_edit">
+            <property name="text">
+             <string>TFK</string>
+            </property>
+           </widget>
+          </item>
+          <item row="6" column="4">
+           <widget class="QPushButton" name="set_match_3_initials_btn">
+            <property name="text">
+             <string>Set</string>
+            </property>
+           </widget>
+          </item>
          </layout>
         </item>
        </layout>
           </property>
          </widget>
         </item>
+        <item>
+         <widget class="QPushButton" name="show_match_3_btn">
+          <property name="text">
+           <string>Show match 3</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="hide_match_3_btn">
+          <property name="text">
+           <string>Hide match 3</string>
+          </property>
+         </widget>
+        </item>
        </layout>
       </item>
       <item>
index bc39b5ab79ca9b3bde5654ea5f9a8ce9ee26450b..c4cdc5a3b2c14edd01218322574a5c97f5826827 100644 (file)
           <td class="clock" id="clock2">0:00</td>
         </tr>
       </table>
+      <table class="scorebug scorebug3" id="scorebug3" style="display: none">
+        <tr>
+          <td class="team1" id="score3_team1">TM3</td>
+          <td class="score" id="score3_score">0&nbsp;–&nbsp;0</td>
+          <td class="team2" id="score3_team2">TM4</td>
+        </tr>
+      </table>
+      <table class="clockbug3 clockbug-hidden" id="clockbug3" style="display: none">
+        <tr>
+          <td class="clock" id="clock3">0:00</td>
+        </tr>
+      </table>
     </div>
     <div class="lowerthird-headline lowerthird-headline-hidden" id="lowerthird-headline"><div class="lowerthird-headline-content lowerthird-headline-content-hidden" id="lowerthird-headline-content">
       Call on the field: Foul
index bedb8299f337b8c3519377aac03750cff2797acb..394bb558043a7efd1beeda406824ee6e799e86aa 100644 (file)
--- a/score.js
+++ b/score.js
@@ -1,9 +1,10 @@
 'use strict';
 
-let num_clocks = 2;
+let num_clocks = 3;
 let clocks = [
        { 'running': false, 'elapsed': 0, 'origin': undefined, 'id': 'clock' },
-       { 'running': false, 'elapsed': 0, 'origin': undefined, 'id': 'clock2' }
+       { 'running': false, 'elapsed': 0, 'origin': undefined, 'id': 'clock2' },
+       { 'running': false, 'elapsed': 0, 'origin': undefined, 'id': 'clock3' }
 ];
 
 let clock_visible = false;
@@ -29,6 +30,12 @@ function setteams2()
        document.getElementById('score2_team2').innerHTML = state['team2'];
 }
 
+function setteams3()
+{
+       document.getElementById('score3_team1').innerHTML = state['team1'];
+       document.getElementById('score3_team2').innerHTML = state['team2'];
+}
+
 function setcolors()
 {
        document.getElementById('team1color').style.backgroundColor = state['team1color'];
@@ -49,6 +56,13 @@ function setscore2()
        document.getElementById('score2_score').innerHTML = scoreA + "&nbsp;–&nbsp;" + scoreB;
 }
 
+function setscore3()
+{
+       scoreA = state['score1'];
+       scoreB = state['score2'];
+       document.getElementById('score3_score').innerHTML = scoreA + "&nbsp;–&nbsp;" + scoreB;
+}
+
 function startclock(num)
 {
        if (!clocks[num].running) {
index e01009213085aa8860263d54e9a76565de3574ae..ca6e177cc1f010a86c577a4b87fdf35602df61c2 100644 (file)
@@ -60,12 +60,10 @@ body {
     border: 1px solid #ccc;
   }
 }
-.scorebug2 td {
+.scorebug2 td, .scorebug3 td {
   border: 1px solid #ccc8;
 }
 .scorebug2 {
-  /*top: 52px; */
- /* left: 22px; */ 
   left: 1275px;
   top: 13px;
   font-size: 20px;
@@ -75,6 +73,16 @@ body {
   top: 13px;
   font-size: 20px;
 }
+.scorebug3 {
+  left: 1275px;
+  top: 47px;
+  font-size: 20px;
+}
+#clockbug3 {
+  left: 1360px;
+  top: 47px;
+  font-size: 20px;
+}
 .team1color, .team2color {
   width: 12px;
   margin: 5px;
@@ -107,14 +115,14 @@ body {
   }
   padding-top: var(--main-padding-top-adjust);
 }
-#score2_team1, #score2_team2 {
+#score2_team1, #score2_team2, #score3_team1, #score3_team2 {
   @if $trondisk {
     background: linear-gradient(to bottom, #00a8, #0088);
   } @else {
     background: linear-gradient(to bottom, #fff8, #eee8);
   }
 }
-#score2_team1, #score2_team2, #score2_score {
+#score2_team1, #score2_team2, #score2_score, #score3_team1, #score3_team2, #score3_score {
   height: 30px;
 }
 .score {
@@ -128,7 +136,7 @@ body {
   height: 35px;
   padding-top: var(--main-padding-top-adjust);
 }
-#score2_score {
+#score2_score, #score3_score {
   @if $trondisk {
     background: linear-gradient(to bottom, #00c8, #00a8);
   } @else {
@@ -137,7 +145,7 @@ body {
 }
 
 /* Clock, to the right of score */
-.clockbug, .clockbug2 {
+.clockbug, .clockbug2, .clockbug3 {
   position: fixed;
   font-size: 25px;
   left: 352px;
@@ -163,7 +171,7 @@ body {
   padding-top: var(--main-padding-top-adjust);
   width: 90px;
 }
-#clock2 {
+#clock2, #clock3 {
   border: 1px solid #ccc8;
   @if $trondisk {
     background: linear-gradient(to bottom, #00a8, #0088);