digiKam
dkcamera.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 : 2004-12-21
7  * Description : abstract camera interface class
8  *
9  * Copyright (C) 2004-2005 by Renchi Raju <renchi dot raju at gmail dot com>
10  * Copyright (C) 2006-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_DKCAMERA_H
26 #define DIGIKAM_DKCAMERA_H
27 
28 // Qt includes
29 
30 #include <QImage>
31 #include <QString>
32 #include <QStringList>
33 #include <QByteArray>
34 
35 // Local includes
36 
37 #include "camiteminfo.h"
38 
39 namespace Digikam
40 {
41 
42 class DMetadata;
43 
44 class DKCamera : public QObject
45 {
46  Q_OBJECT
47 
48 public:
49 
51  {
53  UMSDriver
54  };
55 
56 public:
57 
58  explicit DKCamera(const QString& title, const QString& model, const QString& port, const QString& path);
59  ~DKCamera() override;
60 
61 public:
62 
63  virtual bool doConnect() = 0;
64  virtual void cancel() = 0;
65 
66  virtual bool getFolders(const QString& folder) = 0;
67 
70  virtual bool getItemsInfoList(const QString& folder, bool useMetadata, CamItemInfoList& infoList) = 0;
71  virtual void getItemInfo(const QString& folder, const QString& itemName, CamItemInfo& info, bool useMetadata) = 0;
72  virtual bool getThumbnail(const QString& folder, const QString& itemName, QImage& thumbnail) = 0;
73  virtual bool getMetadata(const QString& folder, const QString& itemName, DMetadata& meta) = 0;
74  virtual bool getFreeSpace(unsigned long& kBSize, unsigned long& kBAvail) = 0;
75  virtual bool getPreview(QImage& preview) = 0;
76 
77  virtual bool capture(CamItemInfo& itemInfo) = 0;
78 
79  virtual bool downloadItem(const QString& folder, const QString& itemName, const QString& saveFile) = 0;
80  virtual bool deleteItem(const QString& folder, const QString& itemName) = 0;
81  virtual bool uploadItem(const QString& folder, const QString& itemName,
82  const QString& localFile, CamItemInfo& itemInfo) = 0;
83  virtual bool cameraSummary(QString& summary) = 0;
84  virtual bool cameraManual(QString& manual) = 0;
85  virtual bool cameraAbout(QString& about) = 0;
86 
87  virtual bool setLockItem(const QString& folder, const QString& itemName, bool lock) = 0;
88 
90  virtual QByteArray cameraMD5ID() = 0;
91 
92 public:
93 
94  QString title() const;
95  QString model() const;
96  QString port() const;
97  QString path() const;
98  QString uuid() const;
99 
100  bool thumbnailSupport() const;
101  bool deleteSupport() const;
102  bool uploadSupport() const;
103  bool mkDirSupport() const;
104  bool delDirSupport() const;
105  bool captureImageSupport() const;
106  bool captureImagePreviewSupport() const;
107 
108  QString mimeType(const QString& fileext) const;
109 
110  void printSupportedFeatures();
111 
112 protected:
113 
114  void fillItemInfoFromMetadata(CamItemInfo& item, const DMetadata& meta) const;
115 
116 protected:
117 
125 
126  QString m_imageFilter;
127  QString m_movieFilter;
128  QString m_audioFilter;
129  QString m_rawFilter;
130 
131  QString m_model;
132  QString m_port;
133  QString m_path;
134  QString m_title;
135  QString m_uuid;
136 
137 Q_SIGNALS:
138 
139  void signalFolderList(const QStringList&);
140 
141 private:
142 
143  // Disable
144  DKCamera(QObject*) = delete;
145 };
146 
147 } // namespace Digikam
148 
149 #endif // DIGIKAM_DKCAMERA_H
Definition: camiteminfo.h:48
Definition: dkcamera.h:45
virtual bool setLockItem(const QString &folder, const QString &itemName, bool lock)=0
bool thumbnailSupport() const
Definition: dkcamera.cpp:90
QString mimeType(const QString &fileext) const
Definition: dkcamera.cpp:125
bool captureImagePreviewSupport() const
Definition: dkcamera.cpp:120
QString m_audioFilter
Definition: dkcamera.h:128
CameraDriverType
Definition: dkcamera.h:51
@ GPhotoDriver
Definition: dkcamera.h:52
@ UMSDriver
Definition: dkcamera.h:53
virtual bool cameraSummary(QString &summary)=0
QString m_movieFilter
Definition: dkcamera.h:127
QString m_path
Definition: dkcamera.h:133
virtual void cancel()=0
QString path() const
Definition: dkcamera.cpp:80
virtual bool uploadItem(const QString &folder, const QString &itemName, const QString &localFile, CamItemInfo &itemInfo)=0
virtual void getItemInfo(const QString &folder, const QString &itemName, CamItemInfo &info, bool useMetadata)=0
virtual bool getFolders(const QString &folder)=0
~DKCamera() override
Definition: dkcamera.cpp:61
bool mkDirSupport() const
Definition: dkcamera.cpp:105
virtual bool getMetadata(const QString &folder, const QString &itemName, DMetadata &meta)=0
bool uploadSupport() const
Definition: dkcamera.cpp:100
QString m_imageFilter
Definition: dkcamera.h:126
virtual DKCamera::CameraDriverType cameraDriverType()=0
virtual bool doConnect()=0
virtual QByteArray cameraMD5ID()=0
bool delDirSupport() const
Definition: dkcamera.cpp:110
virtual bool deleteItem(const QString &folder, const QString &itemName)=0
QString uuid() const
Definition: dkcamera.cpp:85
bool captureImageSupport() const
Definition: dkcamera.cpp:115
virtual bool getItemsInfoList(const QString &folder, bool useMetadata, CamItemInfoList &infoList)=0
If getImageDimensions is false, the camera shall set width and height to -1 if the values are not imm...
virtual bool cameraAbout(QString &about)=0
bool m_captureImageSupport
Definition: dkcamera.h:123
void printSupportedFeatures()
Definition: dkcamera.cpp:183
QString m_uuid
Definition: dkcamera.h:135
bool deleteSupport() const
Definition: dkcamera.cpp:95
bool m_mkDirSupport
Definition: dkcamera.h:121
void fillItemInfoFromMetadata(CamItemInfo &item, const DMetadata &meta) const
Definition: dkcamera.cpp:166
void signalFolderList(const QStringList &)
DKCamera(const QString &title, const QString &model, const QString &port, const QString &path)
Definition: dkcamera.cpp:36
virtual bool getThumbnail(const QString &folder, const QString &itemName, QImage &thumbnail)=0
bool m_delDirSupport
Definition: dkcamera.h:122
QString title() const
Definition: dkcamera.cpp:65
virtual bool getFreeSpace(unsigned long &kBSize, unsigned long &kBAvail)=0
bool m_captureImagePreviewSupport
Definition: dkcamera.h:124
QString port() const
Definition: dkcamera.cpp:75
bool m_uploadSupport
Definition: dkcamera.h:120
bool m_thumbnailSupport
Definition: dkcamera.h:118
bool m_deleteSupport
Definition: dkcamera.h:119
virtual bool capture(CamItemInfo &itemInfo)=0
QString m_rawFilter
Definition: dkcamera.h:129
QString m_title
Definition: dkcamera.h:134
virtual bool cameraManual(QString &manual)=0
QString model() const
Definition: dkcamera.cpp:70
QString m_port
Definition: dkcamera.h:132
virtual bool getPreview(QImage &preview)=0
virtual bool downloadItem(const QString &folder, const QString &itemName, const QString &saveFile)=0
QString m_model
Definition: dkcamera.h:131
Definition: dmetadata.h:55
Definition: datefolderview.cpp:43