equal
deleted
inserted
replaced
214 |
214 |
215 /* Boilerplate to emulate a QLabel */ |
215 /* Boilerplate to emulate a QLabel */ |
216 teMapName->setReadOnly(true); |
216 teMapName->setReadOnly(true); |
217 teMapName->setAcceptRichText(false); |
217 teMapName->setAcceptRichText(false); |
218 teMapName->setFrameStyle(QFrame::NoFrame); |
218 teMapName->setFrameStyle(QFrame::NoFrame); |
219 QPalette pal = QPalette(qApp->palette()); |
219 teMapName->setStyleSheet("background-color: transparent"); |
220 pal.setColor(QPalette::Base, Qt::transparent); |
|
221 teMapName->setPalette(pal); |
|
222 |
220 |
223 teMapName->setLineWrapMode(QTextEdit::WidgetWidth); |
221 teMapName->setLineWrapMode(QTextEdit::WidgetWidth); |
224 teMapName->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); |
222 teMapName->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); |
225 |
223 |
226 rightLayout->addWidget(teMapName, 1); |
224 rightLayout->addWidget(teMapName, 1); |
577 { |
575 { |
578 qDebug() << "HWMapContainer::intSetMap: Map doesn't exist: " << map; |
576 qDebug() << "HWMapContainer::intSetMap: Map doesn't exist: " << map; |
579 m_missingMap = true; |
577 m_missingMap = true; |
580 m_curMap = map; |
578 m_curMap = map; |
581 m_mapInfo.name = map; |
579 m_mapInfo.name = map; |
582 setMapNameLabel(map); |
580 setMapNameLabel(map, false); |
583 if (m_mapInfo.type == MapModel::StaticMap) |
581 if (m_mapInfo.type == MapModel::StaticMap) |
584 setupStaticMapsView(m_curMap); |
582 setupStaticMapsView(m_curMap); |
585 else if (m_mapInfo.type == MapModel::MissionMap) |
583 else if (m_mapInfo.type == MapModel::MissionMap) |
586 setupMissionMapsView(m_curMap); |
584 setupMissionMapsView(m_curMap); |
587 else |
585 else |
998 setupMissionMapsView(); |
996 setupMissionMapsView(); |
999 mapgen = MAPGEN_MAP; |
997 mapgen = MAPGEN_MAP; |
1000 missionMapChanged(newMap.isValid() ? newMap : missionMapList->currentIndex()); |
998 missionMapChanged(newMap.isValid() ? newMap : missionMapList->currentIndex()); |
1001 lblMapList->setText(tr("Mission:")); |
999 lblMapList->setText(tr("Mission:")); |
1002 lblMapList->show(); |
1000 lblMapList->show(); |
1003 setMapNameLabel(m_curMap); |
1001 setMapNameLabel(m_curMap, !m_missingMap); |
1004 if(m_master) |
1002 if(m_master) |
1005 { |
1003 { |
1006 missionMapList->show(); |
1004 missionMapList->show(); |
1007 } |
1005 } |
1008 else |
1006 else |
1018 setupStaticMapsView(); |
1016 setupStaticMapsView(); |
1019 mapgen = MAPGEN_MAP; |
1017 mapgen = MAPGEN_MAP; |
1020 staticMapChanged(newMap.isValid() ? newMap : staticMapList->currentIndex()); |
1018 staticMapChanged(newMap.isValid() ? newMap : staticMapList->currentIndex()); |
1021 lblMapList->setText(tr("Map:")); |
1019 lblMapList->setText(tr("Map:")); |
1022 lblMapList->show(); |
1020 lblMapList->show(); |
1023 setMapNameLabel(m_curMap); |
1021 setMapNameLabel(m_curMap, !m_missingMap); |
1024 if(m_master) |
1022 if(m_master) |
1025 { |
1023 { |
1026 staticMapList->show(); |
1024 staticMapList->show(); |
1027 } |
1025 } |
1028 else |
1026 else |
1282 QModelIndexList mdl = m_themeModel->match(m_themeModel->index(0), ThemeModel::ActualNameRole, m_theme); |
1280 QModelIndexList mdl = m_themeModel->match(m_themeModel->index(0), ThemeModel::ActualNameRole, m_theme); |
1283 if(!mdl.size()) |
1281 if(!mdl.size()) |
1284 setRandomTheme(); |
1282 setRandomTheme(); |
1285 } |
1283 } |
1286 } |
1284 } |
|
1285 else |
|
1286 { |
|
1287 setMapNameLabel(m_curMap, true); |
|
1288 } |
1287 } |
1289 } |
1288 |
1290 |
1289 void HWMapContainer::setMissingTheme(const QString & name) |
1291 void HWMapContainer::setMissingTheme(const QString & name) |
1290 { |
1292 { |
1291 if (name.isNull() || name.isEmpty()) return; |
1293 if (name.isNull() || name.isEmpty()) return; |
1339 staticSelectionModel->setCurrentIndex(m_staticMapModel->index(m, 0), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent); |
1341 staticSelectionModel->setCurrentIndex(m_staticMapModel->index(m, 0), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent); |
1340 } |
1342 } |
1341 |
1343 |
1342 // Call this function instead of setting the text of the map name label |
1344 // Call this function instead of setting the text of the map name label |
1343 // directly. |
1345 // directly. |
1344 void HWMapContainer::setMapNameLabel(QString mapName) |
1346 void HWMapContainer::setMapNameLabel(QString mapName, bool validMap) |
1345 { |
1347 { |
1346 // Cut off insanely long names to be displayed |
1348 // Cut off insanely long names to be displayed |
1347 if(mapName.length() >= 90) |
1349 if(mapName.length() >= 90) |
1348 { |
1350 { |
1349 mapName.truncate(84); |
1351 mapName.truncate(84); |
1350 mapName.append(" (...)"); |
1352 mapName.append(" (...)"); |
1351 } |
1353 } |
1352 teMapName->setPlainText(mapName); |
1354 teMapName->setPlainText(mapName); |
1353 } |
1355 if(validMap) |
|
1356 teMapName->setStyleSheet("background-color: transparent;"); |
|
1357 else |
|
1358 teMapName->setStyleSheet("background-color: transparent; color: #b50000;"); |
|
1359 } |