connect(ui->ungoal_2_btn, &QPushButton::clicked, this, [this]() { add_goal(ui->score_2_box, -1); });
connect(ui->set_clock_btn, &QPushButton::clicked, this, &MainWindow::set_clock_clicked);
+ connect(ui->set_clock_limit_btn, &QPushButton::clicked, this, &MainWindow::set_clock_limit_clicked);
connect(ui->start_and_show_clock_btn, &QPushButton::clicked, this, &MainWindow::start_and_show_clock_clicked);
connect(ui->stop_clock_btn, &QPushButton::clicked, this, &MainWindow::stop_clock_clicked);
connect(ui->show_clock_btn, &QPushButton::clicked, this, &MainWindow::show_clock_clicked);
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);
+ connect(ui->show_roster_1_btn, &QPushButton::clicked, this, [this]() { show_roster_clicked(ui->initials_1_edit->text().toStdString()); });
+ connect(ui->show_roster_2_btn, &QPushButton::clicked, this, [this]() { show_roster_clicked(ui->initials_2_edit->text().toStdString()); });
+ connect(ui->show_roster_carousel_btn, &QPushButton::clicked, this, &MainWindow::show_roster_carousel_clicked);
autocomment_update();
acmp->send_command("cg 1 invoke 1 setclockfromstate");
}
+void MainWindow::set_clock_limit_clicked()
+{
+ map<string, string> param;
+ param["clock_limit_min"] = to_string(ui->clock_limit_min_box->value());
+ param["clock_limit_sec"] = to_string(ui->clock_limit_sec_box->value());
+ acmp->send_command("cg 1 update 1 \"" + escape_quotes(serialize_as_json(param)) + "\"");
+ acmp->send_command("cg 1 invoke 1 setclocklimitfromstate");
+}
+
void MainWindow::start_and_show_clock_clicked()
{
acmp->send_command("cg 1 invoke 1 startclock"); // Also shows.
void MainWindow::quick_lower_third_activate()
{
- map<string, string> param;
- param["code"] = ui->quick_lower_third_edit->text().toStdString();
- acmp->send_command("cg 1 update 1 \"" + escape_quotes(serialize_as_json(param)) + "\"");
- acmp->send_command("cg 1 invoke 1 quicklowerthird");
+ string code = ui->quick_lower_third_edit->text().toUpper().toStdString();
+ if (code == "A") {
+ add_goal(ui->score_1_box, 1);
+ } else if (code == "B") {
+ add_goal(ui->score_2_box, 1);
+ } else if (code == "C") {
+ acmp->send_command("cg 1 invoke 1 hidelowerthird");
+ } else {
+ map<string, string> param;
+ param["code"] = code;
+ acmp->send_command("cg 1 update 1 \"" + escape_quotes(serialize_as_json(param)) + "\"");
+ acmp->send_command("cg 1 invoke 1 quicklowerthird");
+ }
ui->quick_lower_third_edit->clear();
}
string msg;
if (abs(score1 - score2) >= 3) {
msg = "Game ends after this point";
- } else if (score1 >= 12 || score2 >= 12) {
- msg = "Point cap: First to 13";
} else {
- char buf[32];
- snprintf(buf, sizeof(buf), "Pagacap: First to %d", max(score1, score2) + 1);
- msg = buf;
+ int cap = max(score1, score2) + 1;
+ if (score1 == score2) ++cap;
+
+ if (cap >= 13) {
+ msg = "Point cap: First to 13";
+ } else {
+ char buf[32];
+ snprintf(buf, sizeof(buf), "Pagacap: First to %d", cap);
+ msg = buf;
+ }
}
ui->autocomment_edit->setText(QString::fromStdString(msg));
}
acmp->send_command("cg 1 invoke 1 showgroup_from_state");
}
+void MainWindow::show_roster_clicked(const std::string &team_code)
+{
+ map<string, string> param;
+ param["team_code"] = team_code;
+ 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 showroster_from_state");
+}
+
void MainWindow::show_schedule_clicked()
{
acmp->send_command("cg 1 invoke 1 stopcarousel");
acmp->send_command("cg 1 invoke 1 showcarousel");
}
+void MainWindow::show_roster_carousel_clicked()
+{
+ map<string, string> param;
+ param["team1"] = escape_html(ui->initials_1_edit->text().toStdString());
+ param["team2"] = escape_html(ui->initials_2_edit->text().toStdString());
+ 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 showrostercarousel_from_state");
+}
+
void MainWindow::show_nothing_clicked()
{
acmp->send_command("cg 1 invoke 1 hidescorebug");