QTfrontend/model/playerslistmodel.cpp
changeset 7731 262228c64f15
parent 7728 664738870325
child 7732 fad3408fdcc1
equal deleted inserted replaced
7730:2013733f9ca9 7731:262228c64f15
   100     if(mil.size())
   100     if(mil.size())
   101         removeRow(mil[0].row());
   101         removeRow(mil[0].row());
   102 }
   102 }
   103 
   103 
   104 
   104 
       
   105 void PlayersListModel::playerJoinedRoom(const QString & nickname)
       
   106 {
       
   107     QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname);
       
   108 
       
   109     if(mil.size())
       
   110         setData(mil[0], "1", RoomFilterRole);
       
   111 }
       
   112 
       
   113 
       
   114 void PlayersListModel::playerLeftRoom(const QString & nickname)
       
   115 {
       
   116     QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname);
       
   117 
       
   118     if(mil.size())
       
   119         setData(mil[0], "0", RoomFilterRole);
       
   120 }
       
   121 
       
   122 
   105 void PlayersListModel::setFlag(const QString &nickname, StateFlag flagType, bool isSet)
   123 void PlayersListModel::setFlag(const QString &nickname, StateFlag flagType, bool isSet)
   106 {
   124 {
   107     QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname);
   125     QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname);
   108 
   126 
   109     if(mil.size())
   127     if(mil.size())
   116 
   134 
   117         updateIcon(mil[0]);
   135         updateIcon(mil[0]);
   118     }
   136     }
   119 }
   137 }
   120 
   138 
       
   139 
       
   140 void PlayersListModel::resetRoomFlags()
       
   141 {
       
   142     for(int i = rowCount() - 1; i >= 0; --i)
       
   143     {
       
   144         QModelIndex mi = index(i);
       
   145 
       
   146         if(mi.data(RoomFilterRole).toString() == "1")
       
   147         {
       
   148             setData(mi, "0", RoomFilterRole);
       
   149             setData(mi, false, RoomAdmin);
       
   150             setData(mi, false, Ready);
       
   151         }
       
   152     }
       
   153 }
   121 
   154 
   122 void PlayersListModel::updateIcon(const QModelIndex & index)
   155 void PlayersListModel::updateIcon(const QModelIndex & index)
   123 {
   156 {
   124     quint32 iconNum = 0;
   157     quint32 iconNum = 0;
   125 
   158