QTfrontend/model/playerslistmodel.cpp
changeset 7731 262228c64f15
parent 7728 664738870325
child 7732 fad3408fdcc1
--- a/QTfrontend/model/playerslistmodel.cpp	Mon Oct 08 13:27:46 2012 -0400
+++ b/QTfrontend/model/playerslistmodel.cpp	Mon Oct 08 23:57:17 2012 +0400
@@ -102,6 +102,24 @@
 }
 
 
+void PlayersListModel::playerJoinedRoom(const QString & nickname)
+{
+    QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname);
+
+    if(mil.size())
+        setData(mil[0], "1", RoomFilterRole);
+}
+
+
+void PlayersListModel::playerLeftRoom(const QString & nickname)
+{
+    QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname);
+
+    if(mil.size())
+        setData(mil[0], "0", RoomFilterRole);
+}
+
+
 void PlayersListModel::setFlag(const QString &nickname, StateFlag flagType, bool isSet)
 {
     QModelIndexList mil = match(index(0), Qt::DisplayRole, nickname);
@@ -119,6 +137,21 @@
 }
 
 
+void PlayersListModel::resetRoomFlags()
+{
+    for(int i = rowCount() - 1; i >= 0; --i)
+    {
+        QModelIndex mi = index(i);
+
+        if(mi.data(RoomFilterRole).toString() == "1")
+        {
+            setData(mi, "0", RoomFilterRole);
+            setData(mi, false, RoomAdmin);
+            setData(mi, false, Ready);
+        }
+    }
+}
+
 void PlayersListModel::updateIcon(const QModelIndex & index)
 {
     quint32 iconNum = 0;