1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2012-01-31
7  * Description : maintenance manager
8  *
9  * Copyright (C) 2012-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_MAINTENANCE_MNGR_H
25 #define DIGIKAM_MAINTENANCE_MNGR_H
26 
27 // Qt includes
28 
29 #include <QObject>
30 
31 namespace Digikam
32 {
33 
34 class MaintenanceSettings;
35 class ProgressItem;
36 
37 class MaintenanceMngr : public QObject
38 {
39     Q_OBJECT
40 
41 public:
42 
43     explicit MaintenanceMngr(QObject* const parent);
44     ~MaintenanceMngr() override;
45 
46     void setSettings(const MaintenanceSettings& settings);
47 
48     void start();
49     bool isRunning() const;
50 
51 Q_SIGNALS:
52 
53     void signalComplete();
54 
55 private Q_SLOTS:
56 
57     void slotToolCompleted(ProgressItem*);
58     void slotToolCanceled(ProgressItem*);
59 
60 private:
61 
62     void stage1();  ///< Find New items
63     void stage2();  ///< Update Thumbnails
64     void stage3();  ///< Build Similarity Finger-prints
65     void stage4();  ///< Find Duplicates
66     void stage5();  ///< Faces Management
67     void stage6();  ///< Image Quality Sorter
68     void stage7();  ///< Metadata Synchronizer
69     void stage8();  ///< Database Cleanup
70 
71     void done();    ///< Called when all scheduled tools are done.
72     void cancel();  ///< Called when a tool is canceled.
73 
74 private:
75 
76     class Private;
77     Private* const d;
78 };
79 
80 } // namespace Digikam
81 
82 #endif // DIGIKAM_MAINTENANCE_MNGR_H
83