QTfrontend/model/roomslistmodel.cpp
changeset 8377 869f80966a77
parent 7258 722e8a0d89dc
child 9080 9b42757d7e71
equal deleted inserted replaced
8376:c11cc7246df7 8377:869f80966a77
    41      << tr("Owner")
    41      << tr("Owner")
    42      << tr("Map")
    42      << tr("Map")
    43      << tr("Rules")
    43      << tr("Rules")
    44      << tr("Weapons");
    44      << tr("Weapons");
    45 
    45 
    46     m_mapModel = DataManager::instance().mapModel();
    46     m_staticMapModel = DataManager::instance().staticMapModel();
       
    47     m_missionMapModel = DataManager::instance().missionMapModel();
    47 }
    48 }
    48 
    49 
    49 
    50 
    50 QVariant RoomsListModel::headerData(int section, Qt::Orientation orientation, int role) const
    51 QVariant RoomsListModel::headerData(int section, Qt::Orientation orientation, int role) const
    51 {
    52 {
   132                 if (content == "+maze+") return tr("Random Maze");
   133                 if (content == "+maze+") return tr("Random Maze");
   133                 if (content == "+drawn+") return tr("Hand-drawn");
   134                 if (content == "+drawn+") return tr("Hand-drawn");
   134             }
   135             }
   135 
   136 
   136             // prefix ? if map not available
   137             // prefix ? if map not available
   137             if ((m_mapModel->indexOf(content) < 0))
   138             if (!m_staticMapModel->mapExists(content) &&
       
   139                 !m_missionMapModel->mapExists(content))
   138                 return QString ("? %1").arg(content);
   140                 return QString ("? %1").arg(content);
   139         }
   141         }
   140 
   142 
   141         return content;
   143         return content;
   142     }
   144     }
   143 
   145 
   144     // dye map names red if map not available
   146     // dye map names red if map not available
   145     if (role == Qt::ForegroundRole)
   147     if (role == Qt::ForegroundRole)
   146     {
   148     {
   147         if ((m_mapModel->indexOf(content) < 0))
   149         if (content == "+rnd+" ||
       
   150             content == "+maze+" ||
       
   151             content == "+drawn+" ||
       
   152             m_staticMapModel->mapExists(content) ||
       
   153             m_missionMapModel->mapExists(content))
       
   154             return QVariant();
       
   155         else
   148             return QBrush(QColor("darkred"));
   156             return QBrush(QColor("darkred"));
   149         else
       
   150             return QVariant();
       
   151     }
   157     }
   152 
   158 
   153     if (role == Qt::TextAlignmentRole)
   159     if (role == Qt::TextAlignmentRole)
   154     {
   160     {
   155         return (int)(Qt::AlignHCenter | Qt::AlignVCenter);
   161         return (int)(Qt::AlignHCenter | Qt::AlignVCenter);