26
|
1 |
/*
|
|
2 |
* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Makes the Decision to Create Thumbnail Texture or Icon Texture
|
|
15 |
* Considering Drm Validity and Thumbnail Availabilty
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
#include "glxmulthumbnailvarianttype.h"
|
|
23 |
#include <data_caging_path_literals.hrh>
|
|
24 |
#include <alf/ialfvarianttype.h>
|
|
25 |
#include "glxuiutility.h"
|
|
26 |
#include "glxtexturemanager.h"
|
|
27 |
#include <glxerrormanager.h>
|
|
28 |
#include <glxmedia.h>
|
|
29 |
#include <glxthumbnailattributeinfo.h>
|
|
30 |
#include <glxicons.mbg>
|
|
31 |
#include <glxlog.h> // Logging
|
|
32 |
#include <glxtracer.h>
|
|
33 |
#include <glxdrmutility.h>
|
|
34 |
#include <mglxmedialist.h>
|
|
35 |
#include <caf/caferr.h>
|
|
36 |
_LIT(KGlxIconsFilename, "glxicons.mif");
|
|
37 |
|
|
38 |
|
|
39 |
// ----------------------------------------------------------------------------
|
|
40 |
// NewL
|
|
41 |
// ----------------------------------------------------------------------------
|
|
42 |
//
|
|
43 |
GlxThumbnailVariantType* GlxThumbnailVariantType::NewL( const TGlxMedia& aMedia, const TSize& aSize,
|
|
44 |
TBool aIsFocused, TInt aTextureId )
|
|
45 |
{
|
|
46 |
TRACER("GlxThumbnailVariantType::NewL");
|
|
47 |
GlxThumbnailVariantType* self = GlxThumbnailVariantType::NewLC( aMedia,
|
|
48 |
aSize, aIsFocused, aTextureId );
|
|
49 |
CleanupStack::Pop( self );
|
|
50 |
return self;
|
|
51 |
}
|
|
52 |
|
|
53 |
// ----------------------------------------------------------------------------
|
|
54 |
// NewLC
|
|
55 |
// ----------------------------------------------------------------------------
|
|
56 |
//
|
|
57 |
GlxThumbnailVariantType* GlxThumbnailVariantType::NewLC( const TGlxMedia& aMedia, const TSize& aSize,
|
|
58 |
TBool aIsFocused, TInt aTextureId )
|
|
59 |
{
|
|
60 |
TRACER("GlxThumbnailVariantType::NewLC");
|
|
61 |
|
|
62 |
GlxThumbnailVariantType* self = new ( EMM ) GlxThumbnailVariantType(
|
|
63 |
aMedia, aSize, aIsFocused, aTextureId );
|
|
64 |
CleanupStack::PushL( self );
|
|
65 |
self->ConstructL( aMedia, aSize, aIsFocused, aTextureId );
|
|
66 |
return self;
|
|
67 |
}
|
|
68 |
|
|
69 |
// ----------------------------------------------------------------------------
|
|
70 |
// constructor
|
|
71 |
// ----------------------------------------------------------------------------
|
|
72 |
//
|
|
73 |
GlxThumbnailVariantType::GlxThumbnailVariantType( const TGlxMedia& /*aMedia*/,
|
|
74 |
const TSize& /*aSize*/, TBool /*aIsFocused*/, TInt /*aTextureId*/ )
|
|
75 |
{
|
|
76 |
|
|
77 |
}
|
|
78 |
|
|
79 |
// ----------------------------------------------------------------------------
|
|
80 |
// ConstructL
|
|
81 |
// ----------------------------------------------------------------------------
|
|
82 |
//
|
|
83 |
void GlxThumbnailVariantType::ConstructL( const TGlxMedia& aMedia, const TSize& aSize,
|
|
84 |
TBool aIsFocused, TInt aTextureId )
|
|
85 |
{
|
|
86 |
TRACER("GlxThumbnailVariantType::ConstructL");
|
|
87 |
GLX_DEBUG2("GlxThumbnailVariantType::ConstructL Media Id=%d", aMedia.Id().Value());
|
|
88 |
TInt err = KErrNone;
|
|
89 |
|
|
90 |
if(aTextureId != KErrNotFound)
|
|
91 |
{
|
|
92 |
mTextureId = aTextureId;
|
|
93 |
GLX_DEBUG1("GlxThumbnailVariantType::ConstructL valid aTextureId");
|
|
94 |
return;
|
|
95 |
}
|
|
96 |
|
|
97 |
iUiUtility = CGlxUiUtility::UtilityL();
|
|
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 |
|
|
113 |
TBool drm = EFalse;
|
|
114 |
TGlxMediaGeneralRightsValidity isValid = EGlxDrmRightsValidityUnknown;
|
|
115 |
|
|
116 |
if(aMedia.GetDrmProtected(drm))
|
|
117 |
{
|
|
118 |
GLX_DEBUG1("GlxThumbnailVariantType::ConstructL CGlxDRMUtility::InstanceL");
|
|
119 |
iDrmUtility = CGlxDRMUtility::InstanceL();
|
|
120 |
aMedia.GetDrmValidity(isValid);
|
|
121 |
}
|
|
122 |
|
|
123 |
TBool fsTnmAvailable = HasRelevantThumbnail(aMedia,aSize);
|
|
124 |
|
|
125 |
TInt frameCount = 0;
|
|
126 |
aMedia.GetFrameCount(frameCount);
|
|
127 |
|
|
128 |
TInt thumbnailError = GlxErrorManager::HasAttributeErrorL(
|
|
129 |
aMedia.Properties(), KGlxMediaIdThumbnail );
|
|
130 |
|
|
131 |
TIconInfo icon;
|
|
132 |
TBool expired = EFalse;
|
|
133 |
|
|
134 |
if (aIsFocused && frameCount > 1 && fsTnmAvailable && !drm)
|
|
135 |
{
|
|
136 |
GLX_DEBUG1("GlxThumbnailVariantType::CreateAnimatedGifTextureL");
|
|
137 |
|
|
138 |
TRAP( err, mTextureId = iUiUtility->GlxTextureManager().
|
|
139 |
CreateAnimatedGifTextureL( uri, aSize, aMedia,
|
|
140 |
aMedia.IdSpaceId() ).Id() );
|
|
141 |
}
|
|
142 |
//URI length could be zero for Media Id based Thumbnail fetch
|
|
143 |
else if ( fsTnmAvailable )
|
|
144 |
{
|
|
145 |
TMPXGeneralCategory cat = aMedia.Category();
|
|
146 |
//Check if media is DRM rights protected
|
|
147 |
if (drm)
|
|
148 |
{
|
|
149 |
TBool privatePath = EFalse;
|
|
150 |
CreateImageViewerInstanceL();
|
|
151 |
if (iImageViewerInstance->IsPrivate())
|
|
152 |
{
|
|
153 |
privatePath = ETrue;
|
|
154 |
}
|
|
155 |
|
|
156 |
//call 'DisplayItemRightsCheckL' only for focused item
|
|
157 |
if (aIsFocused)
|
|
158 |
{
|
|
159 |
if (privatePath)
|
|
160 |
{
|
|
161 |
expired = !iDrmUtility->DisplayItemRightsCheckL
|
|
162 |
(iImageViewerInstance->ImageFileHandle(),(cat == EMPXImage));
|
|
163 |
}
|
|
164 |
else
|
|
165 |
{
|
|
166 |
expired = !iDrmUtility->DisplayItemRightsCheckL(uri, (cat == EMPXImage));
|
|
167 |
}
|
|
168 |
}
|
|
169 |
else
|
|
170 |
{
|
|
171 |
if (privatePath)
|
|
172 |
{
|
|
173 |
expired = !iDrmUtility->ItemRightsValidityCheckL(
|
|
174 |
iImageViewerInstance->ImageFileHandle(), (cat
|
|
175 |
== EMPXImage));
|
|
176 |
}
|
|
177 |
else
|
|
178 |
{
|
|
179 |
//call 'ItemRightsValidityCheckL' for validity check of non-focused item
|
|
180 |
expired = !iDrmUtility->ItemRightsValidityCheckL(uri,
|
|
181 |
(cat == EMPXImage));
|
|
182 |
}
|
|
183 |
}
|
|
184 |
DeleteImageViewerInstance();
|
|
185 |
//Check If DRM rights have expired.
|
|
186 |
if (expired)
|
|
187 |
{
|
|
188 |
GLX_DEBUG1("GlxThumbnailVariantType::CreateIconTextureL:Default (expired)");
|
|
189 |
TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateIconTextureL(
|
|
190 |
EMbmGlxiconsQgn_prop_image_notcreated, resFile, defaultSize ).Id() );
|
|
191 |
}
|
|
192 |
else
|
|
193 |
{
|
|
194 |
if (isValid == EGlxDrmRightsValid)
|
|
195 |
{
|
|
196 |
// Fix for EABI-7RL9DD
|
|
197 |
// Replaced defaultSize with aSize
|
|
198 |
GLX_DEBUG1("GlxThumbnailVariantType::CreateThumbnailTextureL:EGlxDrmRightsValid");
|
|
199 |
TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateThumbnailTextureL(
|
|
200 |
aMedia, aMedia.IdSpaceId(), aSize, this ).Id() );
|
|
201 |
}
|
|
202 |
|
|
203 |
}
|
|
204 |
}
|
|
205 |
else
|
|
206 |
{
|
|
207 |
GLX_DEBUG1("GlxThumbnailVariantType::CreateThumbnailTextureL");
|
|
208 |
TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateThumbnailTextureL(
|
|
209 |
aMedia, aMedia.IdSpaceId(), aSize, this ).Id() );
|
|
210 |
}
|
|
211 |
}
|
|
212 |
else if ( aMedia.GetIconInfo(icon) )
|
|
213 |
{
|
|
214 |
GLX_DEBUG1("GlxThumbnailVariantType::CreateIconTextureL");
|
|
215 |
TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateIconTextureL(
|
|
216 |
icon.bitmapId, resFile, defaultSize ).Id() );
|
|
217 |
}
|
|
218 |
else if (KErrNone != thumbnailError && aMedia.Category() == EMPXVideo)
|
|
219 |
{
|
|
220 |
//show larger (twice) default icon for videos, which has errors
|
|
221 |
TSize newSize = defaultSize;
|
|
222 |
newSize += defaultSize;
|
|
223 |
GLX_DEBUG1("GlxThumbnailVariantType::CreateIconTextureL::Default (video)");
|
|
224 |
TRAP(err, mTextureId
|
|
225 |
= iUiUtility->GlxTextureManager().CreateIconTextureL(
|
|
226 |
EMbmGlxiconsQgn_prop_image_notcreated, resFile,
|
|
227 |
newSize).Id());
|
|
228 |
}
|
|
229 |
else if( drm && isValid == EGlxDrmRightsInvalid )
|
|
230 |
{
|
|
231 |
//show default image for DRM expired images
|
|
232 |
GLX_LOG_INFO( "GlxThumbnailVariantType::CreateIconTextureL"
|
|
233 |
"::EGlxDrmRightsInvalid" );
|
|
234 |
TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateIconTextureL(
|
|
235 |
EMbmGlxiconsQgn_prop_image_notcreated, resFile, defaultSize ).Id() );
|
|
236 |
}
|
|
237 |
else if ( (KErrNone == thumbnailError) || (KErrArgument == thumbnailError)
|
|
238 |
|| (KErrDiskFull == thumbnailError) || (KErrNoMemory == thumbnailError)
|
|
239 |
|| (KErrCANoRights == thumbnailError) )
|
|
240 |
{
|
|
241 |
GLX_LOG_INFO1( "GlxThumbnailVariantType::thumbnailError=%d" ,
|
|
242 |
thumbnailError );
|
|
243 |
//Try and see if we can scale and show the grid tnm else show the default
|
|
244 |
TBool isGridTnmShown = EFalse;
|
|
245 |
if(HasRelevantThumbnail(aMedia,defaultSize))
|
|
246 |
{
|
|
247 |
TSize origSize;
|
|
248 |
if(aMedia.GetDimensions(origSize))
|
|
249 |
{
|
|
250 |
//Currently scaling the grid TNM's only if their original size > grid size.
|
|
251 |
//Have to relook at this.
|
|
252 |
if(origSize.iWidth > defaultSize.iWidth && origSize.iHeight > defaultSize.iHeight)
|
|
253 |
{
|
|
254 |
GLX_DEBUG1("GlxThumbnailVariantType::CreateThumbnailTextureL::ScaledTnm");
|
|
255 |
TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateThumbnailTextureL(
|
|
256 |
aMedia, aMedia.IdSpaceId(), aSize, this, ETrue ).Id() );
|
|
257 |
if(err == KErrNone)
|
|
258 |
{
|
|
259 |
isGridTnmShown = ETrue;
|
|
260 |
}
|
|
261 |
}
|
|
262 |
}
|
|
263 |
}
|
|
264 |
if(!isGridTnmShown)
|
|
265 |
{
|
|
266 |
GLX_DEBUG1("GlxThumbnailVariantType::CreateThumbnailTextureL::Default");
|
|
267 |
TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateIconTextureL(
|
|
268 |
EMbmGlxiconsQgn_prop_image_notcreated, resFile, defaultSize ).Id() );
|
|
269 |
}
|
|
270 |
}
|
|
271 |
else
|
|
272 |
{
|
|
273 |
GLX_DEBUG1("GlxThumbnailVariantType::CreateIconTextureL::Corrupt");
|
|
274 |
TRAP( err, mTextureId = iUiUtility->GlxTextureManager().CreateIconTextureL(
|
|
275 |
EMbmGlxiconsQgn_prop_image_corrupted, resFile, defaultSize ).Id() );
|
|
276 |
}
|
|
277 |
|
|
278 |
if ( KErrNone != err )
|
|
279 |
{
|
|
280 |
GLX_DEBUG2("GlxThumbnailVariantType::ConstructL() ERROR err=%d", err);
|
|
281 |
throw std::bad_alloc();
|
|
282 |
}
|
|
283 |
}
|
|
284 |
|
|
285 |
// -----------------------------------------------------------------------------
|
|
286 |
// ConsumeRightsBasedOnSize - check if DRM rights should be consumed
|
|
287 |
// -----------------------------------------------------------------------------
|
|
288 |
//
|
|
289 |
TBool GlxThumbnailVariantType::ConsumeRightsBasedOnSize(
|
|
290 |
TSize aImageSize, TSize aBitmapSize)
|
|
291 |
{
|
|
292 |
TRACER("GlxThumbnailVariantType::ConsumeRightsBasedOnSize");
|
|
293 |
|
|
294 |
TBool drmRightsChecked = EFalse;
|
|
295 |
// minimum size (111 x 83)
|
|
296 |
TInt minSize = KGlxThumbnailDrmWidth * KGlxThumbnailDrmHeight;
|
|
297 |
// size of actual image
|
|
298 |
TInt imgSize = aImageSize.iWidth * aImageSize.iHeight;
|
|
299 |
|
|
300 |
// bitmap size
|
|
301 |
TInt bmpSize = aBitmapSize.iWidth * aBitmapSize.iHeight;
|
|
302 |
|
|
303 |
// size of HUI display
|
|
304 |
TSize dispSize = iUiUtility->DisplaySize();
|
|
305 |
|
|
306 |
|
|
307 |
if(dispSize.iWidth>0 && dispSize.iHeight>0)
|
|
308 |
{
|
|
309 |
TReal widthRatio = (TReal)aImageSize.iWidth/(TReal)dispSize.iWidth;
|
|
310 |
TReal heightRatio = (TReal)aImageSize.iHeight/(TReal)dispSize.iHeight;
|
|
311 |
|
|
312 |
if(widthRatio > heightRatio)
|
|
313 |
{
|
|
314 |
dispSize.iHeight = aImageSize.iHeight / widthRatio;
|
|
315 |
}
|
|
316 |
else
|
|
317 |
{
|
|
318 |
if(heightRatio>0)
|
|
319 |
{
|
|
320 |
dispSize.iWidth = aImageSize.iWidth / heightRatio;
|
|
321 |
}
|
|
322 |
}
|
|
323 |
}
|
|
324 |
|
|
325 |
TInt visSize2 = dispSize.iWidth * dispSize.iHeight;
|
|
326 |
|
|
327 |
// if thumbnail is smaller than visual use this for comparison
|
|
328 |
if(bmpSize < visSize2)
|
|
329 |
{
|
|
330 |
visSize2 = bmpSize;
|
|
331 |
}
|
|
332 |
|
|
333 |
// is bmp smaller than 1/4 of image size
|
|
334 |
if(imgSize/4 < minSize)
|
|
335 |
{
|
|
336 |
minSize = imgSize/4;
|
|
337 |
}
|
|
338 |
|
|
339 |
if(visSize2 >= minSize)
|
|
340 |
{
|
|
341 |
drmRightsChecked = ETrue;
|
|
342 |
}
|
|
343 |
|
|
344 |
return drmRightsChecked;
|
|
345 |
}
|
|
346 |
|
|
347 |
// -----------------------------------------------------------------------------
|
|
348 |
// ThumbnailSizeAndQuality - search for largest available thumbnail
|
|
349 |
// -----------------------------------------------------------------------------
|
|
350 |
//
|
|
351 |
TSize GlxThumbnailVariantType::ThumbnailSize(const CGlxMedia* aMedia)
|
|
352 |
{
|
|
353 |
TRACER("GlxThumbnailVariantType::ThumbnailSize");
|
|
354 |
TSize bmpSize(0,0);
|
|
355 |
|
|
356 |
TArray<TMPXAttribute> attr = aMedia->Attributes();
|
|
357 |
|
|
358 |
TInt selectedHeight = 0;
|
|
359 |
TInt selectedWidth = 0;
|
|
360 |
|
|
361 |
TInt count = attr.Count();
|
|
362 |
for(TInt i=0; i<count; i++)
|
|
363 |
{
|
|
364 |
|
|
365 |
if ( KGlxMediaIdThumbnail == attr[i].ContentId()
|
|
366 |
&& GlxIsFullThumbnailAttribute(attr[i].AttributeId()) )
|
|
367 |
{
|
|
368 |
// Get selected Quality, height and width from attribute
|
|
369 |
const CGlxThumbnailAttribute* thumbAtt =
|
|
370 |
static_cast<const CGlxThumbnailAttribute*>
|
|
371 |
(aMedia->ValueCObject( attr[i]));
|
|
372 |
|
|
373 |
if(thumbAtt)
|
|
374 |
{
|
|
375 |
|
|
376 |
selectedHeight = thumbAtt->iDimensions.iHeight;
|
|
377 |
selectedWidth = thumbAtt->iDimensions.iWidth;
|
|
378 |
|
|
379 |
if((selectedHeight * selectedWidth) >
|
|
380 |
(bmpSize.iHeight * bmpSize.iWidth))
|
|
381 |
{
|
|
382 |
bmpSize.iWidth = selectedWidth;
|
|
383 |
bmpSize.iHeight = selectedHeight;
|
|
384 |
}
|
|
385 |
}
|
|
386 |
}
|
|
387 |
}
|
|
388 |
return bmpSize;
|
|
389 |
}
|
|
390 |
// ----------------------------------------------------------------------------
|
|
391 |
// destructor
|
|
392 |
// ----------------------------------------------------------------------------
|
|
393 |
//
|
|
394 |
GlxThumbnailVariantType::~GlxThumbnailVariantType()
|
|
395 |
{
|
|
396 |
TRACER("GlxThumbnailVariantType::~GlxThumbnailVariantType");
|
|
397 |
if( iDrmUtility )
|
|
398 |
{
|
|
399 |
iDrmUtility->Close();
|
|
400 |
}
|
|
401 |
|
|
402 |
if ( iUiUtility)
|
|
403 |
{
|
|
404 |
iUiUtility->Close ();
|
|
405 |
}
|
|
406 |
}
|
|
407 |
|
|
408 |
|
|
409 |
void GlxThumbnailVariantType::TextureContentChangedL( TBool /*aHasContent*/ , CAlfTexture* /*aNewTexture*/)
|
|
410 |
{
|
|
411 |
|
|
412 |
}
|
|
413 |
// ----------------------------------------------------------------------------
|
|
414 |
// integer
|
|
415 |
// ----------------------------------------------------------------------------
|
|
416 |
//
|
|
417 |
int GlxThumbnailVariantType::integer() const
|
|
418 |
{
|
|
419 |
TRACER("GlxThumbnailVariantType::integer");
|
|
420 |
return mTextureId;
|
|
421 |
}
|
|
422 |
|
|
423 |
// ----------------------------------------------------------------------------
|
|
424 |
// HasRelevantThumbnail
|
|
425 |
// ----------------------------------------------------------------------------
|
|
426 |
//
|
|
427 |
TBool GlxThumbnailVariantType::HasRelevantThumbnail(const TGlxMedia& aMedia,
|
|
428 |
const TSize& aSize)
|
|
429 |
{
|
|
430 |
TRACER("GlxThumbnailVariantType::HasRelevantThumbnail()");
|
|
431 |
|
|
432 |
TMPXAttribute tnAttribQuality(KGlxMediaIdThumbnail,
|
|
433 |
GlxFullThumbnailAttributeId( ETrue,
|
|
434 |
aSize.iWidth, aSize.iHeight ) );
|
|
435 |
|
|
436 |
TMPXAttribute tnAttribSpeed(KGlxMediaIdThumbnail,
|
|
437 |
GlxFullThumbnailAttributeId( EFalse,
|
|
438 |
aSize.iWidth, aSize.iHeight ) );
|
|
439 |
|
|
440 |
const CGlxThumbnailAttribute* qualityTn = aMedia.ThumbnailAttribute(
|
|
441 |
tnAttribQuality );
|
|
442 |
const CGlxThumbnailAttribute* speedTn = aMedia.ThumbnailAttribute(
|
|
443 |
tnAttribSpeed );
|
|
444 |
if ( qualityTn || speedTn )
|
|
445 |
{
|
|
446 |
GLX_LOG_INFO("GlxThumbnailVariantType::HasRelevantThumbnail() - TN avail");
|
|
447 |
return ETrue;
|
|
448 |
}
|
|
449 |
return EFalse;
|
|
450 |
}
|
|
451 |
|
|
452 |
// -----------------------------------------------------------------------------
|
|
453 |
// CreateImageViewerInstanceL
|
|
454 |
// -----------------------------------------------------------------------------
|
|
455 |
//
|
|
456 |
void GlxThumbnailVariantType::CreateImageViewerInstanceL()
|
|
457 |
{
|
|
458 |
TRACER("GlxThumbnailVariantType::CreateImageViewerInstanceL");
|
|
459 |
iImageViewerInstance = CGlxImageViewerManager::InstanceL();
|
|
460 |
__ASSERT_ALWAYS(iImageViewerInstance, Panic(EGlxPanicNullPointer));
|
|
461 |
}
|
|
462 |
|
|
463 |
// -----------------------------------------------------------------------------
|
|
464 |
// DeleteImageViewerInstance
|
|
465 |
// -----------------------------------------------------------------------------
|
|
466 |
//
|
|
467 |
void GlxThumbnailVariantType::DeleteImageViewerInstance()
|
|
468 |
{
|
|
469 |
TRACER("GlxThumbnailVariantType::DeleteImageViewerInstance");
|
|
470 |
if ( iImageViewerInstance )
|
|
471 |
{
|
|
472 |
iImageViewerInstance->DeleteInstance();
|
|
473 |
}
|
|
474 |
}
|
|
475 |
|
|
476 |
// ----------------------------------------------------------------------------
|
|
477 |
// type
|
|
478 |
// ----------------------------------------------------------------------------
|
|
479 |
//
|
|
480 |
Alf::IMulVariantType::TMulType GlxThumbnailVariantType::Type() const
|
|
481 |
{
|
|
482 |
TRACER("GlxThumbnailVariantType::type");
|
|
483 |
return EInt;
|
|
484 |
}
|
|
485 |
|
|
486 |
// ----------------------------------------------------------------------------
|
|
487 |
// NewL
|
|
488 |
// ----------------------------------------------------------------------------
|
|
489 |
//
|
|
490 |
GlxIconVariantType* GlxIconVariantType::NewL(TInt aIconId, TFileName aFileName,
|
|
491 |
const TSize& aSize)
|
|
492 |
{
|
|
493 |
TRACER("GlxIconVariantType::NewL");
|
|
494 |
GlxIconVariantType* self = GlxIconVariantType::NewLC( aIconId,
|
|
495 |
aFileName, aSize );
|
|
496 |
CleanupStack::Pop( self );
|
|
497 |
return self;
|
|
498 |
}
|
|
499 |
|
|
500 |
// ----------------------------------------------------------------------------
|
|
501 |
// NewLC
|
|
502 |
// ----------------------------------------------------------------------------
|
|
503 |
//
|
|
504 |
GlxIconVariantType* GlxIconVariantType::NewLC( TInt aIconId, TFileName aFileName, const TSize& aSize )
|
|
505 |
{
|
|
506 |
TRACER("GlxIconVariantType::NewLC");
|
|
507 |
GlxIconVariantType* self = new ( EMM ) GlxIconVariantType( aIconId,
|
|
508 |
aFileName, aSize );
|
|
509 |
CleanupStack::PushL( self );
|
|
510 |
self->ConstructL( aIconId, aFileName, aSize );
|
|
511 |
return self;
|
|
512 |
|
|
513 |
}
|
|
514 |
|
|
515 |
// ----------------------------------------------------------------------------
|
|
516 |
// ConstructL
|
|
517 |
// ----------------------------------------------------------------------------
|
|
518 |
//
|
|
519 |
void GlxIconVariantType::ConstructL( TInt aIconId, TFileName aFileName,
|
|
520 |
const TSize& aSize )
|
|
521 |
{
|
|
522 |
TRACER("GlxIconVariantType::ConstructL");
|
|
523 |
iUiUtility = CGlxUiUtility::UtilityL();
|
|
524 |
|
|
525 |
TRAPD( err, mIconId = iUiUtility->GlxTextureManager().CreateIconTextureL(
|
|
526 |
aIconId, aFileName, aSize).Id() );
|
|
527 |
|
|
528 |
if ( KErrNone != err )
|
|
529 |
{
|
|
530 |
throw std::bad_alloc();
|
|
531 |
}
|
|
532 |
}
|
|
533 |
|
|
534 |
// ----------------------------------------------------------------------------
|
|
535 |
// constructor
|
|
536 |
// ----------------------------------------------------------------------------
|
|
537 |
//
|
|
538 |
GlxIconVariantType::GlxIconVariantType( TInt /*aIconId*/, TFileName /*aFileName*/,
|
|
539 |
const TSize& /*aSize*/ )
|
|
540 |
{
|
|
541 |
|
|
542 |
}
|
|
543 |
|
|
544 |
// ----------------------------------------------------------------------------
|
|
545 |
// destructor
|
|
546 |
// ----------------------------------------------------------------------------
|
|
547 |
//
|
|
548 |
GlxIconVariantType::~GlxIconVariantType()
|
|
549 |
{
|
|
550 |
|
|
551 |
TRACER("GlxIconVariantType::~GlxIconVariantType");
|
|
552 |
if ( iUiUtility)
|
|
553 |
{
|
|
554 |
iUiUtility->Close ();
|
|
555 |
}
|
|
556 |
}
|
|
557 |
|
|
558 |
// ----------------------------------------------------------------------------
|
|
559 |
// integer
|
|
560 |
// ----------------------------------------------------------------------------
|
|
561 |
//
|
|
562 |
int GlxIconVariantType::integer() const
|
|
563 |
{
|
|
564 |
TRACER("GlxIconVariantType::integer");
|
|
565 |
return mIconId;
|
|
566 |
}
|
|
567 |
|
|
568 |
// ----------------------------------------------------------------------------
|
|
569 |
// type
|
|
570 |
// ----------------------------------------------------------------------------
|
|
571 |
//
|
|
572 |
Alf::IMulVariantType::TMulType GlxIconVariantType::Type() const
|
|
573 |
{
|
|
574 |
TRACER("GlxIconVariantType::type");
|
|
575 |
return EInt;
|
|
576 |
}
|