]> git.sesse.net Git - pkanalytics/blob - mainwindow.h
Support filtering passes by thrower and receiver.
[pkanalytics] / mainwindow.h
1 #include <QMainWindow>
2 #include <QApplication>
3 #include <stdint.h>
4 #include <sqlite3.h>
5 #include <optional>
6 #include "ui_mainwindow.h"
7
8 class EventsModel;
9 class PlayersModel;
10 class FormationsModel;
11
12 class MainWindow : public QMainWindow
13 {
14         Q_OBJECT
15
16 public:
17         MainWindow(EventsModel *events, PlayersModel *players,
18                    FormationsModel *offensive_formations, FormationsModel *defensive_formations,
19                    sqlite3 *db, int match_id);
20         ~MainWindow() {
21                 if (ui && ui->video) {
22                         ui->video->stop();
23                 }
24         }
25
26 private:
27         void position_changed(uint64_t pos);
28         void seek(int64_t delta_ms);
29         void insert_player_event(int button_id);
30         void insert_noplayer_event(const std::string &type);
31         void set_current_event_type(const std::string &type);
32         void insert_throwaway();
33         void insert_or_change_formation(bool offense);
34         void delete_current_event();
35         void make_substitution();
36         void formation_double_clicked(bool offense, unsigned row);
37         void open_edit_player_dialog(unsigned row);
38
39         void update_ui_from_time(uint64_t t);
40         void update_status(uint64_t t);
41         void update_player_buttons(uint64_t t);
42         void update_action_buttons(uint64_t t);
43         void update_gender_ratio(uint64_t t);
44
45         Ui::MainWindow *ui;
46         EventsModel *events;
47         PlayersModel *players;
48         FormationsModel *offensive_formations;
49         FormationsModel *defensive_formations;
50         bool seeking = false;
51         std::atomic<bool> playing{true};
52         std::optional<uint64_t> buffered_seek;
53         sqlite3 *db;  // TODO: Check threading
54         int match_id;
55 };