QTfrontend/ui/widget/mapContainer.cpp
changeset 10480 43c6b9cfb569
parent 10477 b219c5a2317f
child 10521 844874dba527
equal deleted inserted replaced
10479:31afb7cdff69 10480:43c6b9cfb569
   230     mapFeatureSize->setMinimum(1);
   230     mapFeatureSize->setMinimum(1);
   231     //mapFeatureSize->setFixedWidth(259);
   231     //mapFeatureSize->setFixedWidth(259);
   232     mapFeatureSize->setValue(m_mapFeatureSize);
   232     mapFeatureSize->setValue(m_mapFeatureSize);
   233     mapFeatureSize->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   233     mapFeatureSize->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   234     bottomLeftLayout->addWidget(mapFeatureSize, 0);
   234     bottomLeftLayout->addWidget(mapFeatureSize, 0);
   235     connect(mapFeatureSize, SIGNAL(valueChanged(int)), this, SLOT(mapFeatureSizeChanged(int)));
   235     connect(mapFeatureSize, SIGNAL(valueChanged(int)), this, SLOT(setFeatureSize(int)));
   236 
   236 
   237     /* Mission description */
   237     /* Mission description */
   238 
   238 
   239     lblDesc = new QLabel();
   239     lblDesc = new QLabel();
   240     lblDesc->setWordWrap(true);
   240     lblDesc->setWordWrap(true);
   691             hhLimit = m_mapInfo.limit;
   691             hhLimit = m_mapInfo.limit;
   692             addInfoToPreview(mapImage);
   692             addInfoToPreview(mapImage);
   693     }
   693     }
   694 }
   694 }
   695 
   695 
   696 void HWMapContainer::setAllMapParameters(const QString &map, MapGenerator m, int mazesize, const QString &seed, int tmpl)
   696 void HWMapContainer::setAllMapParameters(const QString &map, MapGenerator m, int mazesize, const QString &seed, int tmpl, int featureSize)
   697 {
   697 {
   698     intSetMapgen(m);
   698     intSetMapgen(m);
   699     intSetMazeSize(mazesize);
   699     intSetMazeSize(mazesize);
   700     intSetSeed(seed);
   700     intSetSeed(seed);
   701     intSetTemplateFilter(tmpl);
   701     intSetTemplateFilter(tmpl);
   702     // this one last because it will refresh the preview
   702     // this one last because it will refresh the preview
   703     intSetMap(map);
   703     intSetMap(map);
       
   704     intSetMazeSize(mazesize);
       
   705     intSetFeatureSize(featureSize);
   704 }
   706 }
   705 
   707 
   706 void HWMapContainer::updateModelViews()
   708 void HWMapContainer::updateModelViews()
   707 {
   709 {
   708     // restore theme selection
   710     // restore theme selection
   772             break;
   774             break;
   773         case MapModel::HandDrawnMap:
   775         case MapModel::HandDrawnMap:
   774             mapgen = MAPGEN_DRAWN;
   776             mapgen = MAPGEN_DRAWN;
   775             setMapInfo(MapModel::MapInfoDrawn);
   777             setMapInfo(MapModel::MapInfoDrawn);
   776             btnLoadMap->show();
   778             btnLoadMap->show();
       
   779             mapFeatureSize->hide();
   777             btnEditMap->show();
   780             btnEditMap->show();
   778             break;
   781             break;
   779         case MapModel::MissionMap:
   782         case MapModel::MissionMap:
   780             setupMissionMapsView();
   783             setupMissionMapsView();
   781             mapgen = MAPGEN_MAP;
   784             mapgen = MAPGEN_MAP;
   782             missionMapChanged(newMap.isValid() ? newMap : missionMapList->currentIndex());
   785             missionMapChanged(newMap.isValid() ? newMap : missionMapList->currentIndex());
   783             lblMapList->setText(tr("Mission:"));
   786             lblMapList->setText(tr("Mission:"));
   784             lblMapList->show();
   787             lblMapList->show();
   785             missionMapList->show();
   788             missionMapList->show();
   786 	    mapFeatureSize->hide();
   789             mapFeatureSize->hide();
   787             lblDesc->setText(m_mapInfo.desc);
   790             lblDesc->setText(m_mapInfo.desc);
   788             lblDesc->show();
   791             lblDesc->show();
   789             emit mapChanged(m_curMap);
   792             emit mapChanged(m_curMap);
   790             break;
   793             break;
   791         case MapModel::StaticMap:
   794         case MapModel::StaticMap:
   792             setupStaticMapsView();
   795             setupStaticMapsView();
   793             mapgen = MAPGEN_MAP;
   796             mapgen = MAPGEN_MAP;
   794             staticMapChanged(newMap.isValid() ? newMap : staticMapList->currentIndex());
   797             staticMapChanged(newMap.isValid() ? newMap : staticMapList->currentIndex());
   795             lblMapList->setText(tr("Map:"));
   798             lblMapList->setText(tr("Map:"));
   796             lblMapList->show();
   799             lblMapList->show();
       
   800             mapFeatureSize->hide();
   797             staticMapList->show();
   801             staticMapList->show();
   798             emit mapChanged(m_curMap);
   802             emit mapChanged(m_curMap);
   799             break;
   803             break;
   800         default:
   804         default:
   801             break;
   805             break;
   817     repaint();
   821     repaint();
   818 
   822 
   819     emit mapgenChanged(mapgen);
   823     emit mapgenChanged(mapgen);
   820 }
   824 }
   821 
   825 
   822 void HWMapContainer::mapFeatureSizeChanged(int val)
   826 void HWMapContainer::intSetFeatureSize(int val)
       
   827 {
       
   828     mapFeatureSize->setValue(val);    
       
   829     emit mapFeatureSizeChanged(val);
       
   830 }
       
   831 void HWMapContainer::setFeatureSize(int val)
   823 {
   832 {
   824     m_mapFeatureSize = val;
   833     m_mapFeatureSize = val;
   825     // needs to be per map type, scales will be different
   834     intSetFeatureSize(val);
   826     //m_mapFeatureSize = val>>2<<2;
   835     //m_mapFeatureSize = val>>2<<2;
   827     //if (qAbs(m_prevMapFeatureSize-m_mapFeatureSize) > 4)
   836     //if (qAbs(m_prevMapFeatureSize-m_mapFeatureSize) > 4)
   828     {
   837     {
   829         m_prevMapFeatureSize = m_mapFeatureSize;
   838         m_prevMapFeatureSize = m_mapFeatureSize;
   830         updatePreview();
   839         updatePreview();
   832 }
   841 }
   833 
   842 
   834 // unused because I needed the space for the slider
   843 // unused because I needed the space for the slider
   835 void HWMapContainer::updateThemeButtonSize()
   844 void HWMapContainer::updateThemeButtonSize()
   836 {
   845 {
   837     if (m_mapInfo.type != MapModel::StaticMap)
   846     if (m_mapInfo.type != MapModel::StaticMap && m_mapInfo.type != MapModel::HandDrawnMap)
   838     {
   847     {
   839         btnTheme->setIconSize(QSize(30, 30));
   848         btnTheme->setIconSize(QSize(30, 30));
   840         btnTheme->setFixedHeight(30);
   849         btnTheme->setFixedHeight(30);
   841     }
   850     }
   842     else
   851     else