|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (developer.feedback@nokia.com) |
|
6 ** |
|
7 ** This file is part of the HbFeedback module of the UI Extensions for Mobile. |
|
8 ** |
|
9 ** GNU Lesser General Public License Usage |
|
10 ** This file may be used under the terms of the GNU Lesser General Public |
|
11 ** License version 2.1 as published by the Free Software Foundation and |
|
12 ** appearing in the file LICENSE.LGPL included in the packaging of this file. |
|
13 ** Please review the following information to ensure the GNU Lesser General |
|
14 ** Public License version 2.1 requirements will be met: |
|
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
16 ** |
|
17 ** In addition, as a special exception, Nokia gives you certain additional |
|
18 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
20 ** |
|
21 ** If you have questions regarding the use of this file, please contact |
|
22 ** Nokia at developer.feedback@nokia.com. |
|
23 ** |
|
24 ****************************************************************************/ |
|
25 |
|
26 #include "hbfeedbackplayer_stub_p.h" |
|
27 #include <QList> |
|
28 #include "hbinstantfeedback.h" |
|
29 #include "hbcontinuousfeedback.h" |
|
30 #include "hbtacticonfeedback.h" |
|
31 #include "hbhitareafeedback.h" |
|
32 |
|
33 /*! |
|
34 Test player is used to display feedback effects in desktop environment. |
|
35 */ |
|
36 |
|
37 class HbFeedbackBasePlayerPrivate |
|
38 { |
|
39 |
|
40 public: |
|
41 HbFeedbackBasePlayerPrivate(); |
|
42 ~HbFeedbackBasePlayerPrivate(); |
|
43 |
|
44 int getNewContinuousIdentifier(); |
|
45 int getNewHitAreaIdentifier(); |
|
46 |
|
47 public: |
|
48 QList<int> continuousIdentifiers; |
|
49 QList<int> hitAreaIdentifiers; |
|
50 int slidingValueContinuous; |
|
51 int slidingValueHitArea; |
|
52 }; |
|
53 |
|
54 HbFeedbackBasePlayerPrivate::HbFeedbackBasePlayerPrivate() : slidingValueContinuous(0), slidingValueHitArea(0) |
|
55 { |
|
56 } |
|
57 |
|
58 HbFeedbackBasePlayerPrivate::~HbFeedbackBasePlayerPrivate() |
|
59 { |
|
60 continuousIdentifiers.clear(); |
|
61 hitAreaIdentifiers.clear(); |
|
62 } |
|
63 |
|
64 int HbFeedbackBasePlayerPrivate::getNewContinuousIdentifier() |
|
65 { |
|
66 slidingValueContinuous++; |
|
67 return slidingValueContinuous; |
|
68 } |
|
69 |
|
70 int HbFeedbackBasePlayerPrivate::getNewHitAreaIdentifier() |
|
71 { |
|
72 slidingValueHitArea++; |
|
73 return slidingValueHitArea; |
|
74 } |
|
75 |
|
76 HbFeedbackBasePlayer::HbFeedbackBasePlayer() |
|
77 : d(new HbFeedbackBasePlayerPrivate()) |
|
78 { |
|
79 } |
|
80 |
|
81 HbFeedbackBasePlayer::~HbFeedbackBasePlayer() |
|
82 { |
|
83 delete d; |
|
84 } |
|
85 |
|
86 void HbFeedbackBasePlayer::playInstantFeedback(const HbInstantFeedback& feedback) |
|
87 { |
|
88 Q_UNUSED(feedback) |
|
89 } |
|
90 |
|
91 void HbFeedbackBasePlayer::playTacticonFeedback(const HbTacticonFeedback& feedback) |
|
92 { |
|
93 Q_UNUSED(feedback) |
|
94 } |
|
95 |
|
96 int HbFeedbackBasePlayer::startContinuousFeedback(const HbContinuousFeedback& feedback) |
|
97 { |
|
98 Q_UNUSED(feedback) |
|
99 int identifier = d->getNewContinuousIdentifier(); |
|
100 d->continuousIdentifiers.append(identifier); |
|
101 return identifier; |
|
102 } |
|
103 |
|
104 void HbFeedbackBasePlayer::updateContinuousFeedback(int identifier, const HbContinuousFeedback& feedback) |
|
105 { |
|
106 Q_UNUSED(identifier) |
|
107 Q_UNUSED(feedback) |
|
108 } |
|
109 |
|
110 void HbFeedbackBasePlayer::cancelContinuousFeedback(int identifier) |
|
111 { |
|
112 if (d->continuousIdentifiers.contains(identifier)) { |
|
113 d->continuousIdentifiers.removeAll(identifier); |
|
114 } |
|
115 } |
|
116 |
|
117 bool HbFeedbackBasePlayer::continuousFeedbackOngoing(int identifier) |
|
118 { |
|
119 return d->continuousIdentifiers.contains(identifier); |
|
120 } |
|
121 |
|
122 int HbFeedbackBasePlayer::insertHitArea(const HbHitAreaFeedback& feedback) |
|
123 { |
|
124 Q_UNUSED(feedback) |
|
125 int identifier = d->getNewHitAreaIdentifier(); |
|
126 d->hitAreaIdentifiers.append(identifier); |
|
127 return identifier; |
|
128 } |
|
129 |
|
130 void HbFeedbackBasePlayer::updateHitArea(int identifier, const HbHitAreaFeedback& feedback) |
|
131 { |
|
132 Q_UNUSED(identifier) |
|
133 Q_UNUSED(feedback) |
|
134 } |
|
135 |
|
136 void HbFeedbackBasePlayer::removeHitArea(int identifier) |
|
137 { |
|
138 if (d->hitAreaIdentifiers.contains(identifier)) { |
|
139 d->hitAreaIdentifiers.removeAll(identifier); |
|
140 } |
|
141 } |
|
142 |
|
143 bool HbFeedbackBasePlayer::hitAreaExists(int identifier) |
|
144 { |
|
145 return d->hitAreaIdentifiers.contains(identifier); |
|
146 } |
|
147 |
|
148 void HbFeedbackBasePlayer::cancelContinuousFeedbacks() |
|
149 { |
|
150 d->continuousIdentifiers.clear(); |
|
151 } |
|
152 |
|
153 void HbFeedbackBasePlayer::removeHitAreas() |
|
154 { |
|
155 d->hitAreaIdentifiers.clear(); |
|
156 } |