]> git.sesse.net Git - pkanalytics/blobdiff - mainwindow.cpp
Make the table header sticky on scroll.
[pkanalytics] / mainwindow.cpp
index b8322cbb856c20f0c5902251d45e8135afd242e2..0ff813b7ac7465c48192de94d08120d0daebd7a6 100644 (file)
@@ -231,7 +231,8 @@ MainWindow::MainWindow(EventsModel *events, PlayersModel *players,
        });
        connect(ui->pull_or_was_d, &QPushButton::clicked, [this, events]() {
                EventsModel::Status s = events->get_status_at(ui->video->get_position());
-               if (s.pull_state == EventsModel::Status::SHOULD_PULL) {
+               if (s.pull_state == EventsModel::Status::SHOULD_PULL ||
+                   events->get_status_at(ui->video->get_position() - 1).pull_state == EventsModel::Status::SHOULD_PULL) {
                        set_current_event_type("pull");
                } else if (s.pull_state == EventsModel::Status::PULL_IN_AIR) {
                        insert_noplayer_event("pull_landed");
@@ -351,7 +352,7 @@ void MainWindow::insert_or_change_formation(bool offense)
        QItemSelectionModel *select = ui->event_view->selectionModel();
        if (select->hasSelection()) {
                int row = select->selectedRows().front().row();  // Should only be one, due to our selection behavior.
-               string expected_type = offense ? "formation_offense" : "formation_defense";
+               EventType expected_type = offense ? EventType::FORMATION_OFFENSE : EventType::FORMATION_DEFENSE;
                if (events->get_event_type(row) == expected_type) {
                        events->set_event_formation(row, formation_id);
                        update_ui_from_time(ui->video->get_position());
@@ -521,7 +522,8 @@ void MainWindow::update_action_buttons(uint64_t t)
        ui->throwaway->setText("Throwaway (&t)");
        ui->throwaway->setShortcut(QCoreApplication::translate("MainWindow", "T", nullptr));
 
-       if (s.pull_state == EventsModel::Status::SHOULD_PULL) {
+       if (s.pull_state == EventsModel::Status::SHOULD_PULL ||
+           (has_selection_with_player && events->get_status_at(ui->video->get_position() - 1).pull_state == EventsModel::Status::SHOULD_PULL)) {  // Can change this event to pull.
                ui->pull_or_was_d->setEnabled(s.attack_state == EventsModel::Status::DEFENSE && has_selection_with_player);
                ui->their_pull->setEnabled(s.attack_state == EventsModel::Status::OFFENSE);