QTfrontend/ui/widget/mapContainer.cpp
changeset 10477 b219c5a2317f
parent 10472 8d04cebedb16
child 10480 43c6b9cfb569
equal deleted inserted replaced
10476:e40021c61cfe 10477:b219c5a2317f
    59     // don't show preview anything until first show event
    59     // don't show preview anything until first show event
    60     m_previewEnabled = false;
    60     m_previewEnabled = false;
    61     m_missionsViewSetup = false;
    61     m_missionsViewSetup = false;
    62     m_staticViewSetup = false;
    62     m_staticViewSetup = false;
    63     m_script = QString();
    63     m_script = QString();
    64     m_prevMapFeatureSize = 50;
    64     m_prevMapFeatureSize = 12;
    65     m_mapFeatureSize = 50;
    65     m_mapFeatureSize = 12;
    66 
    66 
    67     hhSmall.load(":/res/hh_small.png");
    67     hhSmall.load(":/res/hh_small.png");
    68     hhLimit = 18;
    68     hhLimit = 18;
    69     templateFilter = 0;
    69     templateFilter = 0;
    70     m_master = true;
    70     m_master = true;
   224     rightLayout->addWidget(mazeStyles, 1);
   224     rightLayout->addWidget(mazeStyles, 1);
   225 
   225 
   226     mapFeatureSize = new QSlider(Qt::Horizontal, this);
   226     mapFeatureSize = new QSlider(Qt::Horizontal, this);
   227     mapFeatureSize->setObjectName("mapFeatureSize");
   227     mapFeatureSize->setObjectName("mapFeatureSize");
   228     //mapFeatureSize->setTickPosition(QSlider::TicksBelow);
   228     //mapFeatureSize->setTickPosition(QSlider::TicksBelow);
   229     mapFeatureSize->setMaximum(100);
   229     mapFeatureSize->setMaximum(25);
   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);
   323                    getTemplateFilter(),
   323                    getTemplateFilter(),
   324                    get_mapgen(),
   324                    get_mapgen(),
   325                    getMazeSize(),
   325                    getMazeSize(),
   326                    getDrawnMapData(),
   326                    getDrawnMapData(),
   327                    m_script,
   327                    m_script,
   328 		   m_mapFeatureSize
   328 		           m_mapFeatureSize
   329                   );
   329                   );
   330 
   330 
   331     setHHLimit(0);
   331     setHHLimit(0);
   332 
   332 
   333     const QPixmap waitIcon(":/res/iconTime.png");
   333     const QPixmap waitIcon(":/res/iconTime.png");
   800         default:
   800         default:
   801             break;
   801             break;
   802     }
   802     }
   803 
   803 
   804     // Update theme button size
   804     // Update theme button size
   805     // updateThemeButtonSize();
   805     updateThemeButtonSize();
   806 
   806 
   807     // Update cType combobox
   807     // Update cType combobox
   808     for (int i = 0; i < cType->count(); i++)
   808     for (int i = 0; i < cType->count(); i++)
   809     {
   809     {
   810         if ((MapModel::MapType)cType->itemData(i).toInt() == type)
   810         if ((MapModel::MapType)cType->itemData(i).toInt() == type)
   819     emit mapgenChanged(mapgen);
   819     emit mapgenChanged(mapgen);
   820 }
   820 }
   821 
   821 
   822 void HWMapContainer::mapFeatureSizeChanged(int val)
   822 void HWMapContainer::mapFeatureSizeChanged(int val)
   823 {
   823 {
       
   824     m_mapFeatureSize = val;
   824     // needs to be per map type, scales will be different
   825     // needs to be per map type, scales will be different
   825     m_mapFeatureSize = val;
   826     //m_mapFeatureSize = val>>2<<2;
   826     if (qAbs(m_prevMapFeatureSize-m_mapFeatureSize) > 8)
   827     //if (qAbs(m_prevMapFeatureSize-m_mapFeatureSize) > 4)
   827     {
   828     {
   828 	m_prevMapFeatureSize = m_mapFeatureSize;
   829         m_prevMapFeatureSize = m_mapFeatureSize;
   829 	updatePreview();
   830         updatePreview();
   830     }
   831     }
   831 }
   832 }
   832 
   833 
   833 // unused because I needed the space for the slider
   834 // unused because I needed the space for the slider
   834 void HWMapContainer::updateThemeButtonSize()
   835 void HWMapContainer::updateThemeButtonSize()
   835 {
   836 {
   836     if (m_mapInfo.type == MapModel::MissionMap)
   837     if (m_mapInfo.type != MapModel::StaticMap)
   837     {
   838     {
   838         btnTheme->setIconSize(QSize(30, 30));
   839         btnTheme->setIconSize(QSize(30, 30));
   839         btnTheme->setFixedHeight(30);
   840         btnTheme->setFixedHeight(30);
   840     }
   841     }
   841     else
   842     else
   867     //QSize iconSize = icon.actualSize(QSize(65535, 65535));
   868     //QSize iconSize = icon.actualSize(QSize(65535, 65535));
   868     //btnTheme->setFixedHeight(64);
   869     //btnTheme->setFixedHeight(64);
   869     //btnTheme->setIconSize(iconSize);
   870     //btnTheme->setIconSize(iconSize);
   870     btnTheme->setIcon(icon);
   871     btnTheme->setIcon(icon);
   871     btnTheme->setText(tr("Theme: %1").arg(current.data(Qt::DisplayRole).toString()));
   872     btnTheme->setText(tr("Theme: %1").arg(current.data(Qt::DisplayRole).toString()));
   872     // updateThemeButtonSize();
   873     updateThemeButtonSize();
   873 }
   874 }
   874 
   875 
   875 void HWMapContainer::staticMapChanged(const QModelIndex & map, const QModelIndex & old)
   876 void HWMapContainer::staticMapChanged(const QModelIndex & map, const QModelIndex & old)
   876 {
   877 {
   877     mapChanged(map, 0, old);
   878     mapChanged(map, 0, old);