diff --git a/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp b/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp index 097055d..1c13e71 100644 --- a/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp +++ b/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp @@ -216,6 +216,17 @@ 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("&Exit"), this); @@ -298,7 +309,7 @@ void IntelliPhotoGui::createGui(){ BlueLabel = new QLabel("Blue:"); RedEdit = new QLineEdit("255"); GreenEdit = new QLineEdit("255"); - BlueEdit = new QLineEdit("255");; + BlueEdit = new QLineEdit("255"); RedEdit->setMaximumSize(150,20); GreenEdit->setMaximumSize(150,20); BlueEdit->setMaximumSize(150,20); diff --git a/IntelliPhoto/Painting/IntelliPhoto.pro.user b/IntelliPhoto/Painting/IntelliPhoto.pro.user index 17ebfb2..34921a9 100644 --- a/IntelliPhoto/Painting/IntelliPhoto.pro.user +++ b/IntelliPhoto/Painting/IntelliPhoto.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -317,7 +317,7 @@ false true - Z:/Uni/ws 19_20/mathe/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_x86_windows_msvc2017_pe_64bit-Debug + 1 diff --git a/IntelliPhoto/Painting/Layer/PaintingArea.cpp b/IntelliPhoto/Painting/Layer/PaintingArea.cpp index f1a228d..de6ec85 100644 --- a/IntelliPhoto/Painting/Layer/PaintingArea.cpp +++ b/IntelliPhoto/Painting/Layer/PaintingArea.cpp @@ -111,6 +111,17 @@ bool PaintingArea::saveImage(const QString &fileName, const char *fileFormat) } this->assembleLayers(true); + if(!std::strcmp(fileFormat,"PNG")){ + QImage visibleImage = Canvas->convertToFormat(QImage::Format_Indexed8); + fileFormat = "png"; + if (visibleImage.save(fileName, fileFormat)) { + return true; + } else { + return false; + } + } + + if (Canvas->save(fileName, fileFormat)) { return true; } else {