]> git.sesse.net Git - ultimatescore/blobdiff - client/mainwindow.cpp
Add a third clock.
[ultimatescore] / client / mainwindow.cpp
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;
                }