From: Steinar H. Gunderson Date: Sat, 22 Jul 2023 18:38:07 +0000 (+0200) Subject: We only need one set of soft plus/minus buttons. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=fb839f83f5113f02fb9ef3485f27f5b220919a4c;p=pkanalytics We only need one set of soft plus/minus buttons. --- diff --git a/mainwindow.cpp b/mainwindow.cpp index af32288..81e7e92 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -212,8 +212,22 @@ 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->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 +251,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 +497,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->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 +527,12 @@ 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->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 +553,12 @@ 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->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 +571,14 @@ 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->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); } diff --git a/mainwindow.ui b/mainwindow.ui index 207d0c5..8459660 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -105,16 +105,6 @@ - - - - Pull (&p) - - - P - - - @@ -125,16 +115,6 @@ - - - - true - - - Formation (&o) - - - @@ -145,43 +125,43 @@ - - + + - Soft plus (&+) + Drop (&x) - + + X - - + + - Soft minus (&-) + Goal (&g) - - + G - - - - Drop (&x) + + + + true - - X + + Formation (&o) - - + + - Goal (&g) + Pull (&p) - G + P @@ -209,16 +189,6 @@ - - - - Soft plus (&+) - - - + - - - @@ -239,16 +209,6 @@ - - - - Soft minus (&-) - - - - - - - @@ -259,7 +219,7 @@ - + Their pull (&p) @@ -269,7 +229,7 @@ - + true @@ -296,7 +256,17 @@ - + + + + Stoppage (&v) + + + V + + + + Substitution (&b) @@ -306,7 +276,7 @@ - + Unknown (&?) @@ -316,7 +286,7 @@ - + Delete (⌫) @@ -326,13 +296,23 @@ + + + + Soft plus (&+) + + + + + + + - + - Stoppage (&v) + Soft minus (&-) - V + -