File indexing completed on 2025-01-05 03:59:47

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2004-12-21
0007  * Description : USB Mass Storage camera interface
0008  *
0009  * SPDX-FileCopyrightText: 2004-2005 by Renchi Raju <renchi dot raju at gmail dot com>
0010  * SPDX-FileCopyrightText: 2005-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_UMS_CAMERA_H
0017 #define DIGIKAM_UMS_CAMERA_H
0018 
0019 // Qt includes
0020 
0021 #include <QStringList>
0022 
0023 // Local includes
0024 
0025 #include "dkcamera.h"
0026 
0027 namespace Digikam
0028 {
0029 
0030 class DMetadata;
0031 
0032 /**
0033  * USB Mass Storage camera Implementation of abstract type DKCamera
0034  */
0035 class UMSCamera : public DKCamera
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040 
0041     explicit UMSCamera(const QString& title, const QString& model, const QString& port, const QString& path);
0042     ~UMSCamera()                                                                                                    override;
0043 
0044     QByteArray                 cameraMD5ID()                                                                        override;
0045     DKCamera::CameraDriverType cameraDriverType()                                                                   override;
0046 
0047     bool doConnect()                                                                                                override;
0048     void cancel()                                                                                                   override;
0049 
0050     bool getFolders(const QString& folder)                                                                          override;
0051     bool getItemsInfoList(const QString& folder, bool useMetadata, CamItemInfoList& infoList)                       override;
0052     void getItemInfo(const QString& folder, const QString& itemName, CamItemInfo& info, bool useMetadata)           override;
0053 
0054     bool getThumbnail(const QString& folder, const QString& itemName, QImage& thumbnail)                            override;
0055     bool getMetadata(const QString& folder, const QString& itemName, DMetadata& meta)                               override;
0056 
0057     bool setLockItem(const QString& folder, const QString& itemName, bool lock)                                     override;
0058 
0059     bool downloadItem(const QString& folder, const QString& itemName, const QString& saveFile)                      override;
0060     bool deleteItem(const QString& folder, const QString& itemName)                                                 override;
0061     bool uploadItem(const QString& folder, const QString& itemName, const QString& localFile, CamItemInfo& info)    override;
0062 
0063     bool cameraSummary(QString& summary)                                                                            override;
0064     bool cameraManual(QString& manual)                                                                              override;
0065     bool cameraAbout(QString& about)                                                                                override;
0066 
0067     bool getFreeSpace(qint64& bytesSize, qint64& bytesAvail)                                                        override;
0068 
0069     bool getPreview(QImage& preview)                                                                                override;
0070     bool capture(CamItemInfo& itemInfo)                                                                             override;
0071 
0072 private:
0073 
0074     /**
0075      * Try to find UUID of UMS camera media using Solid interface.
0076      * Search use mount path as reference. Return UUID as string
0077      * else an empty string
0078      */
0079     void getUUIDFromSolid();
0080 
0081 private:
0082 
0083     bool m_cancel;
0084 
0085 private:
0086 
0087     // Disable
0088     explicit UMSCamera(QObject*) = delete;
0089 };
0090 
0091 } // namespace Digikam
0092 
0093 #endif // DIGIKAM_UMS_CAMERA_H