|
1 /* |
|
2 * Copyright (c) 2010 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 |
|
19 #include <hbmainwindow.h> |
|
20 //#include <hbcommonnote.h> |
|
21 #include <hbpopup.h> |
|
22 #include <hbaction.h> |
|
23 |
|
24 #include <QString> |
|
25 #include <QStringList> |
|
26 |
|
27 #include <e32std.h> |
|
28 #include <e32base.h> |
|
29 |
|
30 #include "notifications.h" |
|
31 #include "enginewrapper.h" |
|
32 #include "settingsview.h" |
|
33 #include "engine.h" |
|
34 #include "mainview.h" |
|
35 |
|
36 QStringList LOADTYPES = (QStringList() << "CPU load" << "Memory eat" << "Phone calls" << "Messages" |
|
37 << "Network conn." << "Key presses" << "Applications" << "Photo captures" |
|
38 << "Bluetooth actions" << "Pointer events"); |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 |
|
42 EngineWrapper::EngineWrapper(HbMainWindow &mainWindow, MainView &mainView) |
|
43 : mEngine(0), |
|
44 mMainView(mainView), |
|
45 mMainWindow(mainWindow), |
|
46 mEditExistingLoad(false) |
|
47 { |
|
48 } |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 |
|
52 EngineWrapper::~EngineWrapper() |
|
53 { |
|
54 if (mEngine != 0) { |
|
55 TRAP_IGNORE(mEngine->DeActivateEngineL()); |
|
56 delete mEngine; |
|
57 } |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 |
|
62 bool EngineWrapper::init() |
|
63 { |
|
64 TInt err = KErrNone; |
|
65 TRAP(err, mEngine = CEngine::NewL(this)); |
|
66 if(err != KErrNone) { |
|
67 return false; |
|
68 } |
|
69 else { |
|
70 TRAP(err, mEngine->ActivateEngineL()); |
|
71 if (err != KErrNone) { |
|
72 return false; |
|
73 } |
|
74 else { |
|
75 return true; |
|
76 } |
|
77 } |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 |
|
82 bool EngineWrapper::startNewLoad(int commandId) |
|
83 { |
|
84 TRAPD(err, mEngine->StartNewLoadL(commandId)); |
|
85 |
|
86 // error handling |
|
87 if(err != KErrNone) { |
|
88 return false; |
|
89 } |
|
90 else { |
|
91 return true; |
|
92 } |
|
93 } |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 |
|
97 void EngineWrapper::launchPerfMonApp() |
|
98 { |
|
99 TRAPD(err, mEngine->LaunchPerfMonL()); |
|
100 // error handling |
|
101 if(err != KErrNone) { |
|
102 Notifications::error("Perf Mon launch failed."); |
|
103 } |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 |
|
108 void EngineWrapper::loadAddedOrEdited(TLoadGenCommandIds cmdId) |
|
109 { |
|
110 if (mEditExistingLoad == false) { |
|
111 TRAP_IGNORE(mEngine->DoStartNewLoadL(cmdId)); |
|
112 } |
|
113 else { |
|
114 TRAP_IGNORE(mEngine->ExistingLoadEditedL()); |
|
115 } |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 |
|
120 void EngineWrapper::loadSettingsCanclled() |
|
121 { |
|
122 if (mEditExistingLoad == true) { |
|
123 TRAP_IGNORE(mEngine->ExistingLoadEditCancelled()); |
|
124 } |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 |
|
129 void EngineWrapper::loadEdit(int rowIndex) |
|
130 { |
|
131 TRAPD(err, mEngine->EditLoadL(rowIndex)); |
|
132 // error handling |
|
133 if(err != KErrNone) { |
|
134 Notifications::error("Load edit failed."); |
|
135 } |
|
136 } |
|
137 |
|
138 void EngineWrapper::StopLoadYesNoDialogClosed(HbAction *action) |
|
139 { |
|
140 if( action && !action->text().compare("yes", Qt::CaseInsensitive) ){ |
|
141 const CArrayFix<TInt>* selectionIndexes = NULL; |
|
142 try{ |
|
143 QT_TRAP_THROWING( selectionIndexes = QueryListSelectedIndexesOrCurrentItemL() ); |
|
144 if(selectionIndexes) |
|
145 QT_TRAP_THROWING( mEngine->StopSelectedOrHighlightedItemsL(selectionIndexes) ); |
|
146 } |
|
147 catch(...){ |
|
148 Notifications::error("Stop load failed."); |
|
149 } |
|
150 if(selectionIndexes) |
|
151 delete selectionIndexes; |
|
152 } |
|
153 } |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 bool EngineWrapper::stopLoad(bool stopAll) |
|
157 { |
|
158 TInt err = KErrNone; |
|
159 if (stopAll == true) { |
|
160 TRAP(err, mEngine->StopAllLoadItemsL()); |
|
161 // error handling |
|
162 if(err != KErrNone) { |
|
163 return false; |
|
164 } |
|
165 else { |
|
166 return true; |
|
167 } |
|
168 } |
|
169 else { |
|
170 // by default use selected items |
|
171 QList<int> listIndices = mMainView.listSelectionIndexes(); |
|
172 if (listIndices.count() > 0) |
|
173 { |
|
174 QString message = QString("Stop %1 selections?").arg( listIndices.count() ); |
|
175 HbMessageBox::question(message, this, SLOT(StopLoadYesNoDialogClosed(HbAction *))); |
|
176 } |
|
177 else{ |
|
178 TInt currentItemIndex = mMainView.currentItemIndex(); |
|
179 if (mEngine->LoadItemCount() > currentItemIndex && currentItemIndex >= 0) |
|
180 { |
|
181 QString message("Stop highlighted selections?"); |
|
182 HbMessageBox::question(message, this, SLOT(StopLoadYesNoDialogClosed(HbAction *))); |
|
183 } |
|
184 } |
|
185 return true; |
|
186 } |
|
187 |
|
188 } |
|
189 |
|
190 // --------------------------------------------------------------------------- |
|
191 |
|
192 void EngineWrapper::resumeAllLoadItems() |
|
193 { |
|
194 TRAPD(err, mEngine->ResumeAllLoadItemsL()); |
|
195 // error handling |
|
196 if(err != KErrNone) { |
|
197 Notifications::error("Error in loads resume."); |
|
198 } |
|
199 } |
|
200 |
|
201 // --------------------------------------------------------------------------- |
|
202 |
|
203 void EngineWrapper::suspendAllLoadItems() |
|
204 { |
|
205 TRAPD(err, mEngine->SuspendAllLoadItemsL()); |
|
206 // error handling |
|
207 if(err != KErrNone) { |
|
208 Notifications::error("Error in loads resume."); |
|
209 } |
|
210 } |
|
211 |
|
212 // --------------------------------------------------------------------------- |
|
213 |
|
214 void EngineWrapper::suspendOrResumeSelectedOrHighlightedItems() |
|
215 { |
|
216 TRAPD(err, mEngine->SuspendOrResumeSelectedOrHighlightedItemsL()); |
|
217 // error handling |
|
218 if(err != KErrNone) { |
|
219 Notifications::error("Error to show item action menu."); |
|
220 } |
|
221 } |
|
222 |
|
223 // --------------------------------------------------------------------------- |
|
224 |
|
225 void EngineWrapper::ShowErrorMessage(const TDesC& aErrorMessage) |
|
226 { |
|
227 QString errorMessage((QChar*)aErrorMessage.Ptr(),aErrorMessage.Length()); |
|
228 Notifications::error(errorMessage); |
|
229 |
|
230 } |
|
231 |
|
232 // --------------------------------------------------------------------------- |
|
233 |
|
234 void EngineWrapper::ShowNote(const TDesC& aNoteMessage) |
|
235 { |
|
236 QString note((QChar*)aNoteMessage.Ptr(),aNoteMessage.Length()); |
|
237 Notifications::showGlobalNote(note, HbMessageBox::MessageTypeInformation, HbPopup::StandardTimeout); |
|
238 } |
|
239 |
|
240 // --------------------------------------------------------------------------- |
|
241 |
|
242 TInt EngineWrapper::QueryCurrentItemIndex() |
|
243 { |
|
244 return mMainView.currentItemIndex(); |
|
245 } |
|
246 |
|
247 // --------------------------------------------------------------------------- |
|
248 |
|
249 const CArrayFix<TInt>* EngineWrapper::QueryListSelectedIndexesOrCurrentItemL() |
|
250 { |
|
251 QList<int> listIndices = mMainView.listSelectionIndexes(); |
|
252 TInt cnt = listIndices.count(); |
|
253 CArrayFix<TInt>* indices = new(ELeave)CArrayFixFlat<TInt>( cnt > 0 ? cnt : 1 ); |
|
254 CleanupDeletePushL(indices); |
|
255 if(cnt > 0){ |
|
256 for (TInt i = 0; i < cnt; i++) { |
|
257 indices->AppendL(listIndices.at(i)); |
|
258 } |
|
259 } |
|
260 else{ |
|
261 indices->AppendL(mMainView.currentItemIndex()); |
|
262 } |
|
263 CleanupStack::Pop(indices); |
|
264 return static_cast<const CArrayFix<TInt>*>(indices); |
|
265 } |
|
266 |
|
267 // --------------------------------------------------------------------------- |
|
268 |
|
269 void EngineWrapper::OpenLoadSettings(TInt loadType, bool editExistingLoad) |
|
270 { |
|
271 SettingsView* settings = new SettingsView((HbView&)ViewReference(), |
|
272 WindowReference(), |
|
273 *this); |
|
274 mEditExistingLoad = editExistingLoad; |
|
275 |
|
276 switch (loadType) { |
|
277 case ELoadGenCmdNewLoadCPULoad: { |
|
278 settings->open(LOADTYPES.at(Cpu), |
|
279 (TLoadGenCommandIds)loadType); |
|
280 break; |
|
281 } |
|
282 case ELoadGenCmdNewLoadEatMemory: { |
|
283 settings->open(LOADTYPES.at(EatMemory), |
|
284 (TLoadGenCommandIds)loadType); |
|
285 break; |
|
286 } |
|
287 case ELoadGenCmdNewLoadPhoneCall: { |
|
288 settings->open(LOADTYPES.at(PhoneCalls), |
|
289 (TLoadGenCommandIds)loadType); |
|
290 break; |
|
291 } |
|
292 case ELoadGenCmdNewLoadNetConn: { |
|
293 settings->open(LOADTYPES.at(NWConnections), |
|
294 (TLoadGenCommandIds)loadType); |
|
295 break; |
|
296 } |
|
297 case ELoadGenCmdNewLoadKeyPress: { |
|
298 settings->open(LOADTYPES.at(KeyPresses), |
|
299 (TLoadGenCommandIds)loadType); |
|
300 break; |
|
301 } |
|
302 case ELoadGenCmdNewLoadMessages: { |
|
303 settings->open(LOADTYPES.at(Messages), |
|
304 (TLoadGenCommandIds)loadType); |
|
305 break; |
|
306 } |
|
307 case ELoadGenCmdNewLoadApplications: { |
|
308 settings->open(LOADTYPES.at(Apps), |
|
309 (TLoadGenCommandIds)loadType); |
|
310 break; |
|
311 } |
|
312 case ELoadGenCmdNewLoadPhotoCaptures: { |
|
313 settings->open(LOADTYPES.at(Photos), |
|
314 (TLoadGenCommandIds)loadType); |
|
315 break; |
|
316 } |
|
317 case ELoadGenCmdNewLoadBluetooth: { |
|
318 settings->open(LOADTYPES.at(BTAct), |
|
319 (TLoadGenCommandIds)loadType); |
|
320 break; |
|
321 } |
|
322 case ELoadGenCmdNewLoadPointerEvent: { |
|
323 settings->open(LOADTYPES.at(PointerEvents), |
|
324 (TLoadGenCommandIds)loadType); |
|
325 break; |
|
326 } |
|
327 default: { |
|
328 User::Panic(_L("Wrong new load"), 111); |
|
329 break; |
|
330 } |
|
331 } |
|
332 } |
|
333 |
|
334 // --------------------------------------------------------------------------- |
|
335 |
|
336 CPULoadAttributes EngineWrapper::getCpuLoadAttributes() |
|
337 { |
|
338 TCPULoadAttributes tCpuLoadAttributes = mEngine->GetCPULoadAttributes(); |
|
339 CPULoadAttributes attributes; |
|
340 |
|
341 attributes.mId = tCpuLoadAttributes.iId; |
|
342 attributes.mPriority = tCpuLoadAttributes.iPriority; |
|
343 attributes.mMode = tCpuLoadAttributes.iMode; |
|
344 attributes.mType = tCpuLoadAttributes.iType; |
|
345 attributes.mLength = tCpuLoadAttributes.iLength; |
|
346 attributes.mIdle = tCpuLoadAttributes.iIdle; |
|
347 attributes.mRandomVariance = tCpuLoadAttributes.iRandomVariance; |
|
348 attributes.mCpu = tCpuLoadAttributes.iCpu; |
|
349 attributes.mCpuCount = tCpuLoadAttributes.iCpuCount; |
|
350 return attributes; |
|
351 } |
|
352 |
|
353 // --------------------------------------------------------------------------- |
|
354 |
|
355 void EngineWrapper::setCpuLoadAttributes(CPULoadAttributes attributes) |
|
356 { |
|
357 TCPULoadAttributes tCpuLoadAttributes; |
|
358 |
|
359 tCpuLoadAttributes.iId = attributes.mId; |
|
360 tCpuLoadAttributes.iPriority = attributes.mPriority; |
|
361 tCpuLoadAttributes.iMode = attributes.mMode; |
|
362 tCpuLoadAttributes.iType = attributes.mType; |
|
363 tCpuLoadAttributes.iLength = attributes.mLength; |
|
364 tCpuLoadAttributes.iIdle = attributes.mIdle; |
|
365 tCpuLoadAttributes.iRandomVariance = attributes.mRandomVariance; |
|
366 tCpuLoadAttributes.iCpu = attributes.mCpu; |
|
367 tCpuLoadAttributes.iCpuCount = attributes.mCpuCount; |
|
368 |
|
369 mEngine->ChangeCPULoadAttributes(tCpuLoadAttributes); |
|
370 } |
|
371 |
|
372 // --------------------------------------------------------------------------- |
|
373 |
|
374 MemoryEatAttributes EngineWrapper::getMemoryEatAttributes() |
|
375 { |
|
376 |
|
377 TMemoryEatAttributes tMemoryEatAttributes = mEngine->GetMemoryEatAttributes(); |
|
378 MemoryEatAttributes attributes; |
|
379 |
|
380 // Convert TMemoryEatAttributes to MemoryEatAttributes |
|
381 attributes.mId = tMemoryEatAttributes.iId; |
|
382 attributes.mPriority = tMemoryEatAttributes.iPriority; |
|
383 attributes.mSource = tMemoryEatAttributes.iSource; |
|
384 attributes.mType = tMemoryEatAttributes.iType; |
|
385 attributes.mBuffer = tMemoryEatAttributes.iBuffer; |
|
386 attributes.mIdle = tMemoryEatAttributes.iIdle; |
|
387 attributes.mAmount = tMemoryEatAttributes.iAmount; |
|
388 attributes.mRandomMin = tMemoryEatAttributes.iRandomMin; |
|
389 attributes.mRandomMax = tMemoryEatAttributes.iRandomMax; |
|
390 |
|
391 TBuf<64> amount; |
|
392 amount.Copy(tMemoryEatAttributes.iAmountDes); |
|
393 attributes.mAmountDes = QString((QChar*)amount.Ptr(), amount.Length()); |
|
394 |
|
395 TBuf<64> min; |
|
396 min.Copy(tMemoryEatAttributes.iRandomMinDes); |
|
397 attributes.mAmountDes = QString((QChar*)min.Ptr(), min.Length()); |
|
398 |
|
399 TBuf<64> max; |
|
400 max.Copy(tMemoryEatAttributes.iRandomMaxDes); |
|
401 attributes.mAmountDes = QString((QChar*)max.Ptr(), max.Length()); |
|
402 |
|
403 attributes.mRandomVariance = tMemoryEatAttributes.iRandomVariance; |
|
404 return attributes; |
|
405 } |
|
406 |
|
407 // --------------------------------------------------------------------------- |
|
408 |
|
409 void EngineWrapper::setMemoryEatAttributes(MemoryEatAttributes attributes) |
|
410 { |
|
411 TMemoryEatAttributes tMemoryEatAttributes = mEngine->GetMemoryEatAttributes();//TMemoryEatAttributes tMemoryEatAttributes; |
|
412 |
|
413 tMemoryEatAttributes.iId = attributes.mId; |
|
414 tMemoryEatAttributes.iPriority = attributes.mPriority; |
|
415 tMemoryEatAttributes.iSource = attributes.mSource; |
|
416 tMemoryEatAttributes.iType = attributes.mType; |
|
417 tMemoryEatAttributes.iBuffer = attributes.mBuffer; |
|
418 tMemoryEatAttributes.iIdle = attributes.mIdle; |
|
419 tMemoryEatAttributes.iAmount = attributes.mAmount; |
|
420 tMemoryEatAttributes.iRandomMin = attributes.mRandomMin; |
|
421 tMemoryEatAttributes.iRandomMax = attributes.mRandomMax; |
|
422 |
|
423 TBuf<64> amount = attributes.mAmountDes.utf16(); |
|
424 tMemoryEatAttributes.iAmountDes.Copy(amount); |
|
425 |
|
426 TBuf<64> min = attributes.mRandomMinDes.utf16(); |
|
427 tMemoryEatAttributes.iRandomMinDes.Copy(min); |
|
428 |
|
429 TBuf<64> max = attributes.mRandomMaxDes.utf16(); |
|
430 tMemoryEatAttributes.iRandomMaxDes.Copy(max); |
|
431 |
|
432 tMemoryEatAttributes.iRandomVariance = attributes.mRandomVariance; |
|
433 |
|
434 mEngine->ChangeMemoryEatAttributes(tMemoryEatAttributes); |
|
435 } |
|
436 |
|
437 // --------------------------------------------------------------------------- |
|
438 |
|
439 PhoneCallAttributes EngineWrapper::getPhoneCallAttributes() |
|
440 { |
|
441 TPhoneCallAttributes tPhoneCallAttributes = mEngine->GetPhoneCallAttributes(); |
|
442 PhoneCallAttributes attributes; |
|
443 |
|
444 attributes.mId = tPhoneCallAttributes.iId; |
|
445 attributes.mPriority = tPhoneCallAttributes.iPriority; |
|
446 |
|
447 TBuf<128> dest; |
|
448 dest.Copy(tPhoneCallAttributes.iDestination); |
|
449 attributes.mDestination = QString((QChar*)dest.Ptr(), dest.Length()); |
|
450 |
|
451 attributes.mLength = tPhoneCallAttributes.iLength; |
|
452 attributes.mIdle = tPhoneCallAttributes.iIdle; |
|
453 attributes.mRandomVariance = tPhoneCallAttributes.iRandomVariance; |
|
454 return attributes; |
|
455 } |
|
456 |
|
457 // --------------------------------------------------------------------------- |
|
458 |
|
459 void EngineWrapper::setPhoneCallAttributes(PhoneCallAttributes attributes) |
|
460 { |
|
461 TPhoneCallAttributes tPhoneCallAttributes = mEngine->GetPhoneCallAttributes(); //TPhoneCallAttributes tPhoneCallAttributes; |
|
462 |
|
463 tPhoneCallAttributes.iId = attributes.mId; |
|
464 tPhoneCallAttributes.iPriority = attributes.mPriority; |
|
465 |
|
466 TBuf<128> dest = attributes.mDestination.utf16(); |
|
467 tPhoneCallAttributes.iDestination.Copy(dest); |
|
468 |
|
469 tPhoneCallAttributes.iLength = attributes.mLength; |
|
470 tPhoneCallAttributes.iIdle = attributes.mIdle; |
|
471 tPhoneCallAttributes.iRandomVariance = attributes.mRandomVariance; |
|
472 |
|
473 mEngine->ChangePhoneCallAttributes(tPhoneCallAttributes); |
|
474 } |
|
475 |
|
476 // --------------------------------------------------------------------------- |
|
477 |
|
478 NetConnAttributes EngineWrapper::getNetConnAttributes() |
|
479 { |
|
480 TNetConnAttributes tNetConnAttributes = mEngine->GetNetConnAttributes(); |
|
481 NetConnAttributes attributes; |
|
482 |
|
483 attributes.mId = tNetConnAttributes.iId; |
|
484 attributes.mPriority = tNetConnAttributes.iPriority; |
|
485 |
|
486 TBuf<128> dest; |
|
487 dest.Copy(tNetConnAttributes.iDestination); |
|
488 attributes.mDestination = QString((QChar*)dest.Ptr(), dest.Length()); |
|
489 |
|
490 attributes.mIdle = tNetConnAttributes.iIdle; |
|
491 attributes.mRandomVariance = tNetConnAttributes.iRandomVariance; |
|
492 return attributes; |
|
493 } |
|
494 |
|
495 // --------------------------------------------------------------------------- |
|
496 |
|
497 void EngineWrapper::setNetConnAttributes(NetConnAttributes attributes) |
|
498 { |
|
499 TNetConnAttributes tNetConnAttributes = mEngine->GetNetConnAttributes(); //TNetConnAttributes tNetConnAttributes; |
|
500 |
|
501 tNetConnAttributes.iId = attributes.mId; |
|
502 tNetConnAttributes.iPriority = attributes.mPriority; |
|
503 |
|
504 TBuf<128> dest = attributes.mDestination.utf16(); |
|
505 tNetConnAttributes.iDestination.Copy(dest); |
|
506 |
|
507 tNetConnAttributes.iIdle = attributes.mIdle; |
|
508 tNetConnAttributes.iRandomVariance = attributes.mRandomVariance; |
|
509 |
|
510 mEngine->ChangeNetConnAttributes(tNetConnAttributes); |
|
511 } |
|
512 |
|
513 // --------------------------------------------------------------------------- |
|
514 |
|
515 KeyPressAttributes EngineWrapper::getKeyPressAttributes() |
|
516 { |
|
517 TKeyPressAttributes tKeyPressAttributes = mEngine->GetKeyPressAttributes(); |
|
518 KeyPressAttributes attributes; |
|
519 |
|
520 attributes.mId = tKeyPressAttributes.iId; |
|
521 attributes.mPriority = tKeyPressAttributes.iPriority; |
|
522 attributes.mHeartBeat = tKeyPressAttributes.iHeartBeat; |
|
523 attributes.mRandomVariance = tKeyPressAttributes.iRandomVariance; |
|
524 return attributes; |
|
525 } |
|
526 |
|
527 // --------------------------------------------------------------------------- |
|
528 |
|
529 void EngineWrapper::setKeyPressAttributes(KeyPressAttributes attributes) |
|
530 { |
|
531 TKeyPressAttributes tKeyPressAttributes = mEngine->GetKeyPressAttributes(); //TKeyPressAttributes tKeyPressAttributes; |
|
532 |
|
533 tKeyPressAttributes.iId = attributes.mId; |
|
534 tKeyPressAttributes.iPriority = attributes.mPriority; |
|
535 tKeyPressAttributes.iHeartBeat = attributes.mHeartBeat; |
|
536 tKeyPressAttributes.iRandomVariance = attributes.mRandomVariance; |
|
537 |
|
538 mEngine->ChangeKeyPressAttributes(tKeyPressAttributes); |
|
539 } |
|
540 |
|
541 // --------------------------------------------------------------------------- |
|
542 |
|
543 PointerEventAttributes EngineWrapper::getPointerEventAttributes() |
|
544 { |
|
545 TPointerEventAttributes tPointerEventAttributes = mEngine->GetPointerEventAttributes(); |
|
546 PointerEventAttributes attributes; |
|
547 |
|
548 attributes.mId = tPointerEventAttributes.iId; |
|
549 attributes.mPriority = tPointerEventAttributes.iPriority; |
|
550 attributes.mHeartBeat = tPointerEventAttributes.iHeartBeat; |
|
551 attributes.mRandomVariance = tPointerEventAttributes.iRandomVariance; |
|
552 return attributes; |
|
553 } |
|
554 |
|
555 // --------------------------------------------------------------------------- |
|
556 |
|
557 void EngineWrapper::setPointerEventAttributes(PointerEventAttributes attributes) |
|
558 { |
|
559 TPointerEventAttributes tPointerEventAttributes = mEngine->GetPointerEventAttributes();//TPointerEventAttributes tPointerEventAttributes; |
|
560 |
|
561 tPointerEventAttributes.iId = attributes.mId; |
|
562 tPointerEventAttributes.iPriority = attributes.mPriority; |
|
563 tPointerEventAttributes.iHeartBeat = attributes.mHeartBeat; |
|
564 tPointerEventAttributes.iRandomVariance = attributes.mRandomVariance; |
|
565 |
|
566 mEngine->ChangePointerEventAttributes(tPointerEventAttributes); |
|
567 } |
|
568 |
|
569 // --------------------------------------------------------------------------- |
|
570 |
|
571 MessageAttributes EngineWrapper::getMessageAttributes() |
|
572 { |
|
573 TMessageAttributes tMessageAttributes = mEngine->GetMessageAttributes(); |
|
574 MessageAttributes attributes; |
|
575 |
|
576 attributes.mId = tMessageAttributes.iId; |
|
577 attributes.mMessageType = tMessageAttributes.iMessageType; |
|
578 |
|
579 TBuf<128> dest; |
|
580 dest.Copy(tMessageAttributes.iDestination); |
|
581 attributes.mDestination = QString((QChar*)dest.Ptr(), dest.Length()); |
|
582 |
|
583 attributes.mPriority = tMessageAttributes.iPriority; |
|
584 attributes.mAmount = tMessageAttributes.iAmount; |
|
585 attributes.mLength = tMessageAttributes.iLength; |
|
586 attributes.mIdle = tMessageAttributes.iIdle; |
|
587 attributes.mRandomVariance = tMessageAttributes.iRandomVariance; |
|
588 return attributes; |
|
589 } |
|
590 |
|
591 // --------------------------------------------------------------------------- |
|
592 |
|
593 void EngineWrapper::setMessageAttributes(MessageAttributes attributes) |
|
594 { |
|
595 TMessageAttributes tMessageAttributes = mEngine->GetMessageAttributes();//TMessageAttributes tMessageAttributes; |
|
596 |
|
597 tMessageAttributes.iId = attributes.mId; |
|
598 tMessageAttributes.iMessageType = attributes.mMessageType; |
|
599 |
|
600 TBuf<128> dest = attributes.mDestination.utf16(); |
|
601 tMessageAttributes.iDestination.Copy(dest); |
|
602 |
|
603 tMessageAttributes.iPriority = attributes.mPriority; |
|
604 tMessageAttributes.iAmount = attributes.mAmount; |
|
605 tMessageAttributes.iLength = attributes.mLength; |
|
606 tMessageAttributes.iIdle = attributes.mIdle; |
|
607 tMessageAttributes.iRandomVariance = attributes.mRandomVariance; |
|
608 |
|
609 mEngine->ChangeMessageAttributes(tMessageAttributes); |
|
610 } |
|
611 |
|
612 // --------------------------------------------------------------------------- |
|
613 |
|
614 ApplicationsAttributes EngineWrapper::getApplicationsAttributes() |
|
615 { |
|
616 TApplicationsAttributes tApplicationsAttributes = mEngine->GetApplicationsAttributes(); |
|
617 ApplicationsAttributes attributes; |
|
618 |
|
619 attributes.mId = tApplicationsAttributes.iId; |
|
620 attributes.mPriority = tApplicationsAttributes.iPriority; |
|
621 attributes.mLaunchingInterval = tApplicationsAttributes.iLaunchingInterval; |
|
622 attributes.mKeyPressType = tApplicationsAttributes.iKeyPressType; |
|
623 attributes.mMaxOpen = tApplicationsAttributes.iMaxOpen; |
|
624 attributes.mHeartBeat = tApplicationsAttributes.iHeartBeat; |
|
625 attributes.mRandomVariance = tApplicationsAttributes.iRandomVariance; |
|
626 |
|
627 return attributes; |
|
628 } |
|
629 |
|
630 // --------------------------------------------------------------------------- |
|
631 |
|
632 void EngineWrapper::setApplicationsAttributes(ApplicationsAttributes attributes) |
|
633 { |
|
634 TApplicationsAttributes tApplicationsAttributes = mEngine->GetApplicationsAttributes(); //TApplicationsAttributes tApplicationsAttributes; |
|
635 |
|
636 tApplicationsAttributes.iId = attributes.mId; |
|
637 tApplicationsAttributes.iPriority = attributes.mPriority; |
|
638 tApplicationsAttributes.iLaunchingInterval = attributes.mLaunchingInterval; |
|
639 tApplicationsAttributes.iKeyPressType = attributes.mKeyPressType; |
|
640 tApplicationsAttributes.iMaxOpen = attributes.mMaxOpen; |
|
641 tApplicationsAttributes.iHeartBeat = attributes.mHeartBeat; |
|
642 tApplicationsAttributes.iRandomVariance = attributes.mRandomVariance; |
|
643 |
|
644 mEngine->ChangeApplicationsAttributes(tApplicationsAttributes); |
|
645 } |
|
646 |
|
647 QStringList mAppsArray; |
|
648 |
|
649 // --------------------------------------------------------------------------- |
|
650 |
|
651 PhotoCaptureAttributes EngineWrapper::getPhotoCaptureAttributes() |
|
652 { |
|
653 TPhotoCaptureAttributes tPhotoCaptureAttributes = mEngine->GetPhotoCaptureAttributes(); |
|
654 PhotoCaptureAttributes attributes; |
|
655 |
|
656 attributes.mId = tPhotoCaptureAttributes.iId; |
|
657 attributes.mPriority = tPhotoCaptureAttributes.iPriority; |
|
658 attributes.mCameraCount = tPhotoCaptureAttributes.iCameraCount; |
|
659 attributes.mCamera = tPhotoCaptureAttributes.iCamera; |
|
660 attributes.mIdle = tPhotoCaptureAttributes.iIdle; |
|
661 attributes.mRandomVariance = tPhotoCaptureAttributes.iRandomVariance; |
|
662 return attributes; |
|
663 } |
|
664 |
|
665 // --------------------------------------------------------------------------- |
|
666 |
|
667 void EngineWrapper::setPhotoCaptureAttributes(PhotoCaptureAttributes attributes) |
|
668 { |
|
669 TPhotoCaptureAttributes tPhotoCaptureAttributes; |
|
670 |
|
671 tPhotoCaptureAttributes.iId = attributes.mId; |
|
672 tPhotoCaptureAttributes.iPriority = attributes.mPriority; |
|
673 tPhotoCaptureAttributes.iCameraCount = attributes.mCameraCount; |
|
674 tPhotoCaptureAttributes.iCamera = attributes.mCamera; |
|
675 tPhotoCaptureAttributes.iIdle = attributes.mIdle; |
|
676 tPhotoCaptureAttributes.iRandomVariance = attributes.mRandomVariance; |
|
677 |
|
678 mEngine->ChangePhotoCaptureAttributes(tPhotoCaptureAttributes); |
|
679 } |
|
680 |
|
681 // --------------------------------------------------------------------------- |
|
682 |
|
683 BluetoothAttributes EngineWrapper::getBluetoothAttributes() |
|
684 { |
|
685 TBluetoothAttributes tBluetoothAttributes = mEngine->GetBluetoothAttributes(); |
|
686 BluetoothAttributes attributes; |
|
687 |
|
688 attributes.mId = tBluetoothAttributes.iId; |
|
689 attributes.mPriority = tBluetoothAttributes.iPriority; |
|
690 attributes.mIdle = tBluetoothAttributes.iIdle; |
|
691 attributes.mRandomVariance = tBluetoothAttributes.iRandomVariance; |
|
692 return attributes; |
|
693 } |
|
694 |
|
695 // --------------------------------------------------------------------------- |
|
696 |
|
697 void EngineWrapper::setBluetoothAttributes(BluetoothAttributes attributes) |
|
698 { |
|
699 TBluetoothAttributes tBluetoothAttributes; |
|
700 |
|
701 tBluetoothAttributes.iId = attributes.mId; |
|
702 tBluetoothAttributes.iPriority = attributes.mPriority; |
|
703 tBluetoothAttributes.iIdle = attributes.mIdle; |
|
704 tBluetoothAttributes.iRandomVariance = attributes.mRandomVariance; |
|
705 |
|
706 mEngine->ChangeBluetoothAttributes(tBluetoothAttributes); |
|
707 } |
|
708 |
|
709 // --------------------------------------------------------------------------- |
|
710 |
|
711 void EngineWrapper::ReFreshView(CDesCArray* aTextArray) |
|
712 { |
|
713 QStringList itemList; |
|
714 TInt arrayCnt = aTextArray->Count(); |
|
715 for (int i = 0; i < arrayCnt; i++) { |
|
716 itemList.append(QString::fromUtf16( |
|
717 aTextArray->MdcaPoint(i).Ptr(), |
|
718 aTextArray->MdcaPoint(i).Length())); |
|
719 } |
|
720 mMainView.setLoadListData(itemList); |
|
721 } |
|
722 |
|
723 // --------------------------------------------------------------------------- |
|
724 |
|
725 void EngineWrapper::ClearSelection() |
|
726 { |
|
727 mMainView.clearListSelection(); |
|
728 } |
|
729 |
|
730 // --------------------------------------------------------------------------- |
|
731 |
|
732 void EngineWrapper::SetCurrentItemIndex(TInt aIndex) |
|
733 { |
|
734 mMainView.setCurrentItemIndex(aIndex); |
|
735 } |
|
736 |
|
737 // --------------------------------------------------------------------------- |