photosgallery/viewframework/dataprovider/src/glxmulmodelproviderbase.cpp
branchRCL_3
changeset 23 b023a8d2866a
parent 19 420f6808bf21
child 24 ea65f74e6de4
equal deleted inserted replaced
21:f9e827349359 23:b023a8d2866a
    41 #include <glxgeneraluiutilities.h>
    41 #include <glxgeneraluiutilities.h>
    42 #include <glxtexturemanager.h>
    42 #include <glxtexturemanager.h>
    43 #include <glxicons.mbg>
    43 #include <glxicons.mbg>
    44 #include <glxuistd.h>
    44 #include <glxuistd.h>
    45 #include <mul/imulcoverflowwidget.h>               // An interface for Multimedia coverflow Widget
    45 #include <mul/imulcoverflowwidget.h>               // An interface for Multimedia coverflow Widget
       
    46 #include "glxdrmgiftexturecreator.h"
    46 
    47 
    47 using namespace Alf;
    48 using namespace Alf;
    48 
    49 
    49 static const char* const KListWidget = "ListWidget";
    50 static const char* const KListWidget = "ListWidget";
    50 static const char* const KGridWidget = "GridWidget";
    51 static const char* const KGridWidget = "GridWidget";
    89 // ----------------------------------------------------------------------------
    90 // ----------------------------------------------------------------------------
    90 //
    91 //
    91 CGlxMulModelProviderBase::~CGlxMulModelProviderBase()
    92 CGlxMulModelProviderBase::~CGlxMulModelProviderBase()
    92     { 
    93     { 
    93     TRACER("CGlxMulModelProviderBase::~CGlxMulModelProviderBase");
    94     TRACER("CGlxMulModelProviderBase::~CGlxMulModelProviderBase");
       
    95     if(iDrmGifTextureCreator)
       
    96         {
       
    97         delete iDrmGifTextureCreator;
       
    98         iDrmGifTextureCreator = NULL;
       
    99         }
    94     //   remove event handler
   100     //   remove event handler
    95 	iWidget.RemoveEventHandler( *this );
   101 	iWidget.RemoveEventHandler( *this );
    96     if ( iNavigationalState )
   102     if ( iNavigationalState )
    97           {
   103           {
    98           iNavigationalState->Close();
   104           iNavigationalState->Close();
   291 //	
   297 //	
   292 void CGlxMulModelProviderBase::SetDataT( const CGlxBinding& aBinding,
   298 void CGlxMulModelProviderBase::SetDataT( const CGlxBinding& aBinding,
   293         const TGlxMedia& aMedia, TInt aAtIndex )
   299         const TGlxMedia& aMedia, TInt aAtIndex )
   294     {
   300     {
   295     TRACER("CGlxMulModelProviderBase::SetDataT");
   301     TRACER("CGlxMulModelProviderBase::SetDataT");
   296     iModel->SetData( aAtIndex, CreateItemT( aBinding, aMedia, 
   302     
   297         IsFocused( aAtIndex ) ) );
   303     if(IsFocused(aAtIndex))
       
   304         {
       
   305         TBool drm = EFalse;
       
   306         TGlxMediaGeneralRightsValidity isValid = EGlxDrmRightsValidityUnknown;
       
   307         if (aMedia.GetDrmProtected(drm))
       
   308             {
       
   309             GLX_DEBUG1("CGlxMulModelProviderBase::SetDataT GetDrmValidity");
       
   310             aMedia.GetDrmValidity(isValid);
       
   311             }
       
   312         TInt frameCount;
       
   313         aMedia.GetFrameCount(frameCount);
       
   314         
       
   315         //Create the DRM gif texture intance only if the DRM gif image is
       
   316         //valid and focused
       
   317         if (frameCount > 1 && drm && isValid == EGlxDrmRightsValid)
       
   318             {
       
   319             if (!iDrmGifTextureCreator)
       
   320                 {
       
   321                 iDrmGifTextureCreator = CGlxDrmGifTextureCreator::NewL(
       
   322                         aBinding, aMedia, aAtIndex, iModel);
       
   323                 }
       
   324             else
       
   325                 {
       
   326                 iDrmGifTextureCreator->UpdateNewImageL(aMedia, aAtIndex);
       
   327                 }
       
   328             }
       
   329         else
       
   330             {
       
   331             //if the focus is changed then delete the DRMGifTextureCreator 
       
   332             //instance if any
       
   333             if (iDrmGifTextureCreator)
       
   334                 {
       
   335                 delete iDrmGifTextureCreator;
       
   336                 iDrmGifTextureCreator = NULL;
       
   337                 }
       
   338             iModel->SetData(aAtIndex, CreateItemT(aBinding, aMedia,
       
   339                     IsFocused(aAtIndex)));
       
   340             }
       
   341         }
       
   342     else
       
   343         {
       
   344         iModel->SetData( aAtIndex, CreateItemT( aBinding, aMedia, 
       
   345             IsFocused( aAtIndex ) ) );
       
   346         }
   298     }
   347     }
   299     
   348     
   300 // ----------------------------------------------------------------------------
   349 // ----------------------------------------------------------------------------
   301 // CreateItemT
   350 // CreateItemT
   302 // ----------------------------------------------------------------------------
   351 // ----------------------------------------------------------------------------
   557 void CGlxMulModelProviderBase::AddWidgetEventHandler()
   606 void CGlxMulModelProviderBase::AddWidgetEventHandler()
   558     {
   607     {
   559     iWidget.AddEventHandler( *this );
   608     iWidget.AddEventHandler( *this );
   560     }
   609     }
   561 
   610 
       
   611 //-----------------------------------------------------------------------------
       
   612 // AnimateDRMGifItem
       
   613 //-----------------------------------------------------------------------------
       
   614 //
       
   615 void CGlxMulModelProviderBase::AnimateDRMGifItem( TBool aAnimate )
       
   616     {
       
   617 	TRACER("CGlxMulModelProviderBase::AnimateDRMGifItem");
       
   618     if(iDrmGifTextureCreator)
       
   619         {
       
   620         iDrmGifTextureCreator->AnimateDRMGifItem(aAnimate);
       
   621         }
       
   622     }
   562 //EOF
   623 //EOF