File indexing completed on 2025-01-19 03:59:30

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2013-08-19
0007  * Description : image quality sorter maintenance tool
0008  *
0009  * SPDX-FileCopyrightText: 2013-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2013-2014 by Gowtham Ashok <gwty93 at gmail dot com>
0011  * SPDX-FileCopyrightText: 2021-2022 by Phuoc Khanh Le <phuockhanhnk94 at gmail dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_IMAGE_QUALITY_SORTER_H
0018 #define DIGIKAM_IMAGE_QUALITY_SORTER_H
0019 
0020 // Qt includes
0021 
0022 #include <QObject>
0023 
0024 // Local includes
0025 
0026 #include "album.h"
0027 #include "maintenancetool.h"
0028 #include "imagequalitycontainer.h"
0029 
0030 class QImage;
0031 
0032 namespace Digikam
0033 {
0034 
0035 class ImageQualitySorter : public MaintenanceTool
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040 
0041     enum QualityScanMode
0042     {
0043         AllItems = 0,        ///< Clean all Pick Labels assignments and re-scan all items.
0044         NonAssignedItems     ///< Scan only items with no Pick Labels assigned.
0045     };
0046 
0047 public:
0048 
0049     /**
0050      * Constructor using AlbumList as argument. If list is empty, whole Albums collection is processed.
0051      */
0052     explicit ImageQualitySorter(QualityScanMode mode,
0053                                 const AlbumList& list=AlbumList(),
0054                                 const ImageQualityContainer& quality = ImageQualityContainer(),
0055                                 ProgressItem* const parent = nullptr);
0056     ~ImageQualitySorter() override;
0057 
0058     void setUseMultiCoreCPU(bool b) override;
0059 
0060 private:
0061 
0062     void processOne();
0063 
0064 private Q_SLOTS:
0065 
0066     void slotStart()                override;
0067     void slotCancel()               override;
0068     void slotAdvance(const QImage&);
0069 
0070 private:
0071 
0072     class Private;
0073     Private* const d;
0074 };
0075 
0076 } // namespace Digikam
0077 
0078 #endif // DIGIKAM_IMAGE_QUALITY_SORTER_H