digiKam
gpcamera.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 : 2003-01-21
7  * Description : Gphoto2 camera interface
8  *
9  * Copyright (C) 2003-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  * Copyright (C) 2006-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_GP_CAMERA_H
27 #define DIGIKAM_GP_CAMERA_H
28 
29 // Local includes
30 
31 #include "dkcamera.h"
32 
33 class QImage;
34 
35 namespace Digikam
36 {
37 
38 class GPStatus;
39 class DMetadata;
40 
44 class GPCamera : public DKCamera
45 {
46  Q_OBJECT
47 
48 public:
49 
50  explicit GPCamera(const QString& title, const QString& model,
51  const QString& port, const QString& path);
52  ~GPCamera() override;
53 
54  QByteArray cameraMD5ID() override;
56 
57  bool doConnect() override;
58 
59  void cancel() override;
60 
61  bool getFolders(const QString& folder) override;
62  bool getItemsList(const QString& folder, QStringList& itemsList);
63  bool getItemsInfoList(const QString& folder, bool useMetadata, CamItemInfoList& items) override;
64  void getItemInfo(const QString& folder, const QString& itemName, CamItemInfo& info, bool useMetadata) override;
65 
66  bool getThumbnail(const QString& folder, const QString& itemName, QImage& thumbnail) override;
67  bool getMetadata(const QString& folder, const QString& itemName, DMetadata& meta) override;
68 
69  bool setLockItem(const QString& folder, const QString& itemName, bool lock) override;
70 
71  bool downloadItem(const QString& folder, const QString& itemName, const QString& saveFile) override;
72  bool deleteItem(const QString& folder, const QString& itemName) override;
73 
75  bool deleteAllItems(const QString& folder);
76 
77  bool uploadItem(const QString& folder, const QString& itemName, const QString& localFile, CamItemInfo& itemInfo) override;
78 
79  bool cameraSummary(QString& summary) override;
80  bool cameraManual(QString& manual) override;
81  bool cameraAbout(QString& about) override;
82 
83  bool getFreeSpace(unsigned long& kBSize, unsigned long& kBAvail) override;
84  bool getPreview(QImage& preview) override;
85  bool capture(CamItemInfo& itemInfo) override;
86 
87  // Public static methods shared with Setup Camera
88 
89  static int autoDetect(QString& model, QString& port);
90  static void getSupportedCameras(int& count, QStringList& clist);
91  static void getSupportedPorts(QStringList& plist);
92  static void getCameraSupportedPorts(const QString& model, QStringList& plist);
93  static bool findConnectedUsbCamera(int vendorId, int productId, QString& model, QString& port);
94 
95 private:
96 
100  void getItemInfoInternal(const QString& folder, const QString& itemName, CamItemInfo& info, bool useMetadata);
101 
102  static void printGphotoErrorDescription(int errorCode);
103 
104 private:
105 
106  // Disable
107  explicit GPCamera(QObject*) = delete;
108 
109 private:
110 
111  class Private;
112  Private* const d;
113 };
114 
115 } // namespace Digikam
116 
117 #endif // DIGIKAM_GP_CAMERA_H
Definition: camiteminfo.h:48
Definition: dkcamera.h:45
CameraDriverType
Definition: dkcamera.h:51
QString path() const
Definition: dkcamera.cpp:80
QString title() const
Definition: dkcamera.cpp:65
QString port() const
Definition: dkcamera.cpp:75
QString model() const
Definition: dkcamera.cpp:70
Definition: dmetadata.h:55
Definition: gpcamera.h:45
bool getThumbnail(const QString &folder, const QString &itemName, QImage &thumbnail) override
Definition: gpcamera.cpp:1037
bool uploadItem(const QString &folder, const QString &itemName, const QString &localFile, CamItemInfo &itemInfo) override
Definition: gpcamera.cpp:1360
bool cameraManual(QString &manual) override
Definition: gpcamera.cpp:1579
bool setLockItem(const QString &folder, const QString &itemName, bool lock) override
Definition: gpcamera.cpp:1238
bool getItemsList(const QString &folder, QStringList &itemsList)
Definition: gpcamera.cpp:784
void cancel() override
Definition: gpcamera.cpp:404
static void getSupportedCameras(int &count, QStringList &clist)
Definition: gpcamera.cpp:1664
bool cameraSummary(QString &summary) override
Definition: gpcamera.cpp:1523
static void getSupportedPorts(QStringList &plist)
Definition: gpcamera.cpp:1714
DKCamera::CameraDriverType cameraDriverType() override
Definition: gpcamera.cpp:238
QByteArray cameraMD5ID() override
Definition: gpcamera.cpp:243
bool getFolders(const QString &folder) override
Definition: gpcamera.cpp:724
bool capture(CamItemInfo &itemInfo) override
Definition: gpcamera.cpp:610
static bool findConnectedUsbCamera(int vendorId, int productId, QString &model, QString &port)
Definition: gpcamera.cpp:1892
bool cameraAbout(QString &about) override
Definition: gpcamera.cpp:1612
bool deleteItem(const QString &folder, const QString &itemName) override
Definition: gpcamera.cpp:1299
bool getFreeSpace(unsigned long &kBSize, unsigned long &kBAvail) override
Definition: gpcamera.cpp:424
void getItemInfo(const QString &folder, const QString &itemName, CamItemInfo &info, bool useMetadata) override
Definition: gpcamera.cpp:896
bool downloadItem(const QString &folder, const QString &itemName, const QString &saveFile) override
Definition: gpcamera.cpp:1164
bool getMetadata(const QString &folder, const QString &itemName, DMetadata &meta) override
Definition: gpcamera.cpp:1089
bool getPreview(QImage &preview) override
Definition: gpcamera.cpp:563
bool getItemsInfoList(const QString &folder, bool useMetadata, CamItemInfoList &items) override
If getImageDimensions is false, the camera shall set width and height to -1 if the values are not imm...
Definition: gpcamera.cpp:838
~GPCamera() override
Definition: gpcamera.cpp:216
bool doConnect() override
Definition: gpcamera.cpp:269
bool deleteAllItems(const QString &folder)
recursively delete all items
Definition: gpcamera.cpp:1330
GPCamera(const QString &title, const QString &model, const QString &port, const QString &path)
Definition: gpcamera.cpp:209
static int autoDetect(QString &model, QString &port)
Definition: gpcamera.cpp:1816
static void getCameraSupportedPorts(const QString &model, QStringList &plist)
Definition: gpcamera.cpp:1770
Definition: datefolderview.cpp:43