photosgallery/slideshow/view/src/shwslideshowview.cpp
branchRCL_3
changeset 12 ce1c7ad1f18b
parent 11 71da52165949
child 13 bcb43dc84c44
equal deleted inserted replaced
11:71da52165949 12:ce1c7ad1f18b
   122 //
   122 //
   123 CShwSlideshowView::~CShwSlideshowView()
   123 CShwSlideshowView::~CShwSlideshowView()
   124     {
   124     {
   125     TRACER("CShwSlideshowView::~CShwSlideshowView");
   125     TRACER("CShwSlideshowView::~CShwSlideshowView");
   126   	GLX_LOG_INFO( "CShwSlideshowView::~CShwSlideshowView()" );
   126   	GLX_LOG_INFO( "CShwSlideshowView::~CShwSlideshowView()" );
   127     
   127   	iHarvesterClient.Close();
   128     // delete media list population call back
   128     // delete media list population call back
   129     delete iPopulateListCallBack;
   129     delete iPopulateListCallBack;
   130     
   130     
   131     // delete engine async starter
   131     // delete engine async starter
   132     delete iAsyncCallBack;
   132     delete iAsyncCallBack;
   312     BaseConstructL( R_SHW_SLIDESHOW_PLAY_VIEW );
   312     BaseConstructL( R_SHW_SLIDESHOW_PLAY_VIEW );
   313     
   313     
   314 	// Glx view base construction
   314 	// Glx view base construction
   315     ViewBaseConstructL();
   315     ViewBaseConstructL();
   316     
   316     
       
   317 	TInt err = iHarvesterClient.Connect();
       
   318 	GLX_LOG_INFO1("iHarvesterClient.Connect() err = %d",err);
       
   319 	if(err == KErrNone)
       
   320 		{
       
   321         iHarvesterClient.AddHarvesterEventObserver(*this, EHEObserverTypeMMC, 1000);
       
   322 		}
   317     // Create async engine starter with standard priority
   323     // Create async engine starter with standard priority
   318 	iAsyncCallBack = new( ELeave ) CAsyncCallBack( CActive::EPriorityStandard );
   324 	iAsyncCallBack = new( ELeave ) CAsyncCallBack( CActive::EPriorityStandard );
   319 
   325 
   320     // Create the back light timer
   326     // Create the back light timer
   321     iBackLightTimer = CShwSlideshowBackLightTimer::NewL();
   327     iBackLightTimer = CShwSlideshowBackLightTimer::NewL();
   353     // set the callback for the media list population
   359     // set the callback for the media list population
   354     iPopulateListCallBack->Set(
   360     iPopulateListCallBack->Set(
   355         TShwCallBack< CShwSlideshowView, PopulateListL >( this ) );
   361         TShwCallBack< CShwSlideshowView, PopulateListL >( this ) );
   356     iMSKPressed = EFalse;
   362     iMSKPressed = EFalse;
   357     iLSKPressed = EFalse;
   363     iLSKPressed = EFalse;
   358     
       
   359     //Get the HgContextUtility instance
       
   360 //    iContextUtility = iUiUtility->ContextUtility();
       
   361     
       
   362     }
   364     }
   363    
   365    
   364 // ---------------------------------------------------------------------------
   366 // ---------------------------------------------------------------------------
   365 // From CAknView
   367 // From CAknView
   366 // Returns views id.
   368 // Returns views id.
   422 		}	
   424 		}	
   423 	iHdmiActive = EFalse;
   425 	iHdmiActive = EFalse;
   424     // reset failure flag
   426     // reset failure flag
   425     iEngineStartFailed = EFalse;
   427     iEngineStartFailed = EFalse;
   426 
   428 
   427     iHdmiController = CGlxHdmiController::NewL();
   429 	if(!iHdmiController)
       
   430 		{
       
   431 	    iHdmiController = CGlxHdmiController::NewL();
       
   432 		}
   428     // Engine related construction
   433     // Engine related construction
   429     // Instantiate the slideshow engine, with this class as its observer
   434     // Instantiate the slideshow engine, with this class as its observer
   430     __ASSERT_DEBUG( !iEngine, Panic( EGlxPanicAlreadyInitialised ) );
   435     __ASSERT_DEBUG( !iEngine, Panic( EGlxPanicAlreadyInitialised ) );
   431     iEngine = CShwSlideshowEngine::NewL( *this );
   436     iEngine = CShwSlideshowEngine::NewL( *this );
   432 
   437 
   647             {
   652             {
   648             if(iFilteredList->Count() > KSlideShowTextureOffset)
   653             if(iFilteredList->Count() > KSlideShowTextureOffset)
   649                 {
   654                 {
   650                 RemoveTexture();
   655                 RemoveTexture();
   651                 }
   656                 }
   652             SetImageL();
   657             SetItemToHDMIL();
   653             }    
   658             }    
   654 	    }
   659 	    }
   655     }
   660     }
   656 	
   661 	
   657 // ---------------------------------------------------------------------------
   662 // ---------------------------------------------------------------------------
   725         {
   730         {
   726         // cancel the progress bar
   731         // cancel the progress bar
   727         iWaitDialog->ProcessFinishedL();
   732         iWaitDialog->ProcessFinishedL();
   728         }
   733         }
   729     iShwState = EShwPlay;
   734     iShwState = EShwPlay;
   730     SetImageL();
   735     SetItemToHDMIL();
   731 	iHdmiActive = ETrue;
   736 	iHdmiActive = ETrue;
   732     ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE,R_SHW_SOFTKEYS_END_PAUSE);
   737     ReplaceCommandSetL(R_SHW_SOFTKEYS_END_PAUSE,R_SHW_SOFTKEYS_END_PAUSE);
   733     ShowShwFurnitureL();
   738     ShowShwFurnitureL();
   734     }
   739     }
   735     
   740     
   938     TRACER("CShwSlideshowView::SetupScreenFurnitureL");
   943     TRACER("CShwSlideshowView::SetupScreenFurnitureL");
   939   	GLX_LOG_INFO( "CShwSlideshowView::SetupScreenFurnitureL" );
   944   	GLX_LOG_INFO( "CShwSlideshowView::SetupScreenFurnitureL" );
   940     // Create the soft keys
   945     // Create the soft keys
   941     // Left (bottom in landscape orientation)
   946     // Left (bottom in landscape orientation)
   942     HBufC* softKeyTextLeft = StringLoader::LoadLC( R_SHW_SOFTKEY_LEFT );
   947     HBufC* softKeyTextLeft = StringLoader::LoadLC( R_SHW_SOFTKEY_LEFT );
   943     // SetSoftKeyL takes ownership of softKeyText
       
   944     //SetSoftkeyL( EGlxLeftSoftkey,  EShwSlideshowCmdContinue, softKeyTextLeft );
       
   945     CleanupStack::Pop( softKeyTextLeft );
   948     CleanupStack::Pop( softKeyTextLeft );
   946     // Right (top in landscape orientation)
   949     // Right (top in landscape orientation)
   947     HBufC* softKeyTextRight = StringLoader::LoadLC( R_SHW_SOFTKEY_RIGHT );
   950     HBufC* softKeyTextRight = StringLoader::LoadLC( R_SHW_SOFTKEY_RIGHT );
   948     // SetSoftKeyL takes ownership of softKeyText
       
   949     //SetSoftkeyL( EGlxRightSoftkey,  EAknSoftkeyBack, softKeyTextRight );
       
   950     CleanupStack::Pop( softKeyTextRight );
   951     CleanupStack::Pop( softKeyTextRight );
   951     
   952     
   952     }
   953     }
   953 
   954 
   954 // -----------------------------------------------------------------------------
   955 // -----------------------------------------------------------------------------
  1027             // it's been filtered out so just use the first item
  1028             // it's been filtered out so just use the first item
  1028             focusIndex = 0;
  1029             focusIndex = 0;
  1029             }
  1030             }
  1030         }
  1031         }
  1031     iFilteredList->SetFocusL( NGlxListDefs::EAbsolute, focusIndex );
  1032     iFilteredList->SetFocusL( NGlxListDefs::EAbsolute, focusIndex );
  1032 //    iContextUtility->PublishPhotoContextL(item.Uri());
       
  1033     }
  1033     }
  1034 
  1034 
  1035 
  1035 
  1036 // -----------------------------------------------------------------------------
  1036 // -----------------------------------------------------------------------------
  1037 // HandleTickL.
  1037 // HandleTickL.
  1256 	}
  1256 	}
  1257 // ----------------------------------------------------------------------------- 
  1257 // ----------------------------------------------------------------------------- 
  1258 // Set the image to external display - HDMI
  1258 // Set the image to external display - HDMI
  1259 // -----------------------------------------------------------------------------
  1259 // -----------------------------------------------------------------------------
  1260 //
  1260 //
  1261 void CShwSlideshowView::SetImageL()
  1261 void CShwSlideshowView::SetItemToHDMIL()
  1262     {
  1262     {
  1263     TRACER("CShwSlideshowView::SetImageL() - CGlxHDMI");
  1263     TRACER("CShwSlideshowView::SetImageToHDMIL() ");
  1264     TGlxMedia item = iFilteredList->Item(iFilteredList->FocusIndex());
  1264 
  1265     TInt frameCount(0);
  1265     TInt focusIndex = iFilteredList->FocusIndex();
  1266     TSize orignalSize;
  1266 
  1267     TBool aFramesPresent = item.GetFrameCount(frameCount);
  1267     // If we dont know what item we are focussing on 
  1268     TBool adimension = item.GetDimensions(orignalSize);
  1268     // or if our filtered list is empty
       
  1269     // or if HDMI is not connected 
       
  1270     // or if there is no HDMI Controller at all 
       
  1271     // then dont SetImageToHDMI :)  
       
  1272     if( ( KErrNotFound == focusIndex)
       
  1273             || (0 == iFilteredList->Count())
       
  1274             || (NULL == iHdmiController)
       
  1275             || (!iHdmiController->IsHDMIConnected())) 
       
  1276         {
       
  1277         GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - Cant Set Image To HDMI");
       
  1278         return;
       
  1279         }
       
  1280     
       
  1281     TGlxMedia item = iFilteredList->Item(focusIndex);
  1269     TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(),
  1282     TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(),
  1270             KGlxMediaIdThumbnail);
  1283         KGlxMediaIdThumbnail);
  1271     if (error == KErrNone)
  1284     
  1272         {
  1285     // Item will be supported by HDMI ONLY if
  1273         GLX_LOG_INFO("CShwSlideshowView::SetImageL() - CGlxHDMI call SetImageL");
  1286     // it is not a video
       
  1287     // and it has no attribute error 
       
  1288     if ( (item.Category() != EMPXVideo) 
       
  1289             && (error == KErrNone) )
       
  1290         {
       
  1291         GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - Setting the Image");
       
  1292         TInt frameCount(0);
       
  1293         TSize orignalSize;
       
  1294         item.GetFrameCount(frameCount);
       
  1295         item.GetDimensions(orignalSize);
  1274         iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount);
  1296         iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount);
  1275         }
  1297         }
  1276     else
  1298     else
  1277         {
  1299         {
  1278         GLX_LOG_INFO1("CShwSlideshowView::SetImageL() - CGlxHDMI IsVideo , err=%d",error);
  1300         GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - Unsupported Item");
  1279         //Set the external display to cloning mode.
  1301         //Set the external display to cloning mode if
  1280         //If the current item is a video, corruted thumbnail
  1302         //the current item is something we wont support (e.g. video, corrupted item);
  1281         iHdmiController->IsVideo();
  1303         iHdmiController->ItemNotSupported();
  1282         }
  1304         }
  1283     }
  1305     }
  1284 // ---------------------------------------------------------------------------
  1306 // ---------------------------------------------------------------------------
  1285 // 
  1307 // 
  1286 // Gets the index of the item for which the texture has to be removed
  1308 // Gets the index of the item for which the texture has to be removed
  1320     {
  1342     {
  1321     TRACER("CShwSlideshowView::RemoveTexture");
  1343     TRACER("CShwSlideshowView::RemoveTexture");
  1322     const TGlxMedia& item = iFilteredList->Item(GetIndexToBeRemoved());
  1344     const TGlxMedia& item = iFilteredList->Item(GetIndexToBeRemoved());
  1323     iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse);
  1345     iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse);
  1324     }
  1346     }
       
  1347 
       
  1348 // ---------------------------------------------------------------------------
       
  1349 // HarvestingUpdated
       
  1350 // 
       
  1351 // ---------------------------------------------------------------------------
       
  1352 //
       
  1353 void CShwSlideshowView::HarvestingUpdated( 
       
  1354                 HarvesterEventObserverType HarvestingUpdated, 
       
  1355                 HarvesterEventState aHarvesterEventState,
       
  1356                 TInt aItemsLeft )
       
  1357     {
       
  1358     TRACER("CShwSlideshowView::HarvestingUpdated()");
       
  1359     if(HarvestingUpdated == EHEObserverTypeMMC)
       
  1360         {
       
  1361         ProcessCommandL(EAknSoftkeyClose);
       
  1362         }
       
  1363     }