chatsitemmodel.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef CHATSITEMMODEL_H
  2. #define CHATSITEMMODEL_H
  3. #include "listmodel.h"
  4. class ChatsItemModel : public ListItem
  5. {
  6. Q_OBJECT
  7. public:
  8. enum Roles {
  9. cntPicStatus = Qt::UserRole+1,
  10. cntName,
  11. cntJid,
  12. cntResource,
  13. cntTextStatus,
  14. cntPicAvatar
  15. };
  16. public:
  17. ChatsItemModel(QObject *parent = 0): ListItem(parent) {}
  18. explicit ChatsItemModel( const QString &_picStatus,
  19. const QString &_contactName,
  20. const QString &_contactJid,
  21. const QString &_contactResource,
  22. const QString &_contactTextStatus,
  23. const QString &_contactPicAvatar,
  24. QObject *parent = 0 );
  25. virtual QVariant data(int role) const;
  26. virtual QHash<int, QByteArray> roleNames() const;
  27. virtual QString id() const { return m_jid; }
  28. void setPicStatus( QString &_contactPicStatus );
  29. void setContactName( QString &_contactName );
  30. void setJid( QString &_contactJid );
  31. void setResource( QString &_contactResource );
  32. void setTextStatus( QString &_contactTextStatus );
  33. void setAvatar( QString &_contactPicAvatar );
  34. inline QString picStatus() const { return m_pic_status; }
  35. inline QString contactName() const { return m_name; }
  36. inline QString contactJid() const { return m_jid; }
  37. inline QString contactResource() const { return m_resource; }
  38. inline QString textStatus() const { return m_text_status; }
  39. inline QString picAvatar() const { return m_avatar; }
  40. private:
  41. QString m_pic_status;
  42. QString m_name;
  43. QString m_jid;
  44. QString m_resource;
  45. QString m_text_status;
  46. QString m_avatar;
  47. };
  48. #endif // CHATSITEMMODEL_H