File indexing completed on 2024-05-12 16:01:32

0001 /*
0002  *  SPDX-FileCopyrightText: 2006 Boudewijn Rempt <boud@valdyas.org>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KIS_IMPORT_CATCHER_H_
0008 #define KIS_IMPORT_CATCHER_H_
0009 
0010 #include <QObject>
0011 
0012 #include <kis_types.h>
0013 
0014 class KisViewManager;
0015 
0016 /**
0017  * This small helper class takes an url and an image; tries to import
0018  * the image at the url and shove the layers of the imported image
0019  * into the first image after loading is done. This is a separate class
0020  * because loading can be asynchronous.
0021  *
0022  * Caveat: this class calls "delete this", which means that you new
0023  * it and then never touch it again. Thank you very much.
0024  */
0025 class KisImportCatcher : QObject
0026 {
0027 
0028     Q_OBJECT
0029 
0030 public:
0031 
0032     KisImportCatcher(const QString &url, KisViewManager* view, const QString &layerType);
0033     ~KisImportCatcher() override;
0034 
0035     static void adaptClipToImageColorSpace(KisPaintDeviceSP dev, KisImageSP image);
0036 
0037 private Q_SLOTS:
0038     void slotLoadingFinished();
0039 
0040 private:
0041     void deleteMyself();
0042 
0043 private:
0044 
0045     struct Private;
0046     Private* const m_d;
0047 };
0048 
0049 #endif