--- a/tools/drawMapTest/mainwindow.cpp Wed Dec 01 20:45:46 2010 +0300
+++ b/tools/drawMapTest/mainwindow.cpp Wed Dec 01 22:06:23 2010 +0300
@@ -1,3 +1,5 @@
+#include <QFileDialog>
+
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "drawmapscene.h"
@@ -51,3 +53,30 @@
{
scene->simplifyLast();
}
+
+void MainWindow::on_pbSave_clicked()
+{
+ QString fileName = QFileDialog::getSaveFileName(this, tr("Save map"), ".");
+
+ if(!fileName.isEmpty())
+ {
+ QFile f(fileName);
+
+ f.open(QIODevice::WriteOnly);
+ f.write(qCompress(scene->encode()).toBase64());
+ }
+}
+
+void MainWindow::on_pbLoad_clicked()
+{
+ QString fileName = QFileDialog::getOpenFileName(this, tr("Open map file"), ".");
+
+ if(!fileName.isEmpty())
+ {
+ QFile f(fileName);
+
+ f.open(QIODevice::ReadOnly);
+ QByteArray data = qUncompress(QByteArray::fromBase64(f.readAll()));
+ scene->decode(data);
+ }
+}