X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mainwindow.cpp;h=b8322cbb856c20f0c5902251d45e8135afd242e2;hb=a99f0e230c64ab728c9a83008b89e77893809c1f;hp=af32288d8a33eb083a5ff2f4ba9f5fc58e63cbcd;hpb=fd038d3480948dca80cdb41f4d764295918db30d;p=pkanalytics diff --git a/mainwindow.cpp b/mainwindow.cpp index af32288..b8322cb 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -212,8 +212,23 @@ MainWindow::MainWindow(EventsModel *events, PlayersModel *players, }); connect(ui->drop, &QPushButton::clicked, [this]() { set_current_event_type("drop"); }); connect(ui->goal, &QPushButton::clicked, [this]() { set_current_event_type("goal"); }); - connect(ui->offensive_soft_plus, &QPushButton::clicked, [this]() { set_current_event_type("offensive_soft_plus"); }); - connect(ui->offensive_soft_minus, &QPushButton::clicked, [this]() { set_current_event_type("offensive_soft_minus"); }); + connect(ui->stallout, &QPushButton::clicked, [this]() { set_current_event_type("stallout"); }); + connect(ui->soft_plus, &QPushButton::clicked, [this, events]() { + EventsModel::Status s = events->get_status_at(ui->video->get_position()); + if (s.attack_state == EventsModel::Status::OFFENSE) { + set_current_event_type("offensive_soft_plus"); + } else if (s.attack_state == EventsModel::Status::DEFENSE) { + set_current_event_type("defensive_soft_plus"); + } + }); + connect(ui->soft_minus, &QPushButton::clicked, [this, events]() { + EventsModel::Status s = events->get_status_at(ui->video->get_position()); + if (s.attack_state == EventsModel::Status::OFFENSE) { + set_current_event_type("offensive_soft_minus"); + } else if (s.attack_state == EventsModel::Status::DEFENSE) { + set_current_event_type("defensive_soft_minus"); + } + }); 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) { @@ -237,8 +252,6 @@ MainWindow::MainWindow(EventsModel *events, PlayersModel *players, } }); connect(ui->our_defense, &QPushButton::clicked, [this]() { set_current_event_type("defense"); }); - connect(ui->defensive_soft_plus, &QPushButton::clicked, [this]() { set_current_event_type("defensive_soft_plus"); }); - connect(ui->defensive_soft_minus, &QPushButton::clicked, [this]() { set_current_event_type("defensive_soft_minus"); }); connect(ui->offensive_formation, &QPushButton::clicked, [this]() { insert_or_change_formation(/*offense=*/true); }); connect(ui->defensive_formation, &QPushButton::clicked, [this]() { insert_or_change_formation(/*offense=*/false); }); @@ -485,15 +498,14 @@ void MainWindow::update_action_buttons(uint64_t t) ui->throwaway->setEnabled(false); ui->drop->setEnabled(false); ui->goal->setEnabled(false); - ui->offensive_soft_plus->setEnabled(false); - ui->offensive_soft_minus->setEnabled(false); + ui->stallout->setEnabled(false); + ui->soft_plus->setEnabled(false); + ui->soft_minus->setEnabled(false); ui->pull_or_was_d->setEnabled(false); ui->interception->setEnabled(false); ui->their_throwaway->setEnabled(false); ui->our_defense->setEnabled(false); ui->their_goal->setEnabled(false); - ui->defensive_soft_plus->setEnabled(false); - ui->defensive_soft_minus->setEnabled(false); ui->their_pull->setEnabled(false); return; } else { @@ -517,14 +529,13 @@ void MainWindow::update_action_buttons(uint64_t t) ui->throwaway->setEnabled(false); ui->drop->setEnabled(false); ui->goal->setEnabled(false); - ui->offensive_soft_plus->setEnabled(false); - ui->offensive_soft_minus->setEnabled(false); + ui->stallout->setEnabled(false); + ui->soft_plus->setEnabled(false); + ui->soft_minus->setEnabled(false); ui->interception->setEnabled(false); ui->their_throwaway->setEnabled(false); ui->our_defense->setEnabled(false); ui->their_goal->setEnabled(false); - ui->defensive_soft_plus->setEnabled(false); - ui->defensive_soft_minus->setEnabled(false); return; } if (s.pull_state == EventsModel::Status::PULL_IN_AIR) { @@ -545,14 +556,13 @@ void MainWindow::update_action_buttons(uint64_t t) ui->catch_->setEnabled(false); ui->drop->setEnabled(false); ui->goal->setEnabled(false); - ui->offensive_soft_plus->setEnabled(false); - ui->offensive_soft_minus->setEnabled(false); + ui->stallout->setEnabled(false); + ui->soft_plus->setEnabled(false); + ui->soft_minus->setEnabled(false); ui->interception->setEnabled(false); ui->their_throwaway->setEnabled(false); ui->our_defense->setEnabled(false); ui->their_goal->setEnabled(false); - ui->defensive_soft_plus->setEnabled(false); - ui->defensive_soft_minus->setEnabled(false); return; } @@ -565,16 +575,15 @@ void MainWindow::update_action_buttons(uint64_t t) ui->throwaway->setEnabled(s.attack_state == EventsModel::Status::OFFENSE && has_selection_with_player); ui->drop->setEnabled(s.attack_state == EventsModel::Status::OFFENSE && has_selection_with_player); ui->goal->setEnabled(s.attack_state == EventsModel::Status::OFFENSE && has_selection_with_player); - ui->offensive_soft_plus->setEnabled(s.attack_state == EventsModel::Status::OFFENSE && has_selection_with_player); - ui->offensive_soft_minus->setEnabled(s.attack_state == EventsModel::Status::OFFENSE && has_selection_with_player); + ui->stallout->setEnabled(s.attack_state == EventsModel::Status::OFFENSE && has_selection_with_player); + ui->soft_plus->setEnabled(s.attack_state != EventsModel::Status::NOT_STARTED && has_selection_with_player); + ui->soft_minus->setEnabled(s.attack_state != EventsModel::Status::NOT_STARTED && has_selection_with_player); ui->pull_or_was_d->setEnabled(s.attack_state == EventsModel::Status::OFFENSE && has_selection_with_player); // Was d-ed. ui->interception->setEnabled(s.attack_state == EventsModel::Status::DEFENSE && has_selection_with_player); ui->their_throwaway->setEnabled(s.attack_state == EventsModel::Status::DEFENSE); ui->our_defense->setEnabled(s.attack_state == EventsModel::Status::DEFENSE && has_selection_with_player); ui->their_goal->setEnabled(s.attack_state == EventsModel::Status::DEFENSE); - ui->defensive_soft_plus->setEnabled(s.attack_state == EventsModel::Status::DEFENSE && has_selection_with_player); - ui->defensive_soft_minus->setEnabled(s.attack_state == EventsModel::Status::DEFENSE && has_selection_with_player); ui->their_pull->setEnabled(false); }