Icons for 'i' and 'c' flags
authorunc0rr
Tue, 08 Oct 2013 23:38:45 +0400
changeset 9503 8f9b04138456
parent 9501 dc3d658de350
child 9505 56e0cca99e20
Icons for 'i' and 'c' flags
QTfrontend/hedgewars.qrc
QTfrontend/model/playerslistmodel.cpp
QTfrontend/model/playerslistmodel.h
QTfrontend/net/newnetclient.cpp
QTfrontend/res/chat/hedgehogcontributor.png
QTfrontend/res/chat/hedgehogcontributor_gray.png
QTfrontend/res/chat/roomadmincontributor.png
QTfrontend/res/chat/roomadmincontributor_gray.png
--- a/QTfrontend/hedgewars.qrc	Tue Oct 08 10:28:57 2013 +0400
+++ b/QTfrontend/hedgewars.qrc	Tue Oct 08 23:38:45 2013 +0400
@@ -165,5 +165,9 @@
         <file>res/splash.png</file>
         <file>res/html/about.html</file>
         <file>res/xml/tips.xml</file>
+        <file>res/chat/hedgehogcontributor.png</file>
+        <file>res/chat/hedgehogcontributor_gray.png</file>
+        <file>res/chat/roomadmincontributor.png</file>
+        <file>res/chat/roomadmincontributor_gray.png</file>
     </qresource>
 </RCC>
--- a/QTfrontend/model/playerslistmodel.cpp	Tue Oct 08 10:28:57 2013 +0400
+++ b/QTfrontend/model/playerslistmodel.cpp	Tue Oct 08 23:38:45 2013 +0400
@@ -11,7 +11,8 @@
 PlayersListModel::PlayersListModel(QObject *parent) :
     QAbstractListModel(parent)
 {
-
+    m_fontInRoom = QFont();
+    m_fontInRoom.setItalic(true);
 }
 
 
@@ -223,6 +224,7 @@
         << index.data(Ignore).toBool()
         << index.data(InGame).toBool()
         << index.data(RoomFilterRole).toBool()
+        << index.data(InRoom).toBool()
         ;
 
     for(int i = flags.size() - 1; i >= 0; --i)
@@ -253,16 +255,26 @@
                 else
                     painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/chat/lamp_off.png"));
             }
+        } else
+        { // we're in lobby
+            if(!index.data(InRoom).toBool())
+                painter.drawPixmap(0, 0, 16, 16, QPixmap(":/res/Flake.png"));
         }
 
         QString mainIconName(":/res/chat/");
 
-        if(index.data(RoomAdmin).toBool())
-            mainIconName += "roomadmin";
-        else if(index.data(ServerAdmin).toBool())
+        if(index.data(ServerAdmin).toBool())
             mainIconName += "serveradmin";
         else
-            mainIconName += "hedgehog";
+        {
+            if(index.data(RoomAdmin).toBool())
+                mainIconName += "roomadmin";
+            else
+                mainIconName += "hedgehog";
+
+            if(index.data(Contributor).toBool())
+                mainIconName += "contributor";
+        }
 
         if(!index.data(Registered).toBool())
             mainIconName += "_gray";
--- a/QTfrontend/model/playerslistmodel.h	Tue Oct 08 10:28:57 2013 +0400
+++ b/QTfrontend/model/playerslistmodel.h	Tue Oct 08 23:38:45 2013 +0400
@@ -6,6 +6,7 @@
 #include <QIcon>
 #include <QModelIndex>
 #include <QSet>
+#include <QFont>
 
 class PlayersListModel : public QAbstractListModel
 {
@@ -19,7 +20,9 @@
         Registered  = Qt::UserRole + 3,
         Friend      = Qt::UserRole + 4,
         Ignore      = Qt::UserRole + 5,
-        InGame      = Qt::UserRole + 6
+        InGame      = Qt::UserRole + 6,
+        InRoom      = Qt::UserRole + 7,
+        Contributor = Qt::UserRole + 8
     };
 
     enum SpecialRoles {
@@ -61,6 +64,7 @@
     QList<DataEntry> m_data;
     QSet<QString> m_friendsSet, m_ignoredSet;
     QString m_nickname;
+    QFont m_fontInRoom;
 
     void updateIcon(const QModelIndex & index);
     void updateSortData(const QModelIndex & index);
--- a/QTfrontend/net/newnetclient.cpp	Tue Oct 08 10:28:57 2013 +0400
+++ b/QTfrontend/net/newnetclient.cpp	Tue Oct 08 23:38:45 2013 +0400
@@ -436,6 +436,16 @@
                         foreach(const QString & nick, nicks)
                             m_playersModel->setFlag(nick, PlayersListModel::Registered, setFlag);
                         break;
+                // flag indicating if a player is in room
+                case 'i':
+                        foreach(const QString & nick, nicks)
+                            m_playersModel->setFlag(nick, PlayersListModel::InRoom, setFlag);
+                        break;
+                // flag indicating if a player is contributor
+                case 'c':
+                        foreach(const QString & nick, nicks)
+                            m_playersModel->setFlag(nick, PlayersListModel::InRoom, setFlag);
+                        break;
                 // flag indicating if a player has engine running
                 case 'g':
                     if(inRoom)
Binary file QTfrontend/res/chat/hedgehogcontributor.png has changed
Binary file QTfrontend/res/chat/hedgehogcontributor_gray.png has changed
Binary file QTfrontend/res/chat/roomadmincontributor.png has changed
Binary file QTfrontend/res/chat/roomadmincontributor_gray.png has changed