File indexing completed on 2025-03-09 03:52:07

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2007-11-14
0007  * Description : a presentation tool.
0008  *
0009  * SPDX-FileCopyrightText: 2007-2009 by Valerio Fuoglio <valerio dot fuoglio at gmail dot com>
0010  * SPDX-FileCopyrightText: 2012-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * Parts of this code are based on smoothslidesaver by Carsten Weinhold
0013  * <carsten dot weinhold at gmx dot de>
0014  *
0015  * SPDX-License-Identifier: GPL-2.0-or-later
0016  *
0017  * ============================================================ */
0018 
0019 #ifndef DIGIKAM_KB_IMAGE_LOADER_H
0020 #define DIGIKAM_KB_IMAGE_LOADER_H
0021 
0022 // Qt includes
0023 
0024 #include <QList>
0025 #include <QImage>
0026 #include <QThread>
0027 #include <QWaitCondition>
0028 #include <QMutex>
0029 #include <QPair>
0030 #include <QString>
0031 
0032 namespace DigikamGenericPresentationPlugin
0033 {
0034 
0035 class PresentationContainer;
0036 
0037 class KBImageLoader : public QThread
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042 
0043     KBImageLoader(PresentationContainer* const sharedData, int width, int height);
0044     ~KBImageLoader()                  override;
0045 
0046     void  quit();
0047     void  requestNewImage();
0048 
0049     void          ungrabImage();
0050     bool          grabImage();
0051     bool          ready()       const;
0052     const QImage& image()       const;
0053     float         imageAspect() const;
0054 
0055 protected:
0056 
0057     void run()                        override;
0058     bool loadImage();
0059     void invalidateCurrentImageName();
0060 
0061 private:
0062 
0063     // Disable
0064     explicit KBImageLoader(QObject*) = delete;
0065 
0066 private:
0067 
0068     class Private;
0069     Private* const d;
0070 };
0071 
0072 } // namespace DigikamGenericPresentationPlugin
0073 
0074 #endif // DIGIKAM_KB_IMAGE_LOADER_H