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);
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 set_all_scorebug_clicked();
void add_goal(QSpinBox *box, int delta);
void set_clock_clicked();
+ void set_clock_limit_clicked();
void start_and_show_clock_clicked();
void stop_clock_clicked();
void show_clock_clicked();
<rect>
<x>0</x>
<y>0</y>
- <width>803</width>
+ <width>805</width>
<height>597</height>
</rect>
</property>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="value">
- <number>30</number>
- </property>
</widget>
</item>
<item>
<item>
<widget class="QPushButton" name="set_clock_btn">
<property name="text">
- <string>Set</string>
+ <string>Set clock</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_14">
+ <property name="text">
+ <string>Set clock limit to:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="clock_limit_min_box">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="value">
+ <number>30</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_15">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="clock_limit_sec_box">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximum">
+ <number>59</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="set_clock_limit_btn">
+ <property name="text">
+ <string>Set limit</string>
</property>
</widget>
</item>
setclock(amount);
}
+function setclocklimitfromstate()
+{
+ let amount = parseInt(state['clock_limit_min']) * 60 + parseInt(state['clock_limit_sec']);
+ clock_limit = amount;
+}
+
function showclock()
{
if (clock_visible) return;