if (!playing) {
video->pause(); // We only played to get a picture.
}
- update_status();
+ update_ui_from_time(pos);
}
void MainWindow::seek(int64_t delta_ms)
}
int row = select->selectedRows().front().row(); // Should only be one, due to our selection behavior.
events->set_event_type(row, type);
- update_status();
+ update_ui_from_time(video->position());
}
void MainWindow::delete_current_event()
ui->event_view->selectionModel()->blockSignals(true);
events->delete_event(row);
ui->event_view->selectionModel()->blockSignals(false);
- update_status();
+ update_ui_from_time(video->position());
}
void MainWindow::make_substitution()
}
}
-void MainWindow::update_status()
+void MainWindow::update_ui_from_time(uint64_t t)
+{
+ update_status(t);
+ update_player_buttons(t);
+}
+
+void MainWindow::update_status(uint64_t t)
{
- uint64_t t = video->position();
EventsModel::Status s = events->get_status_at(t);
char buf[256];
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);
ui->status->setText(buf);
+}
+void MainWindow::update_player_buttons(uint64_t t)
+{
// FIXME: sort by number, instead of by internal ID
QPushButton *buttons[] = {
ui->player_1,
void set_current_event_type(const std::string &type);
void delete_current_event();
void make_substitution();
- void update_status();
+
+ void update_ui_from_time(uint64_t t);
+ void update_status(uint64_t t);
+ void update_player_buttons(uint64_t t);
Ui::MainWindow *ui;
EventsModel *events;