videoplayback/videoplaybackcontrols/src/mpxvideoplaybackmediadetailsviewer.cpp
branchRCL_3
changeset 9 5294c000a26d
parent 8 ce5ada96ab30
child 11 8970fbd719ec
equal deleted inserted replaced
8:ce5ada96ab30 9:5294c000a26d
    13 *
    13 *
    14 * Description: Media Details Viewer
    14 * Description: Media Details Viewer
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version:  e003sa33#14 %
    18 
       
    19 // Version : %version:  e003sa33#16 %
    19 
    20 
    20 
    21 
    21 // INCLUDE FILES
    22 // INCLUDE FILES
    22 #include <eikenv.h>
    23 #include <eikenv.h>
    23 #include <eiklabel.h>
    24 #include <eiklabel.h>
    53 const TInt KMediaDetailsViewerOffsetDivisorMax = 20;
    54 const TInt KMediaDetailsViewerOffsetDivisorMax = 20;
    54 const TInt KMediaDetailsViewerMaxBufLen = 255;
    55 const TInt KMediaDetailsViewerMaxBufLen = 255;
    55 
    56 
    56 // UID of this interface
    57 // UID of this interface
    57 const TUid KFileDetailsCntlPluginUid = {0x2002A59D};
    58 const TUid KFileDetailsCntlPluginUid = {0x2002A59D};
    58 const TUid KFileDetailsInterfaceUid = {0x2002A5A0};
    59 
    59 // ---------------------------------------------------------------------------
    60 const TUint32 KScrollTimerDelayTickCounts = 2000;   // 2000 milliseconds
    60 // Local function to cleanup an array
    61 const TUint32 KInvalidTick = 0;
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 
       
    64 static void CleanupEcomArray( TAny* aArray )
       
    65 {
       
    66   ( static_cast<RImplInfoPtrArray*>( aArray ) )->ResetAndDestroy();
       
    67   ( static_cast<RImplInfoPtrArray*>( aArray ) )->Close();
       
    68 }
       
    69 
    62 
    70 // ============================ MEMBER FUNCTIONS ===================================================
    63 // ============================ MEMBER FUNCTIONS ===================================================
    71 
    64 
    72 CMPXVideoPlaybackMediaDetailsViewer::CMPXVideoPlaybackMediaDetailsViewer(
    65 CMPXVideoPlaybackMediaDetailsViewer::CMPXVideoPlaybackMediaDetailsViewer(
    73     CMPXVideoPlaybackControlsController* aController )
    66     CMPXVideoPlaybackControlsController* aController )
    74     : iController( aController )
    67     : iController( aController )
       
    68     , iScrollTimerDelayBeginningTick( KInvalidTick )
    75 {
    69 {
    76 }
    70 }
    77 
    71 
    78 // -------------------------------------------------------------------------------------------------
    72 // -------------------------------------------------------------------------------------------------
    79 // CMPXVideoPlaybackMediaDetailsViewer::ConstructL()
    73 // CMPXVideoPlaybackMediaDetailsViewer::ConstructL()
    81 // -------------------------------------------------------------------------------------------------
    75 // -------------------------------------------------------------------------------------------------
    82 //
    76 //
    83 void CMPXVideoPlaybackMediaDetailsViewer::ConstructL()
    77 void CMPXVideoPlaybackMediaDetailsViewer::ConstructL()
    84 {
    78 {
    85     MPX_DEBUG(_L("CMPXVideoPlaybackMediaDetailsViewer::ConstructL()"));
    79     MPX_DEBUG(_L("CMPXVideoPlaybackMediaDetailsViewer::ConstructL()"));
    86    
    80 
    87     iViewerRect = CalculateViewerRectL();
    81     iViewerRect = CalculateViewerRectL();
    88     SetRect( TRect(0, 0, iViewerRect.Width(), iViewerRect.Height()) );
    82     SetRect( TRect(0, 0, iViewerRect.Width(), iViewerRect.Height()) );
    89         
    83 
    90     CreateLabelsL();
    84     CreateLabelsL();
    91     SkinChangeL();
    85     SkinChangeL();
    92     
    86 
    93     iBackgroundBitmap = new ( ELeave ) CFbsBitmap();
    87     iBackgroundBitmap = new ( ELeave ) CFbsBitmap();
    94     TSize bitmapSize = Rect().Size();
    88     TSize bitmapSize = Rect().Size();
    95     User::LeaveIfError( iBackgroundBitmap->Create( bitmapSize, EColor16MA ) );
    89     User::LeaveIfError( iBackgroundBitmap->Create( bitmapSize, EColor16MA ) );
    96     
    90 
    97     iScrollPosition = 0;
    91     iScrollPosition = 0;
    98     iScrollingTextTimer = CPeriodic::NewL( CActive::EPriorityStandard );     
    92     iScrollingTextTimer = CPeriodic::NewL( CActive::EPriorityStandard );
    99     iScrollingTextTimer->Start( 
    93     iScrollingTextTimer->Start(
   100                 0,
    94                 0,
   101                 175000,
    95                 175000,
   102                 TCallBack( CMPXVideoPlaybackMediaDetailsViewer::ScrollFilenameTimer, this ) );  
    96                 TCallBack( CMPXVideoPlaybackMediaDetailsViewer::ScrollFilenameTimer, this ) );
   103     
    97 
   104     iShouldPauseScrolling = EFalse;
    98     iShouldPauseScrolling = EFalse;
   105            
       
   106 }
    99 }
   107 
   100 
   108 // -------------------------------------------------------------------------------------------------
   101 // -------------------------------------------------------------------------------------------------
   109 // CMPXVideoPlaybackMediaDetailsViewer::NewL()
   102 // CMPXVideoPlaybackMediaDetailsViewer::NewL()
   110 // Two-phased constructor.
   103 // Two-phased constructor.
   129 // -------------------------------------------------------------------------------------------------
   122 // -------------------------------------------------------------------------------------------------
   130 //
   123 //
   131 CMPXVideoPlaybackMediaDetailsViewer::~CMPXVideoPlaybackMediaDetailsViewer()
   124 CMPXVideoPlaybackMediaDetailsViewer::~CMPXVideoPlaybackMediaDetailsViewer()
   132 {
   125 {
   133     MPX_DEBUG(_L("CMPXVideoPlaybackMediaDetailsViewer::~CMPXVideoPlaybackMediaDetailsViewer()"));
   126     MPX_DEBUG(_L("CMPXVideoPlaybackMediaDetailsViewer::~CMPXVideoPlaybackMediaDetailsViewer()"));
   134     
   127 
   135     if ( iClipnameLabel )
   128     if ( iClipnameLabel )
   136     {
   129     {
   137         delete iClipnameLabel;
   130         delete iClipnameLabel;
   138         iClipnameLabel = NULL;
   131         iClipnameLabel = NULL;
   139     }
   132     }
   140     
   133 
   141     if ( iTitleLabel )
   134     if ( iTitleLabel )
   142     {
   135     {
   143         delete iTitleLabel;
   136         delete iTitleLabel;
   144         iTitleLabel = NULL;
   137         iTitleLabel = NULL;
   145     }    
   138     }
   146     
   139 
   147     if ( iArtistLabel )
   140     if ( iArtistLabel )
   148     {
   141     {
   149         delete iArtistLabel;
   142         delete iArtistLabel;
   150         iArtistLabel = NULL;
   143         iArtistLabel = NULL;
   151     }           
   144     }
   152     
   145 
   153     if ( iFormatLabel )
   146     if ( iFormatLabel )
   154     {
   147     {
   155         delete iFormatLabel;
   148         delete iFormatLabel;
   156         iFormatLabel = NULL;
   149         iFormatLabel = NULL;
   157     }
   150     }
   158     
   151 
   159     if ( iResolutionLabel )
   152     if ( iResolutionLabel )
   160     {
   153     {
   161         delete iResolutionLabel;
   154         delete iResolutionLabel;
   162         iResolutionLabel = NULL;
   155         iResolutionLabel = NULL;
   163     }    
   156     }
   164     
   157 
   165     if ( iDurationLabel )
   158     if ( iDurationLabel )
   166     {
   159     {
   167         delete iDurationLabel;
   160         delete iDurationLabel;
   168         iDurationLabel = NULL;
   161         iDurationLabel = NULL;
   169     }    
   162     }
   170   
   163 
   171     if ( iBitrateLabel )
   164     if ( iBitrateLabel )
   172     {
   165     {
   173         delete iBitrateLabel;
   166         delete iBitrateLabel;
   174         iBitrateLabel = NULL;
   167         iBitrateLabel = NULL;
   175     }     
   168     }
   176     
   169 
   177     if ( iLicenseLabel )
   170     if ( iLicenseLabel )
   178     {
   171     {
   179         delete iLicenseLabel;
   172         delete iLicenseLabel;
   180         iLicenseLabel = NULL;
   173         iLicenseLabel = NULL;
   181     }     
   174     }
   182     
   175 
   183     if ( iBackgroundBitmap )
   176     if ( iBackgroundBitmap )
   184     {
   177     {
   185         delete iBackgroundBitmap;
   178         delete iBackgroundBitmap;
   186         iBackgroundBitmap = NULL;
   179         iBackgroundBitmap = NULL;
   187     }          
   180     }
   188     
   181 
   189     if ( iScrollingTextTimer )
   182     if ( iScrollingTextTimer )
   190     {
   183     {
   191         iScrollingTextTimer->Cancel();
   184         iScrollingTextTimer->Cancel();
   192         delete iScrollingTextTimer;
   185         delete iScrollingTextTimer;
   193         iScrollingTextTimer = NULL;
   186         iScrollingTextTimer = NULL;
   194     }        
   187     }
   195     
   188 
   196     if ( iAdditionalLabel )
   189     if ( iAdditionalLabel )
   197     {
   190     {
   198         delete iAdditionalLabel;
   191         delete iAdditionalLabel;
   199         iAdditionalLabel = NULL;
   192         iAdditionalLabel = NULL;
   200     }   
   193     }
   201     
   194 
   202     if ( iAdditionalString )
   195     if ( iAdditionalString )
   203     {
   196     {
   204         delete iAdditionalString;
   197         delete iAdditionalString;
   205         iAdditionalString = NULL;
   198         iAdditionalString = NULL;
   206     }          
   199     }
   207 }
   200 }
   208 
   201 
   209 // -------------------------------------------------------------------------------------------------
   202 // -------------------------------------------------------------------------------------------------
   210 // CMPXVideoPlaybackMediaDetailsViewer::HandlePointerEventL()
   203 // CMPXVideoPlaybackMediaDetailsViewer::HandlePointerEventL()
   211 // -------------------------------------------------------------------------------------------------
   204 // -------------------------------------------------------------------------------------------------
   221             break;
   214             break;
   222         }
   215         }
   223         case TPointerEvent::EButton1Up:
   216         case TPointerEvent::EButton1Up:
   224         {
   217         {
   225             TRect expandedRect;  //make it a bit easier to click the License label
   218             TRect expandedRect;  //make it a bit easier to click the License label
   226             
   219 
   227             if ( iLicenseLabel )
   220             if ( iLicenseLabel )
   228             {
   221             {
   229                 expandedRect = TRect(iLicenseLabel->Rect().iTl, 
   222                 expandedRect = TRect(iLicenseLabel->Rect().iTl,
   230                                      TPoint(iLicenseLabel->Rect().iBr.iX, 
   223                                      TPoint(iLicenseLabel->Rect().iBr.iX,
   231                                             iLicenseLabel->Rect().iBr.iY * 2 ) );                
   224                                             iLicenseLabel->Rect().iBr.iY * 2 ) );
   232             }
   225             }
   233 
   226 
   234             if ( iLicenseLabel && expandedRect.Contains(aPointerEvent.iPosition) )
   227             if ( iLicenseLabel && expandedRect.Contains(aPointerEvent.iPosition) )
   235             {
   228             {
   236                 LaunchDRMDetailsL();
   229                 LaunchDRMDetailsL();
   237             }
   230             }
   238             else
   231             else
   239             { 
   232             {
   240                 iController->HandleEventL( EMPXControlCmdCloseFileDetailsViewer );   
   233                 iController->HandleEventL( EMPXControlCmdCloseFileDetailsViewer );
   241             }             
   234             }
   242         }
   235         }
   243     }
   236     }
   244 }
   237 }
   245 
   238 
   246 // -------------------------------------------------------------------------------------------------
   239 // -------------------------------------------------------------------------------------------------
   247 // CMPXVideoPlaybackMediaDetailsViewer::LaunchDRMDetailsL()
   240 // CMPXVideoPlaybackMediaDetailsViewer::LaunchDRMDetailsL()
   248 // -------------------------------------------------------------------------------------------------
   241 // -------------------------------------------------------------------------------------------------
   249 //
   242 //
   250 void CMPXVideoPlaybackMediaDetailsViewer::LaunchDRMDetailsL()
   243 void CMPXVideoPlaybackMediaDetailsViewer::LaunchDRMDetailsL()
   251 {      
   244 {
   252     iController->iContainer->HandleCommandL(EMPXPbvLaunchDRMDetails);
   245     iController->iContainer->HandleCommandL(EMPXPbvLaunchDRMDetails);
   253 }
   246 }
   254 
   247 
   255 // -------------------------------------------------------------------------------------------------
   248 // -------------------------------------------------------------------------------------------------
   256 // CMPXVideoPlaybackMediaDetailsViewer::SkinChangeL()
   249 // CMPXVideoPlaybackMediaDetailsViewer::SkinChangeL()
   257 // -------------------------------------------------------------------------------------------------
   250 // -------------------------------------------------------------------------------------------------
   258 //
   251 //
   259 void CMPXVideoPlaybackMediaDetailsViewer::SkinChangeL()
   252 void CMPXVideoPlaybackMediaDetailsViewer::SkinChangeL()
   260 {   
   253 {
   261 }
   254 }
   262 
       
   263 
   255 
   264 // -------------------------------------------------------------------------------------------------
   256 // -------------------------------------------------------------------------------------------------
   265 //   CMPXVideoPlaybackMediaDetailsViewer::Draw()
   257 //   CMPXVideoPlaybackMediaDetailsViewer::Draw()
   266 // -------------------------------------------------------------------------------------------------
   258 // -------------------------------------------------------------------------------------------------
   267 //
   259 //
   269 {
   261 {
   270     MPX_DEBUG(_L("CMPXVideoPlaybackMediaDetailsViewer::Draw()"));
   262     MPX_DEBUG(_L("CMPXVideoPlaybackMediaDetailsViewer::Draw()"));
   271 
   263 
   272     CWindowGc& gc = SystemGc();
   264     CWindowGc& gc = SystemGc();
   273     gc.SetClippingRect( aRect );
   265     gc.SetClippingRect( aRect );
   274     
   266 
   275     this->DrawableWindow()->SetCornerType(EWindowCorner5);
   267     this->DrawableWindow()->SetCornerType(EWindowCorner5);
   276     
   268 
   277     TRAP_IGNORE( UpdateBackgroundBitmapL() );
   269     TRAP_IGNORE( UpdateBackgroundBitmapL() );
   278     gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   270     gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   279     gc.BitBlt( Rect().iTl, iBackgroundBitmap );
   271     gc.BitBlt( Rect().iTl, iBackgroundBitmap );
   280                     
   272 
   281     TRAP_IGNORE( FormatLabelsL() );    
   273     TRAP_IGNORE( FormatLabelsL() );
   282     
   274 
   283     gc.SetBrushStyle( CGraphicsContext::ENullBrush );       
   275     gc.SetBrushStyle( CGraphicsContext::ENullBrush );
   284 }
   276 }
   285 
   277 
   286 // -------------------------------------------------------------------------------------------------
   278 // -------------------------------------------------------------------------------------------------
   287 // CMPXVideoPlaybackMediaDetailsViewer::FormatLabelsL()
   279 // CMPXVideoPlaybackMediaDetailsViewer::FormatLabelsL()
   288 // -------------------------------------------------------------------------------------------------
   280 // -------------------------------------------------------------------------------------------------
   289 //
   281 //
   290 void CMPXVideoPlaybackMediaDetailsViewer::FormatLabelsL() const
   282 void CMPXVideoPlaybackMediaDetailsViewer::FormatLabelsL() const
   291 {
   283 {
   292     // FORMAT LABELS
   284     // FORMAT LABELS
   293     
   285 
   294 
   286 
   295     TInt labelWidth = Rect().iBr.iX;
   287     TInt labelWidth = Rect().iBr.iX;
   296     TInt labelHeight = iController->iContainer->Rect().iBr.iY / KMediaDetailsViewerMaxItems;
   288     TInt labelHeight = iController->iContainer->Rect().iBr.iY / KMediaDetailsViewerMaxItems;
   297     TInt rowsAdded = 0;
   289     TInt rowsAdded = 0;
   298 
   290 
   299     // License
   291     // License
   300     if ( iController->FileDetails()->iDrmProtected )
   292     if ( iController->FileDetails()->iDrmProtected )
   301     {
   293     {
   302         iLicenseLabel->SetExtent( 
   294         iLicenseLabel->SetExtent(
   303         		             TPoint(Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded) ) , 
   295                              TPoint(Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded) ) ,
   304                              TSize( labelWidth, labelHeight ) 
   296                              TSize( labelWidth, labelHeight )
   305                              );  
   297                              );
   306         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_LICENSE_HEADING );     
   298         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_LICENSE_HEADING );
   307         CleanupStack::PushL( heading );
   299         CleanupStack::PushL( heading );
   308         
   300 
   309         TBuf<KMediaDetailsViewerMaxBufLen> licenseField;
   301         TBuf<KMediaDetailsViewerMaxBufLen> licenseField;
   310         licenseField.Append(KLeftMargin);
   302         licenseField.Append(KLeftMargin);
   311         licenseField.Append( *heading );
   303         licenseField.Append( *heading );
   312         iLicenseLabel->OverrideColorL(EColorLabelText, KRgbDarkBlue);
   304         iLicenseLabel->OverrideColorL(EColorLabelText, KRgbDarkBlue);
   313         iLicenseLabel->SetTextL(licenseField);
   305         iLicenseLabel->SetTextL(licenseField);
   314         iLicenseLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin); 
   306         iLicenseLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);
   315         iLicenseLabel->SetLabelAlignment(ELayoutAlignCenter);
   307         iLicenseLabel->SetLabelAlignment(ELayoutAlignCenter);
   316         iLicenseLabel->SetUnderlining(ETrue);
   308         iLicenseLabel->SetUnderlining(ETrue);
   317         iLicenseLabel->MakeVisible( ETrue );
   309         iLicenseLabel->MakeVisible( ETrue );
   318         rowsAdded++;
   310         rowsAdded++;
   319         
   311 
   320         CleanupStack::PopAndDestroy( heading );
   312         CleanupStack::PopAndDestroy( heading );
   321     }    
   313     }
   322 
   314 
   323     // Filename
   315     // Filename
   324     HBufC* fileName = iController->FileDetails()->GenerateFileNameL();
   316     HBufC* fileName = iController->FileDetails()->GenerateFileNameL();
       
   317 
   325     if ( fileName && fileName->Length() )
   318     if ( fileName && fileName->Length() )
   326     {   
   319     {
   327         // file name gets populated by HandleScrollFilenameTimer method         
   320         // file name gets populated by HandleScrollFilenameTimer method
   328         iClipnameLabel->SetExtent( 
   321         iClipnameLabel->SetExtent(
   329         		             TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded ) ) , 
   322                              TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded ) ) ,
   330                              TSize( labelWidth, labelHeight )
   323                              TSize( labelWidth, labelHeight )
   331                              );
   324                              );
   332         iClipnameLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);        
   325         iClipnameLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);
   333         iClipnameLabel->MakeVisible( ETrue );
   326         iClipnameLabel->MakeVisible( ETrue );
   334         rowsAdded++;
   327         rowsAdded++;
   335         
   328 
   336         delete fileName;
   329         delete fileName;
   337     }    
   330     }
   338 
   331 
   339     // Mime Type (Format)
   332     // Mime Type (Format)
   340     if ( iController->FileDetails()->iMimeType 
   333     if ( iController->FileDetails()->iMimeType && iController->FileDetails()->iMimeType->Length() )
   341     		&& iController->FileDetails()->iMimeType->Length() )
   334     {
   342     {
   335         iFormatLabel->SetExtent(
   343         iFormatLabel->SetExtent( 
   336                           TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded ) ) ,
   344         		          TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded ) ) , 
       
   345                           TSize( labelWidth, labelHeight )
   337                           TSize( labelWidth, labelHeight )
   346                           );
   338                           );
   347         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_FORMAT_HEADING );     
   339         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_FORMAT_HEADING );
   348         CleanupStack::PushL( heading );
   340         CleanupStack::PushL( heading );
   349         
   341 
   350         TBuf<KMediaDetailsViewerMaxBufLen> formatField;
   342         TBuf<KMediaDetailsViewerMaxBufLen> formatField;
   351         formatField.Append(KLeftMargin);
   343         formatField.Append(KLeftMargin);
   352         formatField.Append( *heading );
   344         formatField.Append( *heading );
   353         formatField.Append( KHeadingValueSeperator );
   345         formatField.Append( KHeadingValueSeperator );
   354         TInt allowLen = KMediaDetailsViewerMaxBufLen-formatField.Length();
   346         TInt allowLen = KMediaDetailsViewerMaxBufLen-formatField.Length();
   355         formatField.Append( (iController->FileDetails()->iMimeType)->Left(allowLen) );        
   347         formatField.Append( (iController->FileDetails()->iMimeType)->Left(allowLen) );
   356         iFormatLabel->SetTextL(formatField);
   348         iFormatLabel->SetTextL(formatField);
   357         iFormatLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);
   349         iFormatLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);
   358         iFormatLabel->MakeVisible( ETrue ); 
   350         iFormatLabel->MakeVisible( ETrue );
   359         rowsAdded++;
   351         rowsAdded++;
   360         
   352 
   361         CleanupStack::PopAndDestroy( heading );
   353         CleanupStack::PopAndDestroy( heading );
   362     }    
   354     }
   363 
   355 
   364     // Resolution
   356     // Resolution
   365     if ( iController->FileDetails()->iVideoHeight &&  
   357     if ( iController->FileDetails()->iVideoHeight &&  iController->FileDetails()->iVideoWidth )
   366          iController->FileDetails()->iVideoWidth )
   358     {
   367     {
   359         iResolutionLabel->SetExtent(
   368         iResolutionLabel->SetExtent( 
   360                                TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded ) ) ,
   369         		               TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded ) ) , 
       
   370                                TSize( labelWidth, labelHeight )
   361                                TSize( labelWidth, labelHeight )
   371                                );
   362                                );
   372         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_RESOLUTION_HEADING );     
   363         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_RESOLUTION_HEADING );
   373         CleanupStack::PushL( heading );
   364         CleanupStack::PushL( heading );
   374         
   365 
   375         TBuf<KMediaDetailsViewerMaxBufLen> resolutionField;
   366         TBuf<KMediaDetailsViewerMaxBufLen> resolutionField;
   376         resolutionField.Append(KLeftMargin);
   367         resolutionField.Append(KLeftMargin);
   377         resolutionField.Append( *heading );
   368         resolutionField.Append( *heading );
   378         resolutionField.Append( KHeadingValueSeperator );
   369         resolutionField.Append( KHeadingValueSeperator );
   379         resolutionField.AppendNum( iController->FileDetails()->iVideoWidth );   
   370         resolutionField.AppendNum( iController->FileDetails()->iVideoWidth );
   380         resolutionField.Append( KWidthHeightSeparator );
   371         resolutionField.Append( KWidthHeightSeparator );
   381         resolutionField.AppendNum( iController->FileDetails()->iVideoHeight);
   372         resolutionField.AppendNum( iController->FileDetails()->iVideoHeight);
   382         AknTextUtils::DisplayTextLanguageSpecificNumberConversion( resolutionField );
   373         AknTextUtils::DisplayTextLanguageSpecificNumberConversion( resolutionField );
   383         
   374 
   384         iResolutionLabel->SetTextL(resolutionField);
   375         iResolutionLabel->SetTextL(resolutionField);
   385         iResolutionLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);
   376         iResolutionLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);
   386         iResolutionLabel->MakeVisible( ETrue ); 
   377         iResolutionLabel->MakeVisible( ETrue );
   387         rowsAdded++;
   378         rowsAdded++;
   388         
   379 
   389         CleanupStack::PopAndDestroy( heading );
   380         CleanupStack::PopAndDestroy( heading );
   390     } 
   381     }
   391 
   382 
   392     // Duration
   383     // Duration
   393     if ( iController->FileDetails()->iDuration > 0 )
   384     if ( iController->FileDetails()->iDuration > 0 )
   394     {
   385     {
   395         iDurationLabel->SetExtent(
   386         iDurationLabel->SetExtent(
   396         		             TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded) ) , 
   387                              TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded) ) ,
   397                              TSize( labelWidth, labelHeight )
   388                              TSize( labelWidth, labelHeight )
   398                              );
   389                              );
   399         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_DURATION_HEADING );     
   390         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_DURATION_HEADING );
   400         CleanupStack::PushL( heading );
   391         CleanupStack::PushL( heading );
   401         
   392 
   402         TBuf<KMediaDetailsViewerMaxBufLen> durationField;
   393         TBuf<KMediaDetailsViewerMaxBufLen> durationField;
   403         durationField.Append(KLeftMargin);
   394         durationField.Append(KLeftMargin);
   404         durationField.Append( *heading );
   395         durationField.Append( *heading );
   405         durationField.Append( KHeadingValueSeperator );
   396         durationField.Append( KHeadingValueSeperator );
   406         
   397 
   407         TInt64 durationInSeconds =  iController->FileDetails()->iDuration / 1000;
   398         TInt64 durationInSeconds =  iController->FileDetails()->iDuration / 1000;
   408         
   399 
   409         HBufC* unitFormatString;
   400         HBufC* unitFormatString;
       
   401 
   410         if ( durationInSeconds < 3600 )  // one hour
   402         if ( durationInSeconds < 3600 )  // one hour
   411         {
   403         {
   412             unitFormatString = StringLoader::LoadLC(R_QTN_TIME_DURAT_MIN_SEC);
   404             unitFormatString = StringLoader::LoadLC(R_QTN_TIME_DURAT_MIN_SEC);
   413         }
   405         }
   414         else
   406         else
   415         {
   407         {
   416             unitFormatString = StringLoader::LoadLC(R_QTN_TIME_DURAT_LONG);
   408             unitFormatString = StringLoader::LoadLC(R_QTN_TIME_DURAT_LONG);
   417         }
   409         }
   418         
   410 
   419         TBuf<64> dur;
   411         TBuf<64> dur;
   420         TTime durTime = TTime(durationInSeconds * 1000000);
   412         TTime durTime = TTime(durationInSeconds * 1000000);
   421         durTime.FormatL(dur, *unitFormatString);
   413         durTime.FormatL(dur, *unitFormatString);
   422         AknTextUtils::DisplayTextLanguageSpecificNumberConversion( dur );        
   414         AknTextUtils::DisplayTextLanguageSpecificNumberConversion( dur );
   423         
   415 
   424         durationField.Append( dur );
   416         durationField.Append( dur );
   425         iDurationLabel->SetTextL(durationField);
   417         iDurationLabel->SetTextL(durationField);
   426         iDurationLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);
   418         iDurationLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);
   427         iDurationLabel->MakeVisible( ETrue ); 
   419         iDurationLabel->MakeVisible( ETrue );
   428         rowsAdded++;
   420         rowsAdded++;
   429         
   421 
   430         CleanupStack::PopAndDestroy( unitFormatString ); // unitFormatString
   422         CleanupStack::PopAndDestroy( unitFormatString ); // unitFormatString
   431         CleanupStack::PopAndDestroy( heading );
   423         CleanupStack::PopAndDestroy( heading );
   432 
   424     }
   433     }     
       
   434     
       
   435 
   425 
   436     // Bitrate
   426     // Bitrate
   437     if ( iController->FileDetails()->iBitRate > 0 )
   427     if ( iController->FileDetails()->iBitRate > 0 )
   438     {
   428     {
   439         iBitrateLabel->SetExtent( 
   429         iBitrateLabel->SetExtent(
   440         		          TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded ) ) , 
   430                           TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded ) ) ,
   441                           TSize( labelWidth, labelHeight )
   431                           TSize( labelWidth, labelHeight )
   442                           );
   432                           );
   443         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_BITRATE_HEADING );     
   433         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_BITRATE_HEADING );
   444         CleanupStack::PushL( heading );
   434         CleanupStack::PushL( heading );
   445         
   435 
   446         TBuf<KMediaDetailsViewerMaxBufLen> bitrateField;
   436         TBuf<KMediaDetailsViewerMaxBufLen> bitrateField;
   447         bitrateField.Append(KLeftMargin);
   437         bitrateField.Append(KLeftMargin);
   448         bitrateField.Append( *heading );
   438         bitrateField.Append( *heading );
   449         bitrateField.Append( KHeadingValueSeperator );
   439         bitrateField.Append( KHeadingValueSeperator );
   450                 
   440 
   451         HBufC* formattedBitrate = 
   441         HBufC* formattedBitrate =
   452              StringLoader::LoadLC(R_MPX_BITRATE_UNITS,iController->FileDetails()->iBitRate / 1000 );
   442              StringLoader::LoadLC(R_MPX_BITRATE_UNITS,iController->FileDetails()->iBitRate / 1000 );
   453                 
   443 
   454         bitrateField.Append( *formattedBitrate );
   444         bitrateField.Append( *formattedBitrate );
   455         iBitrateLabel->SetTextL(bitrateField);
   445         iBitrateLabel->SetTextL(bitrateField);
   456         iBitrateLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);
   446         iBitrateLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);
   457         iBitrateLabel->MakeVisible( ETrue ); 
   447         iBitrateLabel->MakeVisible( ETrue );
   458         rowsAdded++;
   448         rowsAdded++;
   459 
   449 
   460         CleanupStack::PopAndDestroy( formattedBitrate ); // formattedBitrate
   450         CleanupStack::PopAndDestroy( formattedBitrate ); // formattedBitrate
   461         CleanupStack::PopAndDestroy( heading );
   451         CleanupStack::PopAndDestroy( heading );
   462     }         
   452     }
   463 
   453 
   464     // Title
   454     // Title
   465     if ( iController->FileDetails()->iTitle 
   455     if ( iController->FileDetails()->iTitle && iController->FileDetails()->iTitle->Length() )
   466     		&& iController->FileDetails()->iTitle->Length() )
   456     {
   467     {
   457         iTitleLabel->SetExtent(
   468         iTitleLabel->SetExtent( 
   458                           TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded ) ) ,
   469         		          TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded ) ) , 
   459                           TSize( labelWidth, labelHeight )
   470                           TSize( labelWidth, labelHeight ) 
       
   471                           );
   460                           );
   472         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_TITLE_HEADING );     
   461         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_TITLE_HEADING );
   473         CleanupStack::PushL( heading );
   462         CleanupStack::PushL( heading );
   474         
   463 
   475         TBuf<KMediaDetailsViewerMaxBufLen> titleField;
   464         TBuf<KMediaDetailsViewerMaxBufLen> titleField;
   476         titleField.Append(KLeftMargin);
   465         titleField.Append(KLeftMargin);
   477         titleField.Append( *heading );
   466         titleField.Append( *heading );
   478         titleField.Append( KHeadingValueSeperator );
   467         titleField.Append( KHeadingValueSeperator );
   479         TInt allowLen = KMediaDetailsViewerMaxBufLen-titleField.Length();
   468         TInt allowLen = KMediaDetailsViewerMaxBufLen-titleField.Length();
   480         titleField.Append( (iController->FileDetails()->iTitle)->Left(allowLen) );        
   469         titleField.Append( (iController->FileDetails()->iTitle)->Left(allowLen) );
   481         iTitleLabel->SetTextL(titleField);
   470         iTitleLabel->SetTextL(titleField);
   482         iTitleLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);
   471         iTitleLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);
   483         iTitleLabel->MakeVisible( ETrue );
   472         iTitleLabel->MakeVisible( ETrue );
   484         rowsAdded++;
   473         rowsAdded++;
   485         
   474 
   486         CleanupStack::PopAndDestroy( heading );        
   475         CleanupStack::PopAndDestroy( heading );
   487     }    
   476     }
   488 
   477 
   489     // Artist
   478     // Artist
   490     if ( iController->FileDetails()->iArtist 
   479     if ( iController->FileDetails()->iArtist && iController->FileDetails()->iArtist->Length() )
   491     		&& iController->FileDetails()->iArtist->Length() )
   480     {
   492     {
   481         iArtistLabel->SetExtent(
   493         iArtistLabel->SetExtent( 
   482                           TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded ) ) ,
   494         		          TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded ) ) , 
       
   495                           TSize( labelWidth, labelHeight )
   483                           TSize( labelWidth, labelHeight )
   496                           );
   484                           );
   497         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_ARTIST_HEADING );     
   485         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_ARTIST_HEADING );
   498         CleanupStack::PushL( heading );
   486         CleanupStack::PushL( heading );
   499         
   487 
   500         TBuf<KMediaDetailsViewerMaxBufLen> artistField;
   488         TBuf<KMediaDetailsViewerMaxBufLen> artistField;
   501         artistField.Append(KLeftMargin);
   489         artistField.Append(KLeftMargin);
   502         artistField.Append( *heading );
   490         artistField.Append( *heading );
   503         artistField.Append( KHeadingValueSeperator );
   491         artistField.Append( KHeadingValueSeperator );
   504         TInt allowLen = KMediaDetailsViewerMaxBufLen-artistField.Length();
   492         TInt allowLen = KMediaDetailsViewerMaxBufLen-artistField.Length();
   505         artistField.Append( (iController->FileDetails()->iArtist)->Left( allowLen ) );
   493         artistField.Append( (iController->FileDetails()->iArtist)->Left( allowLen ) );
   506         iArtistLabel->SetTextL(artistField);
   494         iArtistLabel->SetTextL(artistField);
   507         iArtistLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);
   495         iArtistLabel->SetAllMarginsTo(KMediaDetailsViewerItemMargin);
   508         iArtistLabel->MakeVisible( ETrue );
   496         iArtistLabel->MakeVisible( ETrue );
   509         rowsAdded++;
   497         rowsAdded++;
   510         
   498 
   511         CleanupStack::PopAndDestroy( heading );       
   499         CleanupStack::PopAndDestroy( heading );
   512     } 
   500     }
   513  
   501 
   514     
       
   515     // Additional Label
   502     // Additional Label
   516     if ( iAdditionalString && iAdditionalString->Length() ) 
   503     if ( iAdditionalString && iAdditionalString->Length() )
   517     {    
   504     {
   518         iAdditionalLabel->SetExtent(
   505         iAdditionalLabel->SetExtent(
   519         		               TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded ) ) , 
   506                                TPoint( Rect().iTl.iX, Rect().iTl.iY + ( labelHeight * rowsAdded ) ) ,
   520                                TSize( labelWidth, labelHeight )
   507                                TSize( labelWidth, labelHeight )
   521                                );  
   508                                );
   522         
   509 
   523         TBuf<KMediaDetailsViewerMaxBufLen> titleField;
   510         TBuf<KMediaDetailsViewerMaxBufLen> titleField;
   524         titleField.Append(KLeftMargin);
   511         titleField.Append(KLeftMargin);
   525         TInt allowLen = KMediaDetailsViewerMaxBufLen-titleField.Length();
   512         TInt allowLen = KMediaDetailsViewerMaxBufLen-titleField.Length();
   526         titleField.Append( iAdditionalString->Left(allowLen) );
   513         titleField.Append( iAdditionalString->Left(allowLen) );
   527         iAdditionalLabel->SetTextL(titleField);
   514         iAdditionalLabel->SetTextL(titleField);
   543 // -------------------------------------------------------------------------------------------------
   530 // -------------------------------------------------------------------------------------------------
   544 // CMPXVideoPlaybackMediaDetailsViewer::ComponentControl
   531 // CMPXVideoPlaybackMediaDetailsViewer::ComponentControl
   545 // -------------------------------------------------------------------------------------------------
   532 // -------------------------------------------------------------------------------------------------
   546 //
   533 //
   547 CCoeControl* CMPXVideoPlaybackMediaDetailsViewer::ComponentControl(TInt aIndex) const
   534 CCoeControl* CMPXVideoPlaybackMediaDetailsViewer::ComponentControl(TInt aIndex) const
   548 {    
   535 {
   549     CCoeControl* control = NULL;
   536     CCoeControl* control = NULL;
   550     
   537 
   551     switch ( aIndex )
   538     switch ( aIndex )
   552     {
   539     {
   553         case 0:
   540         case 0:
   554             control = iClipnameLabel;
   541             control = iClipnameLabel;
   555             break;
   542             break;
   578             control = iAdditionalLabel;
   565             control = iAdditionalLabel;
   579             break;
   566             break;
   580         default:
   567         default:
   581             break;
   568             break;
   582     }
   569     }
   583     
   570 
   584     return control;
   571     return control;
   585 }
   572 }
   586 
   573 
   587 // -------------------------------------------------------------------------------------------------
   574 // -------------------------------------------------------------------------------------------------
   588 // CMPXVideoPlaybackMediaDetailsViewer::Reset
   575 // CMPXVideoPlaybackMediaDetailsViewer::Reset
   596 // CMPXVideoPlaybackMediaDetailsViewer::CreateLabelsL
   583 // CMPXVideoPlaybackMediaDetailsViewer::CreateLabelsL
   597 // -------------------------------------------------------------------------------------------------
   584 // -------------------------------------------------------------------------------------------------
   598 //
   585 //
   599 void CMPXVideoPlaybackMediaDetailsViewer::CreateLabelsL()
   586 void CMPXVideoPlaybackMediaDetailsViewer::CreateLabelsL()
   600 {
   587 {
   601     // Licence / DRM    
   588     // Licence / DRM
   602     iLicenseLabel = new (ELeave) CEikLabel;
   589     iLicenseLabel = new (ELeave) CEikLabel;
   603     iLicenseLabel->SetContainerWindowL( *this );     
   590     iLicenseLabel->SetContainerWindowL( *this );
   604     iLicenseLabel->SetTextL( KNullDesC );
   591     iLicenseLabel->SetTextL( KNullDesC );
   605 
   592 
   606     // Filename
   593     // Filename
   607     iClipnameLabel = new (ELeave) CEikLabel;
   594     iClipnameLabel = new (ELeave) CEikLabel;
   608     iClipnameLabel->SetContainerWindowL( *this );     
   595     iClipnameLabel->SetContainerWindowL( *this );
   609     iClipnameLabel->SetTextL( KNullDesC ); 
   596     iClipnameLabel->SetTextL( KNullDesC );
   610     iClipnameLabel->SetLabelAlignment( ELayoutAlignBidi );
   597     iClipnameLabel->SetLabelAlignment( ELayoutAlignBidi );
   611     
   598 
   612     // Title
   599     // Title
   613     iTitleLabel = new (ELeave) CEikLabel;
   600     iTitleLabel = new (ELeave) CEikLabel;
   614     iTitleLabel->SetContainerWindowL( *this );     
   601     iTitleLabel->SetContainerWindowL( *this );
   615     iTitleLabel->SetTextL( KNullDesC );     
   602     iTitleLabel->SetTextL( KNullDesC );
   616     iTitleLabel->SetLabelAlignment( ELayoutAlignBidi );
   603     iTitleLabel->SetLabelAlignment( ELayoutAlignBidi );
   617     
   604 
   618     // Artist
   605     // Artist
   619     iArtistLabel = new (ELeave) CEikLabel;
   606     iArtistLabel = new (ELeave) CEikLabel;
   620     iArtistLabel->SetContainerWindowL( *this );     
   607     iArtistLabel->SetContainerWindowL( *this );
   621     iArtistLabel->SetTextL( KNullDesC );        
   608     iArtistLabel->SetTextL( KNullDesC );
   622     iArtistLabel->SetLabelAlignment( ELayoutAlignBidi );
   609     iArtistLabel->SetLabelAlignment( ELayoutAlignBidi );
   623     
   610 
   624     // Format
   611     // Format
   625     iFormatLabel = new (ELeave) CEikLabel;
   612     iFormatLabel = new (ELeave) CEikLabel;
   626     iFormatLabel->SetContainerWindowL( *this );     
   613     iFormatLabel->SetContainerWindowL( *this );
   627     iFormatLabel->SetTextL( KNullDesC );
   614     iFormatLabel->SetTextL( KNullDesC );
   628     iFormatLabel->SetLabelAlignment( ELayoutAlignBidi );
   615     iFormatLabel->SetLabelAlignment( ELayoutAlignBidi );
   629     
   616 
   630     // Resolution
   617     // Resolution
   631     iResolutionLabel = new (ELeave) CEikLabel;
   618     iResolutionLabel = new (ELeave) CEikLabel;
   632     iResolutionLabel->SetContainerWindowL( *this );     
   619     iResolutionLabel->SetContainerWindowL( *this );
   633     iResolutionLabel->SetTextL( KNullDesC );    
   620     iResolutionLabel->SetTextL( KNullDesC );
   634     iResolutionLabel->SetLabelAlignment( ELayoutAlignBidi );
   621     iResolutionLabel->SetLabelAlignment( ELayoutAlignBidi );
   635     
   622 
   636     // Duration
   623     // Duration
   637     iDurationLabel = new (ELeave) CEikLabel;
   624     iDurationLabel = new (ELeave) CEikLabel;
   638     iDurationLabel->SetContainerWindowL( *this );     
   625     iDurationLabel->SetContainerWindowL( *this );
   639     iDurationLabel->SetTextL( KNullDesC );    
   626     iDurationLabel->SetTextL( KNullDesC );
   640     iDurationLabel->SetLabelAlignment( ELayoutAlignBidi );
   627     iDurationLabel->SetLabelAlignment( ELayoutAlignBidi );
   641     
   628 
   642     // Bitrate
   629     // Bitrate
   643     iBitrateLabel = new (ELeave) CEikLabel;
   630     iBitrateLabel = new (ELeave) CEikLabel;
   644     iBitrateLabel->SetContainerWindowL( *this );     
   631     iBitrateLabel->SetContainerWindowL( *this );
   645     iBitrateLabel->SetTextL( KNullDesC );   
   632     iBitrateLabel->SetTextL( KNullDesC );
   646     iBitrateLabel->SetLabelAlignment( ELayoutAlignBidi );
   633     iBitrateLabel->SetLabelAlignment( ELayoutAlignBidi );
   647 
   634 
   648     // Additional Labels
   635     // Additional Labels
   649     iAdditionalLabel = new (ELeave) CEikLabel;
   636     iAdditionalLabel = new (ELeave) CEikLabel;
   650     iAdditionalLabel->SetContainerWindowL( *this );     
   637     iAdditionalLabel->SetContainerWindowL( *this );
   651     iAdditionalLabel->SetTextL( KNullDesC );   
   638     iAdditionalLabel->SetTextL( KNullDesC );
   652     iAdditionalLabel->SetLabelAlignment( ELayoutAlignBidi );
   639     iAdditionalLabel->SetLabelAlignment( ELayoutAlignBidi );
   653 
   640 }
   654 } 
       
   655 
   641 
   656 // -----------------------------------------------------------------------------
   642 // -----------------------------------------------------------------------------
   657 // CMPXVideoPlaybackMediaDetailsViewer::UpdateBackgroundBitmapL
   643 // CMPXVideoPlaybackMediaDetailsViewer::UpdateBackgroundBitmapL
   658 // Update background bitmap
   644 // Update background bitmap
   659 // -----------------------------------------------------------------------------
   645 // -----------------------------------------------------------------------------
   660 //
   646 //
   661 void CMPXVideoPlaybackMediaDetailsViewer::UpdateBackgroundBitmapL() const
   647 void CMPXVideoPlaybackMediaDetailsViewer::UpdateBackgroundBitmapL() const
   662 {
   648 {
   663     TSize bitmapSize = Rect().Size();
   649     TSize bitmapSize = Rect().Size();
   664 
   650 
   665     CFbsBitmapDevice* bgBitmapDevice = 
   651     CFbsBitmapDevice* bgBitmapDevice = CFbsBitmapDevice::NewL( iBackgroundBitmap );
   666                     CFbsBitmapDevice::NewL( iBackgroundBitmap );
       
   667     CleanupStack::PushL( bgBitmapDevice );
   652     CleanupStack::PushL( bgBitmapDevice );
   668                     
   653 
   669     CFbsBitGc* bgBitGc( NULL );
   654     CFbsBitGc* bgBitGc( NULL );
   670     User::LeaveIfError( bgBitmapDevice->CreateContext( bgBitGc ) );
   655     User::LeaveIfError( bgBitmapDevice->CreateContext( bgBitGc ) );
   671     CleanupStack::PushL( bgBitGc );
   656     CleanupStack::PushL( bgBitGc );
   672 
   657 
   673     bgBitGc->SetBrushColor( TRgb(0x708090) );  // slate gray
   658     bgBitGc->SetBrushColor( TRgb(0x708090) );  // slate gray
   674     bgBitGc->Clear(); 
   659     bgBitGc->Clear();
   675 
   660 
   676     CleanupStack::PopAndDestroy( bgBitGc );
   661     CleanupStack::PopAndDestroy( bgBitGc );
   677     CleanupStack::PopAndDestroy( bgBitmapDevice );
   662     CleanupStack::PopAndDestroy( bgBitmapDevice );
   678 
   663 
   679     // Dither alpha channel for semitransparency
   664     // Dither alpha channel for semitransparency
   680     //
   665     //
   681     // Scan line length in 32-bit words
   666     // Scan line length in 32-bit words
   682     TInt scanLineLengthWord = CFbsBitmap::ScanLineLength( bitmapSize.iWidth, EColor16MA) / 4;
   667     TInt scanLineLengthWord = CFbsBitmap::ScanLineLength( bitmapSize.iWidth, EColor16MA) / 4;
   683     
   668 
   684     iBackgroundBitmap->LockHeap();
   669     iBackgroundBitmap->LockHeap();
   685     TUint32* dataAddr = 
   670     TUint32* dataAddr = reinterpret_cast<TUint32*>( iBackgroundBitmap->DataAddress() );
   686                 reinterpret_cast<TUint32*>( iBackgroundBitmap->DataAddress() );
   671 
   687     for ( TInt y = 0; y < bitmapSize.iHeight; y++ )
   672     for ( TInt y = 0; y < bitmapSize.iHeight; y++ )
       
   673     {
       
   674         for ( TInt x = 0; x < bitmapSize.iWidth; x++ )
       
   675         {
       
   676             if ( ( y + x ) & 1 )
   688             {
   677             {
   689             for ( TInt x = 0; x < bitmapSize.iWidth; x++ )
   678                 // Make this pixel transparent
       
   679                 dataAddr[y * scanLineLengthWord + x] = 0x00000000;
       
   680             }
       
   681         }
       
   682     }
       
   683 
       
   684     iBackgroundBitmap->UnlockHeap();
       
   685 }
       
   686 
       
   687 // -------------------------------------------------------------------------------------------------
       
   688 // CMPXVideoPlaybackMediaDetailsViewer::ScrollFilenameTimer
       
   689 // -------------------------------------------------------------------------------------------------
       
   690 //
       
   691 TInt CMPXVideoPlaybackMediaDetailsViewer::ScrollFilenameTimer( TAny* aPtr )
       
   692 {
       
   693     TRAP_IGNORE(
       
   694             static_cast<CMPXVideoPlaybackMediaDetailsViewer*>(aPtr)->HandleScrollFilenameTimerL()
       
   695             );
       
   696     return KErrNone;
       
   697 }
       
   698 
       
   699 // -------------------------------------------------------------------------------------------------
       
   700 // CMPXVideoPlaybackMediaDetailsViewer::HandleScrollFilenameTimerL
       
   701 // -------------------------------------------------------------------------------------------------
       
   702 //
       
   703 void CMPXVideoPlaybackMediaDetailsViewer::HandleScrollFilenameTimerL()
       
   704 {
       
   705     MPX_ENTER_EXIT( _L( "CMPXVideoPlaybackMediaDetailsViewer::HandleScrollFilenameTimerL" ) );
       
   706 
       
   707     TBool skipForTimerDelay = EFalse;
       
   708 
       
   709     // add a delay after each complete scrolling
       
   710     if ( iScrollTimerDelayBeginningTick != KInvalidTick )
       
   711     {
       
   712         if ( ( User::NTickCount() - iScrollTimerDelayBeginningTick ) >= KScrollTimerDelayTickCounts )
       
   713         {
       
   714             iScrollTimerDelayBeginningTick = KInvalidTick;
       
   715         }
       
   716         else
       
   717         {
       
   718             skipForTimerDelay = ETrue;
       
   719         }
       
   720     }
       
   721 
       
   722     if ( !skipForTimerDelay && iShouldPauseScrolling )
       
   723     {
       
   724         iShouldPauseScrolling = EFalse;
       
   725         iScrollTimerDelayBeginningTick = User::NTickCount();
       
   726         skipForTimerDelay = ETrue;
       
   727     }
       
   728 
       
   729     // skip the scrolling operation if the loop for delay is going on
       
   730     if ( !skipForTimerDelay )
       
   731     {
       
   732         HBufC* fileName = iController->FileDetails()->GenerateFileNameL();
       
   733 
       
   734         
       
   735         if ( fileName && fileName->Length() )
       
   736         {
       
   737             CleanupStack::PushL( fileName );
       
   738         
       
   739             TInt length = fileName->Length();
       
   740 
       
   741             HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_FILENAME_HEADING );
       
   742             CleanupStack::PushL( heading );
       
   743 
       
   744             TBuf<KMediaDetailsViewerMaxBufLen> filenameField;
       
   745             filenameField.Append(KLeftMargin);
       
   746             filenameField.Append( *heading );
       
   747             filenameField.Append( KHeadingValueSeperator );
       
   748             
       
   749             if ( length >= KMediaDetailsViewerVisibleCharacters )
       
   750             {
       
   751                 filenameField.Append( fileName->Mid( iScrollPosition,
       
   752                         KMediaDetailsViewerVisibleCharacters ) );
       
   753 
       
   754                 if ( iScrollPosition ==  (length - KMediaDetailsViewerVisibleCharacters) )
   690                 {
   755                 {
   691                 if ( ( y + x ) & 1 )
   756                     iScrollPosition = 0;
   692                     {
   757                     iShouldPauseScrolling = ETrue;
   693                     // Make this pixel transparent
       
   694                     dataAddr[y * scanLineLengthWord + x] = 0x00000000; 
       
   695                     }
       
   696                 }
   758                 }
   697             }
   759                 else
   698     
   760                 {
   699     iBackgroundBitmap->UnlockHeap();
   761                     iScrollPosition++;
   700 }
   762                 }
   701 
       
   702 // -------------------------------------------------------------------------------------------------
       
   703 // CMPXVideoPlaybackMediaDetailsViewer::ScrollFilenameTimer
       
   704 // -------------------------------------------------------------------------------------------------
       
   705 //
       
   706 TInt CMPXVideoPlaybackMediaDetailsViewer::ScrollFilenameTimer( TAny* aPtr )
       
   707 {
       
   708 	TRAP_IGNORE( 
       
   709 			static_cast<CMPXVideoPlaybackMediaDetailsViewer*>(aPtr)->HandleScrollFilenameTimerL()
       
   710 			);
       
   711     return KErrNone;
       
   712 }
       
   713 
       
   714 // -------------------------------------------------------------------------------------------------
       
   715 // CMPXVideoPlaybackMediaDetailsViewer::HandleScrollFilenameTimerL
       
   716 // -------------------------------------------------------------------------------------------------
       
   717 //
       
   718 void CMPXVideoPlaybackMediaDetailsViewer::HandleScrollFilenameTimerL()
       
   719 {   
       
   720     HBufC* fileName = iController->FileDetails()->GenerateFileNameL();
       
   721     
       
   722 	if ( fileName && fileName->Length() )
       
   723     {
       
   724         CleanupStack::PushL( fileName );
       
   725         if ( iShouldPauseScrolling )
       
   726         {
       
   727             iShouldPauseScrolling = EFalse;
       
   728             User::After( 2000000 );  // add a 2 second delay after each complete scrolling
       
   729         }    
       
   730     
       
   731         TInt length = fileName->Length();                
       
   732                         
       
   733         HBufC* heading  = iEikonEnv->AllocReadResourceL( R_MPX_FILENAME_HEADING );     
       
   734         CleanupStack::PushL( heading );
       
   735         
       
   736         TBuf<KMediaDetailsViewerMaxBufLen> filenameField;
       
   737         filenameField.Append(KLeftMargin);
       
   738         filenameField.Append( *heading );
       
   739         filenameField.Append( KHeadingValueSeperator );           
       
   740         
       
   741         if ( length >= KMediaDetailsViewerVisibleCharacters )
       
   742         {  
       
   743             filenameField.Append( fileName->Mid( iScrollPosition,
       
   744             		KMediaDetailsViewerVisibleCharacters ) );
       
   745             
       
   746             if ( iScrollPosition ==  (length - KMediaDetailsViewerVisibleCharacters) )
       
   747             {
       
   748                 iScrollPosition = 0;    
       
   749                 iShouldPauseScrolling = ETrue;
       
   750             }
   763             }
   751             else
   764             else
   752             {
   765             {
   753                 iScrollPosition++;
   766                 filenameField.Append( *fileName );
       
   767                 iScrollingTextTimer->Cancel();   // no need to keep the timer active
   754             }
   768             }
       
   769 
       
   770             iClipnameLabel->SetTextL(filenameField);
       
   771             DrawNow();
       
   772 
       
   773             CleanupStack::PopAndDestroy( heading );
       
   774             CleanupStack::PopAndDestroy( fileName );
   755         }
   775         }
   756         else
   776     }
   757         {
       
   758             filenameField.Append( *fileName );
       
   759             iScrollingTextTimer->Cancel();   // no need to keep the timer active
       
   760         }
       
   761                     
       
   762         iClipnameLabel->SetTextL(filenameField);    
       
   763         DrawNow();
       
   764         
       
   765         CleanupStack::PopAndDestroy( heading );        
       
   766         CleanupStack::PopAndDestroy( fileName );                  
       
   767     }           
       
   768 }
   777 }
   769 
   778 
   770 
   779 
   771 // -------------------------------------------------------------------------------------------------
   780 // -------------------------------------------------------------------------------------------------
   772 //   CMPXVideoPlaybackMediaDetailsViewer::NumOfItemsShownInViewer
   781 //   CMPXVideoPlaybackMediaDetailsViewer::NumOfItemsShownInViewer
   773 // -------------------------------------------------------------------------------------------------
   782 // -------------------------------------------------------------------------------------------------
   774 //
   783 //
   775 TInt CMPXVideoPlaybackMediaDetailsViewer::NumOfItemsShownInViewerL()
   784 TInt CMPXVideoPlaybackMediaDetailsViewer::NumOfItemsShownInViewerL()
   776 {
   785 {
   777     TInt numOfItems = 0;
   786     TInt numOfItems = 0;
   778     
   787 
   779     if ( iController->FileDetails()->iDrmProtected )
   788     if ( iController->FileDetails()->iDrmProtected )
   780     {
   789     {
   781         numOfItems++;
   790         numOfItems++;
   782     }
   791     }
   783     
   792 
   784     if ( iController->FileDetails()->iClipName )
   793     if ( iController->FileDetails()->iClipName )
   785     {
   794     {
   786         numOfItems++;
   795         numOfItems++;
   787     }
   796     }
   788     
   797 
   789     if ( iController->FileDetails()->iMimeType )
   798     if ( iController->FileDetails()->iMimeType )
   790     {
   799     {
   791         numOfItems++;
   800         numOfItems++;
   792     }
   801     }
   793     
   802 
   794     if ( iController->FileDetails()->iVideoHeight && 
   803     if ( iController->FileDetails()->iVideoHeight &&
   795          iController->FileDetails()->iVideoWidth )
   804          iController->FileDetails()->iVideoWidth )
   796     {
   805     {
   797         numOfItems++;
   806         numOfItems++;
   798     }
   807     }
   799     
   808 
   800     if ( iController->FileDetails()->iDuration > 0 )
   809     if ( iController->FileDetails()->iDuration > 0 )
   801     {
   810     {
   802         numOfItems++;    
   811         numOfItems++;
   803     }
   812     }
   804     
   813 
   805     if ( iController->FileDetails()->iBitRate > 0 )
   814     if ( iController->FileDetails()->iBitRate > 0 )
   806     {
   815     {
   807         numOfItems++;  
   816         numOfItems++;
   808     }
   817     }
   809     
   818 
   810     if ( iController->FileDetails()->iTitle )
   819     if ( iController->FileDetails()->iTitle )
   811     {
   820     {
   812         numOfItems++;
   821         numOfItems++;
   813     }
   822     }
   814     
   823 
   815     if ( iController->FileDetails()->iArtist )
   824     if ( iController->FileDetails()->iArtist )
   816     {
   825     {
   817         numOfItems++;
   826         numOfItems++;
   818     }
   827     }
   819 
   828 
   820     // Additional File Details
   829     // Additional File Details
   821     CMPXFileDetailsPlugin* addPlugin( NULL );
   830     CMPXFileDetailsPlugin* addPlugin( NULL );
   822     
   831 
   823     // Use the interface to load the ecom plugin
   832     // Use the interface to load the ecom plugin
   824     TRAPD ( err, addPlugin = CMPXFileDetailsPlugin::NewL( KFileDetailsCntlPluginUid ) );
   833     TRAPD ( err, addPlugin = CMPXFileDetailsPlugin::NewL( KFileDetailsCntlPluginUid ) );
   825 
   834 
   826     // If plugin loaded successfully
   835     // If plugin loaded successfully
   827     if (!err )
   836     if ( ! err )
   828     {
   837     {
   829         TPtrC addLabel;
   838         TPtrC addLabel;
   830         addLabel.Set( addPlugin->GetAdditionalLabelLC( iController->FileDetails()->iFourCCCode ) );
   839         addLabel.Set( addPlugin->GetAdditionalLabelLC( iController->FileDetails()->iFourCCCode ) );
   831         iAdditionalString = addLabel.AllocL();
   840         iAdditionalString = addLabel.AllocL();
   832 
   841 
   833         if ( iAdditionalString->Length() ) 
   842         if ( iAdditionalString->Length() )
   834         {   
   843         {
   835             numOfItems++;
   844             numOfItems++;
   836         }
   845         }
   837 
   846 
   838         CleanupStack::PopAndDestroy();  // addLabel
   847         CleanupStack::PopAndDestroy();  // addLabel
   839     }
   848     }
   840     
   849 
   841     delete addPlugin;
   850     delete addPlugin;
   842     
   851 
   843     return numOfItems;
   852     return numOfItems;
   844 }
   853 }
   845 
   854 
   846 // -------------------------------------------------------------------------------------------------
   855 // -------------------------------------------------------------------------------------------------
   847 //   CMPXVideoPlaybackMediaDetailsViewer::CalculateViewerRect
   856 //   CMPXVideoPlaybackMediaDetailsViewer::CalculateViewerRect
   848 // -------------------------------------------------------------------------------------------------
   857 // -------------------------------------------------------------------------------------------------
   849 //
   858 //
   850 TRect CMPXVideoPlaybackMediaDetailsViewer::CalculateViewerRectL()
   859 TRect CMPXVideoPlaybackMediaDetailsViewer::CalculateViewerRectL()
   851 {
   860 {
   852     TInt numOfItems = NumOfItemsShownInViewerL();
   861     TInt numOfItems = NumOfItemsShownInViewerL();
   853     TRect viewerRect;    
   862     TRect viewerRect;
   854     
   863 
   855     // optimize viewer's width for the clipname 
   864     // optimize viewer's width for the clipname
   856     TInt horizontalOffset = 0;
   865     TInt horizontalOffset = 0;
   857     TInt filenameLength = iController->FileDetails()->iClipName->Des().Length();
   866     TInt filenameLength = iController->FileDetails()->iClipName->Des().Length();
   858 
   867 
   859     if ( filenameLength <= KMediaDetailsViewerFilenameMedium  )    
   868     if ( filenameLength <= KMediaDetailsViewerFilenameMedium )
   860     {
   869     {
   861         horizontalOffset = 
   870         horizontalOffset =
   862             iController->iContainer->Rect().iBr.iX / KMediaDetailsViewerOffsetDivisorMedium;
   871             iController->iContainer->Rect().iBr.iX / KMediaDetailsViewerOffsetDivisorMedium;
   863     }        
   872     }
   864     else
   873     else
   865     {
   874     {
   866         horizontalOffset = 
   875         horizontalOffset =
   867             iController->iContainer->Rect().iBr.iX / KMediaDetailsViewerOffsetDivisorMax;
   876             iController->iContainer->Rect().iBr.iX / KMediaDetailsViewerOffsetDivisorMax;
   868     }
   877     }
   869             
   878 
   870     TInt eachItemHeight = 
   879     TInt eachItemHeight = iController->iContainer->Rect().iBr.iY / KMediaDetailsViewerMaxItems;
   871             iController->iContainer->Rect().iBr.iY / KMediaDetailsViewerMaxItems;
   880 
   872     
   881     TInt verticalHalf = iController->iContainer->Rect().iBr.iY / 2;
   873     TInt verticalHalf = iController->iContainer->Rect().iBr.iY / 2;        
   882 
   874     
       
   875     TInt tLX = (iController->iContainer->Rect().iTl.iX) + horizontalOffset;
   883     TInt tLX = (iController->iContainer->Rect().iTl.iX) + horizontalOffset;
   876     TInt bRX = (iController->iContainer->Rect().iBr.iX) - horizontalOffset; 
   884     TInt bRX = (iController->iContainer->Rect().iBr.iX) - horizontalOffset;
   877     
   885 
   878     TInt tLY = verticalHalf - ( eachItemHeight * numOfItems/2 );
   886     TInt tLY = verticalHalf - ( eachItemHeight * numOfItems/2 );
   879     
   887 
   880     // pad for the margins on top and bottom of viewer      
   888     // pad for the margins on top and bottom of viewer
   881     TInt bRY = verticalHalf + ( eachItemHeight * numOfItems/2 ) + (KMediaDetailsViewerItemMargin * 2); 
   889     TInt bRY =
   882     
   890         verticalHalf + ( eachItemHeight * numOfItems/2 ) + ( KMediaDetailsViewerItemMargin * 2 );
       
   891 
   883     viewerRect = TRect( tLX, tLY, bRX, bRY );
   892     viewerRect = TRect( tLX, tLY, bRX, bRY );
   884     
   893 
   885     return viewerRect;
   894     return viewerRect;
   886 }
   895 }
   887 
   896 
   888 // -------------------------------------------------------------------------------------------------
   897 // -------------------------------------------------------------------------------------------------
   889 //   CMPXVideoPlaybackMediaDetailsViewer::ViewerRect
   898 //   CMPXVideoPlaybackMediaDetailsViewer::ViewerRect
   893 {
   902 {
   894     return iViewerRect;
   903     return iViewerRect;
   895 }
   904 }
   896 
   905 
   897 
   906 
   898 
       
   899 //  End of File
   907 //  End of File