QTfrontend/model/playerslistmodel.cpp
branchphysfslayer
changeset 7928 88fde28bbda6
parent 7842 d1c0e4341165
child 8891 bf67b4d7d7b4
--- a/QTfrontend/model/playerslistmodel.cpp	Sun Oct 21 01:28:33 2012 +0400
+++ b/QTfrontend/model/playerslistmodel.cpp	Sat Nov 03 00:34:35 2012 +0400
@@ -110,8 +110,9 @@
 
     if(mil.size())
     {
-        setData(mil[0], "1", RoomFilterRole);
+        setData(mil[0], true, RoomFilterRole);
         updateIcon(mil[0]);
+        updateSortData(mil[0]);
     }
 }
 
@@ -122,7 +123,10 @@
 
     if(mil.size())
     {
-        setData(mil[0], "0", RoomFilterRole);
+        setData(mil[0], false, RoomFilterRole);
+        setData(mil[0], false, RoomAdmin);
+        setData(mil[0], false, Ready);
+        setData(mil[0], false, InGame);
         updateIcon(mil[0]);
     }
 }
@@ -181,9 +185,9 @@
     {
         QModelIndex mi = index(i);
 
-        if(mi.data(RoomFilterRole).toString() == "1")
+        if(mi.data(RoomFilterRole).toBool())
         {
-            setData(mi, "0", RoomFilterRole);
+            setData(mi, false, RoomFilterRole);
             setData(mi, false, RoomAdmin);
             setData(mi, false, Ready);
             setData(mi, false, InGame);
@@ -207,7 +211,7 @@
         << index.data(Friend).toBool()
         << index.data(Ignore).toBool()
         << index.data(InGame).toBool()
-        << (index.data(RoomFilterRole).toString() == "1")
+        << index.data(RoomFilterRole).toBool()
         ;
 
     for(int i = flags.size() - 1; i >= 0; --i)
@@ -225,14 +229,20 @@
 
         QPainter painter(&result);
 
-        if(index.data(RoomFilterRole).toString() == "1")
+        if(index.data(RoomFilterRole).toBool())
+        {
             if(index.data(InGame).toBool())
+            {
                 painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/ingame.png"));
+            }
             else
+            {
                 if(index.data(Ready).toBool())
                     painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/lamp.png"));
                 else
                     painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/lamp_off.png"));
+            }
+        }
 
         QString mainIconName(":/res/chat/");