1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 //USER |
|
19 #include "lcconfiguration.h" |
|
20 #include "LcUiEngine_p.h" |
|
21 #include "lcuidefs.h" |
|
22 #include "lclogger.h" |
|
23 #include "lcuienginesimulator.h" |
|
24 |
|
25 |
|
26 //SYSTEM |
|
27 #include <QTimer> |
|
28 #include <hbdialog.h> |
|
29 #include <hbaction.h> |
|
30 #include <hblabel.h> |
|
31 #include <hblineedit.h> |
|
32 #include <hbinstance.h> |
|
33 #include <hbmessagebox.h> |
|
34 |
|
35 |
|
36 #define LC_VTPLUGIN_NAME "Videotelephony"; |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // LcUiEngineSimulator::LcUiEngineSimulator |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 LcUiEngineSimulator::LcUiEngineSimulator( LcUiEnginePrivate& uiEngine) |
|
43 :mUiEngine( uiEngine ) |
|
44 { |
|
45 mConfig = new LcConfiguration(); |
|
46 mConfig->parse(); |
|
47 mTimer = new QTimer( this ); |
|
48 connect( mTimer, SIGNAL(timeout()), this, SLOT(timerEvent()) ); |
|
49 iSimulatorCount = 0; |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // LcUiEngineSimulator::~LcUiEngineSimulator |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 LcUiEngineSimulator::~LcUiEngineSimulator() |
|
57 { |
|
58 LC_QDEBUG( "livecomms [UI] -> LcUiEngineSimulator::~LcUiEngineSimulator()" ) |
|
59 delete mConfig; |
|
60 delete mTimer; |
|
61 LC_QDEBUG( "livecomms [UI] <- LcUiEngineSimulator::~LcUiEngineSimulator()" ) |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // LcUiEngineSimulator::~LcUiEngineSimulator |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 void LcUiEngineSimulator::start() |
|
69 { |
|
70 mTimer->start(mConfig->mTimerDuration); |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // LcUiEngineSimulator::~LcUiEngineSimulator |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 void LcUiEngineSimulator::stop() |
|
78 { |
|
79 mTimer->stop(); |
|
80 mUiEngine.stopped(); |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // LcUiEngineSimulator::~LcUiEngineSimulator |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 int LcUiEngineSimulator::layout() |
|
88 { |
|
89 return mConfig->mLayout; |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // LcUiEngineSimulator::~LcUiEngineSimulator |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 QString LcUiEngineSimulator::phoneNo() |
|
97 { |
|
98 return mConfig->mPhoneNumber; |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // LcUiEngineSimulator::~LcUiEngineSimulator |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 QString LcUiEngineSimulator::sessionTitle() |
|
106 { |
|
107 return mConfig->mSessionTitle; |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // LcUiEngineSimulator::~LcUiEngineSimulator |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 QString LcUiEngineSimulator::remoteAddress() |
|
115 { |
|
116 return mConfig->mRecipient; |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // LcUiEngineSimulator::zoom |
|
121 // ----------------------------------------------------------------------------- |
|
122 // |
|
123 void LcUiEngineSimulator::timerEvent() |
|
124 { |
|
125 switch( mConfig->mLayout ){ |
|
126 case 0 : { |
|
127 break; |
|
128 } |
|
129 case 1:{ |
|
130 simulateLiveSharingSend(); |
|
131 break; |
|
132 } |
|
133 case 2:{ |
|
134 simulateLiveSharingReceive(); |
|
135 break; |
|
136 } |
|
137 case 3:{ |
|
138 // TODO : Add simulation |
|
139 break; |
|
140 } |
|
141 case 4:{ |
|
142 simulateTwoWaySharing(); |
|
143 break; |
|
144 } |
|
145 case 5:{ |
|
146 simulateVideoTelephony(); |
|
147 break; |
|
148 } |
|
149 default:{ |
|
150 |
|
151 break; |
|
152 } |
|
153 } |
|
154 |
|
155 iSimulatorCount++; |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // LcUiEngineSimulator::zoom |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 void LcUiEngineSimulator::simulateLiveSharingSend() |
|
163 { |
|
164 switch ( iSimulatorCount ){ |
|
165 case 0:{ |
|
166 mUiEngine.mInvitingNote->show(); |
|
167 mUiEngine.localPlayerPreparing(); |
|
168 break; |
|
169 } |
|
170 case 1:{ |
|
171 mUiEngine.mInvitingNote->hide();; |
|
172 mUiEngine.localPlayerBuffering(); |
|
173 break; |
|
174 } |
|
175 case 2:{ |
|
176 mUiEngine.localPlayerPlaying(); |
|
177 break; |
|
178 } |
|
179 default:{ |
|
180 mUiEngine.sessionDurationChanged(QString::number(iSimulatorCount)); |
|
181 break; |
|
182 } |
|
183 } |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // LcUiEngineSimulator::zoom |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 void LcUiEngineSimulator::simulateLiveSharingReceive() |
|
191 { |
|
192 switch ( iSimulatorCount ){ |
|
193 case 0:{ |
|
194 mUiEngine.mAcceptQuery->show(); |
|
195 mUiEngine.remotePlayerPreparing(); |
|
196 break; |
|
197 } |
|
198 case 1:{ |
|
199 mUiEngine.mAcceptQuery->hide(); |
|
200 mUiEngine.mWaitingNote->show(); |
|
201 mUiEngine.remotePlayerBuffering(); |
|
202 break; |
|
203 } |
|
204 case 2:{ |
|
205 mUiEngine.mWaitingNote->hide(); |
|
206 mUiEngine.remotePlayerPlaying(); |
|
207 break; |
|
208 } |
|
209 default:{ |
|
210 mUiEngine.sessionDurationChanged(QString::number(iSimulatorCount)); |
|
211 break; |
|
212 } |
|
213 } |
|
214 } |
|
215 |
|
216 // ----------------------------------------------------------------------------- |
|
217 // LcUiEngineSimulator::zoom |
|
218 // ----------------------------------------------------------------------------- |
|
219 // |
|
220 void LcUiEngineSimulator::simulateTwoWaySharing() |
|
221 { |
|
222 switch ( iSimulatorCount ){ |
|
223 case 0:{ |
|
224 mUiEngine.localPlayerPreparing(); |
|
225 mUiEngine.remotePlayerPreparing(); |
|
226 break; |
|
227 } |
|
228 case 1:{ |
|
229 mUiEngine.localPlayerBuffering(); |
|
230 mUiEngine.remotePlayerBuffering(); |
|
231 break; |
|
232 } |
|
233 case 2:{ |
|
234 mUiEngine.localPlayerPlaying(); |
|
235 mUiEngine.remotePlayerPlaying(); |
|
236 break; |
|
237 } |
|
238 default:{ |
|
239 mUiEngine.sessionDurationChanged(QString::number(iSimulatorCount)); |
|
240 break; |
|
241 } |
|
242 } |
|
243 } |
|
244 |
|
245 // ----------------------------------------------------------------------------- |
|
246 // LcUiEngineSimulator::zoom |
|
247 // ----------------------------------------------------------------------------- |
|
248 // |
|
249 void LcUiEngineSimulator::simulateVideoTelephony() |
|
250 { |
|
251 switch ( iSimulatorCount ){ |
|
252 case 0:{ |
|
253 mUiEngine.localPlayerPreparing(); |
|
254 mUiEngine.remotePlayerPreparing(); |
|
255 break; |
|
256 } |
|
257 case 1:{ |
|
258 mUiEngine.localPlayerBuffering(); |
|
259 mUiEngine.remotePlayerBuffering(); |
|
260 break; |
|
261 } |
|
262 case 2:{ |
|
263 if( !mUiEngine.isRemotePlayerPlaying() ){ |
|
264 mUiEngine.remotePlayerPlaying(); |
|
265 } |
|
266 break; |
|
267 } |
|
268 case 3:{ |
|
269 if( !mUiEngine.isLocalPlayerPlaying() ){ |
|
270 mUiEngine.localPlayerPlaying(); |
|
271 } |
|
272 break; |
|
273 } |
|
274 default:{ |
|
275 mUiEngine.sessionDurationChanged(QString::number(iSimulatorCount)); |
|
276 break; |
|
277 } |
|
278 } |
|
279 } |
|
280 |
|
281 // End of File |
|