6 #include <QAbstractTableModel>
11 class EventsModel : public QAbstractTableModel
14 EventsModel(sqlite3 *db) : db(db) {}
16 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, int player_id); // 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; }
34 unsigned our_score, their_score;
37 unsigned possession_sec;
39 Status get_status_at(uint64_t t);
47 mutable std::map<int, Player> players;
52 std::optional<int> player_id;
55 mutable std::vector<Event> events;
56 mutable bool stale = true;
60 void refresh_if_needed() const;
63 #endif // !defined(_EVENTS_H)