equal
deleted
inserted
replaced
27 #include <QApplication> |
27 #include <QApplication> |
28 #include <QLabel> |
28 #include <QLabel> |
29 #include <QListWidget> |
29 #include <QListWidget> |
30 #include <QVBoxLayout> |
30 #include <QVBoxLayout> |
31 #include <QIcon> |
31 #include <QIcon> |
|
32 #include <QLineEdit> |
32 |
33 |
33 #include "hwconsts.h" |
34 #include "hwconsts.h" |
34 #include "mapContainer.h" |
35 #include "mapContainer.h" |
35 #include "igbox.h" |
36 #include "igbox.h" |
36 |
37 |
209 ); |
210 ); |
210 |
211 |
211 gbTLayout->addWidget(lwThemes); |
212 gbTLayout->addWidget(lwThemes); |
212 lwThemes->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); |
213 lwThemes->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); |
213 |
214 |
|
215 QLabel* seedLabel = new QLabel(tr("Seed"), this); |
|
216 mainLayout.addWidget(seedLabel, 3, 0); |
|
217 seedEdit = new QLineEdit(this); |
|
218 mainLayout.addWidget(seedEdit, 3, 1, 1, 2); |
|
219 connect(seedEdit, SIGNAL(textChanged(const QString&)), this, SLOT(seedEdited(const QString&))); |
|
220 |
214 mainLayout.setSizeConstraint(QLayout::SetFixedSize);//SetMinimumSize |
221 mainLayout.setSizeConstraint(QLayout::SetFixedSize);//SetMinimumSize |
215 |
222 |
216 setRandomSeed(); |
223 setRandomSeed(); |
217 setRandomTheme(); |
224 setRandomTheme(); |
218 } |
225 } |
406 } |
413 } |
407 |
414 |
408 void HWMapContainer::setSeed(const QString & seed) |
415 void HWMapContainer::setSeed(const QString & seed) |
409 { |
416 { |
410 m_seed = seed; |
417 m_seed = seed; |
|
418 if (seed != seedEdit->text()) |
|
419 seedEdit->setText(seed); |
411 if (chooseMap->currentIndex() < MAPGEN_LAST) |
420 if (chooseMap->currentIndex() < MAPGEN_LAST) |
412 changeImage(); |
421 changeImage(); |
413 } |
422 } |
414 |
423 |
415 void HWMapContainer::setMap(const QString & map) |
424 void HWMapContainer::setMap(const QString & map) |
481 } |
490 } |
482 |
491 |
483 void HWMapContainer::setRandomSeed() |
492 void HWMapContainer::setRandomSeed() |
484 { |
493 { |
485 m_seed = QUuid::createUuid().toString(); |
494 m_seed = QUuid::createUuid().toString(); |
|
495 seedEdit->setText(m_seed); |
486 emit seedChanged(m_seed); |
496 emit seedChanged(m_seed); |
487 if (chooseMap->currentIndex() < MAPGEN_LAST) |
497 if (chooseMap->currentIndex() < MAPGEN_LAST) |
488 changeImage(); |
498 changeImage(); |
489 } |
499 } |
490 |
500 |
533 |
543 |
534 QByteArray HWMapContainer::getDrawnMapData() |
544 QByteArray HWMapContainer::getDrawnMapData() |
535 { |
545 { |
536 return drawnMapData; |
546 return drawnMapData; |
537 } |
547 } |
|
548 |
|
549 void HWMapContainer::seedEdited(const QString & seed) |
|
550 { |
|
551 if (seed.isEmpty() || seed.size() > 54) |
|
552 seedEdit->setText(m_seed); |
|
553 else |
|
554 { |
|
555 setSeed(seed); |
|
556 emit seedChanged(seed); |
|
557 } |
|
558 } |