]> git.sesse.net Git - pkanalytics/blobdiff - mainwindow.h
Propagate errors on video opening back to the UI.
[pkanalytics] / mainwindow.h
index 9408436ae6e1e1e8a62f7f98fd62144a715d1202..95dfae78e3ae060eaf7745c041275d8a5a97a11b 100644 (file)
@@ -16,6 +16,11 @@ class MainWindow : public QMainWindow
 public:
        MainWindow(EventsModel *events, PlayersModel *players,
                   FormationsModel *offensive_formations, FormationsModel *defensive_formations);
+       ~MainWindow() {
+               if (ui && ui->video) {
+                       ui->video->stop();
+               }
+       }
 
 private:
        void position_changed(uint64_t pos);
@@ -39,7 +44,6 @@ private:
        FormationsModel *offensive_formations;
        FormationsModel *defensive_formations;
        bool seeking = false;
-       bool playing = true;
+       std::atomic<bool> playing{true};
        std::optional<uint64_t> buffered_seek;
-       QMediaPlayer *video;
 };