digiKam
cameracontroller.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 : 2004-09-17
7  * Description : digital camera controller
8  *
9  * Copyright (C) 2004-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_CAMERA_CONTROLLER_H
27 #define DIGIKAM_CAMERA_CONTROLLER_H
28 
29 // Qt includes
30 
31 #include <QThread>
32 #include <QString>
33 #include <QFileInfo>
34 
35 // Local includes
36 
37 #include "downloadsettings.h"
38 #include "setupcamera.h"
39 #include "camiteminfo.h"
40 #include "dmetadata.h"
41 #include "dkcamera.h"
42 #include "dhistoryview.h"
43 #include "digikam_export.h"
44 
45 namespace Digikam
46 {
47 
48 class CameraCommand;
49 
50 class DIGIKAM_GUI_EXPORT CameraController : public QThread
51 {
52  Q_OBJECT
53 
54 public:
55 
56  explicit CameraController(QWidget* const parent,
57  const QString& title,
58  const QString& model,
59  const QString& port,
60  const QString& path);
61  ~CameraController() override;
62 
63  bool cameraThumbnailSupport() const;
64  bool cameraDeleteSupport() const;
65  bool cameraUploadSupport() const;
66  bool cameraMkDirSupport() const;
67  bool cameraDelDirSupport() const;
68  bool cameraCaptureImageSupport() const;
69  bool cameraCaptureImagePreviewSupport() const;
70 
71  QString cameraPath() const;
72  QString cameraTitle() const;
73 
74  DKCamera::CameraDriverType cameraDriverType() const;
75 
76  QByteArray cameraMD5ID() const;
77 
78  void capture();
79  void listRootFolder(bool useMetadata);
80  void listFolders(const QString& folder = QString());
81  void listFiles(const QString& folder, bool useMetadata);
82  void getFreeSpace();
83  void getMetadata(const QString& folder, const QString& file);
84  void getCameraInformation();
85  void getPreview();
86 
90  CameraCommand* getThumbsInfo(const CamItemInfoList& infoList, int thumbSize);
91  void moveThumbsInfo(CameraCommand* const cmd);
92 
93  void downloadPrep(const SetupCamera::ConflictRule& rule);
94  void download(const DownloadSettings& downloadSettings);
95  void download(const DownloadSettingsList& list);
96  void upload(const QFileInfo& srcFileInfo,
97  const QString& destFile,
98  const QString& destFolder);
99  void deleteFile(const QString& folder, const QString& file);
100  void lockFile(const QString& folder, const QString& file, bool lock);
101  void openFile(const QString& folder, const QString& file);
102 
103  QIcon mimeTypeThumbnail(const QString& itemName) const;
104 
105 Q_SIGNALS:
106 
107  void signalBusy(bool val);
108  void signalLogMsg(const QString& msg,
110  const QString& folder,
111  const QString& file);
112  void signalCameraInformation(const QString& summary,
113  const QString& manual,
114  const QString& about);
115  void signalFreeSpace(unsigned long kBSize,
116  unsigned long kBAvail);
117  void signalPreview(const QImage& preview);
118 
119  void signalConnected(bool val);
120  void signalFolderList(const QStringList& folderList);
121  void signalFileList(const CamItemInfoList& infoList);
122  void signalUploaded(const CamItemInfo& itemInfo);
123  void signalDownloaded(const QString& folder,
124  const QString& file,
125  int status);
126  void signalDownloadComplete(const QString& sourceFolder,
127  const QString& sourceFile,
128  const QString& destFolder,
129  const QString& destFile);
130  void signalSkipped(const QString& folder,
131  const QString& file);
132  void signalDeleted(const QString& folder,
133  const QString& file,
134  bool status);
135  void signalLocked(const QString& folder,
136  const QString& file,
137  bool status);
138  void signalThumbInfo(const QString& folder,
139  const QString& file,
140  const CamItemInfo& itemInfo,
141  const QImage& thumb);
142  void signalThumbInfoFailed(const QString& folder,
143  const QString& file,
144  const CamItemInfo& itemInfo);
145  void signalMetadata(const QString& folder,
146  const QString& file,
147  const MetaEngineData& exifData);
148 
149  void signalInternalCheckRename(const QString& folder,
150  const QString& file,
151  const QString& destination,
152  const QString& temp,
153  const QString& script);
154  void signalInternalDownloadFailed(const QString& folder,
155  const QString& file);
156  void signalInternalUploadFailed(const QString& folder,
157  const QString& file,
158  const QString& src);
159  void signalInternalDeleteFailed(const QString& folder,
160  const QString& file);
161  void signalInternalLockFailed(const QString& folder,
162  const QString& file);
163 
164 public Q_SLOTS:
165 
166  void slotCancel();
167  void slotConnect();
168 
169 protected:
170 
171  void run() override;
172  void executeCommand(CameraCommand* const cmd);
173 
174 private Q_SLOTS:
175 
176  void slotCheckRename(const QString& folder,
177  const QString& file,
178  const QString& destination,
179  const QString& temp,
180  const QString& script);
181  void slotDownloadFailed(const QString& folder,
182  const QString& file);
183  void slotUploadFailed(const QString& folder,
184  const QString& file,
185  const QString& src);
186  void slotDeleteFailed(const QString& folder,
187  const QString& file);
188  void slotLockFailed(const QString& folder,
189  const QString& file);
190 
191 private:
192 
193  void sendLogMsg(const QString& msg,
195  const QString& folder = QString(),
196  const QString& file = QString());
197 
198  void addCommand(CameraCommand* const cmd);
199  bool queueIsEmpty() const;
200 
201 private:
202 
203  class Private;
204  Private* const d;
205 };
206 
207 } // namespace Digikam
208 
209 #endif // DIGIKAM_CAMERA_CONTROLLER_H
Definition: camiteminfo.h:48
Definition: cameracontroller.h:51
void signalUploaded(const CamItemInfo &itemInfo)
void signalInternalCheckRename(const QString &folder, const QString &file, const QString &destination, const QString &temp, const QString &script)
void signalFileList(const CamItemInfoList &infoList)
void signalCameraInformation(const QString &summary, const QString &manual, const QString &about)
void signalInternalUploadFailed(const QString &folder, const QString &file, const QString &src)
void signalFolderList(const QStringList &folderList)
void signalThumbInfo(const QString &folder, const QString &file, const CamItemInfo &itemInfo, const QImage &thumb)
void signalThumbInfoFailed(const QString &folder, const QString &file, const CamItemInfo &itemInfo)
void signalInternalDeleteFailed(const QString &folder, const QString &file)
void signalDownloadComplete(const QString &sourceFolder, const QString &sourceFile, const QString &destFolder, const QString &destFile)
void signalBusy(bool val)
void signalMetadata(const QString &folder, const QString &file, const MetaEngineData &exifData)
void signalLogMsg(const QString &msg, DHistoryView::EntryType type, const QString &folder, const QString &file)
void signalInternalDownloadFailed(const QString &folder, const QString &file)
void signalSkipped(const QString &folder, const QString &file)
void signalPreview(const QImage &preview)
void signalFreeSpace(unsigned long kBSize, unsigned long kBAvail)
void signalLocked(const QString &folder, const QString &file, bool status)
void signalDeleted(const QString &folder, const QString &file, bool status)
void signalConnected(bool val)
void signalInternalLockFailed(const QString &folder, const QString &file)
void signalDownloaded(const QString &folder, const QString &file, int status)
EntryType
Definition: dhistoryview.h:48
@ StartingEntry
Definition: dhistoryview.h:49
CameraDriverType
Definition: dkcamera.h:51
Definition: downloadsettings.h:41
Definition: metaengine_data.h:41
ConflictRule
Definition: setupcamera.h:47
Definition: datefolderview.cpp:43
pt_script script