1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2004-12-21
7  * Description : USB Mass Storage camera interface
8  *
9  * Copyright (C) 2004-2005 by Renchi Raju <renchi dot raju at gmail dot com>
10  * Copyright (C) 2005-2021 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_UMS_CAMERA_H
26 #define DIGIKAM_UMS_CAMERA_H
27 
28 // Qt includes
29 
30 #include <QStringList>
31 
32 // Local includes
33 
34 #include "dkcamera.h"
35 
36 namespace Digikam
37 {
38 
39 class DMetadata;
40 
41 /**
42  * USB Mass Storage camera Implementation of abstract type DKCamera
43  */
44 class UMSCamera : public DKCamera
45 {
46     Q_OBJECT
47 
48 public:
49 
50     explicit UMSCamera(const QString& title, const QString& model, const QString& port, const QString& path);
51     ~UMSCamera()                                                                                                    override;
52 
53     QByteArray                 cameraMD5ID()                                                                        override;
54     DKCamera::CameraDriverType cameraDriverType()                                                                   override;
55 
56     bool doConnect()                                                                                                override;
57     void cancel()                                                                                                   override;
58 
59     bool getFolders(const QString& folder)                                                                          override;
60     bool getItemsInfoList(const QString& folder, bool useMetadata, CamItemInfoList& infoList)                       override;
61     void getItemInfo(const QString& folder, const QString& itemName, CamItemInfo& info, bool useMetadata)           override;
62 
63     bool getThumbnail(const QString& folder, const QString& itemName, QImage& thumbnail)                            override;
64     bool getMetadata(const QString& folder, const QString& itemName, DMetadata& meta)                               override;
65 
66     bool setLockItem(const QString& folder, const QString& itemName, bool lock)                                     override;
67 
68     bool downloadItem(const QString& folder, const QString& itemName, const QString& saveFile)                      override;
69     bool deleteItem(const QString& folder, const QString& itemName)                                                 override;
70     bool uploadItem(const QString& folder, const QString& itemName, const QString& localFile, CamItemInfo& info)    override;
71 
72     bool cameraSummary(QString& summary)                                                                            override;
73     bool cameraManual(QString& manual)                                                                              override;
74     bool cameraAbout(QString& about)                                                                                override;
75 
76     bool getFreeSpace(unsigned long& kBSize, unsigned long& kBAvail)                                                override;
77 
78     bool getPreview(QImage& preview)                                                                                override;
79     bool capture(CamItemInfo& itemInfo)                                                                             override;
80 
81 private:
82 
83     /**
84      * Try to find UUID of UMS camera media using Solid interface.
85      * Search use mount path as reference. Return UUID as string
86      * else an empty string
87      */
88     void getUUIDFromSolid();
89 
90 private:
91 
92     bool m_cancel;
93 
94 private:
95 
96     // Disable
97     explicit UMSCamera(QObject*) = delete;
98 };
99 
100 } // namespace Digikam
101 
102 #endif // DIGIKAM_UMS_CAMERA_H
103