File indexing completed on 2024-05-19 04:28:58

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 "kritaui_export.h"
0013 #include <kis_types.h>
0014 
0015 class KisViewManager;
0016 
0017 /**
0018  * This small helper class takes an url and an image; tries to import
0019  * the image at the url and shove the layers of the imported image
0020  * into the first image after loading is done. This is a separate class
0021  * because loading can be asynchronous.
0022  *
0023  * Caveat: this class calls "delete this", which means that you new
0024  * it and then never touch it again. Thank you very much.
0025  */
0026 class KRITAUI_EXPORT KisImportCatcher : QObject
0027 {
0028 
0029     Q_OBJECT
0030 
0031 public:
0032 
0033     KisImportCatcher(const QString &url, KisViewManager* view, const QString &layerType);
0034     ~KisImportCatcher() override;
0035 
0036     int numLayersImported() const;
0037 
0038     static void adaptClipToImageColorSpace(KisPaintDeviceSP dev, KisImageSP image);
0039 
0040 private Q_SLOTS:
0041     void slotLoadingFinished();
0042 
0043 private:
0044     void deleteMyself();
0045 
0046 private:
0047 
0048     struct Private;
0049     Private* const m_d;
0050 };
0051 
0052 #endif