32 // DEPENDENCIES |
32 // DEPENDENCIES |
33 |
33 |
34 // ----------------------------------------------------------------------------- |
34 // ----------------------------------------------------------------------------- |
35 // Constructor. |
35 // Constructor. |
36 // ----------------------------------------------------------------------------- |
36 // ----------------------------------------------------------------------------- |
37 inline CShwThumbnailContext::CShwThumbnailContext( |
37 inline CShwThumbnailContext::CShwThumbnailContext(TInt aIndex, TSize aSize, |
38 TInt aIndex, TSize aSize ) : iSize(aSize), iCurrentIndex( aIndex ) |
38 MGlxMediaList& aList) : |
|
39 iSize(aSize), iCurrentIndex(aIndex), iList(aList) |
39 { |
40 { |
40 } |
41 } |
41 |
42 |
42 // ----------------------------------------------------------------------------- |
43 // ----------------------------------------------------------------------------- |
43 // NewLC. |
44 // NewLC. |
44 // ----------------------------------------------------------------------------- |
45 // ----------------------------------------------------------------------------- |
45 CShwThumbnailContext* CShwThumbnailContext::NewLC( TInt aIndex, TSize aSize ) |
46 CShwThumbnailContext* CShwThumbnailContext::NewLC(TInt aIndex, TSize aSize, |
|
47 MGlxMediaList& aList) |
46 { |
48 { |
47 TRACER("CShwThumbnailContext::NewLC"); |
49 TRACER("CShwThumbnailContext::NewLC"); |
48 GLX_LOG_INFO1( "CShwThumbnailContext::NewL, aIndex=%d", aIndex ); |
50 GLX_LOG_INFO1( "CShwThumbnailContext::NewL, aIndex=%d", aIndex ); |
49 CShwThumbnailContext* self = |
51 CShwThumbnailContext* self = |
50 new (ELeave) CShwThumbnailContext( aIndex, aSize ); |
52 new (ELeave) CShwThumbnailContext( aIndex, aSize, aList ); |
51 CleanupStack::PushL( self ); |
53 CleanupStack::PushL( self ); |
52 self->ConstructL(); |
54 self->ConstructL(); |
53 return self; |
55 return self; |
54 } |
56 } |
55 |
57 |
57 // ConstructL. |
59 // ConstructL. |
58 // ----------------------------------------------------------------------------- |
60 // ----------------------------------------------------------------------------- |
59 void CShwThumbnailContext::ConstructL() |
61 void CShwThumbnailContext::ConstructL() |
60 { |
62 { |
61 TRACER("CShwThumbnailContext::ConstructL"); |
63 TRACER("CShwThumbnailContext::ConstructL"); |
62 GLX_LOG_INFO("CShwThumbnailContext::ConstructL"); |
|
63 // Create the high quality / slower context |
64 // Create the high quality / slower context |
64 iHighQualityContext = CGlxThumbnailContext::NewL( this ); |
65 iHighQualityContext = CGlxThumbnailContext::NewL( this ); |
65 // Call both setdefault and add |
66 // Call both setdefault and add |
66 iHighQualityContext->SetDefaultSpec( iSize.iWidth, iSize.iHeight ); |
67 iHighQualityContext->SetDefaultSpec( iSize.iWidth, iSize.iHeight ); |
67 iHighQualityContext->AddSpecForItemL( iSize.iWidth, iSize.iHeight, |
68 iHighQualityContext->AddSpecForItemL( iSize.iWidth, iSize.iHeight, |
74 // Destructor. |
75 // Destructor. |
75 // ----------------------------------------------------------------------------- |
76 // ----------------------------------------------------------------------------- |
76 CShwThumbnailContext::~CShwThumbnailContext() |
77 CShwThumbnailContext::~CShwThumbnailContext() |
77 { |
78 { |
78 TRACER("CShwThumbnailContext::~CShwThumbnailContext"); |
79 TRACER("CShwThumbnailContext::~CShwThumbnailContext"); |
79 GLX_LOG_INFO( "CShwThumbnailContext::~CShwThumbnailContext" ); |
|
80 delete iHighQualityContext; |
80 delete iHighQualityContext; |
81 } |
81 } |
82 |
82 |
83 // ----------------------------------------------------------------------------- |
83 // ----------------------------------------------------------------------------- |
84 // SetToFirst. |
84 // SetToFirst. |
85 // ----------------------------------------------------------------------------- |
85 // ----------------------------------------------------------------------------- |
86 void CShwThumbnailContext::SetToFirst( const MGlxMediaList* /*aList*/ ) |
86 void CShwThumbnailContext::SetToFirst( const MGlxMediaList* /*aList*/ ) |
87 { |
87 { |
88 TRACER("CShwThumbnailContext::SetToFirst"); |
88 TRACER("CShwThumbnailContext::SetToFirst"); |
89 GLX_LOG_INFO( "CShwThumbnailContext::SetToFirst" ); |
|
90 // reset iterator state |
89 // reset iterator state |
91 iIterated = EFalse; |
90 iIterated = EFalse; |
92 } |
91 } |
93 |
92 |
94 // ----------------------------------------------------------------------------- |
93 // ----------------------------------------------------------------------------- |
95 // CShwThumbnailLoaderImpl::operator++. |
94 // CShwThumbnailLoaderImpl::operator++. |
96 // ----------------------------------------------------------------------------- |
95 // ----------------------------------------------------------------------------- |
97 TInt CShwThumbnailContext::operator++( TInt ) |
96 TInt CShwThumbnailContext::operator++( TInt ) |
98 { |
97 { |
99 TRACER("CShwThumbnailContext::operator++"); |
98 TRACER("CShwThumbnailContext::operator++"); |
100 GLX_LOG_INFO( "CShwThumbnailContext::operator++" ); |
|
101 // we want to load all the thumbnails our clients have requested |
99 // we want to load all the thumbnails our clients have requested |
102 // notification on, nothing else |
100 // notification on, nothing else |
103 // by default tell the thumbnail that we dont have any interesting indexes |
101 // by default tell the thumbnail that we dont have any interesting indexes |
104 TInt wantedIndex = KErrNotFound; |
102 TInt wantedIndex = KErrNotFound; |
105 // check if we were asked already |
103 TInt count = iList.Count(); |
106 if( !iIterated ) |
104 // check if we were asked already and guard conditions |
107 { |
105 if( !iIterated && (count > 0) && (iCurrentIndex < count)) |
108 // we want to load thumbnail for the specified index |
106 { |
109 wantedIndex = iCurrentIndex; |
107 wantedIndex = iCurrentIndex; |
110 iIterated = ETrue; |
108 iIterated = ETrue; |
111 } |
109 } |
112 // finally return the index that was wanted |
110 // finally return the index that was wanted |
|
111 GLX_LOG_INFO1("CShwThumbnailContext::operator++ wantedIndex %d",wantedIndex); |
113 return wantedIndex; |
112 return wantedIndex; |
114 } |
113 } |
115 |
114 |
116 // ----------------------------------------------------------------------------- |
115 // ----------------------------------------------------------------------------- |
117 // InRange. |
116 // InRange. |
118 // ----------------------------------------------------------------------------- |
117 // ----------------------------------------------------------------------------- |
119 TBool CShwThumbnailContext::InRange( TInt aIndex ) const |
118 TBool CShwThumbnailContext::InRange( TInt aIndex ) const |
120 { |
119 { |
121 TRACER("CShwThumbnailContext::InRange"); |
120 TRACER("CShwThumbnailContext::InRange"); |
122 GLX_LOG_INFO( "CShwThumbnailContext::InRange" ); |
|
123 // if we got notifications |
121 // if we got notifications |
124 if ( aIndex == iCurrentIndex ) |
122 if ( aIndex == iCurrentIndex ) |
125 { |
123 { |
126 // is in range so dont remove the item :) |
124 // is in range so dont remove the item :) |
127 // cache removes thumbnails that are no longer in range |
125 // cache removes thumbnails that are no longer in range |