QTfrontend/model/roomslistmodel.cpp
changeset 6993 47830cf50574
parent 6987 e34415c77342
child 6995 6b44c0f11476
equal deleted inserted replaced
6992:b8f3d8991e92 6993:47830cf50574
    91         return QVariant();
    91         return QVariant();
    92 
    92 
    93     // not a role we have data for
    93     // not a role we have data for
    94     if (role != Qt::DisplayRole)
    94     if (role != Qt::DisplayRole)
    95         // only custom-align counters
    95         // only custom-align counters
    96         if ((role != Qt::TextAlignmentRole) || (column < 2) || (column > 3))
    96         if ((role != Qt::TextAlignmentRole)
    97             // only decorate name column
    97             || ((column != PlayerCountColumn) && (column != TeamCountColumn)))
    98             if ((role != Qt::DecorationRole) || (column != 1))
    98                 // only decorate name column
    99                 // only dye map column
    99                 if ((role != Qt::DecorationRole) || (column != NameColumn))
   100                 if ((role != Qt::ForegroundRole) || (column != 5))
   100                     // only dye map column
   101                     return QVariant();
   101                     if ((role != Qt::ForegroundRole) || (column != MapColumn))
       
   102                         return QVariant();
   102 
   103 
   103     // decorate room name based on room state
   104     // decorate room name based on room state
   104     if (role == Qt::DecorationRole)
   105     if (role == Qt::DecorationRole)
   105     {
   106     {
   106         const QIcon roomBusyIcon(":/res/iconDamage.png");
   107         const QIcon roomBusyIcon(":/res/iconDamage.png");
   204         return -1;
   205         return -1;
   205 
   206 
   206     int i = 0;
   207     int i = 0;
   207 
   208 
   208     // search for record with matching room name
   209     // search for record with matching room name
   209     while(m_data[i].at(1) != name)
   210     while(m_data[i].at(NameColumn) != name)
   210     {
   211     {
   211         i++;
   212         i++;
   212         if(i >= size)
   213         if(i >= size)
   213             return -1;
   214             return -1;
   214     }
   215     }
   251 
   252 
   252     result = info;
   253     result = info;
   253 
   254 
   254     // for matters of less memory usage and quicker access store
   255     // for matters of less memory usage and quicker access store
   255     // the boolean string as either "t" or empty
   256     // the boolean string as either "t" or empty
   256     if (info[0].toLower() == "true")
   257     if (info[StateColumn].toLower() == "true")
   257         result[0] = "t";
   258         result[StateColumn] = "t";
   258     else
   259     else
   259         result[0] = QString();
   260         result[StateColumn] = QString();
   260 
   261 
   261     return result;
   262     return result;
   262 }
   263 }