Changeset View
Changeset View
Standalone View
Standalone View
src/core/model/usersmodel.h
Show All 37 Lines | 30 | public: | |||
---|---|---|---|---|---|
38 | Q_ENUM(UserRoles) | 38 | Q_ENUM(UserRoles) | ||
39 | 39 | | |||
40 | explicit UsersModel(QObject *parent = nullptr); | 40 | explicit UsersModel(QObject *parent = nullptr); | ||
41 | ~UsersModel() override; | 41 | ~UsersModel() override; | ||
42 | 42 | | |||
43 | Q_REQUIRED_RESULT int rowCount(const QModelIndex &parent = QModelIndex()) const override; | 43 | Q_REQUIRED_RESULT int rowCount(const QModelIndex &parent = QModelIndex()) const override; | ||
44 | Q_REQUIRED_RESULT QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; | 44 | Q_REQUIRED_RESULT QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; | ||
45 | 45 | | |||
46 | void addUser(User *userFromUserId); | 46 | void addUser(const User &userFromUserId); | ||
47 | void removeUser(const QString &userId); | 47 | void removeUser(const QString &userId); | ||
48 | 48 | | |||
49 | void updateUser(const QJsonObject &array); | 49 | void updateUser(const QJsonObject &array); | ||
50 | Q_REQUIRED_RESULT QString userStatusIconFileName(const QString &name) const; | 50 | Q_REQUIRED_RESULT QString userStatusIconFileName(const QString &name) const; | ||
51 | 51 | | |||
52 | Q_REQUIRED_RESULT QString status(const QString &userId) const; | 52 | Q_REQUIRED_RESULT QString status(const QString &userId) const; | ||
53 | 53 | | |||
54 | Q_SIGNALS: | 54 | Q_SIGNALS: | ||
55 | void userStatusChanged(User *user); | 55 | void userStatusChanged(const User &user); | ||
56 | void userNameChanged(User *user); | 56 | void userNameChanged(const User &user); | ||
57 | void nameChanged(User *user); | 57 | void nameChanged(const User &user); | ||
58 | void statusMessageChanged(User *user); | 58 | void statusMessageChanged(const User &user); | ||
59 | 59 | | |||
60 | private: | 60 | private: | ||
61 | Q_DISABLE_COPY(UsersModel) | 61 | Q_DISABLE_COPY(UsersModel) | ||
62 | QVector<User *> mUsers; | 62 | QVector<User> mUsers; | ||
63 | }; | 63 | }; | ||
64 | 64 | | |||
65 | #endif // USERSMODEL_H | 65 | #endif // USERSMODEL_H |