]> git.sesse.net Git - ultimatescore/commitdiff
Add an option (default on) to autoshow comment when time goes out.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 17 Feb 2019 23:24:35 +0000 (00:24 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 17 Feb 2019 23:24:35 +0000 (00:24 +0100)
client/mainwindow.cpp
client/mainwindow.ui
score.js

index 228fe6b2044435d4de924645e6dc6593e524af69..d6d32008e73ba6f89f8ae8ea2dda007b18a278af 100644 (file)
@@ -124,6 +124,7 @@ MainWindow::MainWindow(QWidget *parent) :
        connect(ui->set_and_show_comment_btn, &QPushButton::clicked, this, &MainWindow::set_and_show_comment_clicked);
        connect(ui->hide_comment_btn, &QPushButton::clicked, this, &MainWindow::hide_comment_clicked);
        connect(ui->set_and_show_autocomment_btn, &QPushButton::clicked, this, &MainWindow::set_and_show_autocomment_clicked);
        connect(ui->set_and_show_comment_btn, &QPushButton::clicked, this, &MainWindow::set_and_show_comment_clicked);
        connect(ui->hide_comment_btn, &QPushButton::clicked, this, &MainWindow::hide_comment_clicked);
        connect(ui->set_and_show_autocomment_btn, &QPushButton::clicked, this, &MainWindow::set_and_show_autocomment_clicked);
+       connect(ui->autoshow_autocomment, &QCheckBox::stateChanged, this, &MainWindow::autocomment_update);
 
        connect(ui->show_lower_third_btn, &QPushButton::clicked, this, &MainWindow::show_lower_third_clicked);
        connect(ui->hide_lower_third_btn, &QPushButton::clicked, this, &MainWindow::hide_lower_third_clicked);
 
        connect(ui->show_lower_third_btn, &QPushButton::clicked, this, &MainWindow::show_lower_third_clicked);
        connect(ui->hide_lower_third_btn, &QPushButton::clicked, this, &MainWindow::hide_lower_third_clicked);
@@ -333,6 +334,11 @@ void MainWindow::autocomment_update()
                }
        }
        ui->autocomment_edit->setText(QString::fromStdString(msg));
                }
        }
        ui->autocomment_edit->setText(QString::fromStdString(msg));
+
+       map<string, string> param;
+       param["autocomment_on_clock_limit"] = ui->autoshow_autocomment->isChecked() ? "1" : "0";
+       param["autocomment"] = msg;
+       ws->send_command("update " + serialize_as_json(param));
 }
 
 void MainWindow::show_scorebug_clicked()
 }
 
 void MainWindow::show_scorebug_clicked()
index 68bfff94c4d7068ac6483942164c49de78054a57..44418ef7b2240d5d890a274801854ea13b76843c 100644 (file)
           </property>
          </widget>
         </item>
           </property>
          </widget>
         </item>
+        <item>
+         <widget class="QCheckBox" name="autoshow_autocomment">
+          <property name="text">
+           <string>Auto-show on clock limit</string>
+          </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
        </layout>
       </item>
       <item>
        </layout>
       </item>
       <item>
index 273a311896ee3712ef8c87bc48d7971b4ab01f80..b25a61105f936af49b18ad2f9a9754fb080bb155 100644 (file)
--- a/score.js
+++ b/score.js
@@ -213,6 +213,13 @@ function time_elapsed_raw()
                clock_elapsed = clock_limit;
                clock_origin = Date.now();
                clock_running = false;
                clock_elapsed = clock_limit;
                clock_origin = Date.now();
                clock_running = false;
+
+               if (state['autocomment_on_clock_limit'] == '1' && !comment_visible) {
+                       state['comment'] = state['autocomment'];
+                       setcomment();
+                       showcomment();
+               }
+
                return clock_limit;
        }
        return clock_elapsed + elapsed;
                return clock_limit;
        }
        return clock_elapsed + elapsed;