File indexing completed on 2025-01-19 03:54:49

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2006-01-03
0007  * Description : DImgLoader observer interface
0008  *
0009  * SPDX-FileCopyrightText: 2006-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_DIMG_LOADER_OBSERVER_H
0016 #define DIGIKAM_DIMG_LOADER_OBSERVER_H
0017 
0018 // Qt includes
0019 
0020 #include <QtGlobal>
0021 
0022 // Local includes
0023 
0024 #include "digikam_export.h"
0025 
0026 namespace Digikam
0027 {
0028 
0029 class DImg;
0030 
0031 class DIGIKAM_EXPORT DImgLoaderObserver
0032 {
0033 
0034 public:
0035 
0036     DImgLoaderObserver()          = default;
0037     virtual ~DImgLoaderObserver() = default;
0038 
0039     /**
0040      * Posts progress information about image IO
0041      */
0042     virtual void progressInfo(float progress)
0043     {
0044         Q_UNUSED(progress);
0045     };
0046 
0047     /**
0048      * Queries whether the image IO operation shall be continued
0049      */
0050     virtual bool continueQuery()
0051     {
0052         return true;
0053     };
0054 
0055     /**
0056      * Return a relative value which determines the granularity, the frequency
0057      * with which the DImgLoaderObserver is checked and progress is posted.
0058      * Standard is 1.0. Values < 1 mean less granularity (fewer checks),
0059      * values > 1 mean higher granularity (more checks).
0060      */
0061     virtual float granularity()
0062     {
0063         return 1.0F;
0064     };
0065 
0066 private:
0067 
0068     Q_DISABLE_COPY(DImgLoaderObserver)
0069 };
0070 
0071 } // namespace Digikam
0072 
0073 #endif // DIGIKAM_DIMG_LOADER_OBSERVER_H