]> git.sesse.net Git - pkanalytics/blobdiff - mainwindow.h
Make persistent PBOs for faster texture upload.
[pkanalytics] / mainwindow.h
index 83ed90957118262b443acb0eabbfb318926acb3b..ea4ba37048a4e893280713276b6558a5eba82ae9 100644 (file)
@@ -2,6 +2,7 @@
 #include <QMainWindow>
 #include <QApplication>
 #include <stdint.h>
+#include <sqlite3.h>
 #include <optional>
 #include "ui_mainwindow.h"
 
@@ -15,7 +16,13 @@ class MainWindow : public QMainWindow
 
 public:
        MainWindow(EventsModel *events, PlayersModel *players,
-                  FormationsModel *offensive_formations, FormationsModel *defensive_formations);
+                  FormationsModel *offensive_formations, FormationsModel *defensive_formations,
+                  sqlite3 *db, int match_id);
+       ~MainWindow() {
+               if (ui && ui->video) {
+                       ui->video->stop();
+               }
+       }
 
 private:
        void position_changed(uint64_t pos);
@@ -23,6 +30,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 +46,8 @@ 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;
+       sqlite3 *db;  // TODO: Check threading
+       int match_id;
 };