576 } else |
576 } else |
577 { |
577 { |
578 qDebug() << "HWMapContainer::intSetMap: Map doesn't exist: " << map; |
578 qDebug() << "HWMapContainer::intSetMap: Map doesn't exist: " << map; |
579 m_missingMap = true; |
579 m_missingMap = true; |
580 m_curMap = map; |
580 m_curMap = map; |
|
581 m_mapInfo.name = map; |
|
582 setMapNameLabel(map); |
581 if (m_mapInfo.type == MapModel::StaticMap) |
583 if (m_mapInfo.type == MapModel::StaticMap) |
582 setupStaticMapsView(); |
584 setupStaticMapsView(m_curMap); |
583 else if (m_mapInfo.type == MapModel::MissionMap) |
585 else if (m_mapInfo.type == MapModel::MissionMap) |
584 setupMissionMapsView(); |
586 setupMissionMapsView(m_curMap); |
585 else |
587 else |
586 { |
588 { |
587 m_mapInfo.type = MapModel::StaticMap; |
589 m_mapInfo.type = MapModel::StaticMap; |
588 setupStaticMapsView(); |
590 setupStaticMapsView(m_curMap); |
589 changeMapType(m_mapInfo.type, QModelIndex()); |
591 changeMapType(m_mapInfo.type, QModelIndex()); |
590 } |
592 } |
591 updatePreview(); |
593 updatePreview(); |
592 } |
594 } |
593 } |
595 } |
1297 // Question mark in front of theme name denotes it's missing |
1299 // Question mark in front of theme name denotes it's missing |
1298 btnTheme->setText(tr("Theme: %1").arg("?" + name)); |
1300 btnTheme->setText(tr("Theme: %1").arg("?" + name)); |
1299 updateThemeButtonSize(); |
1301 updateThemeButtonSize(); |
1300 } |
1302 } |
1301 |
1303 |
1302 void HWMapContainer::setupMissionMapsView() |
1304 void HWMapContainer::setupMissionMapsView(const QString & initialMap) |
1303 { |
1305 { |
1304 if(m_missionsViewSetup) return; |
1306 if(m_missionsViewSetup) return; |
1305 m_missionsViewSetup = true; |
1307 m_missionsViewSetup = true; |
1306 |
1308 |
1307 m_missionMapModel->loadMaps(); |
1309 m_missionMapModel->loadMaps(); |
1310 QItemSelectionModel * missionSelectionModel = missionMapList->selectionModel(); |
1312 QItemSelectionModel * missionSelectionModel = missionMapList->selectionModel(); |
1311 connect(missionSelectionModel, |
1313 connect(missionSelectionModel, |
1312 SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), |
1314 SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), |
1313 this, |
1315 this, |
1314 SLOT(missionMapChanged(const QModelIndex &, const QModelIndex &))); |
1316 SLOT(missionMapChanged(const QModelIndex &, const QModelIndex &))); |
1315 if(!missionSelectionModel->hasSelection()) |
1317 int m = 0; |
1316 missionSelectionModel->setCurrentIndex(m_missionMapModel->index(0, 0), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent); |
1318 if(!initialMap.isNull()) |
1317 } |
1319 m = m_missionMapModel->findMap(initialMap); |
1318 |
1320 missionSelectionModel->setCurrentIndex(m_missionMapModel->index(m, 0), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent); |
1319 void HWMapContainer::setupStaticMapsView() |
1321 } |
|
1322 |
|
1323 void HWMapContainer::setupStaticMapsView(const QString & initialMap) |
1320 { |
1324 { |
1321 if(m_staticViewSetup) return; |
1325 if(m_staticViewSetup) return; |
1322 m_staticViewSetup = true; |
1326 m_staticViewSetup = true; |
1323 |
1327 |
1324 m_staticMapModel->loadMaps(); |
1328 m_staticMapModel->loadMaps(); |
1327 QItemSelectionModel * staticSelectionModel = staticMapList->selectionModel(); |
1331 QItemSelectionModel * staticSelectionModel = staticMapList->selectionModel(); |
1328 connect(staticSelectionModel, |
1332 connect(staticSelectionModel, |
1329 SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), |
1333 SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), |
1330 this, |
1334 this, |
1331 SLOT(staticMapChanged(const QModelIndex &, const QModelIndex &))); |
1335 SLOT(staticMapChanged(const QModelIndex &, const QModelIndex &))); |
1332 if(!staticSelectionModel->hasSelection()) |
1336 int m = 0; |
1333 staticSelectionModel->setCurrentIndex(m_staticMapModel->index(0, 0), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent); |
1337 if(!initialMap.isNull()) |
|
1338 m = m_staticMapModel->findMap(initialMap); |
|
1339 staticSelectionModel->setCurrentIndex(m_staticMapModel->index(m, 0), QItemSelectionModel::Clear | QItemSelectionModel::SelectCurrent); |
1334 } |
1340 } |
1335 |
1341 |
1336 // Call this function instead of setting the text of the map name label |
1342 // Call this function instead of setting the text of the map name label |
1337 // directly. |
1343 // directly. |
1338 void HWMapContainer::setMapNameLabel(QString mapName) |
1344 void HWMapContainer::setMapNameLabel(QString mapName) |