QTfrontend/mapContainer.cpp
changeset 1318 18da1c5e960d
parent 1248 8c77eec56bf4
child 1333 b0b0510eb82d
--- a/QTfrontend/mapContainer.cpp	Wed Oct 08 15:42:09 2008 +0000
+++ b/QTfrontend/mapContainer.cpp	Wed Oct 08 15:53:23 2008 +0000
@@ -50,6 +50,7 @@
   imageButt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);//QSizePolicy::Minimum, QSizePolicy::Minimum);
   mainLayout.addWidget(imageButt, 0, 0, 1, 2);
   connect(imageButt, SIGNAL(clicked()), this, SLOT(setRandomSeed()));
+  connect(imageButt, SIGNAL(clicked()), this, SLOT(setRandomTheme()));
 
   chooseMap = new QComboBox(this);
   chooseMap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
@@ -88,6 +89,7 @@
   mainLayout.setSizeConstraint(QLayout::SetFixedSize);//SetMinimumSize
 
   setRandomSeed();
+  setRandomTheme();
 }
 
 void HWMapContainer::setImage(const QImage newImage)
@@ -145,10 +147,6 @@
 	pMap = new HWMap();
 	connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage)));
 	pMap->getImage(m_seed.toStdString());
-
-	if(!Themes->size()) return;
-	quint32 themeNum = rand() % Themes->size();
-	lwThemes->setCurrentRow(themeNum);
 }
 
 void HWMapContainer::themeSelected(int currentRow)
@@ -199,7 +197,6 @@
 	QList<QListWidgetItem *> items = lwThemes->findItems(theme, Qt::MatchExactly);
 	if(items.size())
 		lwThemes->setCurrentItem(items.at(0));
-	//this->theme = theme;
 }
 
 void HWMapContainer::setRandomSeed()
@@ -208,3 +205,10 @@
   emit seedChanged(m_seed);
   changeImage();
 }
+
+void HWMapContainer::setRandomTheme()
+{
+	if(!Themes->size()) return;
+	quint32 themeNum = rand() % Themes->size();
+	lwThemes->setCurrentRow(themeNum);
+}