QTfrontend/mapContainer.cpp
changeset 2377 f3fab2b09e0c
parent 2021 a591afb43768
child 2564 96138f0d3cf6
child 2948 3f21a9dc93d0
equal deleted inserted replaced
2376:ece7b87f1334 2377:f3fab2b09e0c
    40 	pMap(0)
    40 	pMap(0)
    41 {
    41 {
    42 	hhSmall.load(":/res/hh_small.png");
    42 	hhSmall.load(":/res/hh_small.png");
    43 	hhLimit = 18;
    43 	hhLimit = 18;
    44     templateFilter = 0;
    44     templateFilter = 0;
    45 	
    45 
    46 	mainLayout.setContentsMargins(QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
    46 	mainLayout.setContentsMargins(QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
    47 		1,
    47 		1,
    48 		QApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin),
    48 		QApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin),
    49 		QApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
    49 		QApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
    50 	
    50 
    51 	imageButt = new QPushButton(this);
    51 	imageButt = new QPushButton(this);
    52 	imageButt->setObjectName("imageButt");
    52 	imageButt->setObjectName("imageButt");
    53 	imageButt->setFixedSize(256 + 6, 128 + 6);
    53 	imageButt->setFixedSize(256 + 6, 128 + 6);
    54 	imageButt->setFlat(true);
    54 	imageButt->setFlat(true);
    55 	imageButt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);//QSizePolicy::Minimum, QSizePolicy::Minimum);
    55 	imageButt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);//QSizePolicy::Minimum, QSizePolicy::Minimum);
    81 				mapInfo.push_back(18);
    81 				mapInfo.push_back(18);
    82 			chooseMap->addItem(map, mapInfo);
    82 			chooseMap->addItem(map, mapInfo);
    83 			mapCfgFile.close();
    83 			mapCfgFile.close();
    84 		}
    84 		}
    85 	}
    85 	}
    86 	
    86 
    87 	connect(chooseMap, SIGNAL(currentIndexChanged(int)), this, SLOT(mapChanged(int)));
    87 	connect(chooseMap, SIGNAL(currentIndexChanged(int)), this, SLOT(mapChanged(int)));
    88 	mainLayout.addWidget(chooseMap, 1, 1);
    88 	mainLayout.addWidget(chooseMap, 1, 1);
    89 
    89 
    90 	QLabel * lblMap = new QLabel(tr("Map"), this);
    90 	QLabel * lblMap = new QLabel(tr("Map"), this);
    91 	mainLayout.addWidget(lblMap, 1, 0);
    91 	mainLayout.addWidget(lblMap, 1, 0);
   109 	gbThemes->setContentTopPadding(6);
   109 	gbThemes->setContentTopPadding(6);
   110 	gbThemes->setTitle(tr("Themes"));
   110 	gbThemes->setTitle(tr("Themes"));
   111 
   111 
   112 	//gbThemes->setStyleSheet("padding: 0px"); // doesn't work - stylesheet is set with icon
   112 	//gbThemes->setStyleSheet("padding: 0px"); // doesn't work - stylesheet is set with icon
   113 	mainLayout.addWidget(gbThemes, 0, 2, 3, 1);
   113 	mainLayout.addWidget(gbThemes, 0, 2, 3, 1);
   114 	
   114 
   115 	QVBoxLayout * gbTLayout = new QVBoxLayout(gbThemes);
   115 	QVBoxLayout * gbTLayout = new QVBoxLayout(gbThemes);
   116 	gbTLayout->setContentsMargins(0, 0, 0 ,0);
   116 	gbTLayout->setContentsMargins(0, 0, 0 ,0);
   117 	gbTLayout->setSpacing(0);
   117 	gbTLayout->setSpacing(0);
   118 	lwThemes = new QListWidget(this);
   118 	lwThemes = new QListWidget(this);
   119 	lwThemes->setMinimumHeight(30);
   119 	lwThemes->setMinimumHeight(30);
   137 			"color: #ffcc00;"
   137 			"color: #ffcc00;"
   138 			"font: bold 14px;"
   138 			"font: bold 14px;"
   139 			"}"
   139 			"}"
   140 		)
   140 		)
   141 	);
   141 	);
   142  
   142 
   143 	gbTLayout->addWidget(lwThemes);
   143 	gbTLayout->addWidget(lwThemes);
   144 	lwThemes->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
   144 	lwThemes->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
   145 	
   145 
   146 	mainLayout.setSizeConstraint(QLayout::SetFixedSize);//SetMinimumSize
   146 	mainLayout.setSizeConstraint(QLayout::SetFixedSize);//SetMinimumSize
   147 
   147 
   148 	setRandomSeed();
   148 	setRandomSeed();
   149 	setRandomTheme();
   149 	setRandomTheme();
   150 }
   150 }
   210 // Should this add text to identify map size?
   210 // Should this add text to identify map size?
   211 void HWMapContainer::addInfoToPreview(QPixmap image)
   211 void HWMapContainer::addInfoToPreview(QPixmap image)
   212 {
   212 {
   213 	QPixmap finalImage = QPixmap(image.size());
   213 	QPixmap finalImage = QPixmap(image.size());
   214 	finalImage.fill(QColor(0, 0, 0, 0));
   214 	finalImage.fill(QColor(0, 0, 0, 0));
   215 	
   215 
   216 	QPainter p(&finalImage);
   216 	QPainter p(&finalImage);
   217 	p.drawPixmap(image.rect(), image);
   217 	p.drawPixmap(image.rect(), image);
   218 	//p.setPen(QColor(0xf4,0x9e,0xe9));
   218 	//p.setPen(QColor(0xf4,0x9e,0xe9));
   219 	p.setPen(QColor(0xff,0xcc,0x00));
   219 	p.setPen(QColor(0xff,0xcc,0x00));
   220 	p.setBrush(QColor(0, 0, 0));
   220 	p.setBrush(QColor(0, 0, 0));
   295 	if(map == "+rnd+")
   295 	if(map == "+rnd+")
   296 	{
   296 	{
   297 		changeImage();
   297 		changeImage();
   298 		return;
   298 		return;
   299 	}
   299 	}
   300 	
   300 
   301 	int id = chooseMap->findText(map);
   301 	int id = chooseMap->findText(map);
   302 	if(id > 0) {
   302 	if(id > 0) {
   303 		if (pMap)
   303 		if (pMap)
   304 		{
   304 		{
   305 			disconnect(pMap, 0, this, SLOT(setImage(const QImage)));
   305 			disconnect(pMap, 0, this, SLOT(setImage(const QImage)));