digiKam
dbjobsthread.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 thread 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_JOBS_THREAD_H
25 #define DIGIKAM_DB_JOBS_THREAD_H
26 
27 // Local includes
28 
29 #include "dbengineparameters.h"
30 #include "dbjobinfo.h"
31 #include "dbjob.h"
32 #include "haariface.h"
33 #include "itemlisterrecord.h"
34 #include "actionthreadbase.h"
35 #include "digikam_export.h"
36 
37 namespace Digikam
38 {
39 
40 class DBJob;
41 
42 class DIGIKAM_DATABASE_EXPORT DBJobsThread : public ActionThreadBase
43 {
44  Q_OBJECT
45 
46 public:
47 
48  explicit DBJobsThread(QObject* const parent);
49  ~DBJobsThread() override;
50 
55  bool hasErrors();
56 
61  QList<QString>& errorsList();
62 
63 protected:
64 
69  void connectFinishAndErrorSignals(DBJob* const j);
70 
71 public Q_SLOTS:
72 
77  void error(const QString& errString);
78 
79 Q_SIGNALS:
80 
81  void finished();
82  void data(const QList<ItemListerRecord>& records);
83 
84 private:
85 
86  QStringList m_errorsList;
87 };
88 
89 // ---------------------------------------------
90 
91 class DIGIKAM_DATABASE_EXPORT AlbumsDBJobsThread : public DBJobsThread
92 {
93  Q_OBJECT
94 
95 public:
96 
97  explicit AlbumsDBJobsThread(QObject* const parent);
98  ~AlbumsDBJobsThread() override;
99 
104  void albumsListing(const AlbumsDBJobInfo& info);
105 
106 Q_SIGNALS:
107 
108  void foldersData(const QMap<int, int>&);
109  void faceFoldersData(const QMap<QString, QMap<int, int> >&);
110 };
111 
112 // ---------------------------------------------
113 
114 class DIGIKAM_DATABASE_EXPORT TagsDBJobsThread : public DBJobsThread
115 {
116  Q_OBJECT
117 
118 public:
119 
120  explicit TagsDBJobsThread(QObject* const parent);
121  ~TagsDBJobsThread() override;
122 
127  void tagsListing(const TagsDBJobInfo& info);
128 
129 Q_SIGNALS:
130 
131  void foldersData(const QMap<int, int>&);
132  void faceFoldersData(const QMap<QString, QMap<int, int> >&);
133 };
134 
135 // ---------------------------------------------
136 
137 class DIGIKAM_DATABASE_EXPORT DatesDBJobsThread : public DBJobsThread
138 {
139  Q_OBJECT
140 
141 public:
142 
143  explicit DatesDBJobsThread(QObject* const parent);
144  ~DatesDBJobsThread() override;
145 
150  void datesListing(const DatesDBJobInfo& info);
151 
152 Q_SIGNALS:
153 
154  void foldersData(const QHash<QDateTime, int>&);
155 };
156 
157 // ---------------------------------------------
158 
159 class DIGIKAM_DATABASE_EXPORT SearchesDBJobsThread : public DBJobsThread
160 {
161  Q_OBJECT
162 
163 public:
164 
165  explicit SearchesDBJobsThread(QObject* const parent);
166  ~SearchesDBJobsThread() override;
167 
172  void searchesListing(const SearchesDBJobInfo& info);
173 
174 public Q_SLOTS:
175 
176  void slotImageProcessed();
177  void slotDuplicatesResults(const HaarIface::DuplicatesResultsMap&);
178 
179 Q_SIGNALS:
180 
181  void signalProgress(int percentage);
182 
183 private:
185  QScopedPointer<HaarIface> m_haarIface;
186  bool m_isAlbumUpdate;
187  int m_processedImages;
188  int m_totalImages2Scan;
189 };
190 
191 // ---------------------------------------------
192 
193 class DIGIKAM_DATABASE_EXPORT GPSDBJobsThread : public DBJobsThread
194 {
195  Q_OBJECT
196 
197 public:
198 
199  explicit GPSDBJobsThread(QObject* const parent);
200  ~GPSDBJobsThread() override;
201 
206  void GPSListing(const GPSDBJobInfo& info);
207 
208 Q_SIGNALS:
209 
210  void directQueryData(const QList<QVariant>& data);
211 };
212 
213 } // namespace Digikam
214 
215 #endif // DIGIKAM_DB_JOBS_THREAD_H
Definition: actionthreadbase.h:102
Definition: dbjobinfo.h:67
Definition: dbjobsthread.h:92
void foldersData(const QMap< int, int > &)
void faceFoldersData(const QMap< QString, QMap< int, int > > &)
Definition: dbjob.h:41
Definition: dbjobsthread.h:43
void data(const QList< ItemListerRecord > &records)
Definition: dbjobinfo.h:178
Definition: dbjobsthread.h:138
void foldersData(const QHash< QDateTime, int > &)
Definition: dbjobinfo.h:111
Definition: dbjobsthread.h:194
void directQueryData(const QList< QVariant > &data)
QMap< qlonglong, QPair< double, QList< qlonglong > > > DuplicatesResultsMap
Definition: haariface.h:98
Definition: dbjobinfo.h:143
Definition: dbjobsthread.h:160
void signalProgress(int percentage)
Definition: dbjobinfo.h:87
Definition: dbjobsthread.h:115
void foldersData(const QMap< int, int > &)
void faceFoldersData(const QMap< QString, QMap< int, int > > &)
Definition: datefolderview.cpp:43