|
1 /* |
|
2 * Copyright (c) 2007-2008 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: Implementation of Slideshow view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <aknnotewrappers.h> |
|
24 #include "shwslideshowview.h" |
|
25 |
|
26 #include <aknViewAppUi.h> |
|
27 #include <eikmenub.h> // for access to CEikButtonGroupContainer (from Cba()) |
|
28 #include <AknUtils.h> // for CompleteWithAppPath |
|
29 #include <AknWaitDialog.h> |
|
30 #include <StringLoader.h> |
|
31 |
|
32 #include <alf/alfcontrolgroup.h> |
|
33 #include <alf/alfenv.h> |
|
34 #include <alf/alfdisplay.h> |
|
35 #include <alf/alfutil.h> |
|
36 #include <alf/alfroster.h> |
|
37 |
|
38 //Hg |
|
39 //#include <hg/hgcontextutility.h> |
|
40 #include <glxhdmicontroller.h> |
|
41 #include <glxresourceutilities.h> // for CGlxResourceUtilities |
|
42 #include <glxresolutionutility.h> // for CGlxResolutionUtility |
|
43 #include <shwslideshowview.rsg> // view's resource |
|
44 #include <data_caging_path_literals.hrh> // for resource directory path |
|
45 #include <glxlog.h> |
|
46 #include <glxtracer.h> |
|
47 #include <aknsoundsystem.h> // for CAknKeySoundSystem |
|
48 #include <avkon.rsg> // for R_AVKON_SILENT_SKEY_LIST |
|
49 #include <mpxcollectionpath.h> |
|
50 #include <coeutils.h> |
|
51 #include <eiksoftkeypostingtransparency.h> |
|
52 #include "mpxcollectionutility.h" |
|
53 #include "glxfilterfactory.h" // for TGlxFilterFactory |
|
54 #include "mglxmedialist.h" |
|
55 #include "glxuiutility.h" |
|
56 #include "shwslideshowengine.h" |
|
57 #include "shweffectinfo.h" |
|
58 #include "shwslideshowvolumecontrol.h" |
|
59 #include "shwslideshowbacklighttimer.h" |
|
60 #include "shwslideshowview.hrh" // for EShwSlideshowCmdContinue |
|
61 #include "shwslideshowkeyhandler.h" |
|
62 #include "shwslideshowpausehandler.h" |
|
63 #include "shwslideshowtelephonehandler.h" |
|
64 #include "shwcallback.h" |
|
65 #include "shwsettingsmodel.h" |
|
66 #include "shwgesturecontrol.h" |
|
67 #include "shwviewtimer.h" |
|
68 #include "shwmediakeyshandler.h" |
|
69 #include <glxtexturemanager.h> |
|
70 namespace |
|
71 { |
|
72 _LIT(KShwSlideshowViewResource,"shwslideshowview.rsc"); |
|
73 const TInt KShwDefaultDelayMicroSeconds = 5000000; // 5s |
|
74 const TInt KVolumeControlGroupId = 1; |
|
75 // Reuse the plug-in's uid |
|
76 const TInt KViewId = 0x20007199; |
|
77 //gontrol goup id has to be locally unique |
|
78 const TInt KShwGestureControlGroupId = 2; |
|
79 const TInt KGestureControlGroupId = 44; |
|
80 //This constant is used to calculate the index of the item for which texture has to removed. |
|
81 //6 = 5(iterator value in forward or backward direction for fullscreen) + 1(focus index); |
|
82 const TInt KSlideShowIterator = 2; |
|
83 //Constant which says maximum number of fullscreen textures that we have have at a time. |
|
84 //11 = (5(5 fullscreen texture backwards)+1(fucus index texture)+5(5 fullscreen texture forwards)) |
|
85 const TInt KSlideShowTextureOffset = 3; |
|
86 } |
|
87 //display screen furniture for KShowForSeconds |
|
88 const TInt KShowForSeconds = 5; |
|
89 |
|
90 // ======== MEMBER FUNCTIONS ======== |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // Default constructor. Inlined to save a few bits of ROM |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 inline CShwSlideshowView::CShwSlideshowView() : |
|
97 CGlxViewBase(ETrue) // workaround - force synchronous view activation |
|
98 { |
|
99 TRACER("CShwSlideshowView::CShwSlideshowView"); |
|
100 GLX_LOG_INFO( "CShwSlideshowView::CShwSlideshowView" ); |
|
101 } |
|
102 |
|
103 // --------------------------------------------------------------------------- |
|
104 // Two-phased constructor. |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 CShwSlideshowView* CShwSlideshowView::NewLC() |
|
108 { |
|
109 TRACER("CShwSlideshowView::NewLC"); |
|
110 GLX_LOG_INFO( "CShwSlideshowView::NewLC" ); |
|
111 CShwSlideshowView* self = new ( ELeave ) CShwSlideshowView; |
|
112 CleanupStack::PushL( self ); |
|
113 self->ConstructL(); |
|
114 return self; |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // Destructor |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 CShwSlideshowView::~CShwSlideshowView() |
|
122 { |
|
123 TRACER("CShwSlideshowView::~CShwSlideshowView"); |
|
124 GLX_LOG_INFO( "CShwSlideshowView::~CShwSlideshowView()" ); |
|
125 |
|
126 // delete media list population call back |
|
127 delete iPopulateListCallBack; |
|
128 |
|
129 // delete engine async starter |
|
130 delete iAsyncCallBack; |
|
131 |
|
132 // Cleanup both the lists in case view was not deactivated |
|
133 if ( iMediaList ) |
|
134 { |
|
135 iMediaList->Close(); |
|
136 } |
|
137 |
|
138 if ( iFilteredList ) |
|
139 { |
|
140 iFilteredList->Close(); |
|
141 } |
|
142 |
|
143 // Remove the back light timer |
|
144 delete iBackLightTimer; |
|
145 |
|
146 // Delete the control groups |
|
147 if ( iEnv ) |
|
148 { |
|
149 iEnv->DeleteControlGroup( KVolumeControlGroupId ); |
|
150 iVolumeControlGroup = NULL; |
|
151 if(iGestureControlGroup) |
|
152 { |
|
153 CAlfControl* gesture = (&(iGestureControlGroup->Control(1))); // CGestureControl is 1 |
|
154 iGestureControlGroup->Remove(gesture); |
|
155 } |
|
156 iEnv->DeleteControlGroup( KShwGestureControlGroupId ); |
|
157 iGestureControlGroup = NULL; |
|
158 delete iGestureControl; |
|
159 } |
|
160 |
|
161 // Turn back on the keypad tones |
|
162 AppUi()->KeySounds()->PopContext(); |
|
163 |
|
164 // Delete resource file |
|
165 if ( iResourceOffset ) |
|
166 { |
|
167 CCoeEnv::Static()->DeleteResourceFile( iResourceOffset ); |
|
168 iResourceOffset = NULL; |
|
169 } |
|
170 } |
|
171 |
|
172 // ----------------------------------------------------------------------------- |
|
173 // ShowProgressDialogL. |
|
174 // ----------------------------------------------------------------------------- |
|
175 TInt CShwSlideshowView::ShowProgressDialogL() |
|
176 { |
|
177 TRACER("CShwSlideshowView::ShowProgressDialogL"); |
|
178 GLX_LOG_INFO( "CShwSlideshowView::ShowProgressDialogL" ); |
|
179 |
|
180 // Set to landscape orientation |
|
181 // Note that the orientation switch is performed here rather than in the |
|
182 // view activation to ensure the correct use of the screen furniture layout |
|
183 iUiUtility->SetAppOrientationL( EGlxOrientationLandscape ); |
|
184 // Set display background as a solid black colour |
|
185 iDisplay->SetClearBackgroundL( CAlfDisplay::EClearWithColor ); |
|
186 |
|
187 // Setup the progress dialog |
|
188 iWaitDialog = new ( ELeave ) CAknWaitDialog( |
|
189 reinterpret_cast< CEikDialog** >( &iWaitDialog ), ETrue ); |
|
190 iWaitDialog->PrepareLC( R_SHW_WAIT_NOTE ); |
|
191 // Dialog is non-modal so request dismissal callbacks |
|
192 iWaitDialog->SetCallback( this ); |
|
193 // Load string for dialog |
|
194 HBufC* title = StringLoader::LoadLC( R_SHW_WAIT_DLG_OPENING ); |
|
195 iWaitDialog->SetTextL( *title ); |
|
196 CleanupStack::PopAndDestroy( title ); |
|
197 |
|
198 // Show the dialog, we show it non blocking so no use for the return value |
|
199 iWaitDialog->RunLD(); |
|
200 // set the callback to be engine start |
|
201 iAsyncCallBack->Set( |
|
202 TShwCallBack< CShwSlideshowView, StartEngineL >( this ) ); |
|
203 // if both lists are ready |
|
204 if( iInputListReady && iPlayListReady ) |
|
205 { |
|
206 // make the async callback, this will end up calling StartEngineL() |
|
207 // in CAsyncCallback::RunL once the scheduler next time runs. |
|
208 iAsyncCallBack->CallBack(); |
|
209 } |
|
210 |
|
211 // return value needed as this is a TCallBack |
|
212 return KErrNone; |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // StartEngineL |
|
217 // ----------------------------------------------------------------------------- |
|
218 TInt CShwSlideshowView::StartEngineL() |
|
219 { |
|
220 TRACER("CShwSlideshowView::StartEngineL"); |
|
221 GLX_LOG_INFO( "CShwSlideshowView::StartEngineL" ); |
|
222 // Check that the list has some items |
|
223 if( iFilteredList ) |
|
224 { |
|
225 TInt filteredCount = iFilteredList->Count(); |
|
226 TInt inputlistCount = iMediaList->Count(); |
|
227 if ( ( inputlistCount < 1 )|| |
|
228 ( filteredCount < 1 ) ) |
|
229 { |
|
230 GLX_LOG_INFO2( |
|
231 "CShwSlideshowView::PopulateListL error, counts: %d, %d", |
|
232 inputlistCount, filteredCount ); |
|
233 iEngineStartFailed = ETrue; |
|
234 // need to dismiss the dialog if it's still there |
|
235 if( iWaitDialog ) |
|
236 { |
|
237 iWaitDialog->ProcessFinishedL(); |
|
238 } |
|
239 } |
|
240 else |
|
241 { |
|
242 // The list should now be populated, so set the focus |
|
243 SetListFocusL(); |
|
244 // Need to take latest screen size as layout has changed |
|
245 TRect currentScreen; |
|
246 TSize screenSize; |
|
247 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen,currentScreen); |
|
248 screenSize = currentScreen.Size(); |
|
249 iEngine->StartL( |
|
250 *iEnv, *iDisplay, *iFilteredList, *this, screenSize ); |
|
251 } |
|
252 } |
|
253 // return value needed as this is a TCallBack |
|
254 return KErrNone; |
|
255 } |
|
256 |
|
257 // ----------------------------------------------------------------------------- |
|
258 // PopulateListL |
|
259 // ----------------------------------------------------------------------------- |
|
260 TInt CShwSlideshowView::PopulateListL() |
|
261 { |
|
262 TRACER("CShwSlideshowView::PopulateListL"); |
|
263 GLX_LOG_INFO( "CShwSlideshowView::PopulateListL" ); |
|
264 // Setup a filter given the play direction and the path |
|
265 CMPXFilter* filter = NULL; |
|
266 |
|
267 // take current filter and add the slideshow parameters in it |
|
268 // If we play forwards, we dont revert the original order and if we |
|
269 // play backwards we need to just revert the original order |
|
270 // Note we dont know the original order and cant ask for it as its set by the |
|
271 // plug-in and never returned to the client side. |
|
272 |
|
273 // we need the full path for the filter creation so that the selection can be |
|
274 // extracted from there |
|
275 CMPXCollectionPath* fullpath = iMediaList->PathLC(); |
|
276 // create the filter |
|
277 filter = TGlxFilterFactory::CreateSlideShowFilterFromExistingFilterL( |
|
278 iMediaList->Filter(), fullpath, |
|
279 iPlayDirection); |
|
280 CleanupStack::PushL( filter ); |
|
281 |
|
282 // Use this DLL's uid as the hierarchy id |
|
283 TGlxHierarchyId hierarchyId = TUid( NShwSlideshow::KEngineDllUid ).iUid; |
|
284 iFilteredList = MGlxMediaList::InstanceL( *iCollectionPath, hierarchyId, filter ); |
|
285 iFilteredList->AddMediaListObserverL( this ); |
|
286 |
|
287 CleanupStack::PopAndDestroy( filter ); |
|
288 CleanupStack::PopAndDestroy( fullpath ); |
|
289 |
|
290 // return value needed as this is a TCallBack |
|
291 return KErrNone; |
|
292 } |
|
293 |
|
294 // --------------------------------------------------------------------------- |
|
295 // Symbian 2nd phase constructor can leave. |
|
296 // --------------------------------------------------------------------------- |
|
297 // |
|
298 void CShwSlideshowView::ConstructL() |
|
299 { |
|
300 TRACER("CShwSlideshowView::ConstructL"); |
|
301 GLX_LOG_INFO( "CShwSlideshowView::ConstructL()" ); |
|
302 |
|
303 // Load the view's resources |
|
304 TFileName resourceFile( KDC_APP_RESOURCE_DIR ); |
|
305 resourceFile.Append( KShwSlideshowViewResource ); |
|
306 CGlxResourceUtilities::GetResourceFilenameL( resourceFile ); |
|
307 iResourceOffset = iCoeEnv->AddResourceFileL( resourceFile ); |
|
308 |
|
309 // AknView base construction |
|
310 BaseConstructL( R_SHW_SLIDESHOW_PLAY_VIEW ); |
|
311 |
|
312 // Glx view base construction |
|
313 ViewBaseConstructL(); |
|
314 |
|
315 // Create async engine starter with standard priority |
|
316 iAsyncCallBack = new( ELeave ) CAsyncCallBack( CActive::EPriorityStandard ); |
|
317 |
|
318 // Create the back light timer |
|
319 iBackLightTimer = CShwSlideshowBackLightTimer::NewL(); |
|
320 |
|
321 iEnv = iUiUtility->Env(); |
|
322 iDisplay = iUiUtility->Display(); |
|
323 |
|
324 // Construct the volume control |
|
325 iVolumeControl = CShwSlideshowVolumeControl:: |
|
326 NewL( *iEnv, |
|
327 *iUiUtility, |
|
328 KShwDefaultDelayMicroSeconds ); |
|
329 // Create a control group for the volume control |
|
330 iVolumeControlGroup = &iEnv->NewControlGroupL( KVolumeControlGroupId ); |
|
331 // doc says the following takes ownership, but reality is different! |
|
332 iVolumeControlGroup->AppendL( iVolumeControl ); |
|
333 |
|
334 iGestureControlGroup = &iEnv->NewControlGroupL( KShwGestureControlGroupId ); |
|
335 |
|
336 // construct the gesture control group |
|
337 iShwGestureControl = CShwGestureControl::NewL(*iEnv,*iDisplay,*this); |
|
338 iGestureControlGroup->AppendL( iShwGestureControl ); |
|
339 |
|
340 iGestureControl = GestureHelper::CGestureControl::NewLC( |
|
341 *iShwGestureControl, *iEnv, *iDisplay, KGestureControlGroupId ); |
|
342 iGestureControlGroup->AppendL( iGestureControl ); |
|
343 |
|
344 // doc says the following takes ownership, but reality is different! |
|
345 |
|
346 CleanupStack::Pop( iGestureControl ); |
|
347 // Need a mechanism to distinguish when we receive the MusicVolume |
|
348 // callback for the first time |
|
349 iCurrentVolume = -1; |
|
350 iPopulateListCallBack = new( ELeave ) |
|
351 CAsyncCallBack( CActive::EPriorityStandard ); |
|
352 // set the callback for the media list population |
|
353 iPopulateListCallBack->Set( |
|
354 TShwCallBack< CShwSlideshowView, PopulateListL >( this ) ); |
|
355 iMSKPressed = EFalse; |
|
356 iLSKPressed = EFalse; |
|
357 |
|
358 //Get the HgContextUtility instance |
|
359 // iContextUtility = iUiUtility->ContextUtility(); |
|
360 |
|
361 } |
|
362 |
|
363 // --------------------------------------------------------------------------- |
|
364 // From CAknView |
|
365 // Returns views id. |
|
366 // --------------------------------------------------------------------------- |
|
367 // |
|
368 TUid CShwSlideshowView::Id() const |
|
369 { |
|
370 TRACER("CShwSlideshowView::Id()"); |
|
371 GLX_LOG_INFO( "CShwSlideshowView::Id()" ); |
|
372 return TUid::Uid( KViewId ); |
|
373 } |
|
374 |
|
375 // --------------------------------------------------------------------------- |
|
376 // From CAknView |
|
377 // Foreground event handling function. |
|
378 // --------------------------------------------------------------------------- |
|
379 // |
|
380 void CShwSlideshowView::HandleForegroundEventL(TBool aForeground) |
|
381 { |
|
382 TRACER("CShwSlideshowView::HandleForegroundEventL"); |
|
383 GLX_LOG_INFO( "CShwSlideshowView::HandleForegroundEventL()" ); |
|
384 |
|
385 if( aForeground ) |
|
386 { |
|
387 // we gained the foreground |
|
388 iPauseHandler->SwitchToForegroundL(); |
|
389 } |
|
390 else |
|
391 { |
|
392 // Something else has gained the foreground |
|
393 iPauseHandler->SwitchToBackgroundL(); |
|
394 } |
|
395 |
|
396 CAknView::HandleForegroundEventL(aForeground); |
|
397 } |
|
398 |
|
399 // ----------------------------------------------------------------------------- |
|
400 // From CGlxViewBase |
|
401 // DoViewActivateL. |
|
402 // ----------------------------------------------------------------------------- |
|
403 void CShwSlideshowView::DoViewActivateL(const TVwsViewId& /*aPrevViewId*/, |
|
404 TUid /*aCustomMessageId*/, |
|
405 const TDesC8& aCustomMessage) |
|
406 { |
|
407 TRACER("CShwSlideshowView::DoViewActivateL"); |
|
408 GLX_LOG_INFO( "CShwSlideshowView::DoViewActivateL()" ); |
|
409 |
|
410 // remove the status pane |
|
411 AppUi()->StatusPane()->MakeVisible(EFalse); |
|
412 |
|
413 //make the softkeys invisible |
|
414 AppUi()->Cba()->MakeVisible(EFalse); |
|
415 |
|
416 // Hide the application toolbar when slide show is started |
|
417 if ( AppUi()->PopupToolbar() ) |
|
418 { |
|
419 AppUi()->PopupToolbar()->SetToolbarVisibility( EFalse ); |
|
420 AppUi()->PopupToolbar()->MakeVisible(EFalse); |
|
421 } |
|
422 // reset failure flag |
|
423 iEngineStartFailed = EFalse; |
|
424 |
|
425 iHdmiController = CGlxHdmiController::NewL(); |
|
426 // Engine related construction |
|
427 // Instantiate the slideshow engine, with this class as its observer |
|
428 __ASSERT_DEBUG( !iEngine, Panic( EGlxPanicAlreadyInitialised ) ); |
|
429 iEngine = CShwSlideshowEngine::NewL( *this ); |
|
430 |
|
431 // Instantiate the pause handler, it encapsulates the pause rules |
|
432 __ASSERT_DEBUG( !iPauseHandler, Panic( EGlxPanicAlreadyInitialised ) ); |
|
433 iPauseHandler = CShwSlideShowPauseHandler::NewL( *iEngine ); |
|
434 |
|
435 // Instantiate the key handler, encapsulates all key handling logic |
|
436 __ASSERT_DEBUG( !iKeyHandler, Panic( EGlxPanicAlreadyInitialised ) ); |
|
437 iKeyHandler = CShwSlideShowKeyHandler::NewL( *iEngine, *iPauseHandler, |
|
438 reinterpret_cast<TInt&>(iShwState )); |
|
439 AppUi()->AddToStackL( iKeyHandler, ECoeStackPriorityDefault, |
|
440 ECoeStackFlagRefusesFocus ); |
|
441 |
|
442 // Create the telephone call handler |
|
443 __ASSERT_DEBUG( !iTelephoneHandler, Panic( EGlxPanicAlreadyInitialised ) ); |
|
444 iTelephoneHandler = CShwTelephoneHandler::NewL( *iEngine, *iPauseHandler ); |
|
445 iTelephoneHandler->StartL(); |
|
446 |
|
447 // Extract the media list's path and the playback direction from |
|
448 // the custom message data |
|
449 GetPathAndPlaybackDirectionL( aCustomMessage ); |
|
450 |
|
451 // Ensure the back light stays on |
|
452 iBackLightTimer->StartL(); |
|
453 |
|
454 // Request asynch callback that will end up in ShowProgressDialogL |
|
455 // once the active scheduler runs |
|
456 iAsyncCallBack->Set( |
|
457 TShwCallBack< CShwSlideshowView, ShowProgressDialogL >( this ) ); |
|
458 iAsyncCallBack->CallBack(); |
|
459 |
|
460 iDisplay->Roster().ShowL( *iGestureControlGroup,KAlfRosterShowAtTop ); |
|
461 |
|
462 iTicker = CShwTicker::NewL(*this); |
|
463 |
|
464 InitializeShwFurnitureL(); |
|
465 iUiUtility->Display()->SetVisibleArea(TRect(TPoint(0,0),AlfUtil::ScreenSize())); |
|
466 } |
|
467 |
|
468 // ----------------------------------------------------------------------------- |
|
469 // From CGlxViewBase |
|
470 // DoViewDeactivate. |
|
471 // ----------------------------------------------------------------------------- |
|
472 void CShwSlideshowView::DoViewDeactivate() |
|
473 { |
|
474 TRACER("CShwSlideshowView::DoViewDeactivate"); |
|
475 GLX_LOG_INFO( "CShwSlideshowView::DoViewDeactivate()" ); |
|
476 if (iHdmiController) |
|
477 { |
|
478 GLX_LOG_INFO( "CShwSlideshowView::DoViewDeactivate() - delete hdmicontroller" ); |
|
479 delete iHdmiController; |
|
480 iHdmiController = NULL; |
|
481 } |
|
482 |
|
483 //check if we have engine active object starting |
|
484 if( iPopulateListCallBack->IsActive() ) |
|
485 { |
|
486 //cancel the engine start |
|
487 iPopulateListCallBack->Cancel(); |
|
488 } |
|
489 |
|
490 //check if we have engine active object starting |
|
491 if( iAsyncCallBack->IsActive() ) |
|
492 { |
|
493 //cancel the engine start |
|
494 iAsyncCallBack->Cancel(); |
|
495 } |
|
496 |
|
497 //Hide the volume control group, iDisplay and iVolumeControlGroup |
|
498 //are always valid so no need to test for != NULL |
|
499 iDisplay->Roster().Hide( *iVolumeControlGroup ); |
|
500 |
|
501 |
|
502 //Ensure we revert to a proper background |
|
503 TRAP_IGNORE( |
|
504 { |
|
505 iDisplay->SetClearBackgroundL( CAlfDisplay::EClearWithSkinBackground ); |
|
506 } ); |
|
507 |
|
508 |
|
509 //Ensure we don't get any more key events |
|
510 AppUi()->RemoveFromStack( iKeyHandler ); |
|
511 delete iKeyHandler; |
|
512 iKeyHandler = NULL; |
|
513 |
|
514 //Stop handling telephone calls |
|
515 delete iTelephoneHandler; |
|
516 iTelephoneHandler = NULL; |
|
517 |
|
518 //delete the pause handler |
|
519 //it is used by key and telephone handlers so do this last |
|
520 delete iPauseHandler; |
|
521 iPauseHandler = NULL; |
|
522 |
|
523 //Cancel the back light timer |
|
524 iBackLightTimer->Cancel(); |
|
525 |
|
526 |
|
527 //Stop the slideshow! |
|
528 //NOTE! this needs to be done before the list is closed as the |
|
529 //destructor removes the engine as medialist observer and also |
|
530 //removes the contexts from the list |
|
531 delete iEngine; |
|
532 iEngine = NULL; |
|
533 |
|
534 delete iCollectionPath; |
|
535 iCollectionPath = NULL; |
|
536 |
|
537 //Ensure we don't get any more list callbacks |
|
538 if( iMediaList ) |
|
539 { |
|
540 iMediaList->RemoveMediaListObserver( this ); |
|
541 //need to close the list |
|
542 iMediaList->Close(); |
|
543 //set to NULL to prevent double delete |
|
544 iMediaList = NULL; |
|
545 } |
|
546 //Ensure we don't get any more list callbacks |
|
547 if ( iFilteredList ) |
|
548 { |
|
549 iFilteredList->RemoveMediaListObserver( this ); |
|
550 //need to also close the list |
|
551 iFilteredList->Close(); |
|
552 //set to NULL to prevent double delete |
|
553 iFilteredList = NULL; |
|
554 } |
|
555 iDisplay->Roster().Hide( *iGestureControlGroup ); |
|
556 |
|
557 if(iTicker) |
|
558 { |
|
559 delete iTicker; |
|
560 iTicker =NULL; |
|
561 } |
|
562 AppUi()->RemoveFromStack( iShwCba ); |
|
563 delete iShwCba; |
|
564 iShwCba =NULL; |
|
565 if(iMediaKeyHandler) |
|
566 { |
|
567 delete iMediaKeyHandler; |
|
568 iMediaKeyHandler = NULL; |
|
569 } |
|
570 } |
|
571 |
|
572 // --------------------------------------------------------------------------- |
|
573 // From MGlxMediaListObserver |
|
574 // HandleItemAddedL |
|
575 // --------------------------------------------------------------------------- |
|
576 // |
|
577 void CShwSlideshowView::HandleItemAddedL( TInt /*aStartIndex*/, |
|
578 TInt /*aEndIndex*/, |
|
579 MGlxMediaList* /*aList*/ ) |
|
580 { |
|
581 } |
|
582 |
|
583 // --------------------------------------------------------------------------- |
|
584 // From MGlxMediaListObserver |
|
585 // HandleMediaL |
|
586 // --------------------------------------------------------------------------- |
|
587 // |
|
588 void CShwSlideshowView::HandleMediaL( TInt /*aListIndex*/, |
|
589 MGlxMediaList* /*aList*/) |
|
590 { |
|
591 } |
|
592 |
|
593 // --------------------------------------------------------------------------- |
|
594 // From MGlxMediaListObserver |
|
595 // HandleItemRemoved |
|
596 // --------------------------------------------------------------------------- |
|
597 // |
|
598 void CShwSlideshowView::HandleItemRemovedL( TInt /*aStartIndex*/, |
|
599 TInt /*aEndIndex*/, |
|
600 MGlxMediaList* /*aList*/ ) |
|
601 { |
|
602 } |
|
603 |
|
604 // --------------------------------------------------------------------------- |
|
605 // From MGlxMediaListObserver |
|
606 // HandleItemModifiedL. |
|
607 // --------------------------------------------------------------------------- |
|
608 // |
|
609 void CShwSlideshowView::HandleItemModifiedL( |
|
610 const RArray<TInt>& /*aItemIndexes*/, MGlxMediaList* /*aList*/ ) |
|
611 { |
|
612 } |
|
613 |
|
614 // --------------------------------------------------------------------------- |
|
615 // From MGlxMediaListObserver |
|
616 // HandleAttributesAvailableL. |
|
617 // --------------------------------------------------------------------------- |
|
618 // |
|
619 void CShwSlideshowView::HandleAttributesAvailableL( |
|
620 TInt /*aItemIndex*/, |
|
621 const RArray<TMPXAttribute>& /*aAttributes*/, |
|
622 MGlxMediaList*/* aList*/ ) |
|
623 { |
|
624 } |
|
625 |
|
626 // --------------------------------------------------------------------------- |
|
627 // From MGlxMediaListObserver |
|
628 // HandleFocusChangedL. |
|
629 // --------------------------------------------------------------------------- |
|
630 // |
|
631 void CShwSlideshowView::HandleFocusChangedL( NGlxListDefs::TFocusChangeType /*aType*/, |
|
632 TInt /*aNewIndex*/, |
|
633 TInt /*aOldIndex*/, |
|
634 MGlxMediaList* /*aList*/) |
|
635 { |
|
636 TRACER("CShwSlideshowView::HandleFocusChangedL()"); |
|
637 if(iFilteredList) |
|
638 { |
|
639 if (iFilteredList->Count() && iHdmiActive) |
|
640 { |
|
641 if(iFilteredList->Count() > KSlideShowTextureOffset) |
|
642 { |
|
643 RemoveTexture(); |
|
644 } |
|
645 SetImage(); |
|
646 } |
|
647 } |
|
648 } |
|
649 |
|
650 // --------------------------------------------------------------------------- |
|
651 // From MGlxMediaListObserver |
|
652 // HandleItemSelected. |
|
653 // --------------------------------------------------------------------------- |
|
654 // |
|
655 void CShwSlideshowView::HandleItemSelectedL( TInt /*aIndex*/, |
|
656 TBool /*aSelected*/, |
|
657 MGlxMediaList* /*aList*/) |
|
658 { |
|
659 } |
|
660 |
|
661 // --------------------------------------------------------------------------- |
|
662 // From MGlxMediaListObserver |
|
663 // HandleMessageL. |
|
664 // --------------------------------------------------------------------------- |
|
665 // |
|
666 void CShwSlideshowView::HandleMessageL( const CMPXMessage& /*aMessage*/, |
|
667 MGlxMediaList* /*aList*/) |
|
668 { |
|
669 } |
|
670 |
|
671 // --------------------------------------------------------------------------- |
|
672 // From MGlxMediaListObserver |
|
673 // HandlePopulated. |
|
674 // --------------------------------------------------------------------------- |
|
675 // |
|
676 void CShwSlideshowView::HandlePopulatedL( MGlxMediaList* aList ) |
|
677 { |
|
678 TRACER("CShwSlideshowView::HandlePopulatedL"); |
|
679 GLX_LOG_INFO( "CShwSlideshowView::HandlePopulatedL" ); |
|
680 |
|
681 if( iMediaList == aList ) |
|
682 { |
|
683 // input list is ready |
|
684 iInputListReady = ETrue; |
|
685 // read the selection and filter |
|
686 // note that these cannot be read until the list has been populated |
|
687 // make the async callback, this will end up calling PopulateListL() |
|
688 // in CAsyncCallback::RunL once the scheduler next time runs. |
|
689 iPopulateListCallBack->CallBack(); |
|
690 } |
|
691 else if( iFilteredList == aList ) |
|
692 { |
|
693 // playable list is ready |
|
694 iPlayListReady = ETrue; |
|
695 } |
|
696 |
|
697 // the filtered list has been populated so start the engine |
|
698 if( iInputListReady && iPlayListReady ) |
|
699 { |
|
700 // make the async callback, this will end up calling StartEngineL() |
|
701 // in CAsyncCallback::RunL once the scheduler next time runs. |
|
702 // this is a no-op if the callback is already active |
|
703 iAsyncCallBack->CallBack(); |
|
704 } |
|
705 } |
|
706 |
|
707 // --------------------------------------------------------------------------- |
|
708 // From MShwEngineObserver |
|
709 // Engine started callback. |
|
710 // --------------------------------------------------------------------------- |
|
711 // |
|
712 void CShwSlideshowView::EngineStartedL() |
|
713 { |
|
714 TRACER("CShwSlideshowView::EngineStartedL"); |
|
715 GLX_LOG_INFO( "CShwSlideshowView::EngineStartedL()" ); |
|
716 |
|
717 if ( iWaitDialog ) |
|
718 { |
|
719 // cancel the progress bar |
|
720 iWaitDialog->ProcessFinishedL(); |
|
721 } |
|
722 iShwState = EShwPlay; |
|
723 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE,R_SHW_SOFTKEYS_END_PAUSE); |
|
724 ShowShwFurnitureL(); |
|
725 } |
|
726 |
|
727 // --------------------------------------------------------------------------- |
|
728 // From MShwEngineObserver |
|
729 // Engine paused callback. |
|
730 // --------------------------------------------------------------------------- |
|
731 // |
|
732 void CShwSlideshowView::EnginePausedL() |
|
733 { |
|
734 TRACER("CShwSlideshowView::EnginePausedL"); |
|
735 GLX_LOG_INFO( "CShwSlideshowView::EnginePausedL()" ); |
|
736 |
|
737 // Cancel the backlight if it's on |
|
738 if ( iBackLightTimer->IsRunning() ) |
|
739 { |
|
740 iBackLightTimer->Cancel(); |
|
741 } |
|
742 |
|
743 if(!iUiUtility->IsExitingState()) |
|
744 { |
|
745 iShwState = EShwPause; |
|
746 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_CONTINUE,R_SHW_SOFTKEYS_END_PAUSE); |
|
747 ShowShwFurnitureL(); |
|
748 } |
|
749 } |
|
750 |
|
751 // --------------------------------------------------------------------------- |
|
752 // From MShwEngineObserver |
|
753 // Engine resumed callback. |
|
754 // --------------------------------------------------------------------------- |
|
755 // |
|
756 void CShwSlideshowView::EngineResumedL() |
|
757 { |
|
758 TRACER("CShwSlideshowView::EngineResumedL"); |
|
759 GLX_LOG_INFO( "CShwSlideshowView::EngineResumedL" ); |
|
760 // Re-enable the backlight if it's off |
|
761 if ( !iBackLightTimer->IsRunning() ) |
|
762 { |
|
763 iBackLightTimer->StartL(); |
|
764 } |
|
765 iShwState = EShwPlay; |
|
766 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE,R_SHW_SOFTKEYS_END_CONTINUE); |
|
767 ShowShwFurnitureL(); |
|
768 } |
|
769 // --------------------------------------------------------------------------- |
|
770 // From MShwEngineObserver |
|
771 // Engine LSK Pressed |
|
772 // --------------------------------------------------------------------------- |
|
773 // |
|
774 void CShwSlideshowView::EngineLSKPressedL() |
|
775 { |
|
776 TRACER("CShwSlideshowView::EngineLSKPressedL"); |
|
777 GLX_LOG_INFO( "CShwSlideshowView::EngineLSKPressedL" ); |
|
778 iLSKPressed = ETrue; |
|
779 iPauseHandler->UserToggledPauseL(); |
|
780 } |
|
781 // --------------------------------------------------------------------------- |
|
782 // From MShwEngineObserver |
|
783 // Engine Toggle Ui callback.EngineLSKPressedL |
|
784 // --------------------------------------------------------------------------- |
|
785 // |
|
786 void CShwSlideshowView::EngineToggleUiStateL() |
|
787 { |
|
788 TRACER("CShwSlideshowView::EngineToggleUiStateL"); |
|
789 GLX_LOG_INFO( "CShwSlideshowView::EngineToggleUiStateL" ); |
|
790 iMSKPressed = ETrue; |
|
791 if(iShwFurniture == EFurnitureVisible) |
|
792 { |
|
793 HideShwFurniture(); |
|
794 } |
|
795 else |
|
796 { |
|
797 ShowShwFurnitureL(); |
|
798 } |
|
799 } |
|
800 |
|
801 // --------------------------------------------------------------------------- |
|
802 // From MShwEngineObserver |
|
803 // Engine encountered an error and we need to exit. |
|
804 // --------------------------------------------------------------------------- |
|
805 void CShwSlideshowView::ErrorDuringSlideshowL() |
|
806 { |
|
807 TRACER("CShwSlideshowView::ErrorDuringSlideshowL"); |
|
808 GLX_LOG_INFO( "CShwSlideshowView::ErrorDuringSlideshowL" ); |
|
809 iEngineStartFailed = ETrue; |
|
810 // need to dismiss the dialog if it's still there |
|
811 if( iWaitDialog ) |
|
812 { |
|
813 iWaitDialog->ProcessFinishedL(); |
|
814 } |
|
815 else |
|
816 { |
|
817 ProcessCommandL( EAknSoftkeyBack ); |
|
818 } |
|
819 } |
|
820 |
|
821 // ----------------------------------------------------------------------------- |
|
822 // From MShwMusicObserver |
|
823 // MusicOn. |
|
824 // ----------------------------------------------------------------------------- |
|
825 void CShwSlideshowView::MusicOnL() |
|
826 { |
|
827 TRACER("CShwSlideshowView::MusicOnL"); |
|
828 GLX_LOG_INFO( "CShwSlideshowView::MusicOnL" ); |
|
829 // Turn on the keypad tones |
|
830 AppUi()->KeySounds()->PushContextL( R_AVKON_SILENT_SKEY_LIST ); |
|
831 // if MusicOn leaves, MusicOff will get called |
|
832 // initialize the medikey control only if music is on. |
|
833 // delayed initialization intended |
|
834 // since there is a conflict if slideshow is launched from full screen |
|
835 iMediaKeyHandler = CShwMediaKeyUtility::NewL(); |
|
836 } |
|
837 |
|
838 // ----------------------------------------------------------------------------- |
|
839 // From MShwMusicObserver |
|
840 // MusicOff. |
|
841 // ----------------------------------------------------------------------------- |
|
842 void CShwSlideshowView::MusicOff() |
|
843 { |
|
844 TRACER("CShwSlideshowView::MusicOff"); |
|
845 GLX_LOG_INFO( "CShwSlideshowView::MusicOff" ); |
|
846 // |
|
847 TInt resource_id = AppUi()->KeySounds()->TopContext(); |
|
848 if( R_AVKON_SILENT_SKEY_LIST == resource_id ) |
|
849 { |
|
850 // Turn off the keypad tones |
|
851 AppUi()->KeySounds()->PopContext(); |
|
852 } |
|
853 |
|
854 // If it's visible, hide the volume control |
|
855 iDisplay->Roster().Hide( *iVolumeControlGroup ); |
|
856 //delete the media key handler |
|
857 if(iMediaKeyHandler) |
|
858 { |
|
859 delete iMediaKeyHandler; |
|
860 iMediaKeyHandler = NULL; |
|
861 } |
|
862 } |
|
863 |
|
864 // ----------------------------------------------------------------------------- |
|
865 // From MShwMusicObserver |
|
866 // MusicVolume. |
|
867 // ----------------------------------------------------------------------------- |
|
868 void CShwSlideshowView::MusicVolumeL(TInt aCurrentVolume, TInt aMaxVolume) |
|
869 { |
|
870 TRACER("CShwSlideshowView::MusicVolume"); |
|
871 GLX_LOG_INFO( "CShwSlideshowView::MusicVolume" ); |
|
872 if (aCurrentVolume != iCurrentVolume) |
|
873 { |
|
874 // Store the changed value |
|
875 iCurrentVolume = aCurrentVolume; |
|
876 iVolumeControl->SetVolume(aCurrentVolume, aMaxVolume); |
|
877 } |
|
878 // Always show the control even if the volume hasn't changed, e.g. @ 100% |
|
879 iVolumeControl->RefreshL(); |
|
880 } |
|
881 |
|
882 // ----------------------------------------------------------------------------- |
|
883 // From MShwMusicObserver |
|
884 // ErrorWithTrackL. |
|
885 // ----------------------------------------------------------------------------- |
|
886 void CShwSlideshowView::ErrorWithTrackL( TInt /*aErrorCode*/ ) |
|
887 { |
|
888 TRACER("CShwSlideshowView::ErrorWithTrackL"); |
|
889 // we dont use the error code as any kind of error with track file |
|
890 // means we cannot play it. |
|
891 // set the music to off if there was an error in track (file missing etc) |
|
892 // this way the user gets notification only once |
|
893 // ER: EMSR-77PCSJ |
|
894 CShwSettingsModel* shwSettingsMdl = CShwSettingsModel::NewL(); |
|
895 CleanupStack::PushL( shwSettingsMdl ); |
|
896 shwSettingsMdl->SaveMusicStateL( EFalse ); |
|
897 CleanupStack::PopAndDestroy( shwSettingsMdl ); |
|
898 |
|
899 // Display the error note |
|
900 HBufC* noteBuf = StringLoader::LoadLC( |
|
901 R_SHW_QTN_LGAL_NOTE_SLIDESHOW_DEFINE ); |
|
902 CAknInformationNote* note = new (ELeave) CAknInformationNote; |
|
903 CleanupStack::Pop( noteBuf ); |
|
904 note->ExecuteLD( *noteBuf ); |
|
905 } |
|
906 |
|
907 // ----------------------------------------------------------------------------- |
|
908 // From MProgressDialogCallback |
|
909 // Gets called when a dialog is dismissed. |
|
910 // ----------------------------------------------------------------------------- |
|
911 void CShwSlideshowView::DialogDismissedL( TInt aButtonId ) |
|
912 { |
|
913 TRACER("CShwSlideshowView::DialogDismissedL"); |
|
914 GLX_LOG_INFO( "CShwSlideshowView::DialogDismissedL" ); |
|
915 if ( iEngineStartFailed || aButtonId == EEikBidCancel ) |
|
916 { |
|
917 // Cancel the callback |
|
918 iAsyncCallBack->Cancel(); |
|
919 // Send the back command to return to the previous view |
|
920 ProcessCommandL( EAknSoftkeyBack ); |
|
921 } |
|
922 } |
|
923 |
|
924 // ----------------------------------------------------------------------------- |
|
925 // SetupScreenFurnitureL. |
|
926 // ----------------------------------------------------------------------------- |
|
927 void CShwSlideshowView::SetupScreenFurnitureL() |
|
928 { |
|
929 TRACER("CShwSlideshowView::SetupScreenFurnitureL"); |
|
930 GLX_LOG_INFO( "CShwSlideshowView::SetupScreenFurnitureL" ); |
|
931 // Create the soft keys |
|
932 // Left (bottom in landscape orientation) |
|
933 HBufC* softKeyTextLeft = StringLoader::LoadLC( R_SHW_SOFTKEY_LEFT ); |
|
934 // SetSoftKeyL takes ownership of softKeyText |
|
935 //SetSoftkeyL( EGlxLeftSoftkey, EShwSlideshowCmdContinue, softKeyTextLeft ); |
|
936 CleanupStack::Pop( softKeyTextLeft ); |
|
937 // Right (top in landscape orientation) |
|
938 HBufC* softKeyTextRight = StringLoader::LoadLC( R_SHW_SOFTKEY_RIGHT ); |
|
939 // SetSoftKeyL takes ownership of softKeyText |
|
940 //SetSoftkeyL( EGlxRightSoftkey, EAknSoftkeyBack, softKeyTextRight ); |
|
941 CleanupStack::Pop( softKeyTextRight ); |
|
942 |
|
943 } |
|
944 |
|
945 // ----------------------------------------------------------------------------- |
|
946 // GetPathAndPlaybackDirectionL |
|
947 // ----------------------------------------------------------------------------- |
|
948 void CShwSlideshowView::GetPathAndPlaybackDirectionL( const TDesC8& aData ) |
|
949 { |
|
950 TRACER("CShwSlideshowView::GetPathAndPlaybackDirectionL"); |
|
951 GLX_LOG_INFO( "CShwSlideshowView::GetPathAndPlaybackDirectionL" ); |
|
952 // reset state flags for list population |
|
953 iInputListReady = iPlayListReady = EFalse; |
|
954 |
|
955 // Create a copy of the media list using the path and the play direction |
|
956 RDesReadStream stream( aData ); |
|
957 CleanupClosePushL( stream ); |
|
958 stream.ReadInt32L(); |
|
959 |
|
960 |
|
961 //Get the play direction. |
|
962 |
|
963 CShwSettingsModel* shwSettingsMdl = CShwSettingsModel::NewL(); |
|
964 CleanupStack::PushL( shwSettingsMdl ); |
|
965 iPlayDirection = static_cast< NShwSlideshow:: |
|
966 TPlayDirection>(shwSettingsMdl->PlayOrderL()); |
|
967 CleanupStack::PopAndDestroy( shwSettingsMdl ); |
|
968 |
|
969 |
|
970 |
|
971 // Retrieve the path |
|
972 iCollectionPath = CMPXCollectionPath::NewL(); |
|
973 iCollectionPath->InternalizeL( stream ); |
|
974 // Create the media list from the path |
|
975 iMediaList = MGlxMediaList::InstanceL( *iCollectionPath ); |
|
976 // the list might be already populated |
|
977 if( iMediaList->IsPopulated() ) |
|
978 { |
|
979 iInputListReady = ETrue; |
|
980 // list is ready so read the selection and filter already now |
|
981 // need to do this while on DoViewActivateL as the previous view |
|
982 // may loose the selection while it is closing |
|
983 PopulateListL(); |
|
984 } |
|
985 else |
|
986 { |
|
987 // add us as an observer for the input list as well |
|
988 // we cannot read the path and filter before the list is populated |
|
989 iMediaList->AddMediaListObserverL( this ); |
|
990 } |
|
991 |
|
992 CleanupStack::PopAndDestroy( &stream ); |
|
993 } |
|
994 |
|
995 // ----------------------------------------------------------------------------- |
|
996 // SetListFocusL. |
|
997 // ----------------------------------------------------------------------------- |
|
998 void CShwSlideshowView::SetListFocusL() |
|
999 { |
|
1000 TRACER("CShwSlideshowView::SetListFocusL"); |
|
1001 GLX_LOG_INFO( "CShwSlideshowView::SetListFocusL" ); |
|
1002 // Ensure that we start the slideshow from the correct image index: |
|
1003 // if there are any selected images we always start from the first one, |
|
1004 // otherwise we try to use the item with focus from the unfiltered list |
|
1005 // so long as it hasn't been filtered out, in which case we use the first image. |
|
1006 TInt selectionCount = iCollectionPath->Selection().Count(); |
|
1007 TInt focusIndex = 0; |
|
1008 if ( selectionCount == 0 ) |
|
1009 { |
|
1010 // nothing selected, so determine which item has focus in the original list |
|
1011 focusIndex = iMediaList->FocusIndex(); |
|
1012 const TGlxMedia& mediaItem = iMediaList->Item( focusIndex ); |
|
1013 // is this item in the filtered list? |
|
1014 TGlxIdSpaceId spaceId = iMediaList->IdSpaceId( focusIndex ); |
|
1015 focusIndex = iFilteredList->Index( spaceId, mediaItem.Id() ); |
|
1016 if ( focusIndex == KErrNotFound ) |
|
1017 { |
|
1018 // it's been filtered out so just use the first item |
|
1019 focusIndex = 0; |
|
1020 } |
|
1021 } |
|
1022 iFilteredList->SetFocusL( NGlxListDefs::EAbsolute, focusIndex ); |
|
1023 SetImage(); |
|
1024 iHdmiActive = ETrue; |
|
1025 // iContextUtility->PublishPhotoContextL(item.Uri()); |
|
1026 } |
|
1027 |
|
1028 |
|
1029 // ----------------------------------------------------------------------------- |
|
1030 // HandleTickL. |
|
1031 // act on timer expiry |
|
1032 // ----------------------------------------------------------------------------- |
|
1033 // |
|
1034 void CShwSlideshowView::HandleTickL() |
|
1035 { |
|
1036 TRACER("CShwSlideshowView::HandleTickL"); |
|
1037 GLX_LOG_INFO( "CShwSlideshowView::HandleTickL" ); |
|
1038 if(iShwFurniture != EFurnitureVisible) |
|
1039 { |
|
1040 ShowShwFurnitureL(); |
|
1041 } |
|
1042 else |
|
1043 { |
|
1044 HideShwFurniture(); |
|
1045 } |
|
1046 } |
|
1047 |
|
1048 // ----------------------------------------------------------------------------- |
|
1049 // HandleTickCancelled. |
|
1050 // act on timer cancelled |
|
1051 // ----------------------------------------------------------------------------- |
|
1052 // |
|
1053 void CShwSlideshowView::HandleTickCancelled() |
|
1054 { |
|
1055 |
|
1056 } |
|
1057 |
|
1058 // ----------------------------------------------------------------------------- |
|
1059 // HandleShwGestureEventL. |
|
1060 // act on gestures |
|
1061 // ----------------------------------------------------------------------------- |
|
1062 // |
|
1063 void CShwSlideshowView::HandleShwGestureEventL(MShwGestureObserver::TShwGestureEventType aType) |
|
1064 { |
|
1065 TRACER("CShwSlideshowView::HandleShwGestureEventL"); |
|
1066 GLX_LOG_INFO( "CShwSlideshowView::HandleShwGestureEventL" ); |
|
1067 iTicker->CancelTicking(); |
|
1068 switch(aType) |
|
1069 { |
|
1070 case ETapEvent: |
|
1071 { |
|
1072 if(iShwFurniture == EFurnitureVisible) |
|
1073 { |
|
1074 HideShwFurniture(); |
|
1075 } |
|
1076 else |
|
1077 { |
|
1078 ShowShwFurnitureL(); |
|
1079 } |
|
1080 break; |
|
1081 } |
|
1082 case ESwipeLeft: |
|
1083 { |
|
1084 iEngine->NextItemL(); |
|
1085 break; |
|
1086 } |
|
1087 case ESwipeRight: |
|
1088 { |
|
1089 iEngine->PreviousItemL(); |
|
1090 break; |
|
1091 } |
|
1092 default: |
|
1093 { |
|
1094 break; |
|
1095 } |
|
1096 } |
|
1097 } |
|
1098 // ----------------------------------------------------------------------------- |
|
1099 // InitializeShwFurnitureL. |
|
1100 // set sof keys and the volume slider |
|
1101 // ----------------------------------------------------------------------------- |
|
1102 // |
|
1103 void CShwSlideshowView::InitializeShwFurnitureL() |
|
1104 { |
|
1105 TRACER("CShwSlideshowView::InitializeShwFurnitureL"); |
|
1106 GLX_LOG_INFO( "CShwSlideshowView::InitializeShwFurnitureL" ); |
|
1107 // initialize softkeys |
|
1108 InitializeCbaL(); |
|
1109 } |
|
1110 |
|
1111 // ----------------------------------------------------------------------------- |
|
1112 // InitializeCbaL. |
|
1113 // set sof keys |
|
1114 // ----------------------------------------------------------------------------- |
|
1115 // |
|
1116 void CShwSlideshowView::InitializeCbaL() |
|
1117 { |
|
1118 TRACER("CShwSlideshowView::InitializeCbaL"); |
|
1119 GLX_LOG_INFO( "CShwSlideshowView::InitializeCbaL" ); |
|
1120 // initialize with the end-pause command set as that is the one |
|
1121 // we are supposed to show immediately on slideshow play |
|
1122 // orientation: set to Vertical as slide show is always intended to |
|
1123 // run in landscape mode |
|
1124 iShwCba = CEikButtonGroupContainer::NewL( |
|
1125 CEikButtonGroupContainer::ECba, |
|
1126 CEikButtonGroupContainer::EVertical, |
|
1127 this, R_SHW_SOFTKEYS_END_PAUSE ); |
|
1128 iShwCba->MakeVisible(EFalse); |
|
1129 //set the current active command set |
|
1130 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE,R_SHW_SOFTKEYS_END_PAUSE); |
|
1131 } |
|
1132 |
|
1133 // ----------------------------------------------------------------------------- |
|
1134 // ReplaceCommandSetL. |
|
1135 // replaces a commandset with a new one |
|
1136 // ----------------------------------------------------------------------------- |
|
1137 // |
|
1138 void CShwSlideshowView::ReplaceCommandSetL(TInt aNewComandId, TInt aOldCommandSet) |
|
1139 { |
|
1140 TRACER("CShwSlideshowView::ReplaceCommandSetL"); |
|
1141 GLX_LOG_INFO( "CShwSlideshowView::ReplaceCommandSetL" ); |
|
1142 //find and remove the command set |
|
1143 TInt pos = iShwCba->PositionById( aOldCommandSet ); |
|
1144 if( pos != KErrNotFound ) |
|
1145 { |
|
1146 iShwCba->RemoveCommandFromStack( pos, aOldCommandSet ); |
|
1147 } |
|
1148 // set the new command set |
|
1149 iShwCba->SetCommandSetL( aNewComandId ); |
|
1150 // keep the current active command set |
|
1151 iCurrentActiveCommandSet = aNewComandId; |
|
1152 } |
|
1153 |
|
1154 |
|
1155 // ----------------------------------------------------------------------------- |
|
1156 // HideShwFurnitureL. |
|
1157 // hide softkeys and the volume slider |
|
1158 // ----------------------------------------------------------------------------- |
|
1159 // |
|
1160 void CShwSlideshowView::HideShwFurniture() |
|
1161 { |
|
1162 TRACER("CShwSlideshowView::HideShwFurnitureL"); |
|
1163 GLX_LOG_INFO( "CShwSlideshowView::HideShwFurnitureL" ); |
|
1164 iTicker->CancelTicking(); |
|
1165 iShwCba->MakeVisible(EFalse); |
|
1166 iShwCba->DrawNow(); |
|
1167 if(iMediaKeyHandler) |
|
1168 { |
|
1169 iVolumeControl->Hide(); |
|
1170 } |
|
1171 iShwFurniture = EFurnitureHidden; |
|
1172 |
|
1173 } |
|
1174 |
|
1175 // ----------------------------------------------------------------------------- |
|
1176 // ShowShwFurnitureL. |
|
1177 // show softkeys and the volume slider |
|
1178 // ----------------------------------------------------------------------------- |
|
1179 // |
|
1180 void CShwSlideshowView::ShowShwFurnitureL() |
|
1181 { |
|
1182 TRACER("CShwSlideshowView::ShowShwFurnitureL"); |
|
1183 GLX_LOG_INFO( "CShwSlideshowView::ShowShwFurnitureL" ); |
|
1184 iTicker->CancelTicking(); |
|
1185 iShwCba->MakeVisible(ETrue); |
|
1186 iShwCba->DrawNow(); |
|
1187 if(iMediaKeyHandler) |
|
1188 { |
|
1189 iVolumeControl->ShowControlL(); |
|
1190 } |
|
1191 iShwFurniture = EFurnitureVisible; |
|
1192 //start the timer to keep the up the screen furniture for 5 seconds |
|
1193 iTicker->StartTicking(KShowForSeconds); |
|
1194 } |
|
1195 |
|
1196 // ----------------------------------------------------------------------------- |
|
1197 // ProcessCommandL. |
|
1198 // handle softkey events |
|
1199 // ----------------------------------------------------------------------------- |
|
1200 // |
|
1201 void CShwSlideshowView::ProcessCommandL(TInt aCommandId) |
|
1202 { |
|
1203 TRACER("CShwSlideshowView::ProcessCommandL"); |
|
1204 GLX_LOG_INFO( "CShwSlideshowView::ProcessCommandL" ); |
|
1205 switch(aCommandId) |
|
1206 { |
|
1207 case EShwSlideshowCmdEnd: |
|
1208 { |
|
1209 iShwState = EShwExiting; |
|
1210 aCommandId = EAknSoftkeyBack; |
|
1211 iDisplay->Roster().Hide( *iGestureControlGroup ); |
|
1212 break; |
|
1213 } |
|
1214 //When user presses MSK or LSK this cmd will Generated |
|
1215 case EShwSlideshowCmdPause: |
|
1216 case EShwSlideshowCmdContinue: |
|
1217 { |
|
1218 // If MSK preesed to toggle visibility of softekey |
|
1219 if(iMSKPressed) |
|
1220 { |
|
1221 iMSKPressed = EFalse; |
|
1222 } |
|
1223 else if(iLSKPressed) |
|
1224 { |
|
1225 iLSKPressed = EFalse;// Already Handlled |
|
1226 } |
|
1227 else |
|
1228 { |
|
1229 iPauseHandler->UserToggledPauseL(); |
|
1230 } |
|
1231 break; |
|
1232 } |
|
1233 |
|
1234 default: |
|
1235 { |
|
1236 break; |
|
1237 } |
|
1238 } |
|
1239 CGlxViewBase::ProcessCommandL(aCommandId); |
|
1240 } |
|
1241 // ----------------------------------------------------------------------------- |
|
1242 // SetImage. |
|
1243 // To set Image to external display if HDmi connected |
|
1244 // ----------------------------------------------------------------------------- |
|
1245 // |
|
1246 void CShwSlideshowView::SetImage() |
|
1247 { |
|
1248 TRACER("CShwSlideshowView::SetImage"); |
|
1249 TGlxMedia item = iFilteredList->Item( iFilteredList->FocusIndex() ); |
|
1250 TInt frameCount(0); |
|
1251 TSize orignalSize; |
|
1252 TBool aFramesPresent = item.GetFrameCount(frameCount); |
|
1253 TBool adimension = item.GetDimensions(orignalSize); |
|
1254 iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount); |
|
1255 } |
|
1256 // --------------------------------------------------------------------------- |
|
1257 // |
|
1258 // Gets the index of the item for which the texture has to be removed |
|
1259 // --------------------------------------------------------------------------- |
|
1260 // |
|
1261 TInt CShwSlideshowView::GetIndexToBeRemoved() |
|
1262 { |
|
1263 TRACER("CShwSlideshowView::GetIndexToBeRemoved"); |
|
1264 TInt indextoberemoved; |
|
1265 TInt count = iFilteredList->Count(); |
|
1266 TInt focusIndex = iFilteredList->FocusIndex(); |
|
1267 if(iPlayDirection == NShwSlideshow::EPlayForwards) |
|
1268 { |
|
1269 indextoberemoved = focusIndex-KSlideShowIterator; |
|
1270 if(indextoberemoved < 0) |
|
1271 { |
|
1272 indextoberemoved = count+indextoberemoved; |
|
1273 } |
|
1274 } |
|
1275 else |
|
1276 { |
|
1277 indextoberemoved = focusIndex+KSlideShowIterator; |
|
1278 if(indextoberemoved > count-1) |
|
1279 { |
|
1280 indextoberemoved = indextoberemoved-count; |
|
1281 } |
|
1282 } |
|
1283 GLX_LOG_INFO1("CShwSlideshowView::GetIndexToBeRemoved Index to be removed is %d",indextoberemoved); |
|
1284 return indextoberemoved; |
|
1285 } |
|
1286 // --------------------------------------------------------------------------- |
|
1287 // |
|
1288 // Remove the texture on every swipe while HDMI is connected. |
|
1289 // --------------------------------------------------------------------------- |
|
1290 // |
|
1291 void CShwSlideshowView::RemoveTexture() |
|
1292 { |
|
1293 TRACER("CShwSlideshowView::RemoveTexture"); |
|
1294 const TGlxMedia& item = iFilteredList->Item(GetIndexToBeRemoved()); |
|
1295 iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse); |
|
1296 } |