digiKam
dinfointerface.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-05-06
7  * Description : abstract interface to image information.
8  * This class do not depend of digiKam database library
9  * to permit to re-use plugins with Showfoto.
10  *
11  * Copyright (C) 2017-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
12  * Copyright (C) 2019-2020 by Minh Nghia Duong <minhnghiaduong997 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_DINFO_INTERFACE_H
28 #define DIGIKAM_DINFO_INTERFACE_H
29 
30 // Qt includes
31 
32 #include <QMap>
33 #include <QString>
34 #include <QObject>
35 #include <QVariant>
36 #include <QUrl>
37 #include <QSize>
38 #include <QList>
39 #include <QDateTime>
40 #include <QDate>
41 #include <QAbstractItemModel>
42 
43 // Local includes
44 
45 #include "digikam_export.h"
46 #include "digikam_config.h"
47 
48 #ifdef HAVE_MARBLE
49 # include "gpsitemcontainer.h"
50 #endif
51 
52 namespace Digikam
53 {
54 
55 class DIGIKAM_EXPORT DInfoInterface : public QObject
56 {
57  Q_OBJECT
58 
59 
60 public:
61 
62  typedef QMap<QString, QVariant> DInfoMap;
64 
65 public:
66 
67  explicit DInfoInterface(QObject* const parent);
68  ~DInfoInterface() override;
69 
70 public:
71 
73  Q_SLOT virtual void slotDateTimeForUrl(const QUrl& url,
74  const QDateTime& dt,
75  bool updModDate);
76 
78  Q_SLOT virtual void slotMetadataChangedForUrl(const QUrl& url);
79 
80  Q_SIGNAL void signalAlbumItemsRecursiveCompleted(const QList<QUrl>& imageList);
81 
82  Q_SIGNAL void signalShortcutPressed(const QString& shortcut, int val);
83 
84 public:
85 
88 
89  virtual QList<QUrl> currentSelectedItems() const;
90  virtual QList<QUrl> currentAlbumItems() const;
91  virtual void parseAlbumItemsRecursive();
92 
93  virtual QList<QUrl> albumItems(int) const;
94  virtual QList<QUrl> albumsItems(const DAlbumIDs&) const;
95  virtual QList<QUrl> allAlbumItems() const;
96 
97  virtual DInfoMap albumInfo(int) const;
98  virtual void setAlbumInfo(int, const DInfoMap&) const;
99 
100  virtual DInfoMap itemInfo(const QUrl&) const;
101  virtual void setItemInfo(const QUrl&, const DInfoMap&) const;
102 
103  Q_SIGNAL void signalLastItemUrl(const QUrl&);
105 
106 public:
107 
110 
111  virtual QWidget* albumChooser(QWidget* const parent) const;
112  virtual DAlbumIDs albumChooserItems() const;
113  virtual bool supportAlbums() const;
114 
117 
118 public:
119 
122 
123  virtual QWidget* uploadWidget(QWidget* const parent) const;
124  virtual QUrl uploadUrl() const;
125 
126  Q_SIGNAL void signalUploadUrlChanged();
127 
129  virtual QUrl defaultUploadUrl() const;
130 
131  Q_SIGNAL void signalImportedImage(const QUrl&);
133 
134 public:
135 
137  virtual QAbstractItemModel* tagFilterModel();
138 
139 #ifdef HAVE_MARBLE
140 
141  virtual QList<GPSItemContainer*> currentGPSItems() const;
142 
143 #endif
144 
145 public:
146 
148  virtual QMap<QString, QString> passShortcutActionsToWidget(QWidget* const) const;
149 
150 public:
151 
153  virtual void deleteImage(const QUrl& url);
154 
155 public:
156 
158  {
159  ExifToolPage = 0
160  };
161 
163  virtual void openSetupPage(SetupPage page);
164 
165  Q_SIGNAL void signalSetupChanged();
166 };
167 
168 // -------------------------------------------------------------------------------------------------------------
169 
199 class DIGIKAM_EXPORT DItemInfo
200 {
201 
202 public:
203 
204  explicit DItemInfo(const DInfoInterface::DInfoMap&);
205  ~DItemInfo();
206 
207 public:
208 
209  QString name() const;
210  QString title() const;
211  QString comment() const;
212  QSize dimensions() const;
213  QDateTime dateTime() const;
214  QStringList tagsPath() const;
215  QStringList keywords() const;
216 
217  int albumId() const;
218  int orientation() const;
219  void setOrientation(int);
220  int rating() const;
221  void setRating(int);
222  int colorLabel() const;
223  void setColorLabel(int);
224  int pickLabel() const;
225  void setPickLabel(int);
226 
227  double latitude() const;
228  double longitude() const;
229  double altitude() const;
230  qlonglong fileSize() const;
231  QStringList creators() const;
232  QString credit() const;
233  QString rights() const;
234  QString source() const;
235  QString lens() const;
236  QString make() const;
237  QString model() const;
238  QString exposureTime() const;
239  QString sensitivity() const;
240  QString aperture() const;
241  QString focalLength() const;
242  QString focalLength35mm() const;
243  QString videoCodec() const;
244 
245  bool hasGeolocationInfo() const;
246 
247 private:
248 
249  QVariant parseInfoMap(const QString& key) const;
250 
251 private:
252 
254 };
255 
256 // -----------------------------------------------------------------
257 
258 class DIGIKAM_EXPORT DAlbumInfo
259 {
260 
261 public:
262 
263  explicit DAlbumInfo(const DInfoInterface::DInfoMap&);
264  ~DAlbumInfo();
265 
266 public:
267 
268  QString title() const;
269  QString caption() const;
270  QDate date() const;
271  QString path() const;
272  QString albumPath() const;
273 
274 private:
275 
277 };
278 
279 } // namespace Digikam
280 
281 #endif // DIGIKAM_DINFO_INTERFACE_H
Definition: dinfointerface.h:259
Definition: dinfointerface.h:56
QList< int > DAlbumIDs
List of Album ids.
Definition: dinfointerface.h:63
Q_SIGNAL void signalImportedImage(const QUrl &)
Q_SIGNAL void signalShortcutPressed(const QString &shortcut, int val)
Q_SIGNAL void signalAlbumItemsRecursiveCompleted(const QList< QUrl > &imageList)
Q_SIGNAL void signalAlbumChooserSelectionChanged()
Q_SIGNAL void signalSetupChanged()
Q_SIGNAL void signalLastItemUrl(const QUrl &)
SetupPage
Definition: dinfointerface.h:158
QMap< QString, QVariant > DInfoMap
Map of properties name and value.
Definition: dinfointerface.h:62
Q_SIGNAL void signalUploadUrlChanged()
Definition: dinfointerface.h:200
Definition: datefolderview.cpp:43