-
Notifications
You must be signed in to change notification settings - Fork 0
/
DQCameraHandler.h
112 lines (91 loc) · 3.04 KB
/
DQCameraHandler.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
* DQCameraHandler.h
*
* Created on: Apr 10, 2014
* Author: Tim
*/
#ifndef DQCAMERAHANDLER_H_
#define DQCAMERAHANDLER_H_
/*****************************************************************************
****************************** I N C L U D E *******************************
*****************************************************************************/
#include <QCamera>
#include <QCameraImageCapture>
#include <QCameraViewfinder>
#include <QTimer>
#include <QMenuBar>
#include <QMenu>
#include <QToolBar>
/*****************************************************************************
*
*** class DQCameraHandler
*
* Class to provide a standard interface to handing a QCamera. A user
* interface is provide with menu and toolbar items.
*
*****************************************************************************/
class DQCameraHandler : public QObject
{
Q_OBJECT
public:
DQCameraHandler(QObject* pParent);
DQCameraHandler(QObject* pParent, QSize CameraResolution);
DQCameraHandler(const DQCameraHandler& src) = delete;
~DQCameraHandler() = default;
DQCameraHandler& operator=(const DQCameraHandler& rhs) = delete;
void AddCameraMenu(QMenuBar* pMenuBar);
void AddCamerasMenuItems(QMenu* pMenu);
void AddCameraButtons(QMenu* pMenu);
void AddCameraMenuMirrorItems(QMenu* pMenu);
void AddCameraButtons(QToolBar* pToolBar);
int GetCaptureInterval() const
{
return (m_CaptureTimer.interval());
}
bool IsRunning() const
{
return (m_bRunning);
}
signals:
void imageCaptured(int nID, const QImage& Image);
void CameraStarted();
void CameraStopped();
public slots:
void StartCamera();
void StopCamera();
void MirrorHorizontal();
void MirrorVertical();
void SetResolution(int nWidth, int nHeight);
void SetResolution(QSize Resolution);
void SetCaptureInterval(int nInterval)
{
m_CaptureTimer.setInterval(nInterval);
return;
}
protected:
QCamera* m_pCamera;
QSize m_CameraResolution;
QCameraViewfinder* m_pViewFinder;
QCameraImageCapture* m_pImageCapture;
bool m_bRunning;
QImage m_CapturedImage;
QTimer m_CaptureTimer;
QAction* m_pActionStart;
QAction* m_pActionStop;
bool m_bMirrorHorizontal;
bool m_bMirrorVertical;
QAction* m_pActionMirrorHorizontal;
QAction* m_pActionMirrorVertical;
void CreateStartAction();
void CreateStopAction();
void CreateMirrorHorizontalAction();
void CreateMirrorVerticalAction();
protected slots:
void SetCamera(const QCameraInfo& CameraInfo);
void UpdateCameraDevice(QAction *pAction);
void CaptureImage();
virtual void ImageCaptured(int nID, const QImage &Image);
private:
};
// end of class DQCameraHandler
#endif /* DQCAMERAHANDLER_H_ */