photosgallery/slideshow/view/src/shwslideshowview.cpp
branchRCL_3
changeset 25 191387a8b767
parent 18 bcb43dc84c44
child 30 a60acebbbd9d
equal deleted inserted replaced
22:2dac0fdba72b 25:191387a8b767
    65 #include "shwviewtimer.h"
    65 #include "shwviewtimer.h"
    66 #include "shwmediakeyshandler.h"
    66 #include "shwmediakeyshandler.h"
    67 #include <glxtexturemanager.h>
    67 #include <glxtexturemanager.h>
    68 #include <glxerrormanager.h>             
    68 #include <glxerrormanager.h>             
    69 #include <glxthumbnailattributeinfo.h>   
    69 #include <glxthumbnailattributeinfo.h>   
       
    70 #include <glxicons.mbg>
       
    71 #include <AknIconUtils.h>
       
    72 #include <glxuistd.h>
       
    73 
    70 namespace
    74 namespace
    71     {
    75     {
    72     _LIT(KShwSlideshowViewResource,"shwslideshowview.rsc");
    76     _LIT(KShwSlideshowViewResource,"shwslideshowview.rsc");
    73     const TInt KShwDefaultDelayMicroSeconds = 5000000;	// 5s
    77     const TInt KShwDefaultDelayMicroSeconds = 5000000;	// 5s
    74     const TInt KVolumeControlGroupId = 1;
    78     const TInt KVolumeControlGroupId = 1;
   199     CleanupStack::PopAndDestroy( title );
   203     CleanupStack::PopAndDestroy( title );
   200 
   204 
   201 	// Show the dialog, we show it non blocking so no use for the return value
   205 	// Show the dialog, we show it non blocking so no use for the return value
   202 	iWaitDialog->RunLD();
   206 	iWaitDialog->RunLD();
   203 	// set the callback to be engine start
   207 	// set the callback to be engine start
   204 	iAsyncCallBack->Set( 
   208     iAsyncCallBack->Set(TShwCallBack<CShwSlideshowView,
   205 	    TShwCallBack< CShwSlideshowView, StartEngineL >( this ) );
   209             &CShwSlideshowView::StartEngineL> (this));
   206     // if both lists are ready
   210     // if both lists are ready
   207     if( iInputListReady && iPlayListReady )
   211     if( iInputListReady && iPlayListReady )
   208         {
   212         {
   209     	// make the async callback, this will end up calling StartEngineL()
   213     	// make the async callback, this will end up calling StartEngineL()
   210     	// in CAsyncCallback::RunL once the scheduler next time runs.
   214     	// in CAsyncCallback::RunL once the scheduler next time runs.
   323     // Create the back light timer
   327     // Create the back light timer
   324     iBackLightTimer = CShwSlideshowBackLightTimer::NewL();
   328     iBackLightTimer = CShwSlideshowBackLightTimer::NewL();
   325     
   329     
   326 	iEnv = iUiUtility->Env();
   330 	iEnv = iUiUtility->Env();
   327    	iDisplay = iUiUtility->Display();
   331    	iDisplay = iUiUtility->Display();
   328 
   332    	iScrnSize = iUiUtility->DisplaySize();
       
   333    	iGridIconSize = iUiUtility->GetGridIconSize();
       
   334    	
   329     // Construct the volume control
   335     // Construct the volume control
   330     iVolumeControl = CShwSlideshowVolumeControl::
   336     iVolumeControl = CShwSlideshowVolumeControl::
   331         NewL( *iEnv,
   337         NewL( *iEnv,
   332         	  *iUiUtility,
   338         	  *iUiUtility,
   333         	  KShwDefaultDelayMicroSeconds );
   339         	  KShwDefaultDelayMicroSeconds );
   352 	// callback for the first time
   358 	// callback for the first time
   353 	iCurrentVolume = -1;
   359 	iCurrentVolume = -1;
   354     iPopulateListCallBack = new( ELeave )
   360     iPopulateListCallBack = new( ELeave )
   355         CAsyncCallBack( CActive::EPriorityStandard );
   361         CAsyncCallBack( CActive::EPriorityStandard );
   356     // set the callback for the media list population
   362     // set the callback for the media list population
   357     iPopulateListCallBack->Set(
   363     iPopulateListCallBack->Set(TShwCallBack<CShwSlideshowView,
   358         TShwCallBack< CShwSlideshowView, PopulateListL >( this ) );
   364             &CShwSlideshowView::PopulateListL> (this));
   359     iMSKPressed = EFalse;
   365     iMSKPressed = EFalse;
   360     iLSKPressed = EFalse;
   366     iLSKPressed = EFalse;
   361     }
   367     }
   362    
   368    
   363 // ---------------------------------------------------------------------------
   369 // ---------------------------------------------------------------------------
   432 
   438 
   433 	if(!iHdmiController)
   439 	if(!iHdmiController)
   434 		{
   440 		{
   435 	    iHdmiController = CGlxHdmiController::NewL();
   441 	    iHdmiController = CGlxHdmiController::NewL();
   436 		}
   442 		}
       
   443 	if(!iTvConnection)
       
   444 		{
       
   445 		iTvConnection = CGlxTv::NewL( *this );
       
   446 		}
   437     // Engine related construction
   447     // Engine related construction
   438     // Instantiate the slideshow engine, with this class as its observer
   448     // Instantiate the slideshow engine, with this class as its observer
   439     __ASSERT_DEBUG( !iEngine, Panic( EGlxPanicAlreadyInitialised ) );
   449     __ASSERT_DEBUG( !iEngine, Panic( EGlxPanicAlreadyInitialised ) );
   440     iEngine = CShwSlideshowEngine::NewL( *this );
   450     iEngine = CShwSlideshowEngine::NewL( *this );
   441 
   451 
   462     // Ensure the back light stays on
   472     // Ensure the back light stays on
   463     iBackLightTimer->StartL();
   473     iBackLightTimer->StartL();
   464 
   474 
   465     // Request asynch callback that will end up in ShowProgressDialogL
   475     // Request asynch callback that will end up in ShowProgressDialogL
   466     // once the active scheduler runs
   476     // once the active scheduler runs
   467     iAsyncCallBack->Set( 
   477     iAsyncCallBack->Set(TShwCallBack<CShwSlideshowView,
   468         TShwCallBack< CShwSlideshowView, ShowProgressDialogL >( this ) );
   478             &CShwSlideshowView::ShowProgressDialogL> (this));
   469     iAsyncCallBack->CallBack();
   479     iAsyncCallBack->CallBack();
   470 
   480 
   471     iDisplay->Roster().ShowL( *iGestureControlGroup,KAlfRosterShowAtTop );
   481     iDisplay->Roster().ShowL( *iGestureControlGroup,KAlfRosterShowAtTop );
   472     
   482     
   473     iTicker = CShwTicker::NewL(*this);
   483     iTicker = CShwTicker::NewL(*this);
   491     if (iHdmiController)
   501     if (iHdmiController)
   492         {
   502         {
   493         GLX_LOG_INFO( "CShwSlideshowView::DoViewDeactivate() - delete hdmicontroller" );
   503         GLX_LOG_INFO( "CShwSlideshowView::DoViewDeactivate() - delete hdmicontroller" );
   494         delete iHdmiController;
   504         delete iHdmiController;
   495         iHdmiController = NULL;
   505         iHdmiController = NULL;
       
   506         }
       
   507     if(iTvConnection)
       
   508         {
       
   509         delete iTvConnection;
       
   510         iTvConnection = NULL;
   496         }
   511         }
   497 
   512 
   498     //check if we have engine active object starting
   513     //check if we have engine active object starting
   499     if( iPopulateListCallBack->IsActive() )
   514     if( iPopulateListCallBack->IsActive() )
   500         {
   515         {
  1289     // it is not a video
  1304     // it is not a video
  1290     // and it has no attribute error 
  1305     // and it has no attribute error 
  1291     if ( (item.Category() != EMPXVideo) 
  1306     if ( (item.Category() != EMPXVideo) 
  1292             && (error == KErrNone) )
  1307             && (error == KErrNone) )
  1293         {
  1308         {
  1294         GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - Setting the Image");
  1309         GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - Fetch FS thumbnail");
  1295         iHdmiController->SetImageL(item.Uri());
  1310         TMPXAttribute fsTnAttrib = TMPXAttribute(KGlxMediaIdThumbnail,
       
  1311                 GlxFullThumbnailAttributeId(ETrue, iScrnSize.iWidth,
       
  1312                         iScrnSize.iHeight));
       
  1313         const CGlxThumbnailAttribute* fsValue = item.ThumbnailAttribute(
       
  1314                 fsTnAttrib);
       
  1315         if (fsValue)
       
  1316             {
       
  1317             GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - Setting FS Bitmap");
       
  1318             CFbsBitmap* fsBitmap = new (ELeave) CFbsBitmap;
       
  1319             CleanupStack::PushL(fsBitmap);
       
  1320             fsBitmap->Duplicate( fsValue->iBitmap->Handle());
       
  1321             
       
  1322             GLX_LOG_INFO2("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - FS Bitmap Size width=%d, height=%d", 
       
  1323                     fsBitmap->SizeInPixels().iWidth, fsBitmap->SizeInPixels().iHeight);
       
  1324             iHdmiController->SetImageL(item.Uri(),fsBitmap);
       
  1325             CleanupStack::PopAndDestroy(fsBitmap);
       
  1326             }
       
  1327         else
       
  1328             {
       
  1329             GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - Fetch Grid thumbnail");
       
  1330             TMPXAttribute gridTnAttrib = TMPXAttribute(KGlxMediaIdThumbnail,
       
  1331                     GlxFullThumbnailAttributeId(ETrue, iGridIconSize.iWidth,
       
  1332                             iGridIconSize.iHeight));
       
  1333             const CGlxThumbnailAttribute* gridvalue = item.ThumbnailAttribute(
       
  1334                     gridTnAttrib);
       
  1335 
       
  1336             if (gridvalue)
       
  1337                 {
       
  1338                 GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - Setting Grid Bitmap");
       
  1339                 CFbsBitmap* gridBitmap = new (ELeave) CFbsBitmap;
       
  1340                 CleanupStack::PushL(gridBitmap);
       
  1341                 gridBitmap->Duplicate( gridvalue->iBitmap->Handle());
       
  1342                 
       
  1343                 GLX_LOG_INFO2("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - gridBitmap Size width=%d, height=%d", 
       
  1344                         gridBitmap->SizeInPixels().iWidth, gridBitmap->SizeInPixels().iHeight);
       
  1345                 iHdmiController->SetImageL(item.Uri(),gridBitmap);
       
  1346                 CleanupStack::PopAndDestroy(gridBitmap);
       
  1347                 }
       
  1348             else
       
  1349                 {
       
  1350                 GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - Setting Null Bitmap");
       
  1351                 TFileName resFile(KDC_APP_BITMAP_DIR);
       
  1352                 resFile.Append(KGlxIconsFilename);
       
  1353                 CFbsBitmap* defaultBitmap = new (ELeave) CFbsBitmap;
       
  1354                 CleanupStack::PushL(defaultBitmap);
       
  1355                 defaultBitmap = AknIconUtils::CreateIconL(resFile,
       
  1356                         EMbmGlxiconsQgn_prop_image_notcreated);
       
  1357                 GLX_LOG_INFO2("CShwSlideshowView::SetImageToHDMIL - CGlxHdmi - Default Size width=%d, height=%d", 
       
  1358                         defaultBitmap->SizeInPixels().iWidth, defaultBitmap->SizeInPixels().iHeight);
       
  1359                 iHdmiController->SetImageL(item.Uri(),defaultBitmap);
       
  1360                 CleanupStack::PopAndDestroy(defaultBitmap); 
       
  1361                 }
       
  1362             }
  1296         }
  1363         }
  1297     else
  1364     else
  1298         {
  1365         {
  1299         GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - Unsupported Item");
  1366         GLX_LOG_INFO("CShwSlideshowView::SetImageToHDMIL - Unsupported Item");
  1300         //Set the external display to cloning mode if
  1367         //Set the external display to cloning mode if
  1369     {
  1436     {
  1370     TRACER("CShwSlideshowView::HandleMMCRemovalL()");
  1437     TRACER("CShwSlideshowView::HandleMMCRemovalL()");
  1371     ProcessCommandL(EAknSoftkeyExit);
  1438     ProcessCommandL(EAknSoftkeyExit);
  1372     }
  1439     }
  1373 
  1440 
  1374 
  1441 // ---------------------------------------------------------------------------
       
  1442 //
       
  1443 // HandleTvStatusChangedL
       
  1444 // ---------------------------------------------------------------------------
       
  1445 //
       
  1446 void CShwSlideshowView::HandleTvStatusChangedL(TTvChangeType aChangeType )
       
  1447 	{
       
  1448 	TRACER("CShwSlideshowView::HandleTvConnectionStatusChangedL");
       
  1449     // This is a common function for both HDMI and TV-out status changes 
       
  1450     // (see CGlxTv::HandleTvConnectionStatusChangedL)
       
  1451     if ((aChangeType == ETvConnectionChanged)
       
  1452             && (!iTvConnection->IsHDMIConnected()
       
  1453                    	&& !iTvConnection->IsConnected()))
       
  1454 	         {
       
  1455                  GLX_LOG_INFO("CShwSlideshowView::HandleTvConnectionStatusChangedL- Acessory Not Connected");
       
  1456 	         //Issue pause command if not already paused
       
  1457                  if (!iPauseHandler->IsSlideShowEngineStatePaused())
       
  1458                     {
       
  1459 	              ProcessCommandL(EShwSlideshowCmdPause);
       
  1460 	            }
       
  1461 		}
       
  1462 	}
       
  1463