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 | |
41 | |
42 | #include "qcamerafeedbackcontrol.h" |
43 | #include <private/qmediacontrol_p.h> |
44 | |
45 | /*! |
46 | \class QCameraFeedbackControl |
47 | |
48 | \brief The QCameraFeedbackControl class allows controlling feedback (sounds etc) during camera operation. |
49 | |
50 | \inmodule QtMultimedia |
51 | |
52 | \ingroup multimedia_control |
53 | \since 5.0 |
54 | |
55 | When using a camera, there are several times when some form of feedback to |
56 | the user is given - for example, when an image is taken, or when recording is started. |
57 | You can enable or disable some of this feedback, or adjust what sound might be played |
58 | for these actions. |
59 | |
60 | In some cases it may be undesirable to play a sound effect - for example, when initiating |
61 | video recording the sound itself may be recorded. |
62 | |
63 | \note In some countries or regions, feedback sounds or other indications (e.g. a red light) are |
64 | mandatory during camera operation. In these cases, you can check \c isEventFeedbackLocked to check |
65 | if that type of feedback can be modified. Any attempts to change a locked feedback type will be |
66 | ignored. |
67 | |
68 | The interface name of QCameraFeedbackControl is \c org.qt-project.qt.camerafeedbackcontrol/5.0 as |
69 | defined in QCameraFeedbackControl_iid. |
70 | |
71 | \sa QCamera |
72 | */ |
73 | |
74 | /*! |
75 | \enum QCameraFeedbackControl::EventType |
76 | |
77 | This enumeration describes certain events that occur during camera usage. You |
78 | can associate some form of feedback to be given when the event occurs, or check |
79 | whether feedback for this event is enabled or locked so that changes cannot be made. |
80 | |
81 | |
82 | |
83 | \value ViewfinderStarted The viewfinder stream was started (even if not visible) |
84 | \value ViewfinderStopped The viewfinder stream was stopped |
85 | \value ImageCaptured An image was captured but not yet fully processed |
86 | \value ImageSaved An image is fully available and saved somewhere. |
87 | \value ImageError An error occurred while capturing an image |
88 | \value RecordingStarted Video recording has started |
89 | \value RecordingInProgress Video recording is in progress |
90 | \value RecordingStopped Video recording has stopped |
91 | \value AutoFocusInProgress The camera is trying to automatically focus |
92 | \value AutoFocusLocked The camera has automatically focused successfully |
93 | \value AutoFocusFailed The camera was unable to focus automatically |
94 | */ |
95 | |
96 | /*! |
97 | \macro QCameraFeedbackControl_iid |
98 | |
99 | \c org.qt-project.qt.camerafeedbackcontrol/5.0 |
100 | |
101 | Defines the interface name of the QCameraFeedbackControl class. |
102 | |
103 | \relates QCameraFeedbackControl |
104 | */ |
105 | |
106 | /*! |
107 | Constructs a camera feedback control object with \a parent. |
108 | */ |
109 | QCameraFeedbackControl::QCameraFeedbackControl(QObject *parent): |
110 | QMediaControl(*new QMediaControlPrivate, parent) |
111 | { |
112 | } |
113 | |
114 | /*! |
115 | Destroys the camera feedback control object. |
116 | */ |
117 | QCameraFeedbackControl::~QCameraFeedbackControl() |
118 | { |
119 | } |
120 | |
121 | /*! |
122 | \fn bool QCameraFeedbackControl::isEventFeedbackLocked(EventType event) const |
123 | |
124 | Returns true if the feedback setting for \a event is locked. This may be true |
125 | because of legal compliance issues, or because configurability of this event's |
126 | feedback is not supported. |
127 | |
128 | \since 5.0 |
129 | */ |
130 | |
131 | /*! |
132 | \fn bool QCameraFeedbackControl::isEventFeedbackEnabled(EventType event) const |
133 | |
134 | Returns true if the feedback for \a event is enabled. |
135 | |
136 | \since 5.0 |
137 | */ |
138 | |
139 | /*! |
140 | \fn bool QCameraFeedbackControl::setEventFeedbackEnabled(EventType event, bool enabled) |
141 | |
142 | Turns on feedback for the specific \a event if \a enabled is true, otherwise disables the |
143 | feedback. Returns true if the feedback could be modified, or false otherwise (e.g. this feedback |
144 | type is locked). |
145 | |
146 | \since 5.0 |
147 | */ |
148 | |
149 | |
150 | /*! |
151 | \fn void QCameraFeedbackControl::resetEventFeedback(EventType event) |
152 | |
153 | Restores the feedback setting for this \a event to its default setting. |
154 | |
155 | \since 5.0 |
156 | */ |
157 | |
158 | /*! |
159 | \fn bool QCameraFeedbackControl::setEventFeedbackSound(EventType event, const QString &filePath) |
160 | |
161 | When the given \a event occurs, the sound effect referenced by \a filePath |
162 | will be played instead of the default sound. |
163 | |
164 | If this feedback type is locked, or if the supplied path is inaccessible, |
165 | this function will return false. In addition, some forms of feedback may |
166 | be non-auditory (e.g. a red light, or a vibration), and false may be |
167 | returned in this case. |
168 | |
169 | The file referenced should be linear PCM (WAV format). |
170 | |
171 | \note In the case that a valid file path to an unsupported file is given, this |
172 | function will return true but the feedback will use the original setting. |
173 | |
174 | \since 5.0 |
175 | */ |
176 | |
177 | |
178 | |
179 | |
180 | |
181 | |
182 | |