6 #include <QAbstractTableModel>
12 class EventsModel : public QAbstractTableModel
15 EventsModel(sqlite3 *db);
17 int rowCount(const QModelIndex &parent) const override
21 int columnCount(const QModelIndex &column) const override
25 QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
26 QVariant data(const QModelIndex &index, int role) const override;
28 unsigned insert_event(uint64_t t, std::optional<int> player_id, const std::string &type = "unknown"); // Returns the row.
29 void delete_event(unsigned row);
30 void set_event_type(unsigned row, const std::string &type);
31 uint64_t get_time(unsigned row) { return events[row].t; }
32 std::optional<int> get_player_id(unsigned row) { return events[row].player_id; }
35 unsigned our_score, their_score;
39 unsigned possession_sec;
40 unsigned stoppage_sec;
42 Status get_status_at(uint64_t t);
43 std::set<int> get_team_at(uint64_t t);
51 std::map<int, Player> players;
56 std::optional<int> player_id;
59 std::vector<Event> events;
66 #endif // !defined(_EVENTS_H)