connect(ui->player_7, &QPushButton::clicked, [this]() { insert_event(7); });
// Offensive events
+ connect(ui->offense_label, &ClickableLabel::clicked, [this]() { insert_noplayer_event("set_offense"); });
connect(ui->catch_, &QPushButton::clicked, [this]() { set_current_event_type("catch"); });
connect(ui->throwaway, &QPushButton::clicked, [this]() { set_current_event_type("throwaway"); });
connect(ui->drop, &QPushButton::clicked, [this]() { set_current_event_type("drop"); });
connect(ui->pull_landed, &QPushButton::clicked, [this]() { insert_noplayer_event("pull_landed"); });
// Defensive events (TODO add more)
+ connect(ui->defense_label, &ClickableLabel::clicked, [this]() { insert_noplayer_event("set_defense"); });
connect(ui->their_throwaway, &QPushButton::clicked, [this]() { insert_noplayer_event("their_throwaway"); });
connect(ui->their_goal, &QPushButton::clicked, [this]() { insert_noplayer_event("their_goal"); });
connect(ui->their_pull, &QPushButton::clicked, [this]() { insert_noplayer_event("their_pull"); });
{
EventsModel::Status s = events->get_status_at(t);
char buf[256];
+ const char *offense = "not started";
+ if (s.offense) {
+ assert(!s.defense);
+ offense = "offense";
+ } else if (s.defense) {
+ offense = "defense";
+ }
+
snprintf(buf, sizeof(buf), "%d–%d | %s | %d passes, %d sec possession",
- s.our_score, s.their_score, s.offense ? "offense" : "defense", s.num_passes, s.possession_sec);
+ s.our_score, s.their_score, offense, s.num_passes, s.possession_sec);
if (s.stoppage_sec > 0) {
char buf2[256];
snprintf(buf2, sizeof(buf2), "%s (plus %d sec stoppage)", buf, s.stoppage_sec);
ui->offensive_soft_minus->setEnabled(s.offense && has_selection_with_player);
// TODO: be stricter
- ui->pull->setEnabled(!s.offense && s.should_pull && has_selection_with_player);
- ui->pull_landed->setEnabled(!s.offense && has_selection_with_player);
-
- ui->interception->setEnabled(!s.offense && has_selection_with_player);
- ui->their_throwaway->setEnabled(!s.offense);
- ui->our_defense->setEnabled(!s.offense && has_selection_with_player);
- ui->their_goal->setEnabled(!s.offense);
- ui->defensive_soft_plus->setEnabled(!s.offense && has_selection_with_player);
- ui->defensive_soft_minus->setEnabled(!s.offense && has_selection_with_player);
+ ui->pull->setEnabled(s.defense && s.should_pull && has_selection_with_player);
+ ui->pull_landed->setEnabled(s.defense && has_selection_with_player);
+
+ ui->interception->setEnabled(s.defense && has_selection_with_player);
+ ui->their_throwaway->setEnabled(s.defense);
+ ui->our_defense->setEnabled(s.defense && has_selection_with_player);
+ ui->their_goal->setEnabled(s.defense);
+ ui->defensive_soft_plus->setEnabled(s.defense && has_selection_with_player);
+ ui->defensive_soft_minus->setEnabled(s.defense && has_selection_with_player);
ui->their_pull->setEnabled(s.offense && s.should_pull);
- ui->our_foul->setEnabled(!s.offense && has_selection_with_player);
+ ui->our_foul->setEnabled(s.defense && has_selection_with_player);
}
sqlite3 *open_db(const char *filename)