File indexing completed on 2024-12-22 04:15:51

0001 /*
0002  *  SPDX-FileCopyrightText: 2007 Boudewijn Rempt <boud@valdyas.org>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "kis_qimageio_import.h"
0008 
0009 #include <QCheckBox>
0010 #include <QSlider>
0011 #include <QApplication>
0012 #include <QFileInfo>
0013 #include <QImageReader>
0014 
0015 #include <kpluginfactory.h>
0016 
0017 #include <KoColorSpace.h>
0018 #include <KoColorSpaceRegistry.h>
0019 
0020 #include <kis_transaction.h>
0021 #include <kis_paint_device.h>
0022 #include <KisDocument.h>
0023 #include <kis_image.h>
0024 #include <kis_paint_layer.h>
0025 #include <kis_node.h>
0026 #include <kis_group_layer.h>
0027 
0028 
0029 K_PLUGIN_FACTORY_WITH_JSON(KisQImageIOImportFactory, "krita_qimageio_import.json", registerPlugin<KisQImageIOImport>();)
0030 
0031 KisQImageIOImport::KisQImageIOImport(QObject *parent, const QVariantList &) : KisImportExportFilter(parent)
0032 {
0033 }
0034 
0035 KisQImageIOImport::~KisQImageIOImport()
0036 {
0037 }
0038 
0039 KisImportExportErrorCode KisQImageIOImport::convert(KisDocument *document, QIODevice *io,  KisPropertiesConfigurationSP /*configuration*/)
0040 {
0041 
0042     QImage img;
0043     if (!img.loadFromData(io->readAll()/*, fi.suffix().toLower().toLatin1()*/)) {
0044         return ImportExportCodes::FileFormatIncorrect;
0045     }
0046 
0047     KisImageSP image = KisImage::fromQImage(img, document->createUndoStore());
0048     document->setCurrentImage(image);
0049     return ImportExportCodes::OK;
0050 
0051 }
0052 
0053 #include "kis_qimageio_import.moc"
0054