QTfrontend/model/playerslistmodel.h
changeset 9503 8f9b04138456
parent 8891 bf67b4d7d7b4
child 9725 68b5d87cfdb0
equal deleted inserted replaced
9501:dc3d658de350 9503:8f9b04138456
     4 #include <QAbstractListModel>
     4 #include <QAbstractListModel>
     5 #include <QHash>
     5 #include <QHash>
     6 #include <QIcon>
     6 #include <QIcon>
     7 #include <QModelIndex>
     7 #include <QModelIndex>
     8 #include <QSet>
     8 #include <QSet>
       
     9 #include <QFont>
     9 
    10 
    10 class PlayersListModel : public QAbstractListModel
    11 class PlayersListModel : public QAbstractListModel
    11 {
    12 {
    12     Q_OBJECT
    13     Q_OBJECT
    13 
    14 
    17         ServerAdmin = Qt::UserRole + 1,
    18         ServerAdmin = Qt::UserRole + 1,
    18         RoomAdmin   = Qt::UserRole + 2,
    19         RoomAdmin   = Qt::UserRole + 2,
    19         Registered  = Qt::UserRole + 3,
    20         Registered  = Qt::UserRole + 3,
    20         Friend      = Qt::UserRole + 4,
    21         Friend      = Qt::UserRole + 4,
    21         Ignore      = Qt::UserRole + 5,
    22         Ignore      = Qt::UserRole + 5,
    22         InGame      = Qt::UserRole + 6
    23         InGame      = Qt::UserRole + 6,
       
    24         InRoom      = Qt::UserRole + 7,
       
    25         Contributor = Qt::UserRole + 8
    23     };
    26     };
    24 
    27 
    25     enum SpecialRoles {
    28     enum SpecialRoles {
    26         SortRole       = Qt::UserRole + 100,
    29         SortRole       = Qt::UserRole + 100,
    27         RoomFilterRole = Qt::UserRole + 101
    30         RoomFilterRole = Qt::UserRole + 101
    59     QHash<quint32, QIcon> & m_icons();
    62     QHash<quint32, QIcon> & m_icons();
    60     typedef QHash<int, QVariant> DataEntry;
    63     typedef QHash<int, QVariant> DataEntry;
    61     QList<DataEntry> m_data;
    64     QList<DataEntry> m_data;
    62     QSet<QString> m_friendsSet, m_ignoredSet;
    65     QSet<QString> m_friendsSet, m_ignoredSet;
    63     QString m_nickname;
    66     QString m_nickname;
       
    67     QFont m_fontInRoom;
    64 
    68 
    65     void updateIcon(const QModelIndex & index);
    69     void updateIcon(const QModelIndex & index);
    66     void updateSortData(const QModelIndex & index);
    70     void updateSortData(const QModelIndex & index);
    67     void loadSet(QSet<QString> & set, const QString & suffix);
    71     void loadSet(QSet<QString> & set, const QString & suffix);
    68     void saveSet(const QSet<QString> & set, const QString & suffix);
    72     void saveSet(const QSet<QString> & set, const QString & suffix);