digiKam
dbjob.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 : 2015-06-01
7  * Description : DB Jobs for listing and scanning
8  *
9  * Copyright (C) 2015 by Mohamed_Anwer <m_dot_anwer at gmx 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_DB_JOB_H
25 #define DIGIKAM_DB_JOB_H
26 
27 // Local includes
28 
29 #include "dbjobinfo.h"
30 #include "itemlisterrecord.h"
32 #include "actionthreadbase.h"
33 #include "digikam_export.h"
34 
35 namespace Digikam
36 {
37 
38 class DuplicatesProgressObserver;
39 
40 class DIGIKAM_DATABASE_EXPORT DBJob : public ActionJob
41 {
42  Q_OBJECT
43 
44 protected:
45 
46  explicit DBJob();
47  ~DBJob() override;
48 
49 Q_SIGNALS:
50 
51  void data(const QList<ItemListerRecord>& records);
52  void error(const QString& err);
53 
54 private:
55 
56  // Disable
57  explicit DBJob(QObject*) = delete;
58 };
59 
60 // ----------------------------------------------
61 
62 class DIGIKAM_DATABASE_EXPORT AlbumsJob : public DBJob
63 {
64  Q_OBJECT
65 
66 public:
67 
68  explicit AlbumsJob(const AlbumsDBJobInfo& jobInfo);
69  ~AlbumsJob() override;
70 
71 protected:
72 
73  void run() override;
74 
75 Q_SIGNALS:
76 
77  void foldersData(const QMap<int, int>&);
78 
79 private:
80 
81  AlbumsDBJobInfo m_jobInfo;
82 
83 private:
84 
85  // Disable
86  AlbumsJob(QObject*);
87 };
88 
89 // ----------------------------------------------
90 
91 class DIGIKAM_DATABASE_EXPORT DatesJob : public DBJob
92 {
93  Q_OBJECT
94 
95 public:
96 
97  explicit DatesJob(const DatesDBJobInfo& jobInfo);
98  ~DatesJob() override;
99 
100 protected:
101 
102  void run() override;
103 
104 Q_SIGNALS:
105 
106  void foldersData(const QHash<QDateTime, int>& datesStatMap);
107 
108 private:
109 
110  DatesDBJobInfo m_jobInfo;
111 
112 private:
113 
114  // Disable
115  DatesJob(QObject*) = delete;
116 };
117 
118 // ----------------------------------------------
119 
120 class DIGIKAM_DATABASE_EXPORT GPSJob : public DBJob
121 {
122  Q_OBJECT
123 
124 public:
125 
126  explicit GPSJob(const GPSDBJobInfo& jobInfo);
127  ~GPSJob() override;
128 
129 protected:
130 
131  void run() override;
132 
133 Q_SIGNALS:
134 
135  void directQueryData(const QList<QVariant>& data);
136 
137 private:
138 
139  GPSDBJobInfo m_jobInfo;
140 
141 private:
142 
143  // Disable
144  GPSJob(QObject*);
145 };
146 
147 // ----------------------------------------------
148 
149 class DIGIKAM_DATABASE_EXPORT TagsJob : public DBJob
150 {
151  Q_OBJECT
152 
153 public:
154 
155  explicit TagsJob(const TagsDBJobInfo& jobInfo);
156  ~TagsJob() override;
157 
158 protected:
159 
160  void run() override;
161 
162 Q_SIGNALS:
163 
164  void foldersData(const QMap<int, int>& data);
165  void faceFoldersData(const QMap<QString, QMap<int, int> >& data);
166 
167 private:
168 
169  TagsDBJobInfo m_jobInfo;
170 
171 private:
172 
173  // Disable
174  TagsJob(QObject*);
175 };
176 
177 // ----------------------------------------------
178 
179 class DIGIKAM_DATABASE_EXPORT SearchesJob : public DBJob
180 {
181  Q_OBJECT
182 
183 public:
184 
185  explicit SearchesJob(const SearchesDBJobInfo& jobInfo);
186  SearchesJob(const SearchesDBJobInfo& jobInfo,
187  const QSet<qlonglong>::const_iterator& begin,
188  const QSet<qlonglong>::const_iterator& end,
189  HaarIface* iface);
190 
191  ~SearchesJob() override;
192 
193  bool isCanceled() const;
194 
195 Q_SIGNALS:
196 
199 
200 protected:
201 
202  void run() override;
203 
204 private:
205 
206  SearchesDBJobInfo m_jobInfo;
207  QSet<qlonglong>::const_iterator m_begin;
208  QSet<qlonglong>::const_iterator m_end;
209  HaarIface* m_iface;
210 
211 private:
212 
213  // Disable
214  SearchesJob(QObject*);
215 
216  void runSearches();
217  void runFindDuplicates();
218 };
219 
220 } // namespace Digikam
221 
222 #endif // DIGIKAM_DB_JOB_H
Definition: actionthreadbase.h:45
Definition: dbjobinfo.h:67
Definition: dbjob.h:63
void foldersData(const QMap< int, int > &)
Definition: dbjob.h:41
void data(const QList< ItemListerRecord > &records)
void error(const QString &err)
Definition: dbjobinfo.h:178
Definition: dbjob.h:92
void foldersData(const QHash< QDateTime, int > &datesStatMap)
Definition: dbjobinfo.h:111
Definition: dbjob.h:121
void directQueryData(const QList< QVariant > &data)
Definition: haariface.h:72
QMap< qlonglong, QPair< double, QList< qlonglong > > > DuplicatesResultsMap
Definition: haariface.h:98
Definition: dbjobinfo.h:143
Definition: dbjob.h:180
void signalDuplicatesResults(const HaarIface::DuplicatesResultsMap &)
Definition: dbjobinfo.h:87
Definition: dbjob.h:150
void faceFoldersData(const QMap< QString, QMap< int, int > > &data)
void foldersData(const QMap< int, int > &data)
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43