38 #include <glxhdmicontroller.h> |
38 #include <glxhdmicontroller.h> |
39 #include <glxresourceutilities.h> // for CGlxResourceUtilities |
39 #include <glxresourceutilities.h> // for CGlxResourceUtilities |
40 #include <glxresolutionutility.h> // for CGlxResolutionUtility |
40 #include <glxresolutionutility.h> // for CGlxResolutionUtility |
41 #include <shwslideshowview.rsg> // view's resource |
41 #include <shwslideshowview.rsg> // view's resource |
42 #include <data_caging_path_literals.hrh> // for resource directory path |
42 #include <data_caging_path_literals.hrh> // for resource directory path |
|
43 #include <glxcommandhandlers.hrh> // for EGlxCmdResetView |
43 #include <glxlog.h> |
44 #include <glxlog.h> |
44 #include <glxtracer.h> |
45 #include <glxtracer.h> |
45 #include <aknsoundsystem.h> // for CAknKeySoundSystem |
46 #include <aknsoundsystem.h> // for CAknKeySoundSystem |
46 #include <avkon.rsg> // for R_AVKON_SILENT_SKEY_LIST |
47 #include <avkon.rsg> // for R_AVKON_SILENT_SKEY_LIST |
47 #include <mpxcollectionpath.h> |
48 #include <mpxcollectionpath.h> |
290 // plug-in and never returned to the client side. |
295 // plug-in and never returned to the client side. |
291 |
296 |
292 // we need the full path for the filter creation so that the selection can be |
297 // we need the full path for the filter creation so that the selection can be |
293 // extracted from there |
298 // extracted from there |
294 CMPXCollectionPath* fullpath = iMediaList->PathLC(); |
299 CMPXCollectionPath* fullpath = iMediaList->PathLC(); |
|
300 // CreateSlideShowFilterFromExistingFilterL() takes ownership of the fullpath so no need to destroy it. |
|
301 CleanupStack::Pop( fullpath ); |
295 // create the filter |
302 // create the filter |
296 filter = TGlxFilterFactory::CreateSlideShowFilterFromExistingFilterL( |
303 filter = TGlxFilterFactory::CreateSlideShowFilterFromExistingFilterL( |
297 iMediaList->Filter(), fullpath, |
304 iMediaList->Filter(), fullpath, |
298 iPlayDirection); |
305 iPlayDirection); |
299 CleanupStack::PushL( filter ); |
306 CleanupStack::PushL( filter ); |
389 return TUid::Uid( KViewId ); |
397 return TUid::Uid( KViewId ); |
390 } |
398 } |
391 |
399 |
392 // --------------------------------------------------------------------------- |
400 // --------------------------------------------------------------------------- |
393 // From CAknView |
401 // From CAknView |
394 // Foreground event handling function. |
402 // Background event handling in HandleWsEventL. |
|
403 // Foreground event handling this function. |
395 // --------------------------------------------------------------------------- |
404 // --------------------------------------------------------------------------- |
396 // |
405 // |
397 void CShwSlideshowView::HandleForegroundEventL(TBool aForeground) |
406 void CShwSlideshowView::HandleForegroundEventL(TBool aForeground) |
398 { |
407 { |
399 TRACER("CShwSlideshowView::HandleForegroundEventL"); |
408 TRACER("CShwSlideshowView::HandleForegroundEventL"); |
400 GLX_LOG_INFO( "CShwSlideshowView::HandleForegroundEventL()" ); |
409 GLX_LOG_INFO1("CShwSlideshowView::HandleForegroundEventL(%d)", aForeground); |
401 iIsForegrnd = aForeground; |
410 iIsForegrnd = aForeground; |
402 if( aForeground ) |
411 if (aForeground) |
403 { |
412 { |
404 if (iHdmiController && iHdmiActive) |
413 if (iHdmiController && iHdmiActive) |
405 { |
414 { |
406 iHdmiController->ShiftToPostingMode(); |
415 iHdmiController->ShiftToPostingMode(); |
407 } |
416 } |
758 // From MShwEngineObserver |
761 // From MShwEngineObserver |
759 // Engine started callback. |
762 // Engine started callback. |
760 // --------------------------------------------------------------------------- |
763 // --------------------------------------------------------------------------- |
761 // |
764 // |
762 void CShwSlideshowView::EngineStartedL() |
765 void CShwSlideshowView::EngineStartedL() |
763 { |
766 { |
764 TRACER("CShwSlideshowView::EngineStartedL"); |
767 TRACER("CShwSlideshowView::EngineStartedL"); |
765 GLX_LOG_INFO( "CShwSlideshowView::EngineStartedL()" ); |
768 GLX_LOG_INFO( "CShwSlideshowView::EngineStartedL()" ); |
766 |
769 if (iWaitDialog) |
767 if (iWaitDialog) |
770 { |
768 { |
771 // cancel the progress bar |
769 // cancel the progress bar |
772 iWaitDialog->ProcessFinishedL(); |
770 iWaitDialog->ProcessFinishedL(); |
773 } |
771 } |
774 if (iHdmiController) |
772 if (iHdmiController) |
775 { |
773 { |
776 iHdmiController->ShiftToPostingMode(); |
774 iHdmiController->ShiftToPostingMode(); |
777 } |
775 } |
778 // Here, iShwState value is either 0(first instance) |
776 iShwState = EShwPlay; |
779 // or EShwExiting(remembered from previous instance) |
777 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE, R_SHW_SOFTKEYS_END_PAUSE); |
780 iShwState = EShwPlay; |
778 ShowShwFurnitureL(); |
781 ShowShwFurnitureL(); |
779 } |
782 } |
780 |
783 |
781 // --------------------------------------------------------------------------- |
784 // --------------------------------------------------------------------------- |
782 // From MShwEngineObserver |
785 // From MShwEngineObserver |
783 // Engine paused callback. |
786 // Engine paused callback. |
784 // --------------------------------------------------------------------------- |
787 // --------------------------------------------------------------------------- |
785 // |
788 // |
786 void CShwSlideshowView::EnginePausedL() |
789 void CShwSlideshowView::EnginePausedL() |
787 { |
790 { |
788 TRACER("CShwSlideshowView::EnginePausedL"); |
791 TRACER("CShwSlideshowView::EnginePausedL"); |
789 GLX_LOG_INFO( "CShwSlideshowView::EnginePausedL()" ); |
792 GLX_LOG_INFO( "CShwSlideshowView::EnginePausedL()" ); |
790 |
|
791 // Cancel the backlight if it's on |
793 // Cancel the backlight if it's on |
792 if ( iBackLightTimer->IsRunning() ) |
794 if (iBackLightTimer->IsRunning()) |
793 { |
795 { |
794 iBackLightTimer->Cancel(); |
796 iBackLightTimer->Cancel(); |
795 } |
797 } |
796 |
798 if (!iUiUtility->IsExitingState() && (iShwState != EShwExiting)) |
797 if(!iUiUtility->IsExitingState()) |
799 { |
798 { |
800 iShwState = EShwPause; |
799 iShwState = EShwPause; |
801 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_CONTINUE, |
800 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_CONTINUE,R_SHW_SOFTKEYS_END_PAUSE); |
802 R_SHW_SOFTKEYS_END_PAUSE); |
801 ShowShwFurnitureL(); |
803 ShowShwFurnitureL(); |
802 } |
804 } |
803 } |
805 } |
804 |
806 |
805 // --------------------------------------------------------------------------- |
807 // --------------------------------------------------------------------------- |
806 // From MShwEngineObserver |
808 // From MShwEngineObserver |
807 // Engine resumed callback. |
809 // Engine resumed callback. |
808 // --------------------------------------------------------------------------- |
810 // --------------------------------------------------------------------------- |
809 // |
811 // |
810 void CShwSlideshowView::EngineResumedL() |
812 void CShwSlideshowView::EngineResumedL() |
811 { |
813 { |
812 TRACER("CShwSlideshowView::EngineResumedL"); |
814 TRACER("CShwSlideshowView::EngineResumedL"); |
813 GLX_LOG_INFO( "CShwSlideshowView::EngineResumedL" ); |
815 GLX_LOG_INFO( "CShwSlideshowView::EngineResumedL" ); |
814 iEngine->GetMusicVolumeL(); |
816 iEngine->GetMusicVolumeL(); |
815 // Re-enable the backlight if it's off |
817 // Re-enable the backlight if it's off |
816 if ( !iBackLightTimer->IsRunning() ) |
818 if (!iBackLightTimer->IsRunning()) |
817 { |
819 { |
818 iBackLightTimer->StartL(); |
820 iBackLightTimer->StartL(); |
819 } |
821 } |
820 iShwState = EShwPlay; |
822 if (iShwState != EShwExiting) |
821 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE,R_SHW_SOFTKEYS_END_CONTINUE); |
823 { |
822 ShowShwFurnitureL(); |
824 iShwState = EShwPlay; |
823 } |
825 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE, |
|
826 R_SHW_SOFTKEYS_END_CONTINUE); |
|
827 ShowShwFurnitureL(); |
|
828 } |
|
829 } |
824 // --------------------------------------------------------------------------- |
830 // --------------------------------------------------------------------------- |
825 // From MShwEngineObserver |
831 // From MShwEngineObserver |
826 // Engine LSK Pressed |
832 // Engine LSK Pressed |
827 // --------------------------------------------------------------------------- |
833 // --------------------------------------------------------------------------- |
828 // |
834 // |
1006 // Create a copy of the media list using the path and the play direction |
1012 // Create a copy of the media list using the path and the play direction |
1007 RDesReadStream stream( aData ); |
1013 RDesReadStream stream( aData ); |
1008 CleanupClosePushL( stream ); |
1014 CleanupClosePushL( stream ); |
1009 stream.ReadInt32L(); |
1015 stream.ReadInt32L(); |
1010 |
1016 |
1011 |
|
1012 //Get the play direction. |
1017 //Get the play direction. |
1013 |
|
1014 CShwSettingsModel* shwSettingsMdl = CShwSettingsModel::NewL(); |
1018 CShwSettingsModel* shwSettingsMdl = CShwSettingsModel::NewL(); |
1015 CleanupStack::PushL( shwSettingsMdl ); |
1019 CleanupStack::PushL(shwSettingsMdl); |
1016 iPlayDirection = static_cast< NShwSlideshow:: |
1020 iPlayDirection |
1017 TPlayDirection>(shwSettingsMdl->PlayOrderL()); |
1021 = static_cast<NShwSlideshow::TPlayDirection> (shwSettingsMdl->PlayOrderL()); |
1018 CleanupStack::PopAndDestroy( shwSettingsMdl ); |
1022 CleanupStack::PopAndDestroy( shwSettingsMdl ); |
1019 |
|
1020 |
|
1021 |
1023 |
1022 // Retrieve the path |
1024 // Retrieve the path |
1023 iCollectionPath = CMPXCollectionPath::NewL(); |
1025 iCollectionPath = CMPXCollectionPath::NewL(); |
1024 iCollectionPath->InternalizeL( stream ); |
1026 iCollectionPath->InternalizeL( stream ); |
1025 // Create the media list from the path |
1027 // Create the media list from the path |
1047 // SetListFocusL. |
1049 // SetListFocusL. |
1048 // ----------------------------------------------------------------------------- |
1050 // ----------------------------------------------------------------------------- |
1049 void CShwSlideshowView::SetListFocusL() |
1051 void CShwSlideshowView::SetListFocusL() |
1050 { |
1052 { |
1051 TRACER("CShwSlideshowView::SetListFocusL"); |
1053 TRACER("CShwSlideshowView::SetListFocusL"); |
1052 GLX_LOG_INFO( "CShwSlideshowView::SetListFocusL" ); |
1054 GLX_LOG_INFO("CShwSlideshowView::SetListFocusL"); |
1053 // Ensure that we start the slideshow from the correct image index: |
1055 // Ensure that we start the slideshow from the correct image index: |
1054 // if there are any selected images we always start from the first one, |
1056 // if there are any selected images we always start from the first one, |
1055 // otherwise we try to use the item with focus from the unfiltered list |
1057 // otherwise we try to use the item with focus from the unfiltered list |
1056 // so long as it hasn't been filtered out, in which case we use the first image. |
1058 // so long as it hasn't been filtered out, in which case we use the first image. |
1057 TInt selectionCount = iCollectionPath->Selection().Count(); |
1059 TInt selectionCount = iCollectionPath->Selection().Count(); |
1058 TInt focusIndex = 0; |
1060 TInt focusIndex = 0; |
1059 if ( selectionCount == 0 ) |
1061 if (selectionCount == 0) |
1060 { |
1062 { |
|
1063 |
1061 // nothing selected, so determine which item has focus in the original list |
1064 // nothing selected, so determine which item has focus in the original list |
1062 focusIndex = iMediaList->FocusIndex(); |
1065 focusIndex = iMediaList->FocusIndex(); |
1063 const TGlxMedia& mediaItem = iMediaList->Item( focusIndex ); |
1066 GLX_LOG_INFO1("SlideshowView::SetListFocusL focusIndex(%d)", focusIndex); |
|
1067 |
|
1068 const TGlxMedia& mediaItem = iMediaList->Item(focusIndex); |
1064 // Check if this item is in the filtered list |
1069 // Check if this item is in the filtered list |
1065 TGlxIdSpaceId spaceId = iMediaList->IdSpaceId( focusIndex ); |
1070 TGlxIdSpaceId spaceId = iMediaList->IdSpaceId(focusIndex); |
1066 focusIndex = iFilteredList->Index( spaceId, mediaItem.Id() ); |
1071 focusIndex = iFilteredList->Index(spaceId, mediaItem.Id()); |
1067 if ( focusIndex == KErrNotFound ) |
1072 if (focusIndex == KErrNotFound) |
1068 { |
1073 { |
1069 // it's been filtered out so just use the first item |
1074 focusIndex = ((iPlayDirection == NShwSlideshow::EPlayBackwards) |
1070 focusIndex = 0; |
1075 ? 0 : iFilteredList->Count() - 1); |
1071 } |
1076 } |
1072 } |
1077 } |
1073 iFilteredList->SetFocusL( NGlxListDefs::EAbsolute, focusIndex ); |
1078 iFilteredList->SetFocusL(NGlxListDefs::EAbsolute, focusIndex); |
1074 } |
1079 } |
1075 |
1080 |
1076 |
1081 |
1077 // ----------------------------------------------------------------------------- |
1082 // ----------------------------------------------------------------------------- |
1078 // HandleTickL. |
1083 // HandleTickL. |
1181 iShwCba = CEikButtonGroupContainer::NewL( |
1186 iShwCba = CEikButtonGroupContainer::NewL( |
1182 CEikButtonGroupContainer::ECba, |
1187 CEikButtonGroupContainer::ECba, |
1183 CEikButtonGroupContainer::EVertical, |
1188 CEikButtonGroupContainer::EVertical, |
1184 this, R_SHW_SOFTKEYS_END_PAUSE ); |
1189 this, R_SHW_SOFTKEYS_END_PAUSE ); |
1185 iShwCba->MakeVisible(EFalse); |
1190 iShwCba->MakeVisible(EFalse); |
1186 //set the current active command set |
|
1187 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE,R_SHW_SOFTKEYS_END_PAUSE); |
|
1188 } |
1191 } |
1189 |
1192 |
1190 // ----------------------------------------------------------------------------- |
1193 // ----------------------------------------------------------------------------- |
1191 // ReplaceCommandSetL. |
1194 // ReplaceCommandSetL. |
1192 // replaces a commandset with a new one |
1195 // replaces a commandset with a new one |
1257 // |
1257 // |
1258 void CShwSlideshowView::ProcessCommandL(TInt aCommandId) |
1258 void CShwSlideshowView::ProcessCommandL(TInt aCommandId) |
1259 { |
1259 { |
1260 TRACER("CShwSlideshowView::ProcessCommandL"); |
1260 TRACER("CShwSlideshowView::ProcessCommandL"); |
1261 GLX_LOG_INFO( "CShwSlideshowView::ProcessCommandL" ); |
1261 GLX_LOG_INFO( "CShwSlideshowView::ProcessCommandL" ); |
1262 switch(aCommandId) |
1262 switch (aCommandId) |
1263 { |
1263 { |
1264 case EShwSlideshowCmdEnd: |
1264 case EShwSlideshowCmdEnd: |
|
1265 case EAknSoftkeyBack: |
|
1266 case EGlxCmdResetView: |
1265 { |
1267 { |
1266 iShwState = EShwExiting; |
1268 iShwState = EShwExiting; |
1267 aCommandId = EAknSoftkeyBack; |
1269 iDisplay->Roster().Hide(*iGestureControlGroup); |
1268 iDisplay->Roster().Hide( *iGestureControlGroup ); |
1270 HideShwFurniture(); |
|
1271 if (aCommandId == EShwSlideshowCmdEnd) |
|
1272 { |
|
1273 aCommandId = EAknSoftkeyBack; |
|
1274 } |
1269 break; |
1275 break; |
1270 } |
1276 } |
1271 //When user presses MSK or LSK this cmd will Generated |
1277 //When user presses MSK or LSK this cmd will Generated |
1272 case EShwSlideshowCmdPause: |
1278 case EShwSlideshowCmdPause: |
1273 case EShwSlideshowCmdContinue: |
1279 case EShwSlideshowCmdContinue: |
1274 { |
1280 { |
1275 // If MSK preesed to toggle visibility of softekey |
1281 // If MSK preesed to toggle visibility of softekey |
1276 if(iMSKPressed) |
1282 if (iMSKPressed) |
1277 { |
1283 { |
1278 iMSKPressed = EFalse; |
1284 iMSKPressed = EFalse; |
1279 } |
1285 } |
1280 else if(iLSKPressed) |
1286 else if (iLSKPressed) |
1281 { |
1287 { |
1282 iLSKPressed = EFalse;// Already Handlled |
1288 iLSKPressed = EFalse;// Already Handlled |
1283 } |
1289 } |
1284 else |
1290 else |
1285 { |
1291 { |
1286 iPauseHandler->UserToggledPauseL(); |
1292 iPauseHandler->UserToggledPauseL(); |
1287 } |
1293 } |
1288 break; |
1294 break; |
1289 } |
1295 } |
1290 |
|
1291 default: |
1296 default: |
1292 { |
1297 { |
1293 break; |
1298 break; |
1294 } |
1299 } |
1295 } |
1300 } |
1536 void CShwSlideshowView::HandleHDMIDecodingEventL(THdmiDecodingStatus aStatus) |
1541 void CShwSlideshowView::HandleHDMIDecodingEventL(THdmiDecodingStatus aStatus) |
1537 { |
1542 { |
1538 TRACER("CShwSlideshowView::HandleHDMIDecodingEventL()"); |
1543 TRACER("CShwSlideshowView::HandleHDMIDecodingEventL()"); |
1539 iEngine->HandleHDMIDecodingEventL(aStatus); |
1544 iEngine->HandleHDMIDecodingEventL(aStatus); |
1540 } |
1545 } |
|
1546 // ------------------------------------------------------------------------------------------------- |
|
1547 // CShwSlideshowView::IsAppInForegroundL() |
|
1548 // ------------------------------------------------------------------------------------------------- |
|
1549 // |
|
1550 TBool CShwSlideshowView::IsAppInForegroundL() |
|
1551 { |
|
1552 TRACER("CShwSlideshowView::IsAppInForegroundL()"); |
|
1553 TBool ret = EFalse; |
|
1554 CArrayFixFlat<TInt>* wgList = new (ELeave) CArrayFixFlat<TInt> ( |
|
1555 iEikonEnv->WsSession().NumWindowGroups()); |
|
1556 CleanupStack::PushL(wgList); |
|
1557 if (iEikonEnv->WsSession().WindowGroupList(0, wgList) == KErrNone) |
|
1558 { |
|
1559 // Check if Photos App window group is in foreground |
|
1560 ret = (iCoeEnv->RootWin().Identifier() == wgList->At(0)); |
|
1561 GLX_LOG_INFO2("SlideshowView::IsAppInForegroundL() ret=%d, wgId=%u", |
|
1562 ret, wgList->At(0)); |
|
1563 } |
|
1564 |
|
1565 CleanupStack::PopAndDestroy(wgList); |
|
1566 return ret; |
|
1567 } |
|
1568 |
|
1569 // ------------------------------------------------------------------------------------------------- |
|
1570 // CShwSlideshowView::HandleWsEventL() |
|
1571 // WS Events handling function |
|
1572 // ------------------------------------------------------------------------------------------------- |
|
1573 // |
|
1574 void CShwSlideshowView::HandleWsEventL(const TWsEvent& aEvent, |
|
1575 CCoeControl* /*aDestination*/) |
|
1576 { |
|
1577 TRACER("CShwSlideshowView::HandleWsEventL()"); |
|
1578 TInt event = aEvent.Type(); |
|
1579 GLX_LOG_INFO1("CShwSlideshowView::HandleWsEventL() event=%d", event); |
|
1580 |
|
1581 // If we are sent to full background, shift to cloning mode |
|
1582 if ((event == KAknFullOrPartialForegroundLost) && !IsAppInForegroundL()) |
|
1583 { |
|
1584 GLX_LOG_INFO("SlideshowView::HandleWsEventL() App is in background!"); |
|
1585 if (iHdmiController && iHdmiActive) |
|
1586 { |
|
1587 iHdmiController->ShiftToCloningMode(); |
|
1588 } |
|
1589 // Something else has gained the foreground |
|
1590 iPauseHandler->SwitchToBackgroundL(); |
|
1591 } |
|
1592 } |