Debian Codegraph @

src/imports/feedback/qdeclarativefeedbackactuator.cpp

raw symbols SCIP
1 /****************************************************************************
2 **
3 ** Copyright (C) 2017 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtFeedback module 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 "qdeclarativefeedbackactuator_p.h"
41
42 /*!
43 \qmltype Actuator
44 \instantiates QFeedbackActuator
45 \brief The Actuator element represents a feedback actuator.
46 \ingroup qml-feedback-api
47
48 The Actuator class maps directly to the QFeedbackActuator C++ class, and
49 can be used with HapticsEffect elements.
50
51 There are several predefined enumerations and constants provided in this object:
52
53 1. Capability
54 \list
55 \li Envelope - Value specifying that the device can bound its intensity by an envelope.
56 \li Period - Value specifying that the device can play periodic effects.
57 \endlist
58
59 2. State
60 \list
61 \li Busy - The actuator is busy.
62 \li Ready - The actuator is ready to play an effect.
63 \li Unknown - The actuator is in an unknown state.
64 \endlist
65
66 \sa HapticsEffect, {QFeedbackActuator}
67 */
68 QDeclarativeFeedbackActuator::QDeclarativeFeedbackActuator(QObject *parent)
69 :QObject(parent)
70 {
71 d = new QFeedbackActuator(this);
72 connect(d, SIGNAL(enabledChanged()), this, SIGNAL(enabledChanged()));
73 }
74
75 QDeclarativeFeedbackActuator::QDeclarativeFeedbackActuator(QObject *parent, QFeedbackActuator* actuator)
76 :QObject(parent)
77 {
78 d = actuator;
79 connect(d, SIGNAL(enabledChanged()), this, SIGNAL(enabledChanged()));
80 }
81
82 QFeedbackActuator* QDeclarativeFeedbackActuator::feedbackActuator() const
83 {
84 return d;
85 }
86
87 /*!
88 \qmlproperty int Actuator::actuatorId
89 This property holds the id of the feedback actuator.
90 This property is read only.
91 */
92 int QDeclarativeFeedbackActuator::actuatorId() const
93 {
94 return d->id();
95 }
96
97 /*!
98 \qmlproperty bool Actuator::valid
99
100 This property is true if the actuator is valid.
101 This property is read only.
102 */
103 bool QDeclarativeFeedbackActuator::isValid() const
104 {
105 return d->isValid();
106 }
107 /*!
108 \qmlproperty string Actuator::name
109 This property holds the name of the feedback actuator.
110 This property is read only.
111 */
112 QString QDeclarativeFeedbackActuator::name() const
113 {
114 return d->name();
115 }
116
117 /*!
118 \qmlproperty enumeration Actuator::state
119 This property holds the state of the feedback actuator.
120 This property is read only.
121 */
122 QDeclarativeFeedbackActuator::State QDeclarativeFeedbackActuator::state() const
123 {
124 return static_cast<State>(d->state());
125 }
126
127 /*!
128 \qmlmethod bool Actuator::isCapabilitySupported(enumeration capability)
129 Returns if the actuator supports the supplied \a capability, available capabilities are:
130 \list
131 \li Envelope - Value specifying that the device can bound its intensity by an Envelope.
132 \li Period - Value specifying that the device can play periodic effects.
133 \endlist
134 */
135 bool QDeclarativeFeedbackActuator::isCapabilitySupported(Capability capability) const
136 {
137 return d->isCapabilitySupported(static_cast<QFeedbackActuator::Capability>(capability));
138 }
139 /*!
140 \qmlproperty bool Actuator::enabled
141 This property is true if the feedback actuator is enabled.
142 */
143
144 bool QDeclarativeFeedbackActuator::isEnabled() const
145 {
146 return d->isEnabled();
147 }
148 void QDeclarativeFeedbackActuator::setEnabled(bool v)
149 {
150 d->setEnabled(v);
151 }