22 #include <eikbtgpc.h> // CEikButtonGroupContainer |
22 #include <eikbtgpc.h> // CEikButtonGroupContainer |
23 #include <aknViewAppUi.h> |
23 #include <aknViewAppUi.h> |
24 #include <data_caging_path_literals.hrh> // for KDC_APP_RESOURCE_DIR |
24 #include <data_caging_path_literals.hrh> // for KDC_APP_RESOURCE_DIR |
25 #include <glxcollectionpluginimageviewer.hrh> |
25 #include <glxcollectionpluginimageviewer.hrh> |
26 #include <StringLoader.h> // String Loader |
26 #include <StringLoader.h> // String Loader |
|
27 #include <AknIconUtils.h> |
|
28 #include <e32math.h> |
27 |
29 |
28 //For animation Effects |
30 //For animation Effects |
29 #include <akntranseffect.h> |
31 #include <akntranseffect.h> |
30 #include <akntransitionutils.h> |
32 #include <akntransitionutils.h> |
31 #include <alf/alflayout.h> |
33 #include <alf/alflayout.h> |
88 */ |
91 */ |
89 const TInt KPeriodicStartDelay = 250000; |
92 const TInt KPeriodicStartDelay = 250000; |
90 /** |
93 /** |
91 * Interval delay for the periodic timer, in microseconds |
94 * Interval delay for the periodic timer, in microseconds |
92 */ |
95 */ |
93 const TInt KPeriodicIntervalDelay = 100000; |
96 const TInt KPeriodicIntervalDelay = 500000; |
94 |
97 |
95 //This constant is used to calculate the index of the item for which texture has to removed. |
98 //This constant is used to calculate the index of the item for which texture has to removed. |
96 //6 = 5(iterator value in forward or backward direction for fullscreen) + 1(focus index) |
99 //6 = 5(iterator value in forward or backward direction for fullscreen) + 1(focus index) |
97 const TInt KFullScreenIterator = 3; |
100 const TInt KFullScreenIterator = 3; |
98 //Constant which says maximum number of fullscreen textures that we have have at a time. |
101 //Constant which says maximum number of fullscreen textures that we have have at a time. |
99 //11 = (5(5 fullscreen texture backwards)+1(fucus index texture)+5(5 fullscreen texture forwards)) |
102 //11 = (5(5 fullscreen texture backwards)+1(fucus index texture)+5(5 fullscreen texture forwards)) |
100 const TInt KFullScreenTextureOffset = 5; |
103 const TInt KFullScreenTextureOffset = 5; |
|
104 const TInt KGlxDecodingThreshold = 3000000; // pixels |
101 |
105 |
102 _LIT( KTfxResourceActivateFullScreen, "z:\\resource\\effects\\photos_fullscreen_open.fxml" ); |
106 _LIT( KTfxResourceActivateFullScreen, "z:\\resource\\effects\\photos_fullscreen_open.fxml" ); |
103 |
107 |
104 // ======== MEMBER FUNCTIONS ======== |
108 // ======== MEMBER FUNCTIONS ======== |
105 |
109 |
321 } |
328 } |
322 //destroy and close navistate and navipath |
329 //destroy and close navistate and navipath |
323 CleanupStack::PopAndDestroy( naviState ); |
330 CleanupStack::PopAndDestroy( naviState ); |
324 CleanupStack::PopAndDestroy( navigationalState ); |
331 CleanupStack::PopAndDestroy( navigationalState ); |
325 |
332 |
|
333 iScrnSize = iUiUtility->DisplaySize(); |
|
334 iGridIconSize = iUiUtility->GetGridIconSize(); |
|
335 |
326 //Create hdmicontroller when it is only launched from fullscreen. |
336 //Create hdmicontroller when it is only launched from fullscreen. |
327 //From filemanager show only clone mode. |
337 //From filemanager show only clone mode. |
328 if( !iImgViewerMode ) |
338 if( !iImgViewerMode ) |
329 { |
339 { |
330 iHdmiController = CGlxHdmiController::NewL(); |
340 iHdmiController = CGlxHdmiController::NewL(); |
688 autoZoomOut = EFalse; |
698 autoZoomOut = EFalse; |
689 } |
699 } |
690 |
700 |
691 iHdmiController->ActivateZoom(autoZoomOut); |
701 iHdmiController->ActivateZoom(autoZoomOut); |
692 } |
702 } |
693 iZoomControl->ActivateL(GetInitialZoomLevel(),aStartMode, focus, |
703 if (aStartMode == EZoomStartSlider) |
|
704 { |
|
705 iZoomControl->ActivateL(iSliderModel->PrimaryValue(),aStartMode, focus, |
694 item, apZoomFocus,iImgViewerMode); |
706 item, apZoomFocus,iImgViewerMode); |
|
707 } |
|
708 else |
|
709 { |
|
710 iZoomControl->ActivateL(GetInitialZoomLevel(),aStartMode, focus, |
|
711 item, apZoomFocus,iImgViewerMode); |
|
712 } |
695 // Now to remove all textures other than the one we are focussing on. |
713 // Now to remove all textures other than the one we are focussing on. |
696 TInt count = iMediaList->Count(); |
714 TInt count = iMediaList->Count(); |
697 while (count > 0) |
715 while (count > 0) |
698 { |
716 { |
699 TGlxMedia mediaItem = iMediaList->Item(count-1); |
717 TGlxMedia mediaItem = iMediaList->Item(count-1); |
1147 TInt focus = iMediaList->FocusIndex(); |
1175 TInt focus = iMediaList->FocusIndex(); |
1148 TGlxMedia item = iMediaList->Item( focus ); |
1176 TGlxMedia item = iMediaList->Item( focus ); |
1149 TSize size; |
1177 TSize size; |
1150 TUint8 initialZoomLevel; |
1178 TUint8 initialZoomLevel; |
1151 item.GetDimensions( size ); |
1179 item.GetDimensions( size ); |
|
1180 if (KGlxDecodingThreshold < (size.iWidth * size.iHeight)) |
|
1181 { |
|
1182 TReal areaRatio = TReal(size.iWidth*size.iHeight)/KGlxDecodingThreshold ; |
|
1183 |
|
1184 TReal sideRatio; |
|
1185 Math::Sqrt(sideRatio, areaRatio); |
|
1186 |
|
1187 size.iHeight = size.iHeight / sideRatio ; |
|
1188 size.iWidth = size.iWidth / sideRatio ; |
|
1189 } |
1152 TRect rect = AlfUtil::ScreenSize(); |
1190 TRect rect = AlfUtil::ScreenSize(); |
1153 |
1191 |
1154 if( rect.Width()>= size.iWidth && rect.Height() >= size.iHeight) |
1192 if( rect.Width()>= size.iWidth && rect.Height() >= size.iHeight) |
1155 { |
1193 { |
1156 //if Both the Width and Height are lesser than the screen size,the initial Zoom Level will be 100 |
1194 //if Both the Width and Height are lesser than the screen size,the initial Zoom Level will be 100 |
1262 // ----------------------------------------------------------------------------- |
1300 // ----------------------------------------------------------------------------- |
1263 // |
1301 // |
1264 inline void CGlxFullScreenViewImp::CallPeriodicCallback() |
1302 inline void CGlxFullScreenViewImp::CallPeriodicCallback() |
1265 { |
1303 { |
1266 TRACER("CGlxFullScreenViewImp::CallPeriodicCallback"); |
1304 TRACER("CGlxFullScreenViewImp::CallPeriodicCallback"); |
1267 TRAP_IGNORE(ShowDrmExpiaryNoteL()); |
1305 TRAP_IGNORE(ShowDrmExpiryNoteL()); |
1268 } |
1306 } |
1269 |
1307 |
1270 // --------------------------------------------------------------------------- |
1308 // --------------------------------------------------------------------------- |
1271 // Shows expiry note / Consumes DRM rights for expired DRM files |
1309 // Shows expiry note / Consumes DRM rights for expired DRM files |
1272 // --------------------------------------------------------------------------- |
1310 // --------------------------------------------------------------------------- |
1273 // |
1311 // |
1274 void CGlxFullScreenViewImp::ShowDrmExpiaryNoteL() |
1312 void CGlxFullScreenViewImp::ShowDrmExpiryNoteL() |
1275 { |
1313 { |
1276 TRACER("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL"); |
1314 TRACER("CGlxFullScreenViewImp::ShowDrmExpiryNoteL"); |
1277 if (iMediaList->Count() > 0) |
1315 if (iMediaList->Count() > 0) |
1278 { |
1316 { |
1279 const TGlxMedia& media = iMediaList->Item(iMediaList->FocusIndex()); |
1317 const TGlxMedia& media = iMediaList->Item(iMediaList->FocusIndex()); |
1280 TInt tnError = GlxErrorManager::HasAttributeErrorL( |
1318 TInt tnError = GlxErrorManager::HasAttributeErrorL( |
1281 media.Properties(), KGlxMediaIdThumbnail); |
1319 media.Properties(), KGlxMediaIdThumbnail); |
1282 GLX_LOG_INFO1("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL()" |
1320 GLX_LOG_INFO1("CGlxFullScreenViewImp::ShowDrmExpiryNoteL()" |
1283 " tnError=%d ", tnError); |
1321 " tnError=%d ", tnError); |
1284 |
1322 |
1285 if (media.IsDrmProtected()) |
1323 if (media.IsDrmProtected()) |
1286 { |
1324 { |
1287 GLX_LOG_INFO("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL()" |
1325 GLX_LOG_INFO("CGlxFullScreenViewImp::ShowDrmExpiryNoteL()" |
1288 "- ConsumeDRMRightsL()"); |
1326 "- ConsumeDRMRightsL()"); |
|
1327 //Consume DRM Rights & cancel Periodic timer for DRM images |
|
1328 //only if Quality TN is available |
1289 ConsumeDRMRightsL(media); |
1329 ConsumeDRMRightsL(media); |
1290 } |
1330 } |
1291 |
1331 else |
1292 if (tnError == KErrNone) |
1332 { |
1293 { |
1333 //Cancel the periodic timer if quality thumbnail is available |
1294 if (iPeriodic->IsActive()) |
1334 //and no error in fetching quality thumbnail. |
1295 { |
1335 TSize tnSize = iUiUtility->DisplaySize(); |
1296 iPeriodic->Cancel(); |
1336 TMPXAttribute qtyTnAttrib = TMPXAttribute(KGlxMediaIdThumbnail, |
1297 } |
1337 GlxFullThumbnailAttributeId(ETrue, tnSize.iWidth, |
1298 } |
1338 tnSize.iHeight)); |
1299 |
1339 const CGlxThumbnailAttribute* qtyTn = media.ThumbnailAttribute( |
|
1340 qtyTnAttrib); |
|
1341 if (qtyTn && tnError == KErrNone) |
|
1342 { |
|
1343 if (iPeriodic->IsActive()) |
|
1344 { |
|
1345 iPeriodic->Cancel(); |
|
1346 } |
|
1347 } |
|
1348 } |
|
1349 |
|
1350 //check if any Error message is to be displayed |
1300 TMPXGeneralCategory cat = media.Category(); |
1351 TMPXGeneralCategory cat = media.Category(); |
1301 TBool checkViewRights = (cat == EMPXImage); |
1352 TBool checkViewRights = (cat == EMPXImage); |
1302 if (iDrmUtility->ItemRightsValidityCheckL(media.Uri(), |
1353 if (iDrmUtility->ItemRightsValidityCheckL(media.Uri(), |
1303 checkViewRights) && tnError != KErrNone) |
1354 checkViewRights) && tnError != KErrNone) |
1304 { |
1355 { |
1312 CleanupClosePushL(*navigationalState); |
1363 CleanupClosePushL(*navigationalState); |
1313 CMPXCollectionPath* naviState = navigationalState->StateLC(); |
1364 CMPXCollectionPath* naviState = navigationalState->StateLC(); |
1314 if (naviState->Id() == TMPXItemId( |
1365 if (naviState->Id() == TMPXItemId( |
1315 KGlxCollectionPluginImageViewerImplementationUid)) |
1366 KGlxCollectionPluginImageViewerImplementationUid)) |
1316 { |
1367 { |
1317 GLX_LOG_INFO("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL()" |
1368 GLX_LOG_INFO("CGlxFullScreenViewImp::ShowDrmExpiryNoteL()" |
1318 "- ShowErrorNoteL()"); |
1369 "- ShowErrorNoteL()"); |
1319 GlxGeneralUiUtilities::ShowErrorNoteL(tnError); |
1370 GlxGeneralUiUtilities::ShowErrorNoteL(tnError); |
1320 } |
1371 } |
1321 CleanupStack::PopAndDestroy(naviState); |
1372 CleanupStack::PopAndDestroy(naviState); |
1322 CleanupStack::PopAndDestroy(navigationalState); |
1373 CleanupStack::PopAndDestroy(navigationalState); |
1474 } |
1525 } |
1475 |
1526 |
1476 TGlxMedia item = iMediaList->Item(focusIndex); |
1527 TGlxMedia item = iMediaList->Item(focusIndex); |
1477 TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(), |
1528 TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(), |
1478 KGlxMediaIdThumbnail); |
1529 KGlxMediaIdThumbnail); |
1479 |
1530 GLX_LOG_INFO1("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi - error=%d", error); |
1480 // Item will be supported by HDMI ONLY if |
1531 // Item will be supported by HDMI ONLY if |
1481 // it is not a video |
1532 // it is not a video |
1482 // and it has valid DRM Viewing rights |
1533 // and it has valid DRM Viewing rights |
1483 // and it has no attribute error |
1534 // and it has no attribute error |
1484 if ( (item.Category() != EMPXVideo) |
1535 if ( (item.Category() != EMPXVideo) |
1485 && iDrmUtility->ItemRightsValidityCheckL(item.Uri(), ETrue) |
1536 && iDrmUtility->ItemRightsValidityCheckL(item.Uri(), ETrue) |
1486 && (error == KErrNone) ) |
1537 && (error == KErrNone) ) |
1487 { |
1538 { |
1488 GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi - Setting the Image"); |
1539 GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi - Fetch FS thumbnail"); |
1489 iHdmiController->SetImageL(item.Uri()); |
1540 TMPXAttribute fsTnAttrib = TMPXAttribute(KGlxMediaIdThumbnail, |
|
1541 GlxFullThumbnailAttributeId(ETrue, iScrnSize.iWidth, |
|
1542 iScrnSize.iHeight)); |
|
1543 const CGlxThumbnailAttribute* fsValue = item.ThumbnailAttribute( |
|
1544 fsTnAttrib); |
|
1545 if (fsValue) |
|
1546 { |
|
1547 GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi - Setting FS Bitmap"); |
|
1548 CFbsBitmap* fsBitmap = new (ELeave) CFbsBitmap; |
|
1549 CleanupStack::PushL(fsBitmap); |
|
1550 fsBitmap->Duplicate( fsValue->iBitmap->Handle()); |
|
1551 |
|
1552 GLX_LOG_INFO2("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi - FS Bitmap Size width=%d, height=%d", |
|
1553 fsBitmap->SizeInPixels().iWidth, fsBitmap->SizeInPixels().iHeight); |
|
1554 iHdmiController->SetImageL(item.Uri(),fsBitmap); |
|
1555 CleanupStack::PopAndDestroy(fsBitmap); |
|
1556 } |
|
1557 else |
|
1558 { |
|
1559 GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi - Fetch Grid thumbnail"); |
|
1560 TMPXAttribute gridTnAttrib = TMPXAttribute(KGlxMediaIdThumbnail, |
|
1561 GlxFullThumbnailAttributeId(ETrue, iGridIconSize.iWidth, |
|
1562 iGridIconSize.iHeight)); |
|
1563 const CGlxThumbnailAttribute* gridvalue = item.ThumbnailAttribute( |
|
1564 gridTnAttrib); |
|
1565 |
|
1566 if (gridvalue) |
|
1567 { |
|
1568 GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi - Setting Grid Bitmap"); |
|
1569 CFbsBitmap* gridBitmap = new (ELeave) CFbsBitmap; |
|
1570 CleanupStack::PushL(gridBitmap); |
|
1571 gridBitmap->Duplicate( gridvalue->iBitmap->Handle()); |
|
1572 |
|
1573 GLX_LOG_INFO2("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi - gridBitmap Size width=%d, height=%d", |
|
1574 gridBitmap->SizeInPixels().iWidth, gridBitmap->SizeInPixels().iHeight); |
|
1575 iHdmiController->SetImageL(item.Uri(),gridBitmap); |
|
1576 CleanupStack::PopAndDestroy(gridBitmap); |
|
1577 } |
|
1578 else |
|
1579 { |
|
1580 GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi - Setting Default Bitmap"); |
|
1581 TFileName resFile(KDC_APP_BITMAP_DIR); |
|
1582 resFile.Append(KGlxIconsFilename); |
|
1583 CFbsBitmap* defaultBitmap = new (ELeave) CFbsBitmap; |
|
1584 CleanupStack::PushL(defaultBitmap); |
|
1585 defaultBitmap = AknIconUtils::CreateIconL(resFile, |
|
1586 EMbmGlxiconsQgn_prop_image_notcreated); |
|
1587 GLX_LOG_INFO2("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi - Default Size width=%d, height=%d", |
|
1588 defaultBitmap->SizeInPixels().iWidth, defaultBitmap->SizeInPixels().iHeight); |
|
1589 iHdmiController->SetImageL(item.Uri(),defaultBitmap); |
|
1590 CleanupStack::PopAndDestroy(defaultBitmap); |
|
1591 } |
|
1592 } |
1490 } |
1593 } |
1491 else |
1594 else |
1492 { |
1595 { |
1493 GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - Unsupported Item"); |
1596 GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - Unsupported Item"); |
1494 //Set the external display to cloning mode if |
1597 //Set the external display to cloning mode if |
1538 // |
1641 // |
1539 // --------------------------------------------------------------------------- |
1642 // --------------------------------------------------------------------------- |
1540 void CGlxFullScreenViewImp::HandleMMCRemovalL() |
1643 void CGlxFullScreenViewImp::HandleMMCRemovalL() |
1541 { |
1644 { |
1542 TRACER("CGlxFullScreenViewImp::HandleMMCRemovalL()"); |
1645 TRACER("CGlxFullScreenViewImp::HandleMMCRemovalL()"); |
1543 if(iZoomControl && iZoomControl->Activated()) |
1646 iIsMMCRemoved = ETrue; |
1544 { |
1647 if(!iIsDialogLaunched) |
1545 SetSliderLevel(); |
1648 { |
1546 DeactivateZoomControlL(); |
1649 if(iZoomControl && iZoomControl->Activated()) |
1547 } |
1650 { |
1548 ProcessCommandL(EAknSoftkeyExit); |
1651 SetSliderLevel(); |
|
1652 DeactivateZoomControlL(); |
|
1653 } |
|
1654 ProcessCommandL(EAknSoftkeyExit); |
|
1655 } |
1549 } |
1656 } |
1550 |
1657 |
1551 // --------------------------------------------------------------------------- |
1658 // --------------------------------------------------------------------------- |
1552 // EnableFSToolbarL |
1659 // EnableFSToolbarL |
1553 // |
1660 // |