1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #include "qandroidcameracontrol.h"
41 
42 #include "qandroidcamerasession.h"
43 
44 QT_BEGIN_NAMESPACE
45 
QAndroidCameraControl(QAndroidCameraSession * session)46 QAndroidCameraControl::QAndroidCameraControl(QAndroidCameraSession *session)
47     : QCameraControl(0)
48     , m_cameraSession(session)
49 
50 {
51     connect(m_cameraSession, SIGNAL(statusChanged(QCamera::Status)),
52             this, SIGNAL(statusChanged(QCamera::Status)));
53 
54     connect(m_cameraSession, SIGNAL(stateChanged(QCamera::State)),
55             this, SIGNAL(stateChanged(QCamera::State)));
56 
57     connect(m_cameraSession, SIGNAL(error(int,QString)), this, SIGNAL(error(int,QString)));
58 
59     connect(m_cameraSession, SIGNAL(captureModeChanged(QCamera::CaptureModes)),
60             this, SIGNAL(captureModeChanged(QCamera::CaptureModes)));
61 }
62 
~QAndroidCameraControl()63 QAndroidCameraControl::~QAndroidCameraControl()
64 {
65 }
66 
captureMode() const67 QCamera::CaptureModes QAndroidCameraControl::captureMode() const
68 {
69     return m_cameraSession->captureMode();
70 }
71 
setCaptureMode(QCamera::CaptureModes mode)72 void QAndroidCameraControl::setCaptureMode(QCamera::CaptureModes mode)
73 {
74     m_cameraSession->setCaptureMode(mode);
75 }
76 
isCaptureModeSupported(QCamera::CaptureModes mode) const77 bool QAndroidCameraControl::isCaptureModeSupported(QCamera::CaptureModes mode) const
78 {
79     return m_cameraSession->isCaptureModeSupported(mode);
80 }
81 
setState(QCamera::State state)82 void QAndroidCameraControl::setState(QCamera::State state)
83 {
84     m_cameraSession->setState(state);
85 }
86 
state() const87 QCamera::State QAndroidCameraControl::state() const
88 {
89     return m_cameraSession->state();
90 }
91 
status() const92 QCamera::Status QAndroidCameraControl::status() const
93 {
94     return m_cameraSession->status();
95 }
96 
canChangeProperty(PropertyChangeType changeType,QCamera::Status status) const97 bool QAndroidCameraControl::canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const
98 {
99     Q_UNUSED(status);
100 
101     switch (changeType) {
102     case QCameraControl::CaptureMode:
103     case QCameraControl::ImageEncodingSettings:
104     case QCameraControl::VideoEncodingSettings:
105     case QCameraControl::Viewfinder:
106         return true;
107     default:
108         return false;
109     }
110 }
111 
112 QT_END_NAMESPACE
113