- 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));
- });