digiKam
databasetask.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 : Thread actions task for database cleanup.
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_DATABASE_TASK_H
25 #define DIGIKAM_DATABASE_TASK_H
26 
27 // Qt includes
28 
29 #include <QList>
30 
31 // Local includes
32 
33 #include "actionthreadbase.h"
34 #include "identity.h"
35 
36 namespace Digikam
37 {
38 
39 class LoadingDescription;
40 class MaintenanceData;
41 
42 class DatabaseTask : public ActionJob
43 {
44  Q_OBJECT
45 
46 public:
47 
48  enum Mode
49  {
57  };
58 
59 public:
60 
61  explicit DatabaseTask();
62  ~DatabaseTask() override;
63 
64  void setMode(Mode mode);
65  void setMaintenanceData(MaintenanceData* const data = nullptr);
66 
67  void computeDatabaseJunk(bool thumbsDb = false,
68  bool facesDb = false,
69  bool similarityDb = false);
70 
71 Q_SIGNALS:
72 
74  void signalFinished(bool done, bool errorFree);
75 
76  void signalData(const QList<qlonglong>& staleImageIds,
77  const QList<int>& staleThumbIds,
78  const QList<Identity>& staleIdentities,
79  const QList<qlonglong>& staleSimilarityImageIds);
80 
84  void signalAddItemsToProcess(int count);
85 
86 protected:
87 
88  void run() override;
89 
90 private:
91 
92  // Disable
93  DatabaseTask(QObject*) = delete;
94 
95 private:
96 
97  class Private;
98  Private* const d;
99 };
100 
101 } // namespace Digikam
102 
103 #endif // DIGIKAM_DATABASE_TASK_H
Definition: actionthreadbase.h:45
Definition: databasetask.h:43
void setMaintenanceData(MaintenanceData *const data=nullptr)
Definition: databasetask.cpp:98
void run() override
Definition: databasetask.cpp:103
void signalAddItemsToProcess(int count)
void computeDatabaseJunk(bool thumbsDb=false, bool facesDb=false, bool similarityDb=false)
Definition: databasetask.cpp:86
void signalData(const QList< qlonglong > &staleImageIds, const QList< int > &staleThumbIds, const QList< Identity > &staleIdentities, const QList< qlonglong > &staleSimilarityImageIds)
void signalFinished(bool done, bool errorFree)
DatabaseTask()
Definition: databasetask.cpp:74
Mode
Definition: databasetask.h:49
@ ShrinkDatabases
Definition: databasetask.h:56
@ CleanRecognitionDb
Definition: databasetask.h:54
@ CleanCoreDb
Definition: databasetask.h:52
@ CleanSimilarityDb
Definition: databasetask.h:55
@ ComputeDatabaseJunk
Definition: databasetask.h:51
@ Unknown
Definition: databasetask.h:50
@ CleanThumbsDb
Definition: databasetask.h:53
~DatabaseTask() override
Definition: databasetask.cpp:80
void setMode(Mode mode)
Definition: databasetask.cpp:93
Definition: maintenancedata.h:42
Definition: datefolderview.cpp:43