ui/uiengine/medialistwrapper/src/glxmlwrapper_p.cpp
changeset 71 27f2d7aec52a
parent 69 45459746d5e8
equal deleted inserted replaced
69:45459746d5e8 71:27f2d7aec52a
    54 const TInt KTBAttributeCorrupt(-1);
    54 const TInt KTBAttributeCorrupt(-1);
    55 const TInt KListDataWindowSize(10);
    55 const TInt KListDataWindowSize(10);
    56 //for grid thumbnail
    56 //for grid thumbnail
    57 const TInt KGridTNWIdth (127);
    57 const TInt KGridTNWIdth (127);
    58 const TInt KGridTNHeight (110);
    58 const TInt KGridTNHeight (110);
    59 const TInt KGridTNPTWIdth (119);
       
    60 const TInt KGridTNPTHeight (103);
       
    61 //for image strip thumbnail
    59 //for image strip thumbnail
    62 const TInt KImageStripLSTNWIdth (95);
    60 const TInt KImageStripLSTNWIdth (95);
    63 const TInt KImageStripLSTNHeight (83);
    61 const TInt KImageStripLSTNHeight (83);
    64 const TInt KImageStripPTTNWIdth (89);
    62 const TInt KImageStripPTTNWIdth (89);
    65 const TInt KImageStripPTTNHeight (78);
    63 const TInt KImageStripPTTNHeight (78);
   202 // RemoveContextMode
   200 // RemoveContextMode
   203 // ---------------------------------------------------------------------------
   201 // ---------------------------------------------------------------------------
   204 //
   202 //
   205 void GlxMLWrapperPrivate::RemoveContextMode(GlxContextMode aContextMode)
   203 void GlxMLWrapperPrivate::RemoveContextMode(GlxContextMode aContextMode)
   206 {
   204 {
   207   if(aContextMode == GlxContextComment) 
   205     switch( aContextMode ){
   208       {
   206     case GlxContextLsGrid :        
   209        RemoveDescContext();
   207     case GlxContextPtGrid :
   210       }
   208         RemoveGridContext();
       
   209         break;
       
   210         
       
   211     case GlxContextLsFs :
       
   212     case GlxContextPtFs :
       
   213         RemovePtFsContext();
       
   214         break;
       
   215         
       
   216     case GlxContextLsList :
       
   217     case GlxContextPtList :
       
   218     case GlxContextSelectionList :
       
   219         RemoveListContext();
       
   220         break;
       
   221         
       
   222     case GlxContextFavorite :
       
   223         RemoveFavouriteContext();
       
   224         break;
       
   225         
       
   226     case GlxContextComment :
       
   227         RemoveDescContext();
       
   228         break;
       
   229         
       
   230     default :
       
   231         break;
       
   232     }
   211 }
   233 }
   212 // ---------------------------------------------------------------------------
   234 // ---------------------------------------------------------------------------
   213 // SetFavouriteContextL
   235 // SetFavouriteContextL
   214 // ---------------------------------------------------------------------------
   236 // ---------------------------------------------------------------------------
   215 //
   237 //
   295 // ---------------------------------------------------------------------------
   317 // ---------------------------------------------------------------------------
   296 //
   318 //
   297 void GlxMLWrapperPrivate::SetThumbnailContextL(GlxContextMode aContextMode)
   319 void GlxMLWrapperPrivate::SetThumbnailContextL(GlxContextMode aContextMode)
   298 {
   320 {
   299     TRACER("GlxMLWrapperPrivate::SetThumbnailContext()");
   321     TRACER("GlxMLWrapperPrivate::SetThumbnailContext()");
   300     if( aContextMode == GlxContextLsGrid || aContextMode == GlxContextPtGrid) {
   322     if( aContextMode == GlxContextLsGrid || aContextMode == GlxContextPtGrid ) {
   301         if(!iGridContextActivated) {
   323         if( !iGridContextActivated ) {
   302             CreateGridContextL();
   324             CreateGridContextL();
   303         }
   325         }
   304     
   326     
   305         if(iPtFsContextActivated) {
   327         if( iPtFsContextActivated ) {
   306             RemovePtFsContext();
   328             RemovePtFsContext();
   307         }
   329         }
   308         
   330         
   309         if(iLsFsContextActivated) {
   331         /*if(iLsFsContextActivated) {
   310             RemoveLsFsContext();
   332             RemoveLsFsContext();
   311         }
   333         }*/
   312     }
   334     }
   313 	
   335 	
   314 	if(aContextMode == GlxContextLsFs && !iLsFsContextActivated) {
   336 /*	if( ( aContextMode == GlxContextLsFs && !iLsFsContextActivated) {
   315 	    if(!iGridContextActivated) {
   337 	    if(!iGridContextActivated) {
   316 	        CreateGridContextL();
   338 	        CreateGridContextL();
   317 	    }
   339 	    }
   318 		if(iPtFsContextActivated) {
   340 		if(iPtFsContextActivated) {
   319 			RemovePtFsContext();
   341 			RemovePtFsContext();
   320 		}
   342 		}
   321 		CreateLsFsContextL();
   343 		CreateLsFsContextL();
   322 	}
   344 	}*/
   323 	
   345 	
   324 	if(aContextMode == GlxContextPtFs && !iPtFsContextActivated) {
   346 	if( aContextMode == GlxContextPtFs || aContextMode == GlxContextLsFs  ) {
   325         if(!iGridContextActivated) {
   347         if( !iGridContextActivated ) {
   326             CreateGridContextL();
   348             CreateGridContextL();
   327         }
   349         }
   328 		if(iLsFsContextActivated) {
   350         if ( !iPtFsContextActivated ) {
   329 			RemoveLsFsContext();
   351 		    CreatePtFsContextL();
   330 		}
   352         }
   331 		CreatePtFsContextL();
       
   332 	}
   353 	}
   333 }
   354 }
   334 
   355 
   335 // ---------------------------------------------------------------------------
   356 // ---------------------------------------------------------------------------
   336 // CreateGridContextL
   357 // CreateGridContextL
   701             itemHeight = KGridTNHeight;
   722             itemHeight = KGridTNHeight;
   702             itemWidth = KGridTNWIdth;
   723             itemWidth = KGridTNWIdth;
   703         }
   724         }
   704         break;
   725         break;
   705         
   726         
   706         case GlxTBContextPtFs:  {
   727         case GlxTBContextPtFs:  
       
   728         case GlxTBContextLsFs: {
   707             itemHeight = KFullScreenTNPTHeight;
   729             itemHeight = KFullScreenTNPTHeight;
   708             itemWidth = KFullScreenTNPTWidth;
   730             itemWidth = KFullScreenTNPTWidth;
   709         }
       
   710         break;
       
   711         
       
   712         case GlxTBContextLsFs: {
       
   713             itemHeight = KFullScreenTNLSHeight;
       
   714             itemWidth = KFullScreenTNLSWidth;
       
   715         }
   731         }
   716         break;
   732         break;
   717         
   733         
   718         default :
   734         default :
   719         break;
   735         break;
   720     }
   736     }
   721     
   737     
   722     const TGlxMedia& item = iMediaList->Item( aItemIndex );
   738     const TGlxMedia& item = iMediaList->Item( aItemIndex );
   723     TMPXAttribute thumbnailAttribute( KGlxMediaIdThumbnail, 
   739     TMPXAttribute thumbnailAttribute( KGlxMediaIdThumbnail, GlxFullThumbnailAttributeId( ETrue, itemWidth, itemHeight ) ); //todo map icon size with actual mode        
   724                        GlxFullThumbnailAttributeId( ETrue, itemWidth, itemHeight ) ); //todo map icon size with actual mode        
       
   725     const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute );
   740     const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute );
   726     TInt tnError = GlxErrorManager::HasAttributeErrorL( item.Properties(), KGlxMediaIdThumbnail );
       
   727 	
   741 	
   728     if ( value && value->iBitmap != NULL ) {
   742     if ( value && value->iBitmap != NULL ) {
   729         if( aTBContextType == GlxTBContextGrid ) {
   743         if( aTBContextType == GlxTBContextGrid ) {
   730             GLX_LOG_INFO1("### GlxMLWrapperPrivate::RetrieveItemIcon value-Index is %d",aItemIndex );
   744             GLX_LOG_INFO1("### GlxMLWrapperPrivate::RetrieveItemIcon value-Index is %d",aItemIndex );
   731             
   745             if ( iContextMode == GlxContextLsFs ) {
   732             if (  iContextMode == GlxContextPtGrid ) {
   746                 return convertFBSBitmapToHbIcon( value->iBitmap, KImageStripLSTNWIdth, KImageStripLSTNHeight, Qt::IgnoreAspectRatio );
   733                 return convertFBSBitmapToHbIcon( value->iBitmap , KGridTNPTWIdth, KGridTNPTHeight );
       
   734             }
       
   735             else if ( iContextMode == GlxContextLsFs ) {
       
   736                 return convertFBSBitmapToHbIcon( value->iBitmap , KImageStripLSTNWIdth, KImageStripLSTNHeight, Qt::IgnoreAspectRatio );
       
   737             }
   747             }
   738             else if ( iContextMode == GlxContextPtFs ) {
   748             else if ( iContextMode == GlxContextPtFs ) {
   739                 return convertFBSBitmapToHbIcon( value->iBitmap , KImageStripPTTNWIdth, KImageStripPTTNHeight, Qt::IgnoreAspectRatio );
   749                 return convertFBSBitmapToHbIcon( value->iBitmap, KImageStripPTTNWIdth, KImageStripPTTNHeight, Qt::IgnoreAspectRatio );
   740             }
   750             }
   741             else {
   751 			else {
   742                 return convertFBSBitmapToHbIcon( value->iBitmap );
   752 				return convertFBSBitmapToHbIcon( value->iBitmap );
   743             }
   753 			}
       
   754         }
       
   755         else if ( aTBContextType == GlxTBContextLsFs ){
       
   756             return convertFBSBitmapToHbIcon( value->iBitmap, KFullScreenTNLSWidth, KFullScreenTNLSHeight ) ;
   744         }
   757         }
   745         else {
   758         else {
   746             return convertFBSBitmapToHbIcon( value->iBitmap, itemWidth, itemHeight ) ;
   759             return convertFBSBitmapToHbIcon( value->iBitmap, itemWidth, itemHeight ) ;
   747         }
   760         }
   748     }
   761     }
   749     /*else if (item.GetIconInfo(icon))   //todo will be required if we are planning to have static item else remove
       
   750     {  
       
   751         GLX_LOG_INFO1("### GlxMLWrapperPrivate::HandleAttributesAvailableL GetIconInfo-Index is %d",aItemIndex);
       
   752     }*/
       
   753         //handle DRM case
       
   754 
       
   755     
   762     
   756     GLX_LOG_INFO1("### GlxMLWrapperPrivate::RetrieveItemIcon value-Index is %d and have returned empty icon",aItemIndex);
   763     GLX_LOG_INFO1("### GlxMLWrapperPrivate::RetrieveItemIcon value-Index is %d and have returned empty icon",aItemIndex);
   757     return NULL;
   764     return NULL;
   758 }
   765 }
   759 
   766 
  1065 // HandleAttributesAvailableL
  1072 // HandleAttributesAvailableL
  1066 // check for Grid PtFS and LsFs thumbnails. If any of them is available notify
  1073 // check for Grid PtFS and LsFs thumbnails. If any of them is available notify
  1067 // iMLWrapper
  1074 // iMLWrapper
  1068 // ---------------------------------------------------------------------------
  1075 // ---------------------------------------------------------------------------
  1069 //
  1076 //
  1070 void GlxMLWrapperPrivate::HandleAttributesAvailableL( TInt aItemIndex, 
  1077 void GlxMLWrapperPrivate::HandleAttributesAvailableL( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList )
  1071 		const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList )
  1078 {
  1072 	{
  1079     GLX_LOG_INFO1("### GlxMLWrapperPrivate::HandleAttributesAvailableL %d",aItemIndex);
  1073 	GLX_LOG_INFO1("### GlxMLWrapperPrivate::HandleAttributesAvailableL %d",aItemIndex);
  1080     Q_UNUSED(aList);
  1074 	Q_UNUSED(aList);
  1081     
  1075     // char temp[100];
  1082     if ( iGridContextActivated || iLsFsContextActivated || iPtFsContextActivated ) {
  1076 	// sprintf(temp, "execution time of update %d", aItemIndex);
  1083         CheckGridTBAttribute( aItemIndex, aAttributes );
  1077 	// PERFORMANCE_ADV( d1, temp) {
  1084     }
  1078 	if ( iGridContextActivated || iLsFsContextActivated || iPtFsContextActivated )
  1085     if ( iPtFsContextActivated ) {
  1079 	    CheckGridTBAttribute(aItemIndex, aAttributes);
  1086         CheckPtFsTBAttribute( aItemIndex, aAttributes );
  1080 	if ( iPtFsContextActivated )
  1087     }
  1081 	    CheckPtFsTBAttribute(aItemIndex, aAttributes);
  1088     /*if ( iLsFsContextActivated ) {
  1082 	if ( iLsFsContextActivated )
  1089         CheckLsFsTBAttribute(aItemIndex, aAttributes);
  1083 	    CheckLsFsTBAttribute(aItemIndex, aAttributes);
  1090     }*/
  1084 	if (iPtListContextActivated || iSelectionListContextActivated)
  1091     if ( iPtListContextActivated || iSelectionListContextActivated ) {
  1085 	    CheckListAttributes(aItemIndex, aAttributes);
  1092         CheckListAttributes( aItemIndex, aAttributes );
  1086  	if( iDetailsContextActivated && aItemIndex == iMediaList->FocusIndex() )
  1093     }
  1087  	   CheckDetailsAttributes(aItemIndex, aAttributes);
  1094     if ( iDetailsContextActivated && aItemIndex == iMediaList->FocusIndex() ) {
  1088 	
  1095         CheckDetailsAttributes( aItemIndex, aAttributes );
  1089 	}
  1096     }
       
  1097 }
  1090 // ---------------------------------------------------------------------------
  1098 // ---------------------------------------------------------------------------
  1091 // CheckGridTBAttribute
  1099 // CheckGridTBAttribute
  1092 // ---------------------------------------------------------------------------
  1100 // ---------------------------------------------------------------------------
  1093 //
  1101 //
  1094 void GlxMLWrapperPrivate::CheckGridTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes)
  1102 void GlxMLWrapperPrivate::CheckGridTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes)
  1110 // ---------------------------------------------------------------------------
  1118 // ---------------------------------------------------------------------------
  1111 // CheckPtFsTBAttribute
  1119 // CheckPtFsTBAttribute
  1112 // ---------------------------------------------------------------------------
  1120 // ---------------------------------------------------------------------------
  1113 //
  1121 //
  1114 void GlxMLWrapperPrivate::CheckPtFsTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes)
  1122 void GlxMLWrapperPrivate::CheckPtFsTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes)
  1115 	{
  1123 {
  1116 	TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, 
  1124     TMPXAttribute thumbnailAttribute( KGlxMediaIdThumbnail, GlxFullThumbnailAttributeId( ETrue,
  1117             GlxFullThumbnailAttributeId( ETrue, KFullScreenTNPTWidth, KFullScreenTNPTHeight ) ); //todo map icon size with actual mode
  1125         KFullScreenTNPTWidth, KFullScreenTNPTHeight ) ); //todo map icon size with actual mode
  1118 	TInt searchStatus = CheckTBAttributesPresenceandSanity(aItemIndex, aAttributes, thumbnailAttribute);
  1126     TInt searchStatus = CheckTBAttributesPresenceandSanity( aItemIndex, aAttributes, thumbnailAttribute );
  1119 	if(searchStatus == KTBAttributeAvailable)
  1127     
  1120 		{
  1128     if ( searchStatus == KTBAttributeAvailable ) {
  1121 		iMLWrapper->handleReceivedIcon(aItemIndex, GlxTBContextPtFs);
  1129         iMLWrapper->handleReceivedIcon( aItemIndex, GlxTBContextPtFs );
  1122 		}
  1130     }
  1123 	else if(searchStatus == KTBAttributeCorrupt)
  1131     else if ( searchStatus == KTBAttributeCorrupt ) {
  1124 		{
  1132         iMLWrapper->handleIconCorrupt( aItemIndex );
  1125 		iMLWrapper->handleIconCorrupt(aItemIndex);
  1133     }
  1126 		}
  1134 }
  1127 	}
       
  1128 
  1135 
  1129 // ---------------------------------------------------------------------------
  1136 // ---------------------------------------------------------------------------
  1130 // CheckLsFsTBAttribute
  1137 // CheckLsFsTBAttribute
  1131 // ---------------------------------------------------------------------------
  1138 // ---------------------------------------------------------------------------
  1132 //
  1139 //