#pragma once #include #include #include #include #include class ReactionsModel : public QAbstractListModel { Q_OBJECT public: explicit ReactionsModel(QObject *parent = nullptr) { Q_UNUSED(parent); } enum Roles { Key, Count, Users, SelfReacted, }; QHash roleNames() const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; public slots: void addReaction(const std::string &room_id, const mtx::events::RoomEvent &reaction); void removeReaction(const mtx::events::RoomEvent &reaction); private: struct KeyReaction { std::string key; std::map> reactions; }; std::string room_id_; std::vector reactions; };