digiKam
itemlisterreceiver.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 : 2007-03-20
7  * Description : Simple virtual interface for ItemLister
8  *
9  * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
10  * Copyright (C) 2007-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
11  * Copyright (C) 2015 by Mohamed_Anwer <m_dot_anwer at gmx dot com>
12  * Copyright (C) 2007-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
13  *
14  * This program is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU General
16  * Public License as published by the Free Software Foundation;
17  * either version 2, or (at your option)
18  * any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * ============================================================ */
26 
27 #ifndef DIGIKAM_ITEM_LISTER_RECEIVER_H
28 #define DIGIKAM_ITEM_LISTER_RECEIVER_H
29 
30 // Qt includes
31 
32 #include <QString>
33 #include <QList>
34 
35 // Local includes
36 
37 #include "digikam_export.h"
38 #include "itemlisterrecord.h"
39 #include "dbjob.h"
40 
41 namespace Digikam
42 {
43 
44 class DIGIKAM_DATABASE_EXPORT ItemListerReceiver
45 {
46 public:
47 
48  ItemListerReceiver() = default;
49  virtual ~ItemListerReceiver() = default;
50 
51  virtual void receive(const ItemListerRecord& record) = 0;
52  virtual void error(const QString& /*errMsg*/) {};
53 
54 private:
55 
56  Q_DISABLE_COPY(ItemListerReceiver)
57 };
58 
59 // ------------------------------------------------------------------------------------------------
60 
61 class DIGIKAM_DATABASE_EXPORT ItemListerValueListReceiver : public ItemListerReceiver
62 {
63 public:
64 
65  explicit ItemListerValueListReceiver();
66 
67  void receive(const ItemListerRecord& record) override;
68  void error(const QString& errMsg) override;
69 
70 public:
71 
73  bool hasError;
74 
75 private:
76 
77  Q_DISABLE_COPY(ItemListerValueListReceiver)
78 };
79 
80 // ------------------------------------------------------------------------------------------------
81 
82 class DIGIKAM_DATABASE_EXPORT ItemListerJobReceiver : public ItemListerValueListReceiver
83 {
84 public:
85 
86  explicit ItemListerJobReceiver(DBJob* const job);
87 
88  void error(const QString& errMsg) override;
89  void sendData();
90 
91 protected:
92 
93  DBJob* const m_job;
94 
95 private:
96 
97  Q_DISABLE_COPY(ItemListerJobReceiver)
98 };
99 
100 // ------------------------------------------------------------------------------------------------
101 
102 class DIGIKAM_DATABASE_EXPORT ItemListerJobPartsSendingReceiver : public ItemListerJobReceiver
103 {
104 public:
105 
106  explicit ItemListerJobPartsSendingReceiver(DBJob* const job, int limit);
107 
108  void receive(const ItemListerRecord &record) override;
109 
110 protected:
111 
112  int m_limit;
113  int m_count;
114 
115 private:
116 
117  Q_DISABLE_COPY(ItemListerJobPartsSendingReceiver)
118 };
119 
120 // ------------------------------------------------------------------------------------------------
121 
123 {
124 public:
125 
127  int start,
128  int end,
129  int increment);
130 
131  void receive(const ItemListerRecord& record) override;
132 
133 protected:
134 
137 
138 private:
139 
141 };
142 
143 } // namespace Digikam
144 
145 #endif // DIGIKAM_ITEM_LISTER_RECEIVER_H
Definition: dbjob.h:41
Definition: itemlisterreceiver.h:123
int m_increment
Definition: itemlisterreceiver.h:136
int m_maxLimit
Definition: itemlisterreceiver.h:135
Definition: itemlisterreceiver.h:103
int m_limit
Definition: itemlisterreceiver.h:112
int m_count
Definition: itemlisterreceiver.h:113
Definition: itemlisterreceiver.h:83
DBJob *const m_job
Definition: itemlisterreceiver.h:93
Definition: itemlisterreceiver.h:45
virtual void error(const QString &)
Definition: itemlisterreceiver.h:52
virtual void receive(const ItemListerRecord &record)=0
virtual ~ItemListerReceiver()=default
Definition: itemlisterrecord.h:48
Definition: itemlisterreceiver.h:62
bool hasError
Definition: itemlisterreceiver.h:73
QList< ItemListerRecord > records
Definition: itemlisterreceiver.h:72
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43