-
Notifications
You must be signed in to change notification settings - Fork 11
/
gphotocontroller.h
73 lines (54 loc) · 2.37 KB
/
gphotocontroller.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef GPHOTOCONTROLLER_H
#define GPHOTOCONTROLLER_H
#include <memory>
#include <QCamera>
#include <QObject>
QT_BEGIN_NAMESPACE
class QThread;
QT_END_NAMESPACE
class GPhotoCamera;
class GPhotoWorker;
class GPhotoController final : public QObject
{
Q_OBJECT
public:
explicit GPhotoController(QObject *parent = nullptr);
~GPhotoController();
GPhotoController(GPhotoController&&) = delete;
GPhotoController& operator=(GPhotoController&&) = delete;
bool init();
QList<QByteArray> cameraNames() const;
QByteArray defaultCameraName() const;
void capturePhoto(int cameraIndex, int id, const QString &fileName) const;
QCamera::CaptureModes captureMode(int cameraIndex) const;
void setCaptureMode(int cameraIndex, QCamera::CaptureModes captureMode);
QCamera::State state(int cameraIndex) const;
void setState(int cameraIndex, QCamera::State state) const;
QCamera::Status status(int cameraIndex) const;
QVariant parameter(int cameraIndex, const QString &name) const;
bool setParameter(int cameraIndex, const QString &name, const QVariant &value);
QVariantList parameterValues(int cameraIndex, const QString &name, QMetaType::Type valueType) const;
signals:
void captureModeChanged(int cameraIndex, QCamera::CaptureModes);
void error(int cameraIndex, int errorCode, const QString &errorString);
void imageCaptured(int cameraIndex, int id, const QByteArray &imageData,
const QString &format, const QString &fileName);
void imageCaptureError(int cameraIndex, int id, int errorCode, const QString &errorString);
void previewCaptured(int cameraIndex, const QImage &image);
void readyForCaptureChanged(int cameraIndex, bool);
void stateChanged(int cameraIndex, QCamera::State);
void statusChanged(int cameraIndex, QCamera::Status);
private slots:
void onCaptureModeChanged(int cameraIndex, QCamera::CaptureModes captureMode);
void onStateChanged(int cameraIndex, QCamera::State state);
void onStatusChanged(int cameraIndex, QCamera::Status status);
private:
Q_DISABLE_COPY(GPhotoController)
std::unique_ptr<QThread> m_workerThread;
std::unique_ptr<GPhotoWorker> m_worker;
QMap<int, QCamera::CaptureModes> m_captureModes;
QMap<int, QCamera::State> m_states;
QMap<int, QCamera::Status> m_statuses;
QMap<int, bool> m_capturings;
};
#endif // GPHOTOCONTROLLER_H