diff --git a/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp b/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp index 29af67e..5518272 100644 --- a/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp +++ b/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp @@ -60,12 +60,14 @@ void IntelliPhotoGui::open() // Called when the user clicks Save As in the menu void IntelliPhotoGui::save() { + // A QAction represents the action of the user clicking QAction *action = qobject_cast(sender()); // Stores the array of bytes of the users data QByteArray fileFormat = action->data().toByteArray(); + // Pass it to be saved saveFile(fileFormat); } @@ -141,6 +143,18 @@ void IntelliPhotoGui::createActions() saveAsActs.append(action); } + QAction *action = new QAction("PNG-8", this); + + // Set an action for each file format + action->setData("PNG"); + + // When clicked call IntelliPhotoGui::save() + connect(action, SIGNAL(triggered()), this, SLOT(save())); + + // Attach each file format option menu item to Save As + saveAsActs.append(action); + + // Create exit action and tie to IntelliPhotoGui::close() exitAct = new QAction(tr("E&xit"), this); @@ -178,6 +192,7 @@ void IntelliPhotoGui::createMenus() foreach (QAction *action, saveAsActs) saveAsMenu->addAction(action); + // Attach all actions to File fileMenu = new QMenu(tr("&File"), this); fileMenu->addAction(openAct); @@ -261,6 +276,10 @@ bool IntelliPhotoGui::saveFile(const QByteArray &fileFormat) // Define path, name and default file type QString initialPath = QDir::currentPath() + "/untitled." + fileFormat; + + + + // Get selected file from dialog // Add the proper file formats and extensions QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), diff --git a/IntelliPhoto/Painting/IntelliPhoto.pro.user b/IntelliPhoto/Painting/IntelliPhoto.pro.user index 8c0d660..87f6eae 100644 --- a/IntelliPhoto/Painting/IntelliPhoto.pro.user +++ b/IntelliPhoto/Painting/IntelliPhoto.pro.user @@ -1,10 +1,10 @@ - + EnvironmentId - {426164d9-3771-4235-8f83-cb0b49423ffc} + {d22feba4-9460-41e9-9ac3-cddcd407714c} ProjectExplorer.Project.ActiveTarget @@ -59,24 +59,19 @@ -fno-delayed-template-parsing true - true - - - - true ProjectExplorer.Project.Target.0 - Desktop Qt 5.12.5 MinGW 64-bit - Desktop Qt 5.12.5 MinGW 64-bit - qt.qt5.5125.win64_mingw73_kit - 1 + Desktop (x86-windows-msvc2017-pe-64bit) + Desktop (x86-windows-msvc2017-pe-64bit) + {39c3549a-728d-484f-a9ec-e2904e3853e7} + 0 0 0 - C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug + Z:/Uni/ws 19_20/softwaretechnologie/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_x86_windows_msvc2017_pe_64bit-Debug true @@ -132,7 +127,7 @@ true - C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Release + Z:/Uni/ws 19_20/softwaretechnologie/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_x86_windows_msvc2017_pe_64bit-Release true @@ -188,7 +183,7 @@ true - C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Profile + Z:/Uni/ws 19_20/softwaretechnologie/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_x86_windows_msvc2017_pe_64bit-Profile true @@ -312,7 +307,7 @@ IntelliPhoto - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/Painting/IntelliPhoto.pro + Qt4ProjectManager.Qt4RunConfiguration:Z:/Uni/ws 19_20/softwaretechnologie/intelliphoto/IntelliPhoto/Painting/IntelliPhoto.pro 3768 false @@ -322,7 +317,7 @@ false true - C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Release + Z:/Uni/ws 19_20/softwaretechnologie/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_x86_windows_msvc2017_pe_64bit-Debug 1 diff --git a/IntelliPhoto/Painting/IntelliPhoto.pro.user.426164d b/IntelliPhoto/Painting/IntelliPhoto.pro.user.426164d new file mode 100644 index 0000000..8c0d660 --- /dev/null +++ b/IntelliPhoto/Painting/IntelliPhoto.pro.user.426164d @@ -0,0 +1,342 @@ + + + + + + EnvironmentId + {426164d9-3771-4235-8f83-cb0b49423ffc} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + true + + + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.12.5 MinGW 64-bit + Desktop Qt 5.12.5 MinGW 64-bit + qt.qt5.5125.win64_mingw73_kit + 1 + 0 + 0 + + C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deployment + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deployment-Konfiguration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + IntelliPhoto + + Qt4ProjectManager.Qt4RunConfiguration:C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/Painting/IntelliPhoto.pro + + 3768 + false + true + true + false + false + true + + C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Release + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/IntelliPhoto/Painting/Layer/PaintingArea.cpp b/IntelliPhoto/Painting/Layer/PaintingArea.cpp index 7c7f085..4404a0f 100644 --- a/IntelliPhoto/Painting/Layer/PaintingArea.cpp +++ b/IntelliPhoto/Painting/Layer/PaintingArea.cpp @@ -63,6 +63,11 @@ bool PaintingArea::saveImage(const QString &fileName, const char *fileFormat) // Created to hold the image QImage visibleImage = image->getDisplayable(); + if(!std::strcmp(fileFormat,"PNG")){ + visibleImage = visibleImage.convertToFormat(QImage::Format_Indexed8); + fileFormat = "png"; + } + if (visibleImage.save(fileName, fileFormat)) { return true; } else {