From 189f07001648f7ba5a9c570ce0f8e30ffb23a556 Mon Sep 17 00:00:00 2001 From: Jan Schuffenhauer Date: Thu, 23 Jan 2020 14:43:33 +0100 Subject: [PATCH] save nearly done, i guess need help with the open, if(end of fileName = ".idf") --- src/GUI/IntelliPhotoGui.cpp | 8 +++++--- src/IntelliHelper/IntelliDatamanager.cpp | 19 +++++++++++++++---- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/GUI/IntelliPhotoGui.cpp b/src/GUI/IntelliPhotoGui.cpp index e5af83b..3753772 100644 --- a/src/GUI/IntelliPhotoGui.cpp +++ b/src/GUI/IntelliPhotoGui.cpp @@ -61,10 +61,12 @@ void IntelliPhotoGui::slotOpen(){ IntelliDatamanager::loadProject(paintingArea,fileName); } } - paintingArea->open(fileName); + } + //paintingArea->open(fileName); + //TODO remove datamanager funciton and enable painting area function + IntelliDatamanager::loadProject(paintingArea,fileName); UpdateGui(); - } - } + } } // Called when the user clicks Save As in the menu diff --git a/src/IntelliHelper/IntelliDatamanager.cpp b/src/IntelliHelper/IntelliDatamanager.cpp index aed051e..fb900df 100644 --- a/src/IntelliHelper/IntelliDatamanager.cpp +++ b/src/IntelliHelper/IntelliDatamanager.cpp @@ -1,13 +1,24 @@ #include "IntelliDatamanager.h" #include "Layer/PaintingArea.h" - bool IntelliDatamanager::saveProject(PaintingArea* Canvas, QString filePath){ QFile openFile(filePath); if(openFile.open(QIODevice::WriteOnly)){ - qDebug() << "works."; - openFile.write("Hahaha"); + QTextStream out(&openFile); + + out << "Format: idf\n" << "Version: 0.7\n" << endl; + out << "Resolution: " << Canvas->getMaxWidth() << "x" << Canvas->getMaxHeight() << endl; + out << "Layers: " << "0" << endl; + if(false){ + out << "width: " << endl; + out << "height: " << endl; + out << "xoffset: " << endl; + out << "yoffset: " << endl; + out << "alpha: " << endl; + out << "imageData: " << endl; + } + openFile.close(); return true; } @@ -19,7 +30,7 @@ bool IntelliDatamanager::loadProject(PaintingArea* Canvas, QString filePath){ QFile openFile(filePath); if(openFile.open(QIODevice::ReadOnly)){ - qDebug() << openFile.readAll(); + qDebug() << openFile.readLine(); openFile.close(); return true; }