digiKam
dbcleaner.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2017-01-29
7  * Description : Database cleaner.
8  *
9  * Copyright (C) 2017-2018 by Mario Frank <mario dot frank at uni minus potsdam dot de>
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_DB_CLEANER_H
25 #define DIGIKAM_DB_CLEANER_H
26 
27 // Qt includes
28 
29 #include <QDialog>
30 #include <QString>
31 #include <QWidget>
32 #include <QList>
33 
34 // Local includes
35 
36 #include "identity.h"
37 #include "dlayoutbox.h"
38 #include "dworkingpixmap.h"
39 #include "maintenancetool.h"
40 
41 namespace Digikam
42 {
43 
44 class DbCleaner : public MaintenanceTool
45 {
46  Q_OBJECT
47 
48 public:
49 
50  explicit DbCleaner(bool cleanThumbsDb = false,
51  bool cleanFacesDb = false,
52  bool cleanSimilarityDb = false,
53  bool shrinkDatabases = false,
54  ProgressItem* const parent = nullptr);
55  ~DbCleaner() override;
56 
57  void setUseMultiCoreCPU(bool b) override;
58 
59 private Q_SLOTS:
60 
61  void slotStart() override;
62  void slotCancel() override;
63  void slotAdvance();
64  void slotShrinkNextDBInfo(bool done, bool passed);
65 
66  void slotFetchedData(const QList<qlonglong>& staleImageIds,
67  const QList<int>& staleThumbIds,
68  const QList<Identity>& staleIdentities,
69  const QList<qlonglong>& staleImageSimilarities);
70 
71  void slotAddItemsToProcess(int count);
72 
73  void slotCleanItems();
74  void slotCleanedItems();
75  void slotCleanedThumbnails();
76  void slotCleanedFaces();
77  void slotCleanedSimilarity();
78  void slotShrinkDatabases();
79 
80  void slotDone() override;
81 
82 private:
83 
84  class Private;
85  Private* const d;
86 };
87 
88 // -----------------------------------------------------
89 
90 class DbShrinkDialog : public QDialog
91 {
92  Q_OBJECT
93 
94 public:
95 
96  explicit DbShrinkDialog(QWidget* const parent);
97  ~DbShrinkDialog() override;
98 
99  void setActive(const int pos);
100  void setIcon(const int pos, const QIcon& icon);
101 
102 public Q_SLOTS:
103 
104  int exec() override;
105 
106 private Q_SLOTS:
107 
108  void slotProgressTimerDone();
109 
110 private:
111 
112  class Private;
113  Private* const d;
114 };
115 
116 } // namespace Digikam
117 
118 #endif // DIGIKAM_DB_CLEANER_H
Definition: dbcleaner.h:45
~DbCleaner() override
Definition: dbcleaner.cpp:129
void setUseMultiCoreCPU(bool b) override
Definition: dbcleaner.cpp:453
DbCleaner(bool cleanThumbsDb=false, bool cleanFacesDb=false, bool cleanSimilarityDb=false, bool shrinkDatabases=false, ProgressItem *const parent=nullptr)
Definition: dbcleaner.cpp:82
Definition: dbcleaner.h:91
int exec() override
Definition: dbcleaner.cpp:580
void setIcon(const int pos, const QIcon &icon)
Definition: dbcleaner.cpp:570
void setActive(const int pos)
Definition: dbcleaner.cpp:548
DbShrinkDialog(QWidget *const parent)
Definition: dbcleaner.cpp:496
~DbShrinkDialog() override
Definition: dbcleaner.cpp:542
Definition: maintenancetool.h:41
Definition: progressmanager.h:45
ProgressItem * parent() const
Definition: progressmanager.cpp:299
Definition: datefolderview.cpp:43