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 : 2004-12-21 0007 * Description : abstract camera interface class 0008 * 0009 * SPDX-FileCopyrightText: 2004-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 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_DKCAMERA_H 0017 #define DIGIKAM_DKCAMERA_H 0018 0019 // Qt includes 0020 0021 #include <QImage> 0022 #include <QString> 0023 #include <QStringList> 0024 #include <QByteArray> 0025 0026 // Local includes 0027 0028 #include "camiteminfo.h" 0029 0030 namespace Digikam 0031 { 0032 0033 class DMetadata; 0034 0035 class DKCamera : public QObject 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 0041 enum CameraDriverType 0042 { 0043 GPhotoDriver = 0, 0044 UMSDriver 0045 }; 0046 0047 public: 0048 0049 explicit DKCamera(const QString& title, const QString& model, const QString& port, const QString& path); 0050 ~DKCamera() override; 0051 0052 public: 0053 0054 virtual bool doConnect() = 0; 0055 virtual void cancel() = 0; 0056 0057 virtual bool getFolders(const QString& folder) = 0; 0058 0059 /// If getImageDimensions is false, the camera shall set width and height to -1 0060 /// if the values are not immediately available 0061 virtual bool getItemsInfoList(const QString& folder, bool useMetadata, CamItemInfoList& infoList) = 0; 0062 virtual void getItemInfo(const QString& folder, const QString& itemName, CamItemInfo& info, bool useMetadata) = 0; 0063 virtual bool getThumbnail(const QString& folder, const QString& itemName, QImage& thumbnail) = 0; 0064 virtual bool getMetadata(const QString& folder, const QString& itemName, DMetadata& meta) = 0; 0065 virtual bool getFreeSpace(qint64& bytesSize, qint64& bytesAvail) = 0; 0066 virtual bool getPreview(QImage& preview) = 0; 0067 0068 virtual bool capture(CamItemInfo& itemInfo) = 0; 0069 0070 virtual bool downloadItem(const QString& folder, const QString& itemName, const QString& saveFile) = 0; 0071 virtual bool deleteItem(const QString& folder, const QString& itemName) = 0; 0072 virtual bool uploadItem(const QString& folder, const QString& itemName, 0073 const QString& localFile, CamItemInfo& itemInfo) = 0; 0074 virtual bool cameraSummary(QString& summary) = 0; 0075 virtual bool cameraManual(QString& manual) = 0; 0076 virtual bool cameraAbout(QString& about) = 0; 0077 0078 virtual bool setLockItem(const QString& folder, const QString& itemName, bool lock) = 0; 0079 0080 virtual DKCamera::CameraDriverType cameraDriverType() = 0; 0081 virtual QByteArray cameraMD5ID() = 0; 0082 0083 public: 0084 0085 QString title() const; 0086 QString model() const; 0087 QString port() const; 0088 QString path() const; 0089 QString uuid() const; 0090 0091 bool thumbnailSupport() const; 0092 bool deleteSupport() const; 0093 bool uploadSupport() const; 0094 bool mkDirSupport() const; 0095 bool delDirSupport() const; 0096 bool captureImageSupport() const; 0097 bool captureImagePreviewSupport() const; 0098 0099 QString mimeType(const QString& fileext) const; 0100 0101 void printSupportedFeatures(); 0102 0103 protected: 0104 0105 void fillItemInfoFromMetadata(CamItemInfo& item, const DMetadata& meta) const; 0106 0107 protected: 0108 0109 bool m_thumbnailSupport; 0110 bool m_deleteSupport; 0111 bool m_uploadSupport; 0112 bool m_mkDirSupport; 0113 bool m_delDirSupport; 0114 bool m_captureImageSupport; 0115 bool m_captureImagePreviewSupport; 0116 0117 QString m_imageFilter; 0118 QString m_movieFilter; 0119 QString m_audioFilter; 0120 QString m_rawFilter; 0121 0122 QString m_model; 0123 QString m_port; 0124 QString m_path; 0125 QString m_title; 0126 QString m_uuid; 0127 0128 Q_SIGNALS: 0129 0130 void signalFolderList(const QStringList&); 0131 0132 private: 0133 0134 // Disable 0135 DKCamera(QObject*) = delete; 0136 }; 0137 0138 } // namespace Digikam 0139 0140 #endif // DIGIKAM_DKCAMERA_H