summaryrefslogtreecommitdiff
path: root/src/mainwindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cc')
-rw-r--r--src/mainwindow.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index ea86b3c..9dabde1 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -26,6 +26,8 @@
*/
#include "mainwindow.h"
+#include <iostream>
+
#include <QHBoxLayout>
#include <QVBoxLayout>
@@ -52,6 +54,7 @@
#include "zoomslider.h"
#include "settings.h"
#include "projectdialog.h"
+#include "projectserialiser.h"
#define MAXVAL 10000000L
@@ -107,6 +110,14 @@ MainWindow::MainWindow(Settings& settings)
fileMenu->addAction(act_new_project);
connect(act_new_project, SIGNAL(triggered()), this, SLOT(newProject()));
+ QAction* act_load_project = new QAction(tr("&Load Project..."), this);
+ fileMenu->addAction(act_load_project);
+ connect(act_load_project, SIGNAL(triggered()), this, SLOT(loadProject()));
+
+ QAction* act_save_project = new QAction(tr("&Save Project..."), this);
+ fileMenu->addAction(act_save_project);
+ connect(act_save_project, SIGNAL(triggered()), this, SLOT(saveProject()));
+
QAction* act_quit = new QAction(tr("&Quit"), this);
fileMenu->addAction(act_quit);
connect(act_quit, SIGNAL(triggered()), this, SLOT(close()));
@@ -457,6 +468,31 @@ void MainWindow::newProject()
dlg.exec();
}
+void MainWindow::loadProject()
+{
+ QFile file("test.dgedit");
+ if(!file.open(QIODevice::ReadOnly))
+ {
+ return;
+ }
+
+ QString xml(file.readAll());
+ file.close();
+
+ ProjectSerialiser ser;
+ ser.deserialise(xml, project);
+
+ std::cout << project.getProjectName().toStdString() << std::endl;
+ std::cout << project.getRawFileRoot().toStdString() << std::endl;
+}
+
+void MainWindow::saveProject()
+{
+ ProjectSerialiser ser;
+ auto xml = ser.serialise(project);
+ std::cout << xml.toStdString() << std::endl;
+}
+
void MainWindow::projectChanged()
{
statusBar()->showMessage(tr("Unsaved"));