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 |
|
44 #include <glxlog.h> |
43 #include <glxlog.h> |
45 #include <glxtracer.h> |
44 #include <glxtracer.h> |
46 #include <aknsoundsystem.h> // for CAknKeySoundSystem |
45 #include <aknsoundsystem.h> // for CAknKeySoundSystem |
47 #include <avkon.rsg> // for R_AVKON_SILENT_SKEY_LIST |
46 #include <avkon.rsg> // for R_AVKON_SILENT_SKEY_LIST |
48 #include <mpxcollectionpath.h> |
47 #include <mpxcollectionpath.h> |
243 // need to dismiss the dialog if it's still there |
242 // need to dismiss the dialog if it's still there |
244 if (iWaitDialog) |
243 if (iWaitDialog) |
245 { |
244 { |
246 iWaitDialog->ProcessFinishedL(); |
245 iWaitDialog->ProcessFinishedL(); |
247 } |
246 } |
248 HBufC* popupText = NULL; |
|
249 //Load the "No Images to Play Slideshow" string from the resource file |
|
250 popupText = StringLoader::LoadLC(R_GLX_NO_IMAGES_TO_PLAY_SLIDESHOW); |
|
251 // Show the Info Note. |
|
252 GlxGeneralUiUtilities::ShowInfoNoteL(popupText->Des(), EFalse); |
|
253 // LoadLC will push text on to cleanupstack, |
|
254 // hence it should be poped and destroyed |
|
255 CleanupStack::PopAndDestroy(popupText); |
|
256 } |
247 } |
257 else |
248 else |
258 { |
249 { |
259 // The list should now be populated, so set the focus |
250 // The list should now be populated, so set the focus |
260 SetListFocusL(); |
251 SetListFocusL(); |
261 |
|
262 // Initialize control textures |
|
263 iVolumeControl->InitControlTextureL(); |
|
264 |
|
265 // Need to take latest screen size as layout has changed |
252 // Need to take latest screen size as layout has changed |
266 TRect currentScreen; |
253 TRect currentScreen; |
267 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, |
254 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, |
268 currentScreen); |
255 currentScreen); |
269 iScrnSize = currentScreen.Size(); |
256 iScrnSize = currentScreen.Size(); |
407 return TUid::Uid( KViewId ); |
392 return TUid::Uid( KViewId ); |
408 } |
393 } |
409 |
394 |
410 // --------------------------------------------------------------------------- |
395 // --------------------------------------------------------------------------- |
411 // From CAknView |
396 // From CAknView |
412 // Background event handling in HandleWsEventL. |
397 // Foreground event handling function. |
413 // Foreground event handling this function. |
|
414 // --------------------------------------------------------------------------- |
398 // --------------------------------------------------------------------------- |
415 // |
399 // |
416 void CShwSlideshowView::HandleForegroundEventL(TBool aForeground) |
400 void CShwSlideshowView::HandleForegroundEventL(TBool aForeground) |
417 { |
401 { |
418 TRACER("CShwSlideshowView::HandleForegroundEventL"); |
402 TRACER("CShwSlideshowView::HandleForegroundEventL"); |
419 GLX_LOG_INFO1("CShwSlideshowView::HandleForegroundEventL(%d)", aForeground); |
403 GLX_LOG_INFO( "CShwSlideshowView::HandleForegroundEventL()" ); |
420 iIsForegrnd = aForeground; |
404 iIsForegrnd = aForeground; |
421 if (aForeground) |
405 if( aForeground ) |
422 { |
406 { |
423 if (iHdmiController && iHdmiActive) |
407 if (iHdmiController && iHdmiActive) |
424 { |
408 { |
425 iHdmiController->ShiftToPostingMode(); |
409 iHdmiController->ShiftToPostingMode(); |
426 } |
410 } |
771 // From MShwEngineObserver |
761 // From MShwEngineObserver |
772 // Engine started callback. |
762 // Engine started callback. |
773 // --------------------------------------------------------------------------- |
763 // --------------------------------------------------------------------------- |
774 // |
764 // |
775 void CShwSlideshowView::EngineStartedL() |
765 void CShwSlideshowView::EngineStartedL() |
776 { |
766 { |
777 TRACER("CShwSlideshowView::EngineStartedL"); |
767 TRACER("CShwSlideshowView::EngineStartedL"); |
778 GLX_LOG_INFO( "CShwSlideshowView::EngineStartedL()" ); |
768 GLX_LOG_INFO( "CShwSlideshowView::EngineStartedL()" ); |
779 if (iWaitDialog) |
769 |
780 { |
770 if (iWaitDialog) |
781 // cancel the progress bar |
771 { |
782 iWaitDialog->ProcessFinishedL(); |
772 // cancel the progress bar |
783 } |
773 iWaitDialog->ProcessFinishedL(); |
784 if (iHdmiController) |
774 } |
785 { |
775 if (iHdmiController) |
786 iHdmiController->ShiftToPostingMode(); |
776 { |
787 } |
777 iHdmiController->ShiftToPostingMode(); |
788 // Here, iShwState value is either 0(first instance) |
778 } |
789 // or EShwExiting(remembered from previous instance) |
779 iShwState = EShwPlay; |
790 iShwState = EShwPlay; |
780 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE, R_SHW_SOFTKEYS_END_PAUSE); |
791 ShowShwFurnitureL(); |
781 ShowShwFurnitureL(); |
792 } |
782 } |
793 |
783 |
794 // --------------------------------------------------------------------------- |
784 // --------------------------------------------------------------------------- |
795 // From MShwEngineObserver |
785 // From MShwEngineObserver |
796 // Engine paused callback. |
786 // Engine paused callback. |
797 // --------------------------------------------------------------------------- |
787 // --------------------------------------------------------------------------- |
798 // |
788 // |
799 void CShwSlideshowView::EnginePausedL() |
789 void CShwSlideshowView::EnginePausedL() |
800 { |
790 { |
801 TRACER("CShwSlideshowView::EnginePausedL"); |
791 TRACER("CShwSlideshowView::EnginePausedL"); |
802 GLX_LOG_INFO( "CShwSlideshowView::EnginePausedL()" ); |
792 GLX_LOG_INFO( "CShwSlideshowView::EnginePausedL()" ); |
|
793 |
803 // Cancel the backlight if it's on |
794 // Cancel the backlight if it's on |
804 if (iBackLightTimer->IsRunning()) |
795 if ( iBackLightTimer->IsRunning() ) |
805 { |
796 { |
806 iBackLightTimer->Cancel(); |
797 iBackLightTimer->Cancel(); |
807 } |
798 } |
808 if (!iUiUtility->IsExitingState() && (iShwState != EShwExiting)) |
799 |
809 { |
800 if(!iUiUtility->IsExitingState()) |
810 iShwState = EShwPause; |
801 { |
811 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_CONTINUE, |
802 iShwState = EShwPause; |
812 R_SHW_SOFTKEYS_END_PAUSE); |
803 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_CONTINUE,R_SHW_SOFTKEYS_END_PAUSE); |
813 ShowShwFurnitureL(); |
804 ShowShwFurnitureL(); |
814 } |
805 } |
815 } |
806 } |
816 |
807 |
817 // --------------------------------------------------------------------------- |
808 // --------------------------------------------------------------------------- |
818 // From MShwEngineObserver |
809 // From MShwEngineObserver |
819 // Engine resumed callback. |
810 // Engine resumed callback. |
820 // --------------------------------------------------------------------------- |
811 // --------------------------------------------------------------------------- |
821 // |
812 // |
822 void CShwSlideshowView::EngineResumedL() |
813 void CShwSlideshowView::EngineResumedL() |
823 { |
814 { |
824 TRACER("CShwSlideshowView::EngineResumedL"); |
815 TRACER("CShwSlideshowView::EngineResumedL"); |
825 GLX_LOG_INFO( "CShwSlideshowView::EngineResumedL" ); |
816 GLX_LOG_INFO( "CShwSlideshowView::EngineResumedL" ); |
826 iEngine->GetMusicVolumeL(); |
817 iEngine->GetMusicVolumeL(); |
827 // Re-enable the backlight if it's off |
818 // Re-enable the backlight if it's off |
828 if (!iBackLightTimer->IsRunning()) |
819 if ( !iBackLightTimer->IsRunning() ) |
829 { |
820 { |
830 iBackLightTimer->StartL(); |
821 iBackLightTimer->StartL(); |
831 } |
822 } |
832 if (iShwState != EShwExiting) |
823 iShwState = EShwPlay; |
833 { |
824 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE,R_SHW_SOFTKEYS_END_CONTINUE); |
834 iShwState = EShwPlay; |
825 ShowShwFurnitureL(); |
835 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE, |
826 } |
836 R_SHW_SOFTKEYS_END_CONTINUE); |
|
837 ShowShwFurnitureL(); |
|
838 } |
|
839 } |
|
840 // --------------------------------------------------------------------------- |
827 // --------------------------------------------------------------------------- |
841 // From MShwEngineObserver |
828 // From MShwEngineObserver |
842 // Engine LSK Pressed |
829 // Engine LSK Pressed |
843 // --------------------------------------------------------------------------- |
830 // --------------------------------------------------------------------------- |
844 // |
831 // |
1022 // Create a copy of the media list using the path and the play direction |
1009 // Create a copy of the media list using the path and the play direction |
1023 RDesReadStream stream( aData ); |
1010 RDesReadStream stream( aData ); |
1024 CleanupClosePushL( stream ); |
1011 CleanupClosePushL( stream ); |
1025 stream.ReadInt32L(); |
1012 stream.ReadInt32L(); |
1026 |
1013 |
|
1014 |
1027 //Get the play direction. |
1015 //Get the play direction. |
|
1016 |
1028 CShwSettingsModel* shwSettingsMdl = CShwSettingsModel::NewL(); |
1017 CShwSettingsModel* shwSettingsMdl = CShwSettingsModel::NewL(); |
1029 CleanupStack::PushL(shwSettingsMdl); |
1018 CleanupStack::PushL( shwSettingsMdl ); |
1030 iPlayDirection |
1019 iPlayDirection = static_cast< NShwSlideshow:: |
1031 = static_cast<NShwSlideshow::TPlayDirection> (shwSettingsMdl->PlayOrderL()); |
1020 TPlayDirection>(shwSettingsMdl->PlayOrderL()); |
1032 CleanupStack::PopAndDestroy( shwSettingsMdl ); |
1021 CleanupStack::PopAndDestroy( shwSettingsMdl ); |
|
1022 |
|
1023 |
1033 |
1024 |
1034 // Retrieve the path |
1025 // Retrieve the path |
1035 iCollectionPath = CMPXCollectionPath::NewL(); |
1026 iCollectionPath = CMPXCollectionPath::NewL(); |
1036 iCollectionPath->InternalizeL( stream ); |
1027 iCollectionPath->InternalizeL( stream ); |
1037 // Create the media list from the path |
1028 // Create the media list from the path |
1059 // SetListFocusL. |
1050 // SetListFocusL. |
1060 // ----------------------------------------------------------------------------- |
1051 // ----------------------------------------------------------------------------- |
1061 void CShwSlideshowView::SetListFocusL() |
1052 void CShwSlideshowView::SetListFocusL() |
1062 { |
1053 { |
1063 TRACER("CShwSlideshowView::SetListFocusL"); |
1054 TRACER("CShwSlideshowView::SetListFocusL"); |
1064 GLX_LOG_INFO("CShwSlideshowView::SetListFocusL"); |
1055 GLX_LOG_INFO( "CShwSlideshowView::SetListFocusL" ); |
1065 // Ensure that we start the slideshow from the correct image index: |
1056 // Ensure that we start the slideshow from the correct image index: |
1066 // if there are any selected images we always start from the first one, |
1057 // if there are any selected images we always start from the first one, |
1067 // otherwise we try to use the item with focus from the unfiltered list |
1058 // otherwise we try to use the item with focus from the unfiltered list |
1068 // so long as it hasn't been filtered out, in which case we use the first image. |
1059 // so long as it hasn't been filtered out, in which case we use the first image. |
1069 TInt selectionCount = iCollectionPath->Selection().Count(); |
1060 TInt selectionCount = iCollectionPath->Selection().Count(); |
1070 TInt focusIndex = 0; |
1061 TInt focusIndex = 0; |
1071 if (selectionCount == 0) |
1062 if ( selectionCount == 0 ) |
1072 { |
1063 { |
1073 |
|
1074 // 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 |
1075 focusIndex = iMediaList->FocusIndex(); |
1065 focusIndex = iMediaList->FocusIndex(); |
1076 GLX_LOG_INFO1("SlideshowView::SetListFocusL focusIndex(%d)", focusIndex); |
1066 const TGlxMedia& mediaItem = iMediaList->Item( focusIndex ); |
1077 |
|
1078 const TGlxMedia& mediaItem = iMediaList->Item(focusIndex); |
|
1079 // Check if this item is in the filtered list |
1067 // Check if this item is in the filtered list |
1080 TGlxIdSpaceId spaceId = iMediaList->IdSpaceId(focusIndex); |
1068 TGlxIdSpaceId spaceId = iMediaList->IdSpaceId( focusIndex ); |
1081 focusIndex = iFilteredList->Index(spaceId, mediaItem.Id()); |
1069 focusIndex = iFilteredList->Index( spaceId, mediaItem.Id() ); |
1082 if (focusIndex == KErrNotFound) |
1070 if ( focusIndex == KErrNotFound ) |
1083 { |
1071 { |
1084 focusIndex = ((iPlayDirection == NShwSlideshow::EPlayBackwards) |
1072 // it's been filtered out so just use the first item |
1085 ? 0 : iFilteredList->Count() - 1); |
1073 focusIndex = 0; |
1086 } |
1074 } |
1087 } |
1075 } |
1088 iFilteredList->SetFocusL(NGlxListDefs::EAbsolute, focusIndex); |
1076 iFilteredList->SetFocusL( NGlxListDefs::EAbsolute, focusIndex ); |
1089 } |
1077 } |
1090 |
1078 |
1091 |
1079 |
1092 // ----------------------------------------------------------------------------- |
1080 // ----------------------------------------------------------------------------- |
1093 // HandleTickL. |
1081 // HandleTickL. |
1196 iShwCba = CEikButtonGroupContainer::NewL( |
1184 iShwCba = CEikButtonGroupContainer::NewL( |
1197 CEikButtonGroupContainer::ECba, |
1185 CEikButtonGroupContainer::ECba, |
1198 CEikButtonGroupContainer::EVertical, |
1186 CEikButtonGroupContainer::EVertical, |
1199 this, R_SHW_SOFTKEYS_END_PAUSE ); |
1187 this, R_SHW_SOFTKEYS_END_PAUSE ); |
1200 iShwCba->MakeVisible(EFalse); |
1188 iShwCba->MakeVisible(EFalse); |
|
1189 //set the current active command set |
|
1190 ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE,R_SHW_SOFTKEYS_END_PAUSE); |
1201 } |
1191 } |
1202 |
1192 |
1203 // ----------------------------------------------------------------------------- |
1193 // ----------------------------------------------------------------------------- |
1204 // ReplaceCommandSetL. |
1194 // ReplaceCommandSetL. |
1205 // replaces a commandset with a new one |
1195 // replaces a commandset with a new one |
1267 // |
1260 // |
1268 void CShwSlideshowView::ProcessCommandL(TInt aCommandId) |
1261 void CShwSlideshowView::ProcessCommandL(TInt aCommandId) |
1269 { |
1262 { |
1270 TRACER("CShwSlideshowView::ProcessCommandL"); |
1263 TRACER("CShwSlideshowView::ProcessCommandL"); |
1271 GLX_LOG_INFO( "CShwSlideshowView::ProcessCommandL" ); |
1264 GLX_LOG_INFO( "CShwSlideshowView::ProcessCommandL" ); |
1272 switch (aCommandId) |
1265 switch(aCommandId) |
1273 { |
1266 { |
1274 case EShwSlideshowCmdEnd: |
1267 case EShwSlideshowCmdEnd: |
1275 case EAknSoftkeyBack: |
|
1276 case EGlxCmdResetView: |
|
1277 { |
1268 { |
1278 iShwState = EShwExiting; |
1269 iShwState = EShwExiting; |
1279 iDisplay->Roster().Hide(*iGestureControlGroup); |
1270 aCommandId = EAknSoftkeyBack; |
1280 HideShwFurniture(); |
1271 iDisplay->Roster().Hide( *iGestureControlGroup ); |
1281 if (aCommandId == EShwSlideshowCmdEnd) |
|
1282 { |
|
1283 aCommandId = EAknSoftkeyBack; |
|
1284 } |
|
1285 break; |
1272 break; |
1286 } |
1273 } |
1287 //When user presses MSK or LSK this cmd will Generated |
1274 //When user presses MSK or LSK this cmd will Generated |
1288 case EShwSlideshowCmdPause: |
1275 case EShwSlideshowCmdPause: |
1289 case EShwSlideshowCmdContinue: |
1276 case EShwSlideshowCmdContinue: |
1290 { |
1277 { |
1291 // If MSK preesed to toggle visibility of softekey |
1278 // If MSK preesed to toggle visibility of softekey |
1292 if (iMSKPressed) |
1279 if(iMSKPressed) |
1293 { |
1280 { |
1294 iMSKPressed = EFalse; |
1281 iMSKPressed = EFalse; |
1295 } |
1282 } |
1296 else if (iLSKPressed) |
1283 else if(iLSKPressed) |
1297 { |
1284 { |
1298 iLSKPressed = EFalse;// Already Handlled |
1285 iLSKPressed = EFalse;// Already Handlled |
1299 } |
1286 } |
1300 else |
1287 else |
1301 { |
1288 { |
1302 iPauseHandler->UserToggledPauseL(); |
1289 iPauseHandler->UserToggledPauseL(); |
1303 } |
1290 } |
1304 break; |
1291 break; |
1305 } |
1292 } |
|
1293 |
1306 default: |
1294 default: |
1307 { |
1295 { |
1308 break; |
1296 break; |
1309 } |
1297 } |
1310 } |
1298 } |
1551 void CShwSlideshowView::HandleHDMIDecodingEventL(THdmiDecodingStatus aStatus) |
1539 void CShwSlideshowView::HandleHDMIDecodingEventL(THdmiDecodingStatus aStatus) |
1552 { |
1540 { |
1553 TRACER("CShwSlideshowView::HandleHDMIDecodingEventL()"); |
1541 TRACER("CShwSlideshowView::HandleHDMIDecodingEventL()"); |
1554 iEngine->HandleHDMIDecodingEventL(aStatus); |
1542 iEngine->HandleHDMIDecodingEventL(aStatus); |
1555 } |
1543 } |
1556 // ------------------------------------------------------------------------------------------------- |
|
1557 // CShwSlideshowView::IsAppInForegroundL() |
|
1558 // ------------------------------------------------------------------------------------------------- |
|
1559 // |
|
1560 TBool CShwSlideshowView::IsAppInForegroundL() |
|
1561 { |
|
1562 TRACER("CShwSlideshowView::IsAppInForegroundL()"); |
|
1563 TBool ret = EFalse; |
|
1564 CArrayFixFlat<TInt>* wgList = new (ELeave) CArrayFixFlat<TInt> ( |
|
1565 iEikonEnv->WsSession().NumWindowGroups()); |
|
1566 CleanupStack::PushL(wgList); |
|
1567 if (iEikonEnv->WsSession().WindowGroupList(0, wgList) == KErrNone) |
|
1568 { |
|
1569 // Check if Photos App window group is in foreground |
|
1570 ret = (iCoeEnv->RootWin().Identifier() == wgList->At(0)); |
|
1571 GLX_LOG_INFO2("SlideshowView::IsAppInForegroundL() ret=%d, wgId=%u", |
|
1572 ret, wgList->At(0)); |
|
1573 } |
|
1574 |
|
1575 CleanupStack::PopAndDestroy(wgList); |
|
1576 return ret; |
|
1577 } |
|
1578 |
|
1579 // ------------------------------------------------------------------------------------------------- |
|
1580 // CShwSlideshowView::HandleWsEventL() |
|
1581 // WS Events handling function |
|
1582 // ------------------------------------------------------------------------------------------------- |
|
1583 // |
|
1584 void CShwSlideshowView::HandleWsEventL(const TWsEvent& aEvent, |
|
1585 CCoeControl* /*aDestination*/) |
|
1586 { |
|
1587 TRACER("CShwSlideshowView::HandleWsEventL()"); |
|
1588 TInt event = aEvent.Type(); |
|
1589 GLX_LOG_INFO1("CShwSlideshowView::HandleWsEventL() event=%d", event); |
|
1590 |
|
1591 // If we are sent to full background, shift to cloning mode |
|
1592 if ((event == KAknFullOrPartialForegroundLost) && !IsAppInForegroundL()) |
|
1593 { |
|
1594 GLX_LOG_INFO("SlideshowView::HandleWsEventL() App is in background!"); |
|
1595 if (iHdmiController && iHdmiActive) |
|
1596 { |
|
1597 iHdmiController->ShiftToCloningMode(); |
|
1598 } |
|
1599 // Something else has gained the foreground |
|
1600 iPauseHandler->SwitchToBackgroundL(); |
|
1601 } |
|
1602 } |
|