diff --git a/plugins/impex/csv/kis_csv_import.cpp b/plugins/impex/csv/kis_csv_import.cpp index d49d613537..fb9a555d7c 100644 --- a/plugins/impex/csv/kis_csv_import.cpp +++ b/plugins/impex/csv/kis_csv_import.cpp @@ -1,51 +1,55 @@ /* * Copyright (c) 2016 Laszlo Fazekas * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "kis_csv_import.h" #include #include #include #include #include #include #include "csv_loader.h" K_PLUGIN_FACTORY_WITH_JSON(CSVImportFactory, "krita_csv_import.json", registerPlugin();) KisCSVImport::KisCSVImport(QObject *parent, const QVariantList &) : KisImportExportFilter(parent) { } KisCSVImport::~KisCSVImport() { } KisImportExportErrorCode KisCSVImport::convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP /*configuration*/) { CSVLoader ib(document, batchMode()); - return ib.buildAnimation(io, filename()); + KisImportExportErrorCode result = ib.buildAnimation(io, filename()); + if (result.isOk()) { + document->setCurrentImage(ib.image()); + } + return result; } #include diff --git a/plugins/impex/exr/exr_import.cc b/plugins/impex/exr/exr_import.cc index 0e5dad274e..a6926dd6bc 100644 --- a/plugins/impex/exr/exr_import.cc +++ b/plugins/impex/exr/exr_import.cc @@ -1,49 +1,53 @@ /* * Copyright (c) 2010 Cyrille Berger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "exr_import.h" #include #include #include #include #include #include "exr_converter.h" K_PLUGIN_FACTORY_WITH_JSON(ImportFactory, "krita_exr_import.json", registerPlugin();) exrImport::exrImport(QObject *parent, const QVariantList &) : KisImportExportFilter(parent) { } exrImport::~exrImport() { } KisImportExportErrorCode exrImport::convert(KisDocument *document, QIODevice */*io*/, KisPropertiesConfigurationSP /*configuration*/) { EXRConverter ib(document, !batchMode()); - return ib.buildImage(filename()); + KisImportExportErrorCode result = ib.buildImage(filename()); + if (result.isOk()) { + document->setCurrentImage(ib.image()); + } + return result; } #include diff --git a/plugins/impex/jpeg/kis_jpeg_import.cc b/plugins/impex/jpeg/kis_jpeg_import.cc index 1fc63a5c99..911c3c453d 100644 --- a/plugins/impex/jpeg/kis_jpeg_import.cc +++ b/plugins/impex/jpeg/kis_jpeg_import.cc @@ -1,52 +1,54 @@ /* * Copyright (c) 2005 Cyrille Berger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "kis_jpeg_import.h" #include #include #include #include #include #include #include "kis_jpeg_converter.h" K_PLUGIN_FACTORY_WITH_JSON(JPEGImportFactory, "krita_jpeg_import.json", registerPlugin();) KisJPEGImport::KisJPEGImport(QObject *parent, const QVariantList &) : KisImportExportFilter(parent) { } KisJPEGImport::~KisJPEGImport() { } KisImportExportErrorCode KisJPEGImport::convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP /*configuration*/) { - KisJPEGConverter ib(document, batchMode()); - return ib.buildImage(io); - + KisImportExportErrorCode result = ib.buildImage(io); + if (result.isOk()) { + document->setCurrentImage(ib.image()); + } + return result; } #include diff --git a/plugins/impex/ora/ora_import.cc b/plugins/impex/ora/ora_import.cc index 9e6a0a1cf1..2d49dee39c 100644 --- a/plugins/impex/ora/ora_import.cc +++ b/plugins/impex/ora/ora_import.cc @@ -1,45 +1,52 @@ /* * Copyright (c) 2007 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "ora_import.h" #include #include #include #include #include "ora_converter.h" K_PLUGIN_FACTORY_WITH_JSON(ImportFactory, "krita_ora_import.json", registerPlugin();) OraImport::OraImport(QObject *parent, const QVariantList &) : KisImportExportFilter(parent) { } OraImport::~OraImport() { } KisImportExportErrorCode OraImport::convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP /*configuration*/) { OraConverter oraConverter(document); - return oraConverter.buildImage(io); + KisImportExportErrorCode result = oraConverter.buildImage(io); + if (result.isOk()) { + document->setCurrentImage(oraConverter.image()); + if (oraConverter.activeNodes().size() > 0) { + document->setPreActivatedNode(oraConverter.activeNodes()[0]); + } + } + return result; } #include diff --git a/plugins/impex/png/kis_png_import.cc b/plugins/impex/png/kis_png_import.cc index ae44981470..29a82cea2d 100644 --- a/plugins/impex/png/kis_png_import.cc +++ b/plugins/impex/png/kis_png_import.cc @@ -1,53 +1,56 @@ /* * Copyright (c) 2005 Cyrille Berger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "kis_png_import.h" #include #include #include #include #include #include #include "kis_png_converter.h" K_PLUGIN_FACTORY_WITH_JSON(PNGImportFactory, "krita_png_import.json", registerPlugin();) KisPNGImport::KisPNGImport(QObject *parent, const QVariantList &) : KisImportExportFilter(parent) { } KisPNGImport::~KisPNGImport() { } KisImportExportErrorCode KisPNGImport::convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP /*configuration*/) { KisPNGConverter ib(document, batchMode()); KisImportExportErrorCode res = ib.buildImage(io); + if (res.isOk()){ + document->setCurrentImage(ib.image()); + } return res; } #include diff --git a/plugins/impex/psd/psd_import.cc b/plugins/impex/psd/psd_import.cc index 23061a816c..a73917e1e6 100644 --- a/plugins/impex/psd/psd_import.cc +++ b/plugins/impex/psd/psd_import.cc @@ -1,45 +1,49 @@ /* * Copyright (c) 2009 Boudewijn Rempt * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "psd_import.h" #include #include #include #include #include "psd_loader.h" K_PLUGIN_FACTORY_WITH_JSON(ImportFactory, "krita_psd_import.json", registerPlugin();) psdImport::psdImport(QObject *parent, const QVariantList &) : KisImportExportFilter(parent) { } psdImport::~psdImport() { } KisImportExportErrorCode psdImport::convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP /*configuration*/) { PSDLoader ib(document); - return ib.buildImage(io); + KisImportExportErrorCode result = ib.buildImage(io); + if (result.isOk()) { + document->setCurrentImage(ib.image()); + } + return result; } #include diff --git a/plugins/impex/tiff/kis_tiff_import.cc b/plugins/impex/tiff/kis_tiff_import.cc index 8077c89b7b..eb947dc135 100644 --- a/plugins/impex/tiff/kis_tiff_import.cc +++ b/plugins/impex/tiff/kis_tiff_import.cc @@ -1,50 +1,54 @@ /* * Copyright (c) 2005 Cyrille Berger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "kis_tiff_import.h" #include #include #include #include #include #include "kis_tiff_converter.h" K_PLUGIN_FACTORY_WITH_JSON(TIFFImportFactory, "krita_tiff_import.json", registerPlugin();) KisTIFFImport::KisTIFFImport(QObject *parent, const QVariantList &) : KisImportExportFilter(parent) { } KisTIFFImport::~KisTIFFImport() { } KisImportExportErrorCode KisTIFFImport::convert(KisDocument *document, QIODevice */*io*/, KisPropertiesConfigurationSP /*configuration*/) { KisTIFFConverter tiffConverter(document); - return tiffConverter.buildImage(filename()); + KisImportExportErrorCode result = tiffConverter.buildImage(filename()); + if (result.isOk()) { + document->setCurrentImage(tiffConverter.image()); + } + return result; } #include