photosgallery/viewframework/medialists/src/glxattributecontext.cpp
changeset 1 9ba538e329bd
parent 0 4e91876724a2
child 25 191387a8b767
equal deleted inserted replaced
0:4e91876724a2 1:9ba538e329bd
    21 #include "mglxmedialist.h"
    21 #include "mglxmedialist.h"
    22 #include "glxerrormanager.h"
    22 #include "glxerrormanager.h"
    23 #include "glxtracer.h"
    23 #include "glxtracer.h"
    24 #include "glxlog.h"
    24 #include "glxlog.h"
    25 #include "glxlistutils.h"
    25 #include "glxlistutils.h"
       
    26 #include "glxthumbnailattributeinfo.h"
    26 
    27 
    27 // Default granularity of items to request for
    28 // Default granularity of items to request for
    28 const TUint KGlxAttributeContextDefaultGranularity = 200;
    29 const TUint KGlxAttributeContextDefaultGranularity = 200;
    29 
    30 
    30 const TInt KVisibleItemsCorrectionValue = 1;
    31 const TInt KVisibleItemsCorrectionValue = 1;
   118 // From MGlxFetchContext
   119 // From MGlxFetchContext
   119 // -----------------------------------------------------------------------------
   120 // -----------------------------------------------------------------------------
   120 //
   121 //
   121 TInt CGlxAttributeContext::AttributeRequestL(const MGlxMediaList* aList, 
   122 TInt CGlxAttributeContext::AttributeRequestL(const MGlxMediaList* aList, 
   122         RArray<TInt>& aItemIndices, RArray<TMPXAttribute>& aAttributes, 
   123         RArray<TInt>& aItemIndices, RArray<TMPXAttribute>& aAttributes, 
   123         CMPXAttributeSpecs*& /*aDetailedSpecs*/) const
   124         CMPXAttributeSpecs*& aDetailedSpecs) const
   124     {
   125     {
   125     TRACER("CGlxAttributeContext::AttributeRequestL");
   126     TRACER("CGlxAttributeContext::AttributeRequestL");
   126     
   127     
   127     TInt itemCount = aList->Count();
   128     TInt itemCount = aList->Count();
   128     if (0 == itemCount || !iIterator) 
   129     if (0 == itemCount || !iIterator) 
   168             // if the first item had errors
   169             // if the first item had errors
   169             // See EMYP-79VDHP
   170             // See EMYP-79VDHP
   170             error = KErrNone;
   171             error = KErrNone;
   171             }
   172             }
   172         }
   173         }
       
   174     
       
   175     
       
   176     // If the attribute request is for Thumbnail, Check if there is a match found.
       
   177     // And set the size and thumbnail quality
       
   178 	TIdentityRelation<TMPXAttribute> matchContent(&TMPXAttribute::MatchContentId);
       
   179 	TMPXAttribute tnAttr(KGlxMediaIdThumbnail, 0);
       
   180 	
       
   181 	if (iAttributes.Find(tnAttr, matchContent) != KErrNotFound) 
       
   182 		{
       
   183 		// Allocate CMPXAttributeSpecs
       
   184 		CMPXAttributeSpecs* attributeSpecs = CMPXAttributeSpecs::NewL();
       
   185 		CleanupStack::PushL(attributeSpecs);
       
   186 		
       
   187 	attributeSpecs->SetTObjectValueL(
       
   188 	   TMPXAttribute( KGlxMediaIdThumbnail,
       
   189 					   KGlxAttribSpecThumbnailSize ), 
       
   190 					   TSize(iDefaultSpecSize.iWidth,iDefaultSpecSize.iHeight) );
       
   191 		
       
   192 		attributeSpecs->SetTObjectValueL(
       
   193 		   TMPXAttribute( KGlxMediaIdThumbnail,
       
   194 					   KGlxAttribSpecThumbnailQualityOverSpeed ), ETrue );
       
   195 		
       
   196 		aDetailedSpecs = attributeSpecs;
       
   197 		
       
   198 		// Pop from stack
       
   199 		CleanupStack::Pop(attributeSpecs);
       
   200 		
       
   201 		}
   173 
   202 
   174     // If an error was found, return KErrGeneral
   203     // If an error was found, return KErrGeneral
   175     if (error != KErrNone)
   204     if (error != KErrNone)
   176         {
   205         {
   177         return KErrGeneral;
   206         return KErrGeneral;
   370     {
   399     {
   371     TRACER("CGlxDefaultAttributeContext::SetRangeOffsets");
   400     TRACER("CGlxDefaultAttributeContext::SetRangeOffsets");
   372     
   401     
   373     iFromFocusIterator.SetRangeOffsets(aRearOffset, aFrontOffset);
   402     iFromFocusIterator.SetRangeOffsets(aRearOffset, aFrontOffset);
   374     }
   403     }
       
   404 
       
   405 // -----------------------------------------------------------------------------
       
   406 // Sets the default fetch specification
       
   407 // -----------------------------------------------------------------------------
       
   408 //
       
   409 EXPORT_C void CGlxAttributeContext::SetDefaultSpec(TInt aWidth, TInt aHeight)
       
   410 
       
   411     {
       
   412     TRACER( " CGlxAttributeContext::SetDefaultSpec");
       
   413 
       
   414     iDefaultSpecSize = TSize(aWidth, aHeight);
       
   415     }
       
   416