]> git.sesse.net Git - ultimatescore/commitdiff
Add some functionality to hide and show the scorebug itself, and also to control...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 22 Oct 2017 22:57:51 +0000 (00:57 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 22 Oct 2017 23:12:05 +0000 (01:12 +0200)
carousel.js
client/mainwindow.cpp
client/mainwindow.h
client/mainwindow.ui
score.html

index 3d8d20f03220005760af088b40819a138df13981..10c9e3f70587b8273c311c1c5a37f9dfc1c64fbc 100644 (file)
@@ -288,6 +288,8 @@ var display_group = function(response, group_name)
 
 var display_group_parsed = function(teams, games, group_name)
 {
+       document.getElementById('entire-bug').style.display = 'none';
+
        var teams_to_idx = make_teams_to_idx(teams);
        for (i = 0; i < games.length; ++i) {
                var idx1 = teams_to_idx[games[i].name1];
@@ -404,6 +406,8 @@ var display_stream_schedule = function(response, group_name) {
 };
 
 var display_stream_schedule_parsed = function(teams, games) {
+       document.getElementById('entire-bug').style.display = 'none';
+
        var teams_to_idx = make_teams_to_idx(teams);
        games = games.filter(function(game) { return game.streamtime !== undefined && game.streamtime.match(/[0-9]+:[0-9]+/) != null; });
        games.sort(function(a, b) {
@@ -473,6 +477,11 @@ var showgroup = function(group_name)
        get_group(group_name, display_group);
 };
 
+var showgroup_from_state = function()
+{
+       showgroup(state['group_name']);
+};
+
 var carousel_timeout = null;
 
 var hidetable = function()
@@ -554,3 +563,13 @@ var stopcarousel = function()
        }
 };
 
+var hidescorebug = function()
+{
+       document.getElementById('entire-bug').style.display = 'none';
+}
+
+var showscorebug = function()
+{
+       document.getElementById('entire-bug').style.display = null;
+};
+
index af7ee4b05695f616f533047c43b9b4348b70174a..7936ee3228c7588b709cde74a4895a468c2e43cb 100644 (file)
@@ -123,6 +123,13 @@ MainWindow::MainWindow(QWidget *parent) :
        connect(ui->quick_lower_third_edit, &QLineEdit::returnPressed, this, &MainWindow::quick_lower_third_activate);
        connect(ui->show_quick_lower_third_btn, &QPushButton::clicked, this, &MainWindow::quick_lower_third_activate);
 
+       connect(ui->show_scorebug_btn, &QPushButton::clicked, this, &MainWindow::show_scorebug_clicked);
+       connect(ui->show_group_a_btn, &QPushButton::clicked, this, [this]() { show_group_clicked("Group A"); });
+       connect(ui->show_group_b_btn, &QPushButton::clicked, this, [this]() { show_group_clicked("Group B"); });
+       connect(ui->show_schedule_btn, &QPushButton::clicked, this, &MainWindow::show_schedule_clicked);
+       connect(ui->show_carousel_btn, &QPushButton::clicked, this, &MainWindow::show_carousel_clicked);
+       connect(ui->show_nothing_btn, &QPushButton::clicked, this, &MainWindow::show_nothing_clicked);
+
        autocomment_update();
 
        const set<pair<unsigned, unsigned>> usb{{ 0x0e8f, 0x0041 }};
@@ -276,3 +283,38 @@ void MainWindow::autocomment_update()
        }
        ui->autocomment_edit->setText(QString::fromStdString(msg));
 }
+
+void MainWindow::show_scorebug_clicked()
+{
+       acmp->send_command("cg 1 invoke 1 stopcarousel");
+       acmp->send_command("cg 1 invoke 1 hidetable");
+       acmp->send_command("cg 1 invoke 1 showscorebug");
+}
+
+void MainWindow::show_group_clicked(const std::string &group_name)
+{
+       map<string, string> param;
+       param["group_name"] = group_name;
+       acmp->send_command("cg 1 invoke 1 stopcarousel");
+       acmp->send_command("cg 1 update 1 \"" + escape_quotes(serialize_as_json(param)) + "\"");
+       acmp->send_command("cg 1 invoke 1 showgroup_from_state");
+}
+
+void MainWindow::show_schedule_clicked()
+{
+       acmp->send_command("cg 1 invoke 1 stopcarousel");
+       acmp->send_command("cg 1 invoke 1 showschedule");
+}
+
+void MainWindow::show_carousel_clicked()
+{
+       acmp->send_command("cg 1 invoke 1 stopcarousel");
+       acmp->send_command("cg 1 invoke 1 showcarousel");
+}
+
+void MainWindow::show_nothing_clicked()
+{
+       acmp->send_command("cg 1 invoke 1 hidescorebug");
+       acmp->send_command("cg 1 invoke 1 stopcarousel");
+       acmp->send_command("cg 1 invoke 1 hidetable");
+}
index 8a517901b669e3499120943d0fbeab9a47b8272d..b9e90217a77d6eb9b15b82d76252bc6b8c1147d8 100644 (file)
@@ -40,6 +40,11 @@ private:
        void hide_lower_third_clicked();
        void quick_lower_third_activate();
        void autocomment_update();
+       void show_scorebug_clicked();
+       void show_group_clicked(const std::string &group_name);
+       void show_schedule_clicked();
+       void show_carousel_clicked();
+       void show_nothing_clicked();
 
        Ui::MainWindow *ui;
        ACMPClient *acmp;
index 507e31a400afaaebaaaebeeac97deccdb5de0141..625940a21b603803fbb36f0bafbccce5dfd3549d 100644 (file)
         </item>
        </layout>
       </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_13">
+        <item>
+         <widget class="QPushButton" name="show_scorebug_btn">
+          <property name="text">
+           <string>Show scorebug</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="show_group_a_btn">
+          <property name="text">
+           <string>Show group A</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="show_group_b_btn">
+          <property name="text">
+           <string>Show group B</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="show_schedule_btn">
+          <property name="text">
+           <string>Show schedule</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="show_carousel_btn">
+          <property name="text">
+           <string>Carousel</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="show_nothing_btn">
+          <property name="text">
+           <string>Hide all</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
       <item>
        <layout class="QHBoxLayout" name="horizontalLayout_3">
         <item>
index e824684050e3562eaffe4213bdc6c19e219019d5..8f535a43d1da050920f48583630dc429a215177c 100644 (file)
@@ -9,25 +9,27 @@
   </head>
   <body>
     <div id="area"></div>
-    <table class="scorebug">
-      <tr>
-        <td class="team1color" id="team1color"></td>
-        <td class="team1" id="team1">PCL</td>
-        <td class="score" id="score">17&nbsp;–&nbsp;11</td>
-        <td class="team2" id="team2">NMBUI</td>
-        <td class="team2color" id="team2color"></td>
-      </tr>
-    </table>
-    <table class="clockbug clockbug-hidden" id="clockbug">
-      <tr>
-        <td class="clock" id="clock">25:00</td>
-      </tr>
-    </table>
-    <table class="commentbug commentbug-hidden" id="commentbug">
-      <tr>
-        <td class="comment" id="comment">Pagacap: First to 9 points</td>
-      </tr>
-    </table>
+    <div id="entire-bug">
+      <table class="scorebug">
+        <tr>
+          <td class="team1color" id="team1color"></td>
+          <td class="team1" id="team1">PCL</td>
+          <td class="score" id="score">17&nbsp;–&nbsp;11</td>
+          <td class="team2" id="team2">NMBUI</td>
+          <td class="team2color" id="team2color"></td>
+        </tr>
+      </table>
+      <table class="clockbug clockbug-hidden" id="clockbug">
+        <tr>
+          <td class="clock" id="clock">25:00</td>
+        </tr>
+      </table>
+      <table class="commentbug commentbug-hidden" id="commentbug">
+        <tr>
+          <td class="comment" id="comment">Pagacap: First to 9 points</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">
       John Doe<br>Ola Nordmann
     </div></div>
@@ -60,6 +62,7 @@
         <a href="javascript:hidelowerthird()">hide lower third</a>
       </p>
       <p>
+        <a href="javascript:stopcarousel();hidetable();showscorebug()">show scorebug</a>
         <a href="javascript:stopcarousel();showgroup('Group A')">show group A</a>
         <a href="javascript:stopcarousel();showgroup('Group B')">show group B</a>
         <a href="javascript:stopcarousel();showschedule()">show schedule</a>