File indexing completed on 2025-01-19 03:51:17

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-10-11
0007  * Description : save image thread for scanned data
0008  *
0009  * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_SAVE_IMG_THREAD_H
0016 #define DIGIKAM_SAVE_IMG_THREAD_H
0017 
0018 // Qt includes
0019 
0020 #include <QObject>
0021 #include <QThread>
0022 #include <QString>
0023 #include <QUrl>
0024 #include <QByteArray>
0025 #include <QImage>
0026 
0027 // KDE includes
0028 
0029 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
0030 #   include <ksane_version.h>
0031 #endif
0032 
0033 namespace DigikamGenericDScannerPlugin
0034 {
0035 
0036 class SaveImgThread : public QThread
0037 {
0038     Q_OBJECT
0039 
0040 public:
0041 
0042     explicit SaveImgThread(QObject* const parent);
0043     ~SaveImgThread()    override;
0044 
0045     void setTargetFile(const QUrl& url, const QString& format);
0046     void setScannerModel(const QString& make, const QString& model);
0047 
0048 #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
0049 
0050     void setImageData(const QImage& imageData);
0051 
0052 #elif KSANE_VERSION < QT_VERSION_CHECK(21,8,0)
0053 
0054     void setImageData(const QByteArray& ksaneData, int width, int height,
0055                       int bytesPerLine, int ksaneFormat);
0056 
0057 #else
0058 
0059     void setImageData(const QImage& imageData);
0060 
0061 #endif
0062 
0063 Q_SIGNALS:
0064 
0065     void signalProgress(const QUrl&, int);
0066     void signalComplete(const QUrl&, bool);
0067 
0068 private:
0069 
0070     void run()          override;
0071 
0072 private:
0073 
0074     class Private;
0075     Private* const d;
0076 };
0077 
0078 } // namespace DigikamGenericDScannerPlugin
0079 
0080 #endif // DIGIKAM_SAVE_IMG_THREAD_H