1 /*
2  *  Copyright (c) 2013 Sven Langkamp <sven.langkamp@gmail.com>
3  *
4  *  This library is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU Lesser General Public License as published by
6  *  the Free Software Foundation; version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This library is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU Lesser General Public License for more details.
13  *
14  *  You should have received a copy of the GNU Lesser General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #include "qml_export.h"
20 
21 #include <QCheckBox>
22 #include <QSlider>
23 
24 #include <kpluginfactory.h>
25 #include <QFileInfo>
26 #include <QApplication>
27 
28 #include <KisExportCheckRegistry.h>
29 #include <KisDocument.h>
30 #include <kis_image.h>
31 
32 #include "qml_converter.h"
33 #include <KoColorModelStandardIds.h>
34 
35 K_PLUGIN_FACTORY_WITH_JSON(ExportFactory, "krita_qml_export.json", registerPlugin<QMLExport>();)
36 
QMLExport(QObject * parent,const QVariantList &)37 QMLExport::QMLExport(QObject *parent, const QVariantList &) : KisImportExportFilter(parent)
38 {
39 }
40 
~QMLExport()41 QMLExport::~QMLExport()
42 {
43 }
44 
convert(KisDocument * document,QIODevice * io,KisPropertiesConfigurationSP)45 KisImportExportErrorCode QMLExport::convert(KisDocument *document, QIODevice *io,  KisPropertiesConfigurationSP /*configuration*/)
46 {
47     KisImageSP image = document->savingImage();
48     Q_CHECK_PTR(image);
49 
50     QMLConverter converter;
51     return converter.buildFile(filename(), realFilename(), io, image);
52 }
53 
initializeCapabilities()54 void QMLExport::initializeCapabilities()
55 {
56     addCapability(KisExportCheckRegistry::instance()->get("MultiLayerCheck")->create(KisExportCheckBase::SUPPORTED));
57 
58     QList<QPair<KoID, KoID> > supportedColorModels;
59     supportedColorModels << QPair<KoID, KoID>()
60             << QPair<KoID, KoID>(RGBAColorModelID, Integer8BitsColorDepthID)
61             << QPair<KoID, KoID>(GrayAColorModelID, Integer8BitsColorDepthID);
62     addSupportedColorModels(supportedColorModels, "QML");
63     }
64 
65 
66 
67 #include <qml_export.moc>
68 
69