]> git.sesse.net Git - pkanalytics/blobdiff - mainwindow.h
playing is used from multiple threads, so it must be atomic.
[pkanalytics] / mainwindow.h
index 83ed90957118262b443acb0eabbfb318926acb3b..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);
@@ -23,6 +28,7 @@ private:
        void insert_player_event(int button_id);
        void insert_noplayer_event(const std::string &type);
        void set_current_event_type(const std::string &type);
+       void insert_or_change_formation(bool offense);
        void delete_current_event();
        void make_substitution();
        void formation_double_clicked(bool offense, unsigned row);
@@ -38,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;
 };