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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2008-08-04
0007  * Description : RAW preview widget.
0008  *
0009  * SPDX-FileCopyrightText: 2008-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_RAW_PREVIEW_H
0016 #define DIGIKAM_RAW_PREVIEW_H
0017 
0018 // Qt includes
0019 
0020 #include <QImage>
0021 #include <QPixmap>
0022 #include <QResizeEvent>
0023 #include <QUrl>
0024 
0025 // Local includes
0026 
0027 #include "dimg.h"
0028 #include "graphicsdimgview.h"
0029 #include "loadingdescription.h"
0030 
0031 
0032 using namespace Digikam;
0033 
0034 namespace DigikamRawImportNativePlugin
0035 {
0036 
0037 class  RawPreview : public GraphicsDImgView
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042 
0043     explicit RawPreview(const QUrl& url, QWidget* const parent);
0044     ~RawPreview()                    override;
0045 
0046     DImg& demosaicedImage()    const;
0047     DImg  postProcessedImage() const;
0048 
0049     void setDecodingSettings(const DRawDecoding& settings);
0050     void setPostProcessedImage(const DImg& image);
0051 
0052     void ICCSettingsChanged();
0053     void exposureSettingsChanged();
0054 
0055     void cancelLoading();
0056 
0057 Q_SIGNALS:
0058 
0059     void signalLoadingStarted();
0060     void signalLoadingProgress(float);
0061     void signalLoadingFailed();
0062     void signalDemosaicedImage();
0063     void signalPostProcessedImage();
0064 
0065 private Q_SLOTS:
0066 
0067     void slotLoadingProgress(const LoadingDescription& description, float progress);
0068     void slotImageLoaded(const LoadingDescription& description, const DImg& image);
0069 
0070 private:
0071 
0072     void   setdemosaicedImg(const DImg& image);
0073     void   postProcessing(const DRawDecoding& settings);
0074     int    previewWidth()    const;
0075     int    previewHeight()   const;
0076     bool   previewIsNull()   const;
0077     QImage previewToQImage() const;
0078     void   resetPreview();
0079 
0080 private:
0081 
0082     class Private;
0083     Private* const d;
0084 };
0085 
0086 } // namespace DigikamRawImportNativePlugin
0087 
0088 #endif // DIGIKAM_RAW_PREVIEW_H