QTfrontend/ui/page/pagedrawmap.cpp
changeset 9551 61f160dfd0f1
parent 9080 9b42757d7e71
child 9998 736015b847e3
--- a/QTfrontend/ui/page/pagedrawmap.cpp	Tue Oct 15 23:07:22 2013 +0400
+++ b/QTfrontend/ui/page/pagedrawmap.cpp	Fri Oct 18 15:26:43 2013 +0400
@@ -20,6 +20,7 @@
 #include <QPushButton>
 #include <QFileDialog>
 #include <QCheckBox>
+#include <QRadioButton>
 
 #include "pagedrawmap.h"
 #include "drawmapwidget.h"
@@ -32,12 +33,22 @@
     cbEraser = new QCheckBox(tr("Eraser"), this);
     pageLayout->addWidget(cbEraser, 0, 0);
     pbUndo = addButton(tr("Undo"), pageLayout, 1, 0);
-    pbClear = addButton(tr("Clear"), pageLayout, 2, 0);
-    pbLoad = addButton(tr("Load"), pageLayout, 3, 0);
-    pbSave = addButton(tr("Save"), pageLayout, 4, 0);
+
+    rbPolyline = new QRadioButton(tr("Polyline"), this);
+    pageLayout->addWidget(rbPolyline, 2, 0);
+    rbRectangle = new QRadioButton(tr("Rectangle"), this);
+    pageLayout->addWidget(rbRectangle, 3, 0);
+    rbEllipse = new QRadioButton(tr("Ellipse"), this);
+    pageLayout->addWidget(rbEllipse, 4, 0);
+
+    rbPolyline->setChecked(true);
+
+    pbClear = addButton(tr("Clear"), pageLayout, 5, 0);
+    pbLoad = addButton(tr("Load"), pageLayout, 6, 0);
+    pbSave = addButton(tr("Save"), pageLayout, 7, 0);
 
     drawMapWidget = new DrawMapWidget(this);
-    pageLayout->addWidget(drawMapWidget, 0, 1, 6, 1);
+    pageLayout->addWidget(drawMapWidget, 0, 1, 9, 1);
 
     return pageLayout;
 }
@@ -49,6 +60,10 @@
     connect(pbClear, SIGNAL(clicked()), drawMapWidget, SLOT(clear()));
     connect(pbLoad, SIGNAL(clicked()), this, SLOT(load()));
     connect(pbSave, SIGNAL(clicked()), this, SLOT(save()));
+
+    connect(rbPolyline, SIGNAL(toggled(bool)), this, SLOT(pathTypeSwitched(bool)));
+    connect(rbRectangle, SIGNAL(toggled(bool)), this, SLOT(pathTypeSwitched(bool)));
+    connect(rbEllipse, SIGNAL(toggled(bool)), this, SLOT(pathTypeSwitched(bool)));
 }
 
 PageDrawMap::PageDrawMap(QWidget* parent) : AbstractPage(parent)
@@ -71,3 +86,13 @@
     if(!fileName.isEmpty())
         drawMapWidget->save(fileName);
 }
+
+void PageDrawMap::pathTypeSwitched(bool b)
+{
+    if(b)
+    {
+        if(rbPolyline->isChecked()) drawMapWidget->setPathType(DrawMapScene::Polyline);
+        else if(rbRectangle->isChecked()) drawMapWidget->setPathType(DrawMapScene::Rectangle);
+        else if(rbEllipse->isChecked()) drawMapWidget->setPathType(DrawMapScene::Ellipse);
+    }
+}