21 #include <QFileDialog> |
21 #include <QFileDialog> |
22 |
22 |
23 #include "pagedrawmap.h" |
23 #include "pagedrawmap.h" |
24 #include "drawmapwidget.h" |
24 #include "drawmapwidget.h" |
25 |
25 |
26 PageDrawMap::PageDrawMap(QWidget* parent) : AbstractPage(parent) |
26 |
|
27 QLayout * PageDrawMap::bodyLayoutDefinition() |
27 { |
28 { |
28 QGridLayout * pageLayout = new QGridLayout(this); |
29 QGridLayout * pageLayout = new QGridLayout(); |
29 |
30 |
30 QPushButton * pbUndo = addButton(tr("Undo"), pageLayout, 0, 0); |
31 pbUndo = addButton(tr("Undo"), pageLayout, 0, 0); |
31 QPushButton * pbClear = addButton(tr("Clear"), pageLayout, 1, 0); |
32 pbClear = addButton(tr("Clear"), pageLayout, 1, 0); |
32 QPushButton * pbLoad = addButton(tr("Load"), pageLayout, 2, 0); |
33 pbLoad = addButton(tr("Load"), pageLayout, 2, 0); |
33 QPushButton * pbSave = addButton(tr("Save"), pageLayout, 3, 0); |
34 pbSave = addButton(tr("Save"), pageLayout, 3, 0); |
34 |
|
35 |
|
36 BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true); |
|
37 connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack())); |
|
38 |
|
39 |
35 |
40 drawMapWidget = new DrawMapWidget(this); |
36 drawMapWidget = new DrawMapWidget(this); |
41 pageLayout->addWidget(drawMapWidget, 0, 1, 5, 1); |
37 pageLayout->addWidget(drawMapWidget, 0, 1, 5, 1); |
42 |
38 |
|
39 return pageLayout; |
|
40 } |
|
41 |
|
42 void PageDrawMap::connectSignals() |
|
43 { |
43 connect(pbUndo, SIGNAL(clicked()), drawMapWidget, SLOT(undo())); |
44 connect(pbUndo, SIGNAL(clicked()), drawMapWidget, SLOT(undo())); |
44 connect(pbClear, SIGNAL(clicked()), drawMapWidget, SLOT(clear())); |
45 connect(pbClear, SIGNAL(clicked()), drawMapWidget, SLOT(clear())); |
45 connect(pbLoad, SIGNAL(clicked()), this, SLOT(load())); |
46 connect(pbLoad, SIGNAL(clicked()), this, SLOT(load())); |
46 connect(pbSave, SIGNAL(clicked()), this, SLOT(save())); |
47 connect(pbSave, SIGNAL(clicked()), this, SLOT(save())); |
|
48 } |
|
49 |
|
50 PageDrawMap::PageDrawMap(QWidget* parent) : AbstractPage(parent) |
|
51 { |
|
52 initPage(); |
47 } |
53 } |
48 |
54 |
49 void PageDrawMap::load() |
55 void PageDrawMap::load() |
50 { |
56 { |
51 QString fileName = QFileDialog::getOpenFileName(NULL, tr("Load drawn map"), ".", tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)"); |
57 QString fileName = QFileDialog::getOpenFileName(NULL, tr("Load drawn map"), ".", tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)"); |