- video = new QMediaPlayer;
- //video->setSource(QUrl::fromLocalFile("/home/sesse/dev/stats/ultimate.mkv"));
- video->setSource(QUrl::fromLocalFile("/home/sesse/dev/stats/ultimate-prores.mkv"));
- video->play();
-
- ui = new Ui::MainWindow;
- ui->setupUi(this);
-
- ui->event_view->setModel(events);
- connect(ui->event_view->selectionModel(), &QItemSelectionModel::currentRowChanged,
- [this, events](const QModelIndex ¤t, const QModelIndex &previous) {
- video->setPosition(events->get_time(current.row()));
- });
-
- ui->player_view->setModel(players);
-
- connect(video, &QMediaPlayer::positionChanged, [this](uint64_t pos) {
- position_changed(pos);
- });
-
- video->setVideoOutput(ui->video);
-
- connect(ui->minus10s, &QPushButton::clicked, [this]() { seek(-10000); });
- connect(ui->plus10s, &QPushButton::clicked, [this]() { seek(10000); });
-
- connect(ui->minus2s, &QPushButton::clicked, [this]() { seek(-2000); });
- connect(ui->plus2s, &QPushButton::clicked, [this]() { seek(2000); });
-
- // TODO: Would be nice to actually have a frame...
- connect(ui->minus1f, &QPushButton::clicked, [this]() { seek(-20); });
- connect(ui->plus1f, &QPushButton::clicked, [this]() { seek(20); });
-
- connect(ui->play_pause, &QPushButton::clicked, [this]() {
- if (playing) {
- video->pause();
- ui->play_pause->setText("Play (space)");
- } else {
- video->setPlaybackRate(1.0);
- video->play();
- ui->play_pause->setText("Pause (space)");
- }
- playing = !playing;
-
- // Needs to be set anew when we modify setText(), evidently.
- ui->play_pause->setShortcut(QCoreApplication::translate("MainWindow", "Space", nullptr));
- });
-
- connect(ui->player_1, &QPushButton::clicked, [this]() { insert_event(1); });
- connect(ui->player_2, &QPushButton::clicked, [this]() { insert_event(2); });
- connect(ui->player_3, &QPushButton::clicked, [this]() { insert_event(3); });
- connect(ui->player_4, &QPushButton::clicked, [this]() { insert_event(4); });
- connect(ui->player_5, &QPushButton::clicked, [this]() { insert_event(5); });
- connect(ui->player_6, &QPushButton::clicked, [this]() { insert_event(6); });
- connect(ui->player_7, &QPushButton::clicked, [this]() { insert_event(7); });
-
- // Offensive events
- // 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"); });