From 7052479971248ff9ea9381c700625619f7eba2b4 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 23 Oct 2017 00:57:51 +0200 Subject: [PATCH] Add some functionality to hide and show the scorebug itself, and also to control the carousel display from the client. --- carousel.js | 19 ++++++++++++++++++ client/mainwindow.cpp | 42 +++++++++++++++++++++++++++++++++++++++ client/mainwindow.h | 5 +++++ client/mainwindow.ui | 46 +++++++++++++++++++++++++++++++++++++++++++ score.html | 41 ++++++++++++++++++++------------------ 5 files changed, 134 insertions(+), 19 deletions(-) diff --git a/carousel.js b/carousel.js index 3d8d20f..10c9e3f 100644 --- a/carousel.js +++ b/carousel.js @@ -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; +}; + diff --git a/client/mainwindow.cpp b/client/mainwindow.cpp index af7ee4b..7936ee3 100644 --- a/client/mainwindow.cpp +++ b/client/mainwindow.cpp @@ -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> 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 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"); +} diff --git a/client/mainwindow.h b/client/mainwindow.h index 8a51790..b9e9021 100644 --- a/client/mainwindow.h +++ b/client/mainwindow.h @@ -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; diff --git a/client/mainwindow.ui b/client/mainwindow.ui index 507e31a..625940a 100644 --- a/client/mainwindow.ui +++ b/client/mainwindow.ui @@ -83,6 +83,52 @@ + + + + + + Show scorebug + + + + + + + Show group A + + + + + + + Show group B + + + + + + + Show schedule + + + + + + + Carousel + + + + + + + Hide all + + + + + diff --git a/score.html b/score.html index e824684..8f535a4 100644 --- a/score.html +++ b/score.html @@ -9,25 +9,27 @@
- - - - - - - - -
PCL17 â€“ 11NMBUI
- - - - -
25:00
- - - - -
Pagacap: First to 9 points
+
+ + + + + + + + +
PCL17 â€“ 11NMBUI
+ + + + +
25:00
+ + + + +
Pagacap: First to 9 points
+
John Doe
Ola Nordmann
@@ -60,6 +62,7 @@ hide lower third

+ show scorebug show group A show group B show schedule -- 2.39.2