X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=mainwindow.h;h=c16681b18d53cc6adb4bad68605f4d3dc9e203e0;hb=0e5644cd3643825c6c9413f8aaacbf4623aec77a;hp=e78463dc83a388ad99d70f38c3369b25b61f1b1a;hpb=b559be6b7d8362ec1d2fe9277cb8e9cfb9a6559e;p=pkanalytics diff --git a/mainwindow.h b/mainwindow.h index e78463d..c16681b 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -1,29 +1,55 @@ -#include #include #include #include +#include #include #include "ui_mainwindow.h" class EventsModel; +class PlayersModel; +class FormationsModel; class MainWindow : public QMainWindow { Q_OBJECT public: - MainWindow(); - void setModel(EventsModel *model); + MainWindow(EventsModel *events, PlayersModel *players, + 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); void seek(int64_t delta_ms); + 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_throwaway(); + void insert_or_change_formation(bool offense); void delete_current_event(); + void make_substitution(); + void formation_double_clicked(bool offense, unsigned row); + void open_edit_player_dialog(unsigned row); + + void update_ui_from_time(uint64_t t); + void update_status(uint64_t t); + void update_player_buttons(uint64_t t); + void update_action_buttons(uint64_t t); + void update_gender_ratio(uint64_t t); Ui::MainWindow *ui; - EventsModel *model; + EventsModel *events; + PlayersModel *players; + FormationsModel *offensive_formations; + FormationsModel *defensive_formations; bool seeking = false; - bool playing = true; + std::atomic playing{true}; std::optional buffered_seek; - QMediaPlayer *player; + sqlite3 *db; // TODO: Check threading + int match_id; };