1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2013-08-19
7  * Description : image quality sorter
8  *
9  * Copyright (C) 2013-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_IMAGE_QUALITY_SORTER_H
25 #define DIGIKAM_IMAGE_QUALITY_SORTER_H
26 
27 // Qt includes
28 
29 #include <QObject>
30 
31 // Local includes
32 
33 #include "album.h"
34 #include "maintenancetool.h"
35 #include "imagequalitycontainer.h"
36 
37 class QImage;
38 
39 namespace Digikam
40 {
41 
42 class ImageQualitySorter : public MaintenanceTool
43 {
44     Q_OBJECT
45 
46 public:
47 
48     enum QualityScanMode
49     {
50         AllItems = 0,        // Clean all Pick Labels assignements and re-scan all items.
51         NonAssignedItems     // Scan only items with no Pick Labels assigned.
52     };
53 
54 public:
55 
56     /** Constructor using AlbumList as argument. If list is empty, whole Albums collection is processed.
57      */
58     explicit ImageQualitySorter(QualityScanMode mode,
59                                 const AlbumList& list=AlbumList(),
60                                 const ImageQualityContainer& quality=ImageQualityContainer(),
61                                 ProgressItem* const parent = nullptr);
62     ~ImageQualitySorter() override;
63 
64     void setUseMultiCoreCPU(bool b) override;
65 
66 private:
67 
68     void processOne();
69 
70 private Q_SLOTS:
71 
72     void slotStart()                override;
73     void slotCancel()               override;
74     void slotAdvance(const QImage&);
75 
76 private:
77 
78     class Private;
79     Private* const d;
80 };
81 
82 } // namespace Digikam
83 
84 #endif // DIGIKAM_IMAGE_QUALITY_SORTER_H
85