QTfrontend/model/roomslistmodel.cpp
branch0.9.21
changeset 10739 d886f319e7b3
parent 10511 c33b2f001730
child 10741 7fababf10b60
--- a/QTfrontend/model/roomslistmodel.cpp	Sat Jan 03 15:25:42 2015 -0500
+++ b/QTfrontend/model/roomslistmodel.cpp	Sat Jan 03 17:27:33 2015 -0500
@@ -108,12 +108,32 @@
     if (role == Qt::DecorationRole)
     {
         const QIcon roomBusyIcon(":/res/iconDamage.png");
+        const QIcon roomBusyIconGreen(":/res/iconDamageLockG.png");
+        const QIcon roomBusyIconRed(":/res/iconDamageLockR.png");
         const QIcon roomWaitingIcon(":/res/iconTime.png");
+        const QIcon roomWaitingIconGreen(":/res/iconTimeLockG.png");
+        const QIcon roomWaitingIconRed(":/res/iconTimeLockR.png");
+
+        QString flags = m_data.at(row).at(0);
 
-        if (m_data.at(row).at(0).isEmpty())
-            return QVariant(roomWaitingIcon);
+        if (flags.contains("g"))
+        {
+            if (flags.contains("j"))
+                return QVariant(roomWaitingIconRed);
+            else if (flags.contains("p"))
+                return QVariant(roomWaitingIconGreen);
+            else
+                return QVariant(roomWaitingIcon);
+        }
         else
-            return QVariant(roomBusyIcon);
+        {
+            if (flags.contains("j"))
+                return QVariant(roomBusyIconRed);
+            else if (flags.contains("p"))
+                return QVariant(roomBusyIconGreen);
+            else
+                return QVariant(roomBusyIcon);
+        }
     }
 
     QString content = m_data.at(row).at(column);
@@ -190,7 +210,7 @@
             l.append(rooms[i + t]);
         }
 
-        m_data.append(roomInfo2RoomRecord(l));
+        m_data.append(l);
     }
 
     endResetModel();
@@ -201,7 +221,7 @@
 {
     beginInsertRows(QModelIndex(), 0, 0);
 
-    m_data.prepend(roomInfo2RoomRecord(info));
+    m_data.prepend(info);
 
     endInsertRows();
 }
@@ -250,25 +270,7 @@
     if (i < 0)
         return;
 
-    m_data[i] = roomInfo2RoomRecord(info);
+    m_data[i] = info;
 
     emit dataChanged(index(i, 0), index(i, columnCount(QModelIndex()) - 1));
 }
-
-
-QStringList RoomsListModel::roomInfo2RoomRecord(const QStringList & info)
-{
-    QStringList result;
-
-    result = info;
-
-    QString flags = info[StateColumn];
-    // for matters of less memory usage and quicker access store
-    // the boolean string as either "t" or empty
-    if (flags.contains('g'))
-        result[StateColumn] = "t";
-    else
-        result[StateColumn] = QString();
-
-    return result;
-}