QTfrontend/mapContainer.cpp
changeset 1333 b0b0510eb82d
parent 1318 18da1c5e960d
child 1348 0eb0b3a955b8
equal deleted inserted replaced
1332:19ff9bf7d69e 1333:b0b0510eb82d
    33 #include "hwconsts.h"
    33 #include "hwconsts.h"
    34 #include "mapContainer.h"
    34 #include "mapContainer.h"
    35 #include "igbox.h"
    35 #include "igbox.h"
    36 
    36 
    37 HWMapContainer::HWMapContainer(QWidget * parent) :
    37 HWMapContainer::HWMapContainer(QWidget * parent) :
    38   QWidget(parent), mainLayout(this)
    38 	QWidget(parent),
       
    39 	mainLayout(this),
       
    40 	pMap(0)
    39 {
    41 {
    40 #if QT_VERSION >= 0x040300
    42 #if QT_VERSION >= 0x040300
    41   mainLayout.setContentsMargins(QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
    43   mainLayout.setContentsMargins(QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
    42                 1,
    44                 1,
    43                 QApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin),
    45                 QApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin),
   109   p.drawPixmap(QPoint(0, 0), px);
   111   p.drawPixmap(QPoint(0, 0), px);
   110 
   112 
   111   imageButt->setIcon(pxres);
   113   imageButt->setIcon(pxres);
   112   imageButt->setIconSize(QSize(256, 128));
   114   imageButt->setIconSize(QSize(256, 128));
   113   chooseMap->setCurrentIndex(0);
   115   chooseMap->setCurrentIndex(0);
       
   116   pMap = 0;
   114 }
   117 }
   115 
   118 
   116 void HWMapContainer::mapChanged(int index)
   119 void HWMapContainer::mapChanged(int index)
   117 {
   120 {
   118   if(!index) {
   121   if(!index) {
   119     changeImage();
   122     changeImage();
       
   123     emit mapChanged("+rnd+");
   120     return;
   124     return;
   121   }
   125   }
   122 
   126 
   123   loadMap(index);
   127   loadMap(index);
   124 
   128 
   183 	changeImage();
   187 	changeImage();
   184 }
   188 }
   185 
   189 
   186 void HWMapContainer::setMap(const QString & map)
   190 void HWMapContainer::setMap(const QString & map)
   187 {
   191 {
       
   192 	if(map == "+rnd+")
       
   193 	{
       
   194 		changeImage();
       
   195 		return;
       
   196 	}
       
   197 	
   188 	int id = chooseMap->findText(map);
   198 	int id = chooseMap->findText(map);
   189 	if(id >= 0) {
   199 	if(id > 0) {
   190 		chooseMap->setCurrentIndex(id);
   200 		chooseMap->setCurrentIndex(id);
   191 		loadMap(id);
   201 		loadMap(id);
       
   202 		if (pMap)
       
   203 			disconnect(pMap, 0, this, SLOT(setImage(const QImage)));
   192 	}
   204 	}
   193 }
   205 }
   194 
   206 
   195 void HWMapContainer::setTheme(const QString & theme)
   207 void HWMapContainer::setTheme(const QString & theme)
   196 {
   208 {