diff --git a/plugins/impex/odg/kis_odg_import.cc b/plugins/impex/odg/kis_odg_import.cc index 218ef05ae5..53c3baac7f 100644 --- a/plugins/impex/odg/kis_odg_import.cc +++ b/plugins/impex/odg/kis_odg_import.cc @@ -1,160 +1,161 @@ /* * Copyright (c) 2006-2008 Boudewijn Rempt * Copyright (c) 2007 Thomas Zander * Copyright (c) 2009 Cyrille Berger * Copyright (c) 2010 Sven Langkamp * * 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_odg_import.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include K_PLUGIN_FACTORY_WITH_JSON(ODGImportFactory, "krita_odg_import.json", registerPlugin();) KisODGImport::KisODGImport(QObject *parent, const QVariantList &) : KisImportExportFilter(parent) { } KisODGImport::~KisODGImport() { } KisImportExportFilter::ConversionStatus KisODGImport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration) { + Q_UNUSED(configuration); dbgFile << "Import odg"; if (to != "application/x-krita") return KisImportExportFilter::BadMimeType; KisDocument * doc = outputDocument(); if (!doc) return KisImportExportFilter::NoDocumentCreated; QString filename = inputFile(); KoStore* store = KoStore::createStore(filename, KoStore::Read, from, KoStore::Zip); if (!store || store->bad()) { delete store; return KisImportExportFilter::BadConversionGraph; } doc -> prepareForImport(); KoOdfReadStore odfStore(store); QString errorMessage; odfStore.loadAndParse(errorMessage); if (!errorMessage.isEmpty()) { warnKrita << errorMessage; return KisImportExportFilter::CreationError; } KoXmlElement contents = odfStore.contentDoc().documentElement(); KoXmlElement body(KoXml::namedItemNS(contents, KoXmlNS::office, "body")); if (body.isNull()) { //setErrorMessage( i18n( "Invalid OASIS document. No office:body tag found." ) ); return KisImportExportFilter::CreationError; } body = KoXml::namedItemNS(body, KoXmlNS::office, "drawing"); if (body.isNull()) { //setErrorMessage( i18n( "Invalid OASIS document. No office:drawing tag found." ) ); return KisImportExportFilter::CreationError; } KoXmlElement page(KoXml::namedItemNS(body, KoXmlNS::draw, "page")); if (page.isNull()) { //setErrorMessage( i18n( "Invalid OASIS document. No draw:page tag found." ) ); return KisImportExportFilter::CreationError; } KoXmlElement * master = 0; if (odfStore.styles().masterPages().contains("Standard")) master = odfStore.styles().masterPages().value("Standard"); else if (odfStore.styles().masterPages().contains("Default")) master = odfStore.styles().masterPages().value("Default"); else if (! odfStore.styles().masterPages().empty()) master = odfStore.styles().masterPages().begin().value(); qint32 width = 1000; qint32 height = 1000; if (master) { const KoXmlElement *style = odfStore.styles().findStyle( master->attributeNS(KoXmlNS::style, "page-layout-name", QString())); if (style) { KoPageLayout pageLayout; pageLayout.loadOdf(*style); width = pageLayout.width; height = pageLayout.height; } } // We work fine without a master page KoOdfLoadingContext context(odfStore.styles(), odfStore.store()); context.setManifestFile(QString("tar:/") + odfStore.store()->currentPath() + "META-INF/manifest.xml"); KoShapeLoadingContext shapeContext(context, doc->shapeController()->resourceManager()); const KoColorSpace* cs = KoColorSpaceRegistry::instance()->rgb8(); KisImageWSP image = new KisImage(doc->createUndoStore(), width, height, cs, "built image"); doc->setCurrentImage(image); KoXmlElement layerElement; forEachElement(layerElement, KoXml::namedItemNS(page, KoXmlNS::draw, "layer-set")) { KisShapeLayerSP shapeLayer = new KisShapeLayer(doc->shapeController(), image, i18n("Vector Layer"), OPACITY_OPAQUE_U8); if (!shapeLayer->loadOdf(layerElement, shapeContext)) { dbgKrita << "Could not load vector layer!"; return KisImportExportFilter::CreationError; } image->addNode(shapeLayer, image->rootLayer(), 0); } KoXmlElement child; forEachElement(child, page) { /*KoShape * shape = */KoShapeRegistry::instance()->createShapeFromOdf(child, shapeContext); } return KisImportExportFilter::OK; } #include "kis_odg_import.moc" diff --git a/plugins/impex/psd/psd_import.cc b/plugins/impex/psd/psd_import.cc index 0e111dffc6..a609245d8b 100644 --- a/plugins/impex/psd/psd_import.cc +++ b/plugins/impex/psd/psd_import.cc @@ -1,93 +1,94 @@ /* * 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 #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() { } KisImportExportFilter::ConversionStatus psdImport::convert(const QByteArray&, const QByteArray& to, KisPropertiesConfigurationSP configuration) { + Q_UNUSED(configuration); dbgFile <<"Importing using PSDImport!"; if (to != "application/x-krita") return KisImportExportFilter::BadMimeType; KisDocument * doc = outputDocument(); if (!doc) return KisImportExportFilter::NoDocumentCreated; QString filename = inputFile(); doc->prepareForImport(); if (!filename.isEmpty()) { if (!QFileInfo(filename).exists()) { return KisImportExportFilter::FileNotFound; } PSDLoader ib(doc); KisImageBuilder_Result result = ib.buildImage(filename); switch (result) { case KisImageBuilder_RESULT_UNSUPPORTED: return KisImportExportFilter::NotImplemented; case KisImageBuilder_RESULT_INVALID_ARG: return KisImportExportFilter::BadMimeType; case KisImageBuilder_RESULT_NO_URI: case KisImageBuilder_RESULT_NOT_EXIST: case KisImageBuilder_RESULT_NOT_LOCAL: qDebug() << "ib returned KisImageBuilder_RESULT_NOT_LOCAL"; return KisImportExportFilter::FileNotFound; case KisImageBuilder_RESULT_BAD_FETCH: case KisImageBuilder_RESULT_EMPTY: return KisImportExportFilter::ParsingError; case KisImageBuilder_RESULT_FAILURE: return KisImportExportFilter::InternalError; case KisImageBuilder_RESULT_OK: doc -> setCurrentImage( ib.image()); return KisImportExportFilter::OK; default: return KisImportExportFilter::StorageCreationError; //dbgFile << "Result was: " << result; } } return KisImportExportFilter::StorageCreationError; } #include diff --git a/plugins/impex/qml/qml_export.cc b/plugins/impex/qml/qml_export.cc index e2caee782d..2665c595bf 100644 --- a/plugins/impex/qml/qml_export.cc +++ b/plugins/impex/qml/qml_export.cc @@ -1,80 +1,81 @@ /* * Copyright (c) 2013 Sven Langkamp * * 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 "qml_export.h" #include #include #include #include #include #include #include #include #include "qml_converter.h" K_PLUGIN_FACTORY_WITH_JSON(ExportFactory, "krita_qml_export.json", registerPlugin();) QMLExport::QMLExport(QObject *parent, const QVariantList &) : KisImportExportFilter(parent) { } QMLExport::~QMLExport() { } KisImportExportFilter::ConversionStatus QMLExport::convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration) { + Q_UNUSED(configuration); Q_UNUSED(from); Q_UNUSED(to); if (from != "application/x-krita") return KisImportExportFilter::NotImplemented; KisDocument *input = inputDocument(); QString filename = outputFile(); dbgKrita << "input " << input; if (!input) { return KisImportExportFilter::NoDocumentCreated; } dbgKrita << "filename " << input; if (filename.isEmpty()) { return KisImportExportFilter::FileNotFound; } KisImageWSP image = input->image(); Q_CHECK_PTR(image); QMLConverter converter; KisImageBuilder_Result result = converter.buildFile(filename, image); if (result == KisImageBuilder_RESULT_OK) { dbgFile << "success !"; return KisImportExportFilter::OK; } dbgFile << " Result =" << result; return KisImportExportFilter::InternalError; } #include