2015 |
2016 |
2016 PageDrawMap::PageDrawMap(QWidget* parent) : AbstractPage(parent) |
2017 PageDrawMap::PageDrawMap(QWidget* parent) : AbstractPage(parent) |
2017 { |
2018 { |
2018 QGridLayout * pageLayout = new QGridLayout(this); |
2019 QGridLayout * pageLayout = new QGridLayout(this); |
2019 |
2020 |
2020 BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
2021 QPushButton * pbUndo = addButton(tr("Undo"), pageLayout, 0, 0); |
|
2022 QPushButton * pbClear = addButton(tr("Clear"), pageLayout, 1, 0); |
|
2023 QPushButton * pbLoad = addButton(tr("Load"), pageLayout, 2, 0); |
|
2024 QPushButton * pbSave = addButton(tr("Save"), pageLayout, 3, 0); |
|
2025 |
|
2026 BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true); |
2021 |
2027 |
2022 drawMapWidget = new DrawMapWidget(this); |
2028 drawMapWidget = new DrawMapWidget(this); |
2023 pageLayout->addWidget(drawMapWidget, 0, 0, 1, 2); |
2029 pageLayout->addWidget(drawMapWidget, 0, 1, 5, 1); |
2024 } |
2030 |
|
2031 connect(pbUndo, SIGNAL(clicked()), drawMapWidget, SLOT(undo())); |
|
2032 connect(pbClear, SIGNAL(clicked()), drawMapWidget, SLOT(clear())); |
|
2033 connect(pbLoad, SIGNAL(clicked()), this, SLOT(load())); |
|
2034 connect(pbSave, SIGNAL(clicked()), this, SLOT(save())); |
|
2035 } |
|
2036 |
|
2037 void PageDrawMap::load() |
|
2038 { |
|
2039 QString fileName = QFileDialog::getOpenFileName(this, tr("Load drawn map"), ".", tr("Drawn Maps (*.hwmap);;All files (*.*)")); |
|
2040 |
|
2041 if(!fileName.isEmpty()) |
|
2042 drawMapWidget->load(fileName); |
|
2043 } |
|
2044 |
|
2045 void PageDrawMap::save() |
|
2046 { |
|
2047 QString fileName = QFileDialog::getSaveFileName(this, tr("Save drawn map"), ".", tr("Drawn Maps (*.hwmap);;All files (*.*)")); |
|
2048 |
|
2049 if(!fileName.isEmpty()) |
|
2050 drawMapWidget->save(fileName); |
|
2051 } |