]> git.sesse.net Git - pkanalytics/blobdiff - main.cpp
Fix handling of multiple filters.
[pkanalytics] / main.cpp
index b0488a0304b54e9d9018ce1b6d259dea107952b2..01b158373c1bc9cf620744055134dbe8a5a3ddf9 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -47,6 +47,8 @@ MainWindow::MainWindow(EventsModel *events, PlayersModel *players,
        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 &current, const QModelIndex &previous) {
                        uint64_t t = events->get_time(current.row());
@@ -299,15 +301,23 @@ void MainWindow::update_status(uint64_t t)
 {
        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);