81 // ---------------------------------------------------------------------------- |
81 // ---------------------------------------------------------------------------- |
82 // |
82 // |
83 void GlxThumbnailVariantType::ConstructL( const TGlxMedia& aMedia, const TSize& aSize, |
83 void GlxThumbnailVariantType::ConstructL( const TGlxMedia& aMedia, const TSize& aSize, |
84 TBool aIsFocused, TInt aTextureId ) |
84 TBool aIsFocused, TInt aTextureId ) |
85 { |
85 { |
86 |
|
87 TRACER("GlxThumbnailVariantType::ConstructL"); |
86 TRACER("GlxThumbnailVariantType::ConstructL"); |
88 GLX_DEBUG2("GlxThumbnailVariantType::ConstructL Media Id=%d", aMedia.Id().Value()); |
87 GLX_DEBUG2("GlxThumbnailVariantType::ConstructL Media Id=%d", aMedia.Id().Value()); |
89 |
88 TInt err = KErrNone; |
|
89 |
90 if(aTextureId != KErrNotFound) |
90 if(aTextureId != KErrNotFound) |
91 { |
91 { |
92 mTextureId = aTextureId; |
92 mTextureId = aTextureId; |
|
93 GLX_DEBUG1("GlxThumbnailVariantType::ConstructL valid aTextureId"); |
93 return; |
94 return; |
94 } |
95 } |
95 |
96 |
96 iUiUtility = CGlxUiUtility::UtilityL(); |
97 iUiUtility = CGlxUiUtility::UtilityL(); |
97 |
98 TSize defaultSize = iUiUtility->GetGridIconSize(); |
|
99 TFileName resFile(KDC_APP_BITMAP_DIR); |
|
100 resFile.Append(KGlxIconsFilename); |
|
101 |
|
102 const TDesC& uri = aMedia.Uri(); |
|
103 GLX_LOG_URI( "GlxThumbnailVariantType::ConstructL(uri=%S)", &uri ); |
|
104 |
|
105 if (!iUiUtility->GetForegroundStatus() || uri.Length() == 0) |
|
106 { |
|
107 GLX_DEBUG1("GlxThumbnailVariantType::Create default texture & return"); |
|
108 TRAP(err, mTextureId = iUiUtility->GlxTextureManager().CreateIconTextureL( |
|
109 EMbmGlxiconsQgn_prop_image_notcreated, resFile, defaultSize).Id()); |
|
110 return; |
|
111 } |
|
112 |
98 TBool drm = EFalse; |
113 TBool drm = EFalse; |
99 TGlxMediaGeneralRightsValidity isValid = EGlxDrmRightsValidityUnknown; |
114 TGlxMediaGeneralRightsValidity isValid = EGlxDrmRightsValidityUnknown; |
100 |
115 |
101 if(aMedia.GetDrmProtected(drm)) |
116 if(aMedia.GetDrmProtected(drm)) |
102 { |
117 { |
105 aMedia.GetDrmValidity(isValid); |
120 aMedia.GetDrmValidity(isValid); |
106 } |
121 } |
107 |
122 |
108 TBool fsTnmAvailable = HasRelevantThumbnail(aMedia,aSize); |
123 TBool fsTnmAvailable = HasRelevantThumbnail(aMedia,aSize); |
109 |
124 |
110 TIconInfo icon; |
|
111 |
|
112 TSize defaultSize = iUiUtility->GetGridIconSize(); |
|
113 |
|
114 TFileName resFile(KDC_APP_BITMAP_DIR); |
|
115 resFile.Append(KGlxIconsFilename); |
|
116 |
|
117 TInt frameCount = 0; |
125 TInt frameCount = 0; |
118 aMedia.GetFrameCount(frameCount); |
126 aMedia.GetFrameCount(frameCount); |
119 |
127 |
120 const TDesC& uri = aMedia.Uri(); |
|
121 GLX_DEBUG2("GlxThumbnailVariantType::ConstructL() uri.Length()=%d", uri.Length()); |
|
122 |
|
123 TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( |
128 TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( |
124 aMedia.Properties(), KGlxMediaIdThumbnail ); |
129 aMedia.Properties(), KGlxMediaIdThumbnail ); |
125 |
130 |
126 TInt err = KErrNone; |
131 TIconInfo icon; |
127 TBool expired = EFalse; |
132 TBool expired = EFalse; |
128 |
133 |
129 if ( aIsFocused && frameCount > 1 && (fsTnmAvailable) ) |
134 if (aIsFocused && frameCount > 1 && fsTnmAvailable && !drm) |
130 { |
135 { |
131 GLX_DEBUG1("GlxThumbnailVariantType::CreateAnimatedGifTextureL"); |
136 GLX_DEBUG1("GlxThumbnailVariantType::CreateAnimatedGifTextureL"); |
132 |
137 |
133 // If the image is DRM gif, we'll not animate. |
138 TRAP( err, mTextureId = iUiUtility->GlxTextureManager(). |
134 // Only display the 1st frame. Otherwise animate for normal gif. |
139 CreateAnimatedGifTextureL( uri, aSize, aMedia, |
135 if (drm) |
140 aMedia.IdSpaceId() ).Id() ); |
136 { |
|
137 TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateThumbnailTextureL( |
|
138 aMedia, aMedia.IdSpaceId(), aSize, this ).Id() ); |
|
139 } |
|
140 else |
|
141 { |
|
142 TRAP( err, mTextureId = iUiUtility->GlxTextureManager(). |
|
143 CreateAnimatedGifTextureL( uri, aSize, aMedia, |
|
144 aMedia.IdSpaceId() ).Id() ); |
|
145 } |
|
146 } |
141 } |
147 //URI length could be zero for Media Id based Thumbnail fetch |
142 //URI length could be zero for Media Id based Thumbnail fetch |
148 else if ( fsTnmAvailable ) |
143 else if ( fsTnmAvailable ) |
149 { |
144 { |
150 GLX_DEBUG1("GlxThumbnailVariantType::CreateThumbnailTextureL"); |
|
151 TMPXGeneralCategory cat = aMedia.Category(); |
145 TMPXGeneralCategory cat = aMedia.Category(); |
152 //Check if media is DRM rights protected |
146 //Check if media is DRM rights protected |
153 if (drm) |
147 if (drm) |
154 { |
148 { |
155 TBool privatePath = EFalse; |
149 TBool privatePath = EFalse; |
189 } |
183 } |
190 DeleteImageViewerInstance(); |
184 DeleteImageViewerInstance(); |
191 //Check If DRM rights have expired. |
185 //Check If DRM rights have expired. |
192 if (expired) |
186 if (expired) |
193 { |
187 { |
|
188 GLX_DEBUG1("GlxThumbnailVariantType::CreateIconTextureL:Default (expired)"); |
194 TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateIconTextureL( |
189 TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateIconTextureL( |
195 EMbmGlxiconsQgn_prop_image_notcreated, resFile, defaultSize ).Id() ); |
190 EMbmGlxiconsQgn_prop_image_notcreated, resFile, defaultSize ).Id() ); |
196 } |
191 } |
197 else |
192 else |
198 { |
193 { |
199 if (isValid == EGlxDrmRightsValid) |
194 if (isValid == EGlxDrmRightsValid) |
200 { |
195 { |
201 // Fix for EABI-7RL9DD |
196 // Fix for EABI-7RL9DD |
202 // Replaced defaultSize with aSize |
197 // Replaced defaultSize with aSize |
|
198 GLX_DEBUG1("GlxThumbnailVariantType::CreateThumbnailTextureL:EGlxDrmRightsValid"); |
203 TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateThumbnailTextureL( |
199 TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateThumbnailTextureL( |
204 aMedia, aMedia.IdSpaceId(), aSize, this ).Id() ); |
200 aMedia, aMedia.IdSpaceId(), aSize, this ).Id() ); |
205 } |
201 } |
206 |
202 |
207 } |
203 } |
208 } |
204 } |
209 else |
205 else |
210 { |
206 { |
|
207 GLX_DEBUG1("GlxThumbnailVariantType::CreateThumbnailTextureL"); |
211 TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateThumbnailTextureL( |
208 TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateThumbnailTextureL( |
212 aMedia, aMedia.IdSpaceId(), aSize, this ).Id() ); |
209 aMedia, aMedia.IdSpaceId(), aSize, this ).Id() ); |
213 } |
210 } |
214 } |
211 } |
215 else if ( aMedia.GetIconInfo(icon) ) |
212 else if ( aMedia.GetIconInfo(icon) ) |
221 else if (KErrNone != thumbnailError && aMedia.Category() == EMPXVideo) |
218 else if (KErrNone != thumbnailError && aMedia.Category() == EMPXVideo) |
222 { |
219 { |
223 //show larger (twice) default icon for videos, which has errors |
220 //show larger (twice) default icon for videos, which has errors |
224 TSize newSize = defaultSize; |
221 TSize newSize = defaultSize; |
225 newSize += defaultSize; |
222 newSize += defaultSize; |
226 GLX_DEBUG1( |
223 GLX_DEBUG1("GlxThumbnailVariantType::CreateIconTextureL::Default (video)"); |
227 "GlxThumbnailVariantType::CreateThumbnailTextureL::Default (video)"); |
|
228 TRAP(err, mTextureId |
224 TRAP(err, mTextureId |
229 = iUiUtility->GlxTextureManager().CreateIconTextureL( |
225 = iUiUtility->GlxTextureManager().CreateIconTextureL( |
230 EMbmGlxiconsQgn_prop_image_notcreated, resFile, |
226 EMbmGlxiconsQgn_prop_image_notcreated, resFile, |
231 newSize).Id()); |
227 newSize).Id()); |
232 } |
228 } |
291 // ----------------------------------------------------------------------------- |
287 // ----------------------------------------------------------------------------- |
292 // |
288 // |
293 TBool GlxThumbnailVariantType::ConsumeRightsBasedOnSize( |
289 TBool GlxThumbnailVariantType::ConsumeRightsBasedOnSize( |
294 TSize aImageSize, TSize aBitmapSize) |
290 TSize aImageSize, TSize aBitmapSize) |
295 { |
291 { |
296 TRACER("CGlxCommandHandlerDrm::ConsumeRightsBasedOnSize"); |
292 TRACER("GlxThumbnailVariantType::ConsumeRightsBasedOnSize"); |
297 |
293 |
298 TBool drmRightsChecked = EFalse; |
294 TBool drmRightsChecked = EFalse; |
299 // minimum size (111 x 83) |
295 // minimum size (111 x 83) |
300 TInt minSize = KGlxThumbnailDrmWidth * KGlxThumbnailDrmHeight; |
296 TInt minSize = KGlxThumbnailDrmWidth * KGlxThumbnailDrmHeight; |
301 // size of actual image |
297 // size of actual image |