This repository has been archived by the owner on Feb 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
camera.h
84 lines (63 loc) · 1.98 KB
/
camera.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
74
75
76
77
78
79
80
81
82
83
84
#ifndef CAMERA_H
#define CAMERA_H
#include <QCamera>
#include <QCameraImageCapture>
#include <QMediaRecorder>
#include <QScopedPointer>
#include <QMainWindow>
#include <DApplication>
#include <DMainWindow>
#include <DWidgetUtil>
QT_BEGIN_NAMESPACE
namespace Ui { class Camera; }
QT_END_NAMESPACE
class Camera : public QMainWindow
{
Q_OBJECT
public:
Camera();
private slots:
void setCamera(const QCameraInfo &cameraInfo);
void startCamera();
void stopCamera();
void record();
void pause();
void stop();
void setMuted(bool);
void toggleLock();
void takeImage();
void displayCaptureError(int, QCameraImageCapture::Error, const QString &errorString);
void configureCaptureSettings();
void configureVideoSettings();
void configureImageSettings();
void displayRecorderError();
void displayCameraError();
void updateCameraDevice(QAction *action);
void updateCameraState(QCamera::State);
void updateCaptureMode();
void updateRecorderState(QMediaRecorder::State state);
void setExposureCompensation(int index);
void updateRecordTime();
void processCapturedImage(int requestId, const QImage &img);
void updateLockStatus(QCamera::LockStatus, QCamera::LockChangeReason);
void displayViewfinder();
void displayCapturedImage();
void readyForCapture(bool ready);
void imageSaved(int id, const QString &fileName);
protected:
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
void closeEvent(QCloseEvent *event) override;
private:
Ui::Camera *ui;
QScopedPointer<QCamera> m_camera;
QScopedPointer<QCameraImageCapture> m_imageCapture;
QScopedPointer<QMediaRecorder> m_mediaRecorder;
QImageEncoderSettings m_imageSettings;
QAudioEncoderSettings m_audioSettings;
QVideoEncoderSettings m_videoSettings;
QString m_videoContainerFormat;
bool m_isCapturingImage = false;
bool m_applicationExiting = false;
};
#endif