added set button to seed edit so maps won't regenerate as often
authorHenek
Fri, 17 Dec 2010 09:26:02 +0100
changeset 4550 d300ea498486
parent 4548 a4c327b27583
child 4551 05c32ee166b6
added set button to seed edit so maps won't regenerate as often
QTfrontend/mapContainer.cpp
QTfrontend/mapContainer.h
--- a/QTfrontend/mapContainer.cpp	Thu Dec 16 17:40:31 2010 -0500
+++ b/QTfrontend/mapContainer.cpp	Fri Dec 17 09:26:02 2010 +0100
@@ -176,7 +176,7 @@
     gbThemes->setTitle(tr("Themes"));
 
     //gbThemes->setStyleSheet("padding: 0px"); // doesn't work - stylesheet is set with icon
-    mainLayout.addWidget(gbThemes, 0, 2, 3, 1);
+    mainLayout.addWidget(gbThemes, 0, 2, 3, 2);
 
     QVBoxLayout * gbTLayout = new QVBoxLayout(gbThemes);
     gbTLayout->setContentsMargins(0, 0, 0 ,0);
@@ -213,8 +213,12 @@
     QLabel* seedLabel = new QLabel(tr("Seed"), this);
     mainLayout.addWidget(seedLabel, 3, 0);
     seedEdit = new QLineEdit(this);
+    connect(seedEdit, SIGNAL(returnPressed()), this, SLOT(seedEdited()));
     mainLayout.addWidget(seedEdit, 3, 1, 1, 2);
-    connect(seedEdit, SIGNAL(textChanged(const QString&)), this, SLOT(seedEdited(const QString&)));
+    seedSet = new QPushButton(this);
+    seedSet->setText(QPushButton::tr("Set"));
+    connect(seedSet, SIGNAL(clicked()), this, SLOT(seedEdited()));
+    mainLayout.addWidget(seedSet, 3, 3);
 
     mainLayout.setSizeConstraint(QLayout::SetFixedSize);//SetMinimumSize
 
@@ -550,14 +554,14 @@
     return drawMapScene.encode();
 }
 
-void HWMapContainer::seedEdited(const QString & seed)
+void HWMapContainer::seedEdited()
 {
-    if (seed.isEmpty() || seed.size() > 54)
+    if (seedEdit->text().isEmpty() || seedEdit->text().size() > 54)
         seedEdit->setText(m_seed);
     else
     {
-        setSeed(seed);
-        emit seedChanged(seed);
+        setSeed(seedEdit->text());
+        emit seedChanged(seedEdit->text());
     }
 }
 
@@ -571,4 +575,4 @@
     emit drawnMapChanged(getDrawnMapData());
 
     changeImage();
-}
\ No newline at end of file
+}
--- a/QTfrontend/mapContainer.h	Thu Dec 16 17:40:31 2010 -0500
+++ b/QTfrontend/mapContainer.h	Fri Dec 17 09:26:02 2010 +0100
@@ -89,7 +89,7 @@
   void themeSelected(int currentRow);
   void addInfoToPreview(QPixmap image);
   void templateFilterChanged(int filter);
-  void seedEdited(const QString & seed);
+  void seedEdited();
 
  protected:
   virtual void resizeEvent ( QResizeEvent * event );
@@ -103,6 +103,7 @@
   HWMap* pMap;
   QString m_seed;
   QLineEdit* seedEdit;
+  QPushButton* seedSet;
   int hhLimit;
   int templateFilter;
   QPixmap hhSmall;