Try to send drawn map data to net server
authorunc0rr
Tue, 14 Dec 2010 20:46:50 +0300
changeset 4525 0a81be113e21
parent 4524 65c294aedaea
child 4526 38afca1e4248
Try to send drawn map data to net server
QTfrontend/gamecfgwidget.cpp
QTfrontend/gamecfgwidget.h
QTfrontend/hwform.cpp
QTfrontend/mapContainer.cpp
QTfrontend/mapContainer.h
--- a/QTfrontend/gamecfgwidget.cpp	Tue Dec 14 20:01:27 2010 +0300
+++ b/QTfrontend/gamecfgwidget.cpp	Tue Dec 14 20:46:50 2010 +0300
@@ -140,6 +140,7 @@
     connect(pMapContainer, SIGNAL(themeChanged(const QString &)), this, SLOT(themeChanged(const QString &)));
     connect(pMapContainer, SIGNAL(newTemplateFilter(int)), this, SLOT(templateFilterChanged(int)));
     connect(pMapContainer, SIGNAL(drawMapRequested()), this, SIGNAL(goToDrawMap()));
+    connect(pMapContainer, SIGNAL(drawnMapChanged(const QByteArray &)), this, SLOT(onDrawnMapChanged(const QByteArray &)));
 }
 
 void GameCFGWidget::jumpToSchemes()
@@ -529,3 +530,10 @@
 {
     schemeChanged(GameSchemes->currentIndex());
 }
+
+void GameCFGWidget::onDrawnMapChanged(const QByteArray & data)
+{
+    QStringList sl;
+    sl << QString(qCompress(data).toBase64());
+    emit paramChanged("DRAWNMAP", sl);
+}
\ No newline at end of file
--- a/QTfrontend/gamecfgwidget.h	Tue Dec 14 20:01:27 2010 +0300
+++ b/QTfrontend/gamecfgwidget.h	Tue Dec 14 20:46:50 2010 +0300
@@ -70,6 +70,7 @@
     void jumpToWeapons();
     void mapgenChanged(MapGenerator m);
     void maze_sizeChanged(int s);
+    void onDrawnMapChanged(const QByteArray & data);
 
 private:
     QGridLayout mainLayout;
--- a/QTfrontend/hwform.cpp	Tue Dec 14 20:01:27 2010 +0300
+++ b/QTfrontend/hwform.cpp	Tue Dec 14 20:46:50 2010 +0300
@@ -446,9 +446,9 @@
     if(lastid == ID_PAGE_DRAWMAP)
     {
         if(id = ID_PAGE_MULTIPLAYER)
-            ui.pageMultiplayer->gameCFG->pMapContainer->changeImage();
+            ui.pageMultiplayer->gameCFG->pMapContainer->mapDrawingFinished();
         else
-            ui.pageNetGame->pGameCFG->pMapContainer->changeImage();
+            ui.pageNetGame->pGameCFG->pMapContainer->mapDrawingFinished();
     }
 
     if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETGAME) {
--- a/QTfrontend/mapContainer.cpp	Tue Dec 14 20:01:27 2010 +0300
+++ b/QTfrontend/mapContainer.cpp	Tue Dec 14 20:46:50 2010 +0300
@@ -559,3 +559,10 @@
 {
     return &drawMapScene;
 }
+
+void HWMapContainer::mapDrawingFinished()
+{
+    changeImage();
+
+    emit drawnMapChanged(getDrawnMapData());
+}
\ No newline at end of file
--- a/QTfrontend/mapContainer.h	Tue Dec 14 20:01:27 2010 +0300
+++ b/QTfrontend/mapContainer.h	Tue Dec 14 20:46:50 2010 +0300
@@ -58,6 +58,7 @@
 
  public slots:
   void changeImage();
+  void mapDrawingFinished();
   void setSeed(const QString & seed);
   void setMap(const QString & map);
   void setTheme(const QString & theme);
@@ -73,6 +74,7 @@
   void mapgenChanged(MapGenerator m);
   void maze_sizeChanged(int s);
   void drawMapRequested();
+  void drawnMapChanged(const QByteArray & data);
 
  private slots:
   void setImage(const QImage newImage);