00001 #ifndef QFRIENDLISTMODEL_H
00002 #define QFRIENDLISTMODEL_H
00003
00004 #include <QAbstractListModel>
00005 #include <datatypes/friend.h>
00006
00007 class QFriendListModel : public QAbstractListModel
00008 {
00009 Q_OBJECT
00010 public:
00011 explicit QFriendListModel(QObject *parent = 0):
00012 QAbstractListModel(parent) {};
00013
00014 int rowCount(const QModelIndex &parent = QModelIndex()) const;
00015 QVariant data(const QModelIndex &index, int role) const;
00016 QVariant headerData(int section, Qt::Orientation orientation,
00017 int role = Qt::DisplayRole) const;
00018
00019 void setNameFilter(const QString &str);
00020
00021 QModelIndex getIndex(const Friend& fr) const;
00022 QModelIndex getIndex(const QString& accountId, const QString& ownerId) const;
00023 signals:
00024
00025 public slots:
00026 void updateList(const FriendList &lst);
00027
00028 private:
00029
00030 FriendList frList;
00031
00032
00033 FriendList onlineList;
00034
00035 QString nameFilter;
00036
00037 void updateOnlineList();
00038 };
00039
00040 #endif // QFRIENDLISTMODEL_H