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