connect(ui->player_7, &QPushButton::clicked, [this]() {
ui->event_view->selectRow(model->insert_event(player->position(), 7));
});
+
+ // TODO: disable if nothing is selected
+ connect(ui->catch_, &QPushButton::clicked, [this]() { set_current_event_type("catch"); });
+ connect(ui->throwaway, &QPushButton::clicked, [this]() { set_current_event_type("throwaway"); });
+ 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->pull, &QPushButton::clicked, [this]() { set_current_event_type("pull"); });
+ connect(ui->pull_landed, &QPushButton::clicked, [this]() { set_current_event_type("pull_landed"); });
}
void MainWindow::setModel(EventsModel *model)
}
}
+void MainWindow::set_current_event_type(const string &type)
+{
+ QItemSelectionModel *select = ui->event_view->selectionModel();
+ if (!select->hasSelection()) {
+ return;
+ }
+ int row = select->selectedRows().front().row(); // Should only be one, due to our selection behavior.
+ model->set_event_type(row, type);
+}
+
sqlite3 *open_db(const char *filename)
{
sqlite3 *db;