ui->setupUi(this);
ui->event_view->setModel(events);
+ ui->event_view->setColumnWidth(1, 150);
+ ui->event_view->setColumnWidth(2, 150);
connect(ui->event_view->selectionModel(), &QItemSelectionModel::currentRowChanged,
[this, events](const QModelIndex ¤t, const QModelIndex &previous) {
uint64_t t = events->get_time(current.row());
{
EventsModel::Status s = events->get_status_at(t);
char buf[256];
- const char *offense = "not started";
+ std::string formation = "Not started";
if (s.attack_state == EventsModel::Status::OFFENSE) {
- offense = "offense";
+ if (s.offensive_formation != 0) {
+ formation = offensive_formations->get_formation_name_by_id(s.offensive_formation);
+ } else {
+ formation = "Offense";
+ }
} else if (s.attack_state == EventsModel::Status::DEFENSE) {
- offense = "defense";
+ if (s.defensive_formation != 0) {
+ formation = defensive_formations->get_formation_name_by_id(s.defensive_formation);
+ } else {
+ formation = "Defense";
+ }
}
snprintf(buf, sizeof(buf), "%d–%d | %s | %d passes, %d sec possession",
- s.our_score, s.their_score, offense, s.num_passes, s.possession_sec);
+ s.our_score, s.their_score, formation.c_str(), 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);
return;
}
- // FIXME insert
+ id = formations->insert_new(new_formation_str.toStdString());
+ QListView *view = offense ? ui->offensive_formation_view : ui->defensive_formation_view;
+ view->selectionModel()->select(formations->index(formations->get_row_from_id(id), 0), QItemSelectionModel::ClearAndSelect);
+ events->inserted_new_formation(id, new_formation_str.toStdString());
} else {
events->set_formation_at(video->position(), offense, id);
}