File indexing completed on 2025-01-05 03:59:46
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2003-01-21 0007 * Description : Gphoto2 camera interface 0008 * 0009 * SPDX-FileCopyrightText: 2003-2005 by Renchi Raju <renchi dot raju at gmail dot com> 0010 * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * SPDX-FileCopyrightText: 2006-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #ifndef DIGIKAM_GP_CAMERA_H 0018 #define DIGIKAM_GP_CAMERA_H 0019 0020 // Local includes 0021 0022 #include "dkcamera.h" 0023 0024 class QImage; 0025 0026 namespace Digikam 0027 { 0028 0029 class GPStatus; 0030 class DMetadata; 0031 0032 /** 0033 * Gphoto2 camera Implementation of abstract type DKCamera 0034 */ 0035 class GPCamera : public DKCamera 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 0041 explicit GPCamera(const QString& title, const QString& model, 0042 const QString& port, const QString& path); 0043 ~GPCamera() override; 0044 0045 QByteArray cameraMD5ID() override; 0046 DKCamera::CameraDriverType cameraDriverType() override; 0047 0048 bool doConnect() override; 0049 0050 void cancel() override; 0051 0052 bool getFolders(const QString& folder) override; 0053 bool getItemsList(const QString& folder, QStringList& itemsList); 0054 bool getItemsInfoList(const QString& folder, bool useMetadata, CamItemInfoList& items) override; 0055 void getItemInfo(const QString& folder, const QString& itemName, CamItemInfo& info, bool useMetadata) override; 0056 0057 bool getThumbnail(const QString& folder, const QString& itemName, QImage& thumbnail) override; 0058 bool getMetadata(const QString& folder, const QString& itemName, DMetadata& meta) override; 0059 0060 bool setLockItem(const QString& folder, const QString& itemName, bool lock) override; 0061 0062 bool downloadItem(const QString& folder, const QString& itemName, const QString& saveFile) override; 0063 bool deleteItem(const QString& folder, const QString& itemName) override; 0064 0065 /// recursively delete all items 0066 bool deleteAllItems(const QString& folder); 0067 0068 bool uploadItem(const QString& folder, const QString& itemName, const QString& localFile, CamItemInfo& itemInfo) override; 0069 0070 bool cameraSummary(QString& summary) override; 0071 bool cameraManual(QString& manual) override; 0072 bool cameraAbout(QString& about) override; 0073 0074 bool getFreeSpace(qint64& bytesSize, qint64& bytesAvail) override; 0075 bool getPreview(QImage& preview) override; 0076 bool capture(CamItemInfo& itemInfo) override; 0077 0078 // Public static methods shared with Setup Camera 0079 0080 static int autoDetect(QString& model, QString& port); 0081 static void getSupportedCameras(int& count, QStringList& clist); 0082 static void getSupportedPorts(QStringList& plist); 0083 static void getCameraSupportedPorts(const QString& model, QStringList& plist); 0084 static bool findConnectedUsbCamera(int vendorId, int productId, QString& model, QString& port); 0085 0086 private: 0087 0088 /** 0089 * Run getItemInfo implementation without being wrapped into GPhoto context 0090 */ 0091 void getItemInfoInternal(const QString& folder, const QString& itemName, CamItemInfo& info, bool useMetadata); 0092 0093 static void printGphotoErrorDescription(int errorCode); 0094 0095 private: 0096 0097 // Disable 0098 explicit GPCamera(QObject*) = delete; 0099 0100 private: 0101 0102 class Private; 0103 Private* const d; 0104 }; 0105 0106 } // namespace Digikam 0107 0108 #endif // DIGIKAM_GP_CAMERA_H