48 imageButt->setFixedSize(256 + 6, 128 + 6); |
48 imageButt->setFixedSize(256 + 6, 128 + 6); |
49 imageButt->setFlat(true); |
49 imageButt->setFlat(true); |
50 imageButt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);//QSizePolicy::Minimum, QSizePolicy::Minimum); |
50 imageButt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);//QSizePolicy::Minimum, QSizePolicy::Minimum); |
51 mainLayout.addWidget(imageButt, 0, 0, 1, 2); |
51 mainLayout.addWidget(imageButt, 0, 0, 1, 2); |
52 connect(imageButt, SIGNAL(clicked()), this, SLOT(setRandomSeed())); |
52 connect(imageButt, SIGNAL(clicked()), this, SLOT(setRandomSeed())); |
|
53 connect(imageButt, SIGNAL(clicked()), this, SLOT(setRandomTheme())); |
53 |
54 |
54 chooseMap = new QComboBox(this); |
55 chooseMap = new QComboBox(this); |
55 chooseMap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
56 chooseMap->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
56 chooseMap->addItem(QComboBox::tr("generated map...")); |
57 chooseMap->addItem(QComboBox::tr("generated map...")); |
57 chooseMap->addItems(*mapList); |
58 chooseMap->addItems(*mapList); |
143 void HWMapContainer::changeImage() |
145 void HWMapContainer::changeImage() |
144 { |
146 { |
145 pMap = new HWMap(); |
147 pMap = new HWMap(); |
146 connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage))); |
148 connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage))); |
147 pMap->getImage(m_seed.toStdString()); |
149 pMap->getImage(m_seed.toStdString()); |
148 |
|
149 if(!Themes->size()) return; |
|
150 quint32 themeNum = rand() % Themes->size(); |
|
151 lwThemes->setCurrentRow(themeNum); |
|
152 } |
150 } |
153 |
151 |
154 void HWMapContainer::themeSelected(int currentRow) |
152 void HWMapContainer::themeSelected(int currentRow) |
155 { |
153 { |
156 theme = Themes->at(currentRow); |
154 theme = Themes->at(currentRow); |
197 void HWMapContainer::setTheme(const QString & theme) |
195 void HWMapContainer::setTheme(const QString & theme) |
198 { |
196 { |
199 QList<QListWidgetItem *> items = lwThemes->findItems(theme, Qt::MatchExactly); |
197 QList<QListWidgetItem *> items = lwThemes->findItems(theme, Qt::MatchExactly); |
200 if(items.size()) |
198 if(items.size()) |
201 lwThemes->setCurrentItem(items.at(0)); |
199 lwThemes->setCurrentItem(items.at(0)); |
202 //this->theme = theme; |
|
203 } |
200 } |
204 |
201 |
205 void HWMapContainer::setRandomSeed() |
202 void HWMapContainer::setRandomSeed() |
206 { |
203 { |
207 m_seed = QUuid::createUuid().toString(); |
204 m_seed = QUuid::createUuid().toString(); |
208 emit seedChanged(m_seed); |
205 emit seedChanged(m_seed); |
209 changeImage(); |
206 changeImage(); |
210 } |
207 } |
|
208 |
|
209 void HWMapContainer::setRandomTheme() |
|
210 { |
|
211 if(!Themes->size()) return; |
|
212 quint32 themeNum = rand() % Themes->size(); |
|
213 lwThemes->setCurrentRow(themeNum); |
|
214 } |