author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:28:40 +0300 | |
branch | RCL_3 |
changeset 66 | 1f1dad4af8f8 |
parent 53 | 3de6c4cf6b67 |
permissions | -rw-r--r-- |
53 | 1 |
/* |
2 |
* Copyright (c) 2006 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: Implementation of Screen Saver Plugin |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
||
21 |
#include <eikenv.h> |
|
22 |
#include <data_caging_path_literals.hrh> |
|
23 |
#include <screensaverplugin.h> |
|
24 |
#include <AknsUtils.h> |
|
25 |
#include <AknUtils.h> |
|
26 |
#include <AknBidiTextUtils.h> |
|
27 |
#include <eiklabel.h> |
|
28 |
#include <aknlayoutscalable_avkon.cdl.h> |
|
29 |
#include <StringLoader.h> |
|
30 |
#include <bitmaptransforms.h> |
|
31 |
#include <e32math.h> |
|
32 |
||
33 |
#include <PUAcodes.hrh> |
|
34 |
#include <barsread.h> |
|
35 |
||
36 |
#include <mpxmedia.h> |
|
37 |
#include <mpxmediageneraldefs.h> |
|
38 |
#include <mpxscreensaverplugin.rsg> |
|
39 |
#include <mpxscreensaverplugin.mbg> |
|
40 |
#include <mpxplaybackframeworkdefs.h> |
|
41 |
#include <mpxlog.h> |
|
42 |
#include <mpxuser.h> |
|
43 |
||
44 |
#include "mpxscreensaverplugincontainer.h" |
|
45 |
||
46 |
// Constants |
|
47 |
const TInt KMPXDurationDisplayResvLen = 10; |
|
48 |
const TInt KMPXNumBackgrounds = 4; |
|
49 |
#define KMPXIndicatorColor KRgbWhite |
|
50 |
||
51 |
_LIT( KIconFileName, "mpxscreensaverplugin.mbm" ); |
|
52 |
_LIT( KMXPanicCategory, "CMPXScreenSaverPluginContainer" ); |
|
53 |
||
54 |
// ----------------------------------------------------------------------------- |
|
55 |
// CMPXScreenSaverPluginContainer::CMPXScreenSaverPluginContainer |
|
56 |
// ----------------------------------------------------------------------------- |
|
57 |
// |
|
58 |
CMPXScreenSaverPluginContainer::CMPXScreenSaverPluginContainer( |
|
59 |
MScreensaverPluginHost *aHost ): |
|
60 |
iScreenSaverHost( aHost ), |
|
61 |
iParentControl( NULL ), |
|
62 |
iBackground( KMPXNumBackgrounds ) |
|
63 |
{ |
|
64 |
} |
|
65 |
||
66 |
// ----------------------------------------------------------------------------- |
|
67 |
// CMPXScreenSaverPluginContainer::ConstructL |
|
68 |
// ----------------------------------------------------------------------------- |
|
69 |
// |
|
70 |
void CMPXScreenSaverPluginContainer::ConstructL() |
|
71 |
{ |
|
72 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::ConstructL" ); |
|
73 |
||
74 |
iEikEnv = CEikonEnv::Static(); |
|
75 |
iTitleLabel = new ( ELeave ) CEikLabel(); |
|
76 |
iClockLabel = new ( ELeave ) CEikLabel(); |
|
77 |
iAmPmLabel = new ( ELeave ) CEikLabel(); |
|
78 |
||
79 |
RefreshDisplayInfo(); |
|
80 |
CreateIconsL(); |
|
81 |
} |
|
82 |
||
83 |
// ---------------------------------------------------------------------------- |
|
84 |
// CMPXScreenSaverPluginContainerContainer::~CMPXScreenSaverPluginContainerContainer |
|
85 |
// ---------------------------------------------------------------------------- |
|
86 |
// |
|
87 |
CMPXScreenSaverPluginContainer:: |
|
88 |
~CMPXScreenSaverPluginContainer() |
|
89 |
{ |
|
90 |
MPX_DEBUG1( "CMPXScreenSaverPluginContainer::~CMPXScreenSaverPluginContainer START" ); |
|
91 |
||
92 |
delete iPlayIcon; |
|
93 |
delete iPauseIcon; |
|
94 |
delete iMessageIcon; |
|
95 |
delete iMissedCallIcon; |
|
96 |
delete iNewInstantMessageIcon; |
|
97 |
delete iNewVoiceMessageIcon; |
|
98 |
delete iNewEmailIcon; |
|
99 |
delete iKeyguardIcon; |
|
100 |
||
101 |
delete iTitleLabel; |
|
102 |
delete iClockLabel; |
|
103 |
delete iAmPmLabel; |
|
104 |
delete iProfileName; |
|
105 |
||
106 |
iBackground.ResetAndDestroy(); |
|
107 |
iBackground.Close(); |
|
108 |
||
109 |
if ( iIndicatorFont && iOSBitmapDevice ) |
|
110 |
{ |
|
111 |
iOSBitmapDevice->ReleaseFont( iIndicatorFont ); |
|
112 |
} |
|
113 |
||
114 |
delete iOffScreenBitmap; |
|
115 |
delete iOSBitmapContext; |
|
116 |
delete iOSBitmapDevice; |
|
117 |
||
118 |
MPX_DEBUG1( "CMPXScreenSaverPluginContainer::~CMPXScreenSaverPluginContainer END" ); |
|
119 |
} |
|
120 |
||
121 |
// ----------------------------------------------------------------------------- |
|
122 |
// CMPXScreenSaverPluginContainer::Draw |
|
123 |
// ----------------------------------------------------------------------------- |
|
124 |
// |
|
125 |
TInt CMPXScreenSaverPluginContainer::DrawL( CWindowGc& aGc, |
|
126 |
TMPXPlaybackState aPlaybackState ) |
|
127 |
{ |
|
128 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawL" ); |
|
129 |
||
130 |
TInt colorIndex = GetDrawPositionAndColorIndexL(); |
|
131 |
if ( !iOffScreenBitmap ) |
|
132 |
{ |
|
133 |
TInt backgroundHeight = BackgroundHeightL(); |
|
134 |
// create an off-screen bitmap, device and context |
|
135 |
iOffScreenBitmap = new ( ELeave ) CFbsBitmap(); |
|
136 |
User::LeaveIfError( iOffScreenBitmap->Create( |
|
137 |
TSize( iScreenSize.iWidth, backgroundHeight), |
|
138 |
aGc.Device()->DisplayMode() ) ); |
|
139 |
iOSBitmapDevice = CFbsBitmapDevice::NewL( iOffScreenBitmap ); |
|
140 |
User::LeaveIfError( iOSBitmapDevice->CreateContext( iOSBitmapContext ) ); |
|
141 |
||
142 |
iOSBitmapContext->SetPenColor( KMPXIndicatorColor ); |
|
143 |
// brush style has to be null in order for icon mask to work |
|
144 |
iOSBitmapContext->SetBrushColor( KRgbBlack ); |
|
145 |
iOSBitmapContext->SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
146 |
iOSBitmapContext->SetPenStyle( CGraphicsContext::ESolidPen ); |
|
147 |
||
148 |
// update the layouts |
|
149 |
UpdateLayoutL(); |
|
150 |
||
151 |
if ( iIndicatorFont ) |
|
152 |
{ |
|
153 |
iOSBitmapDevice->ReleaseFont( iIndicatorFont ); |
|
154 |
} |
|
155 |
const CFont* origFont = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont ); |
|
156 |
TFontSpec fontSpecTitle = origFont->FontSpecInTwips(); |
|
157 |
fontSpecTitle.iHeight = iRectIndicators.Height(); // Scale smaller |
|
158 |
iOSBitmapDevice->GetNearestFontToDesignHeightInPixels( iIndicatorFont, fontSpecTitle ); |
|
159 |
||
160 |
// reload the backgrounds |
|
161 |
LoadBackgroundsL(); |
|
162 |
} |
|
163 |
||
164 |
iOSBitmapContext->Clear(); |
|
165 |
||
166 |
DrawBackground( *iOSBitmapContext, colorIndex ); |
|
167 |
DrawClockL( *iOSBitmapContext ); |
|
168 |
DrawPlaybackStatusL( *iOSBitmapContext, aPlaybackState ); |
|
169 |
DrawIndicatorsL( *iOSBitmapContext ); |
|
170 |
||
171 |
aGc.SetBrushColor( KRgbBlack ); |
|
172 |
aGc.Clear(); |
|
173 |
// activate partial mode |
|
174 |
// partial mode is not supported in landscape orientation? |
|
175 |
TScreensaverPartialMode partialMode; |
|
176 |
TRect drawArea = TRect( TPoint(0, iStartY), |
|
177 |
TPoint( iOffScreenBitmap->SizeInPixels().iWidth, |
|
178 |
iOffScreenBitmap->SizeInPixels().iHeight + iStartY) ); |
|
179 |
partialMode.iBpp = 8; |
|
180 |
partialMode.iType = EPartialModeTypeMostPowerSaving; |
|
181 |
TInt status = iScreenSaverHost->SetActiveDisplayArea( |
|
182 |
drawArea, partialMode ); |
|
183 |
MPX_DEBUG2( "CMPXScreenSaverPluginContainer::DrawL SetActiveDisplayArea status = %d", status ); |
|
184 |
aGc.BitBlt( TPoint(0, iStartY), iOffScreenBitmap ); |
|
185 |
||
186 |
return KErrNone; |
|
187 |
} |
|
188 |
||
189 |
// ----------------------------------------------------------------------------- |
|
190 |
// CMPXScreenSaverPluginContainer::SetSongPropertiesL |
|
191 |
// ----------------------------------------------------------------------------- |
|
192 |
// |
|
193 |
void CMPXScreenSaverPluginContainer::SetSongPropertiesL( |
|
194 |
const CMPXMedia& aMedia ) |
|
195 |
{ |
|
196 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::SetSongPropertiesL" ); |
|
197 |
iTitleLabel->SetTextL( |
|
198 |
aMedia.ValueText( KMPXMediaGeneralTitle ) ); |
|
199 |
} |
|
200 |
||
201 |
// ----------------------------------------------------------------------------- |
|
202 |
// CMPXScreenSaverPluginContainer::SetNewVoiceMessage |
|
203 |
// ----------------------------------------------------------------------------- |
|
204 |
// |
|
205 |
void CMPXScreenSaverPluginContainer::SetParam( |
|
206 |
MPXScreenSaverPluginParam aType, TInt aValue ) |
|
207 |
{ |
|
208 |
MPX_DEBUG3( "-->CMPXScreenSaverPluginContainer::SetParam type = %d, value = %d", aType, aValue ); |
|
209 |
||
210 |
switch ( aType ) |
|
211 |
{ |
|
212 |
case MPXScreenSaverPluginParamMissedCall: |
|
213 |
{ |
|
214 |
iMissedCall = aValue; |
|
215 |
break; |
|
216 |
} |
|
217 |
case MPXScreenSaverPluginParamNewMessage: |
|
218 |
{ |
|
219 |
iNewMessage = aValue; |
|
220 |
break; |
|
221 |
} |
|
222 |
case MPXScreenSaverPluginParamInstantMessage: |
|
223 |
{ |
|
224 |
iNewInstantMessage = aValue; |
|
225 |
break; |
|
226 |
} |
|
227 |
case MPXScreenSaverPluginParamEmail: |
|
228 |
{ |
|
229 |
iNewEmail = aValue; |
|
230 |
break; |
|
231 |
} |
|
232 |
case MPXScreenSaverPluginParamVoiceMessage: |
|
233 |
{ |
|
234 |
iNewVoiceMessage = aValue; |
|
235 |
break; |
|
236 |
} |
|
237 |
case MPXScreenSaverPluginParamKeyguard: |
|
238 |
{ |
|
239 |
iKeyguard = aValue; |
|
240 |
break; |
|
241 |
} |
|
242 |
case MPXScreenSaverPluginParamIsSilent: |
|
243 |
{ |
|
244 |
iIsSilent = aValue; |
|
245 |
break; |
|
246 |
} |
|
247 |
default: |
|
248 |
break; |
|
249 |
} |
|
250 |
MPX_DEBUG1( "<--CMPXScreenSaverPluginContainer::SetParam" ); |
|
251 |
} |
|
252 |
||
253 |
// ----------------------------------------------------------------------------- |
|
254 |
// CMPXScreenSaverPluginContainer::SetProfileNameL |
|
255 |
// ----------------------------------------------------------------------------- |
|
256 |
// |
|
257 |
void CMPXScreenSaverPluginContainer::SetProfileNameL( |
|
258 |
const TDesC& aName, TBool aDisplay ) |
|
259 |
{ |
|
260 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::SetProfileNameL" ); |
|
261 |
delete iProfileName; |
|
262 |
iProfileName = NULL; |
|
263 |
if ( aDisplay ) |
|
264 |
{ |
|
265 |
iProfileName = aName.AllocL(); |
|
266 |
} |
|
267 |
} |
|
268 |
||
269 |
// ----------------------------------------------------------------------------- |
|
270 |
// CMPXScreenSaverPluginContainer::RefreshDisplayInfo |
|
271 |
// ----------------------------------------------------------------------------- |
|
272 |
// |
|
273 |
void CMPXScreenSaverPluginContainer::RefreshDisplayInfo() |
|
274 |
{ |
|
275 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::RefreshDisplayInfo" ); |
|
276 |
||
277 |
TScreensaverDisplayInfo displayInfo; |
|
278 |
displayInfo.iSize = sizeof( TScreensaverDisplayInfo ); |
|
279 |
iScreenSaverHost->DisplayInfo( &displayInfo ); |
|
280 |
iParentControl = displayInfo.iParent; |
|
281 |
||
282 |
// screen size from display info may not be full screen size |
|
283 |
iScreenSize = CCoeEnv::Static()->ScreenDevice()->SizeInPixels(); |
|
284 |
MPX_DEBUG3( "CMPXScreenSaverPluginContainer::RefreshDisplayInfo Screen size: %d %d", iScreenSize.iWidth, iScreenSize.iHeight ); |
|
285 |
||
286 |
// delete them so that they will be recreated next time |
|
287 |
delete iOffScreenBitmap; |
|
288 |
iOffScreenBitmap = NULL; |
|
289 |
delete iOSBitmapContext; |
|
290 |
iOSBitmapContext = NULL; |
|
291 |
delete iOSBitmapDevice; |
|
292 |
iOSBitmapDevice = NULL; |
|
293 |
} |
|
294 |
||
295 |
// --------------------------------------------------------------------------- |
|
296 |
// With this method the plugin may request a one-shot timeout event |
|
297 |
// (EScreensaverEventTimeout) after the specified amount of seconds |
|
298 |
// has passed. |
|
299 |
// --------------------------------------------------------------------------- |
|
300 |
// |
|
301 |
void CMPXScreenSaverPluginContainer::RequestTimeout(TInt aSecs) |
|
302 |
{ |
|
303 |
iScreenSaverHost->RequestTimeout( aSecs ); |
|
304 |
} |
|
305 |
||
306 |
// --------------------------------------------------------------------------- |
|
307 |
// Create icons. |
|
308 |
// --------------------------------------------------------------------------- |
|
309 |
// |
|
310 |
void CMPXScreenSaverPluginContainer::CreateIconsL() |
|
311 |
{ |
|
312 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::CreateIconsL" ); |
|
313 |
||
314 |
TParse parse; |
|
315 |
parse.Set( KIconFileName, &KDC_APP_RESOURCE_DIR, NULL ); |
|
316 |
TFileName iconFile( parse.FullName() ); |
|
317 |
User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) ); |
|
318 |
||
319 |
iPlayIcon = CreateIconL( |
|
320 |
KAknsIIDQgnIndiMupPlay, |
|
321 |
KAknsIIDQsnIconColors, |
|
322 |
EAknsCIQsnIconColorsCG1, |
|
323 |
iconFile, |
|
324 |
EMbmMpxscreensaverpluginQgn_graf_mup_npv_icon_play, |
|
325 |
EMbmMpxscreensaverpluginQgn_graf_mup_npv_icon_play_mask, |
|
326 |
ETrue ); |
|
327 |
||
328 |
iPauseIcon = CreateIconL( |
|
329 |
KAknsIIDQgnIndiMupPause, |
|
330 |
KAknsIIDQsnIconColors, |
|
331 |
EAknsCIQsnIconColorsCG1, |
|
332 |
iconFile, |
|
333 |
EMbmMpxscreensaverpluginQgn_graf_mup_npv_icon_pause, |
|
334 |
EMbmMpxscreensaverpluginQgn_graf_mup_npv_icon_pause_mask, |
|
335 |
ETrue ); |
|
336 |
||
337 |
iMessageIcon = CreateIconL( |
|
338 |
KAknsIIDQgnStatMessage, |
|
339 |
KAknsIIDQsnIconColors, |
|
340 |
EAknsMinorDefault, |
|
341 |
iconFile, |
|
342 |
EMbmMpxscreensaverpluginQgn_stat_message, |
|
343 |
EMbmMpxscreensaverpluginQgn_stat_message_mask, |
|
344 |
ETrue ); |
|
345 |
||
346 |
iMissedCallIcon = CreateIconL( |
|
347 |
KAknsIIDQgnStatMissedCallsUni, |
|
348 |
KAknsIIDQsnIconColors, |
|
349 |
EAknsMinorDefault, |
|
350 |
iconFile, |
|
351 |
EMbmMpxscreensaverpluginQgn_stat_missed_calls_uni, |
|
352 |
EMbmMpxscreensaverpluginQgn_stat_missed_calls_uni_mask, |
|
353 |
ETrue ); |
|
354 |
||
355 |
iNewInstantMessageIcon = CreateIconL( |
|
356 |
KAknsIIDQgnStatImUni, |
|
357 |
KAknsIIDQsnIconColors, |
|
358 |
EAknsMinorDefault, |
|
359 |
iconFile, |
|
360 |
EMbmMpxscreensaverpluginQgn_stat_im_uni, |
|
361 |
EMbmMpxscreensaverpluginQgn_stat_im_uni_mask, |
|
362 |
ETrue ); |
|
363 |
||
364 |
iNewVoiceMessageIcon = CreateIconL( |
|
365 |
KAknsIIDQgnStatVm0, |
|
366 |
KAknsIIDQsnIconColors, |
|
367 |
EAknsMinorDefault, |
|
368 |
iconFile, |
|
369 |
EMbmMpxscreensaverpluginQgn_stat_vm0, |
|
370 |
EMbmMpxscreensaverpluginQgn_stat_vm0_mask, |
|
371 |
ETrue ); |
|
372 |
||
373 |
iNewEmailIcon = CreateIconL( |
|
374 |
KAknsIIDQgnStatMessageMail, |
|
375 |
KAknsIIDQsnIconColors, |
|
376 |
EAknsMinorDefault, |
|
377 |
iconFile, |
|
378 |
EMbmMpxscreensaverpluginQgn_stat_message_mail, |
|
379 |
EMbmMpxscreensaverpluginQgn_stat_message_mail_mask, |
|
380 |
ETrue ); |
|
381 |
||
382 |
iKeyguardIcon = CreateIconL( |
|
383 |
KAknsIIDQgnStatKeyguard, |
|
384 |
KAknsIIDQsnIconColors, |
|
385 |
EAknsMinorDefault, |
|
386 |
iconFile, |
|
387 |
EMbmMpxscreensaverpluginQgn_stat_keyguard, |
|
388 |
EMbmMpxscreensaverpluginQgn_stat_keyguard_mask, |
|
389 |
ETrue ); |
|
390 |
||
391 |
LoadBackgroundsL(); |
|
392 |
} |
|
393 |
||
394 |
// --------------------------------------------------------------------------- |
|
395 |
// Create a color icon. |
|
396 |
// --------------------------------------------------------------------------- |
|
397 |
// |
|
398 |
CGulIcon* CMPXScreenSaverPluginContainer::CreateIconL( |
|
399 |
const TAknsItemID& aID, |
|
400 |
const TAknsItemID& aColorId, |
|
401 |
TInt aColorIndex, |
|
402 |
const TDesC& aBitmapFilename, |
|
403 |
TInt aFileBitmapId, |
|
404 |
TInt aFileMaskId, |
|
405 |
TBool aIsIndicator |
|
406 |
) |
|
407 |
{ |
|
408 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::CreateIconL" ); |
|
409 |
||
410 |
MAknsSkinInstance* skin( AknsUtils::SkinInstance() ); |
|
411 |
||
412 |
CFbsBitmap* icon( NULL ); |
|
413 |
CFbsBitmap* mask( NULL ); |
|
414 |
||
415 |
if ( aColorId == KAknsIIDNone ) |
|
416 |
{ |
|
417 |
// do not use theme color, use the default color from the file |
|
418 |
AknsUtils::CreateIconLC( skin, aID, |
|
419 |
icon, mask, aBitmapFilename, aFileBitmapId, aFileMaskId ); |
|
420 |
} |
|
421 |
else |
|
422 |
{ |
|
423 |
// use theme color |
|
424 |
AknsUtils::CreateColorIconLC( skin, aID, aColorId, aColorIndex, |
|
425 |
icon, mask, aBitmapFilename, aFileBitmapId, aFileMaskId, KRgbBlack ); |
|
426 |
} |
|
427 |
||
428 |
if ( aIsIndicator ) |
|
429 |
{ |
|
430 |
// should not be theme colored since everything else is not? |
|
431 |
AknIconUtils::SetIconColor( icon, KMPXIndicatorColor ); |
|
432 |
} |
|
433 |
||
434 |
CGulIcon* res = CGulIcon::NewL( icon, mask ); |
|
435 |
res->SetBitmapsOwnedExternally( EFalse ); |
|
436 |
CleanupStack::Pop( 2 ); // mask, icon |
|
437 |
return res; |
|
438 |
} |
|
439 |
||
440 |
// --------------------------------------------------------------------------- |
|
441 |
// Load the backgrounds, and resize them to screen size |
|
442 |
// --------------------------------------------------------------------------- |
|
443 |
// |
|
444 |
void CMPXScreenSaverPluginContainer::LoadBackgroundsL() |
|
445 |
{ |
|
446 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::LoadBackgroundsL" ); |
|
447 |
||
448 |
TParse parse; |
|
449 |
parse.Set( KIconFileName, &KDC_APP_RESOURCE_DIR, NULL ); |
|
450 |
TFileName iconFile; |
|
451 |
iconFile.Append( parse.FullName() ); |
|
452 |
User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) ); |
|
453 |
||
454 |
iBackground.ResetAndDestroy(); |
|
455 |
||
456 |
TInt width = iScreenSize.iWidth; |
|
457 |
TInt height = BackgroundHeightL(); |
|
458 |
||
459 |
CGulIcon* icon = CreateIconL( |
|
460 |
KAknsIIDNone, |
|
461 |
KAknsIIDNone, |
|
462 |
EAknsMinorNone, |
|
463 |
iconFile, |
|
464 |
EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_01, |
|
465 |
EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_01_mask, |
|
466 |
EFalse ); |
|
467 |
AknIconUtils::SetSize( icon->Bitmap(), TSize( width, height ), |
|
468 |
EAspectRatioNotPreserved ); |
|
469 |
iBackground.Append( icon ); |
|
470 |
icon = NULL; |
|
471 |
||
472 |
icon = CreateIconL( |
|
473 |
KAknsIIDNone, |
|
474 |
KAknsIIDNone, |
|
475 |
EAknsMinorNone, |
|
476 |
iconFile, |
|
477 |
EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_02, |
|
478 |
EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_02_mask, |
|
479 |
EFalse ); |
|
480 |
AknIconUtils::SetSize( icon->Bitmap(), TSize( width, height ), |
|
481 |
EAspectRatioNotPreserved ); |
|
482 |
iBackground.Append( icon ); |
|
483 |
icon = NULL; |
|
484 |
||
485 |
icon = CreateIconL( |
|
486 |
KAknsIIDNone, |
|
487 |
KAknsIIDNone, |
|
488 |
EAknsMinorNone, |
|
489 |
iconFile, |
|
490 |
EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_03, |
|
491 |
EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_03_mask, |
|
492 |
EFalse ); |
|
493 |
AknIconUtils::SetSize( icon->Bitmap(), TSize( width, height ), |
|
494 |
EAspectRatioNotPreserved ); |
|
495 |
iBackground.Append( icon ); |
|
496 |
icon = NULL; |
|
497 |
||
498 |
icon = CreateIconL( |
|
499 |
KAknsIIDNone, |
|
500 |
KAknsIIDNone, |
|
501 |
EAknsMinorNone, |
|
502 |
iconFile, |
|
503 |
EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_04, |
|
504 |
EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_04_mask, |
|
505 |
EFalse ); |
|
506 |
AknIconUtils::SetSize( icon->Bitmap(), TSize( width, height ), |
|
507 |
EAspectRatioNotPreserved ); |
|
508 |
iBackground.Append( icon ); |
|
509 |
icon = NULL; |
|
510 |
} |
|
511 |
||
512 |
// ----------------------------------------------------------------------------- |
|
513 |
// CMPXScreenSaverPluginContainer::DrawClock |
|
514 |
// ----------------------------------------------------------------------------- |
|
515 |
// |
|
516 |
void CMPXScreenSaverPluginContainer::DrawClockL( CBitmapContext& aGc ) |
|
517 |
{ |
|
518 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawClockL" ); |
|
519 |
||
520 |
// Draw clock display |
|
521 |
TTime time; |
|
522 |
time.HomeTime(); |
|
523 |
// R_QTN_TIME_USUAL_WITH_ZERO cannot be used because ZDigi does not have |
|
524 |
// alphabets |
|
525 |
HBufC* format = StringLoader::LoadLC( |
|
526 |
R_MPX_SCREENSAVER_TIME_USUAL_WITHOUT_AMPM ); |
|
527 |
HBufC* clockTime = HBufC::NewLC( |
|
528 |
format->Length() + KMPXDurationDisplayResvLen ); |
|
529 |
TPtr clockTimePtr = clockTime->Des(); |
|
530 |
MPX_TRAPD( err, time.FormatL( clockTimePtr, *format ) ); |
|
531 |
if (err != KErrNone) |
|
532 |
{ |
|
533 |
clockTimePtr = KNullDesC; |
|
534 |
} |
|
535 |
else |
|
536 |
{ |
|
537 |
AknTextUtils::LanguageSpecificNumberConversion( clockTimePtr ); |
|
538 |
} |
|
66
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
539 |
|
53 | 540 |
|
541 |
// AM/PM text |
|
542 |
HBufC* ampmFormat = StringLoader::LoadLC( R_MPX_SCREENSAVER_AMPM ); |
|
543 |
HBufC* ampm = HBufC::NewLC( ampmFormat->Length() + KMPXDurationDisplayResvLen ); |
|
544 |
TPtr ampmPtr = ampm->Des(); |
|
545 |
MPX_TRAP( err, time.FormatL( ampmPtr, *ampmFormat ) ); |
|
546 |
if ( err != KErrNone ) |
|
547 |
{ |
|
548 |
ampmPtr = KNullDesC; |
|
549 |
} |
|
550 |
||
551 |
TRgb color( KMPXIndicatorColor ); |
|
552 |
aGc.UseFont( iClockLabel->Font() ); |
|
553 |
aGc.SetPenColor( color ); |
|
554 |
TInt width = iClockLabel->Font()->TextWidthInPixels( clockTimePtr ); |
|
555 |
// align right |
|
556 |
aGc.DrawText( clockTimePtr, |
|
557 |
TPoint( iClockLabel->Rect().iBr.iX - width, iClockLabel->Rect().iBr.iY ) ); |
|
558 |
||
559 |
// draw AM/PM if time format is 12-hour |
|
560 |
TLocale locale; |
|
561 |
if ( locale.TimeFormat() == ETime12 ) |
|
562 |
{ |
|
563 |
aGc.DiscardFont(); |
|
564 |
aGc.UseFont( iAmPmLabel->Font() ); |
|
565 |
width = iAmPmLabel->Font()->TextWidthInPixels( ampmPtr ); |
|
566 |
// align right |
|
567 |
aGc.DrawText( ampmPtr, |
|
568 |
TPoint( iAmPmLabel->Rect().iBr.iX - width, iAmPmLabel->Rect().iBr.iY ) ); |
|
569 |
} |
|
570 |
||
571 |
aGc.DiscardFont(); |
|
572 |
CleanupStack::PopAndDestroy( ampm ); |
|
573 |
CleanupStack::PopAndDestroy( ampmFormat ); |
|
574 |
CleanupStack::PopAndDestroy( clockTime ); |
|
575 |
CleanupStack::PopAndDestroy( format ); |
|
576 |
} |
|
577 |
||
578 |
// ----------------------------------------------------------------------------- |
|
579 |
// CMPXScreenSaverPluginContainer::DrawBackground |
|
580 |
// ----------------------------------------------------------------------------- |
|
581 |
// |
|
582 |
void CMPXScreenSaverPluginContainer::DrawBackground( |
|
583 |
CBitmapContext& aGc, TInt aColorIndex ) |
|
584 |
{ |
|
585 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawBackground" ); |
|
586 |
aGc.BitBltMasked( |
|
587 |
TPoint(), |
|
588 |
iBackground[ aColorIndex ]->Bitmap(), |
|
589 |
TRect( aGc.Device()->SizeInPixels() ), |
|
590 |
iBackground[ aColorIndex ]->Mask(), |
|
591 |
EFalse ); |
|
592 |
} |
|
593 |
||
594 |
// ----------------------------------------------------------------------------- |
|
595 |
// CMPXScreenSaverPluginContainer::DrawPlaybackStatus |
|
596 |
// ----------------------------------------------------------------------------- |
|
597 |
// |
|
598 |
void CMPXScreenSaverPluginContainer::DrawPlaybackStatusL( |
|
599 |
CBitmapContext& aGc, TMPXPlaybackState aPlaybackState ) |
|
600 |
{ |
|
601 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawPlaybackStatus" ); |
|
602 |
||
603 |
TBool showTitle = EFalse; |
|
604 |
||
605 |
// Draw play status icon (if any) |
|
606 |
CGulIcon* icon = NULL; |
|
607 |
switch ( aPlaybackState ) |
|
608 |
{ |
|
609 |
case EPbStatePlaying: |
|
610 |
{ |
|
611 |
icon = iPlayIcon; |
|
612 |
showTitle = ETrue; |
|
613 |
break; |
|
614 |
} |
|
615 |
case EPbStatePaused: |
|
616 |
{ |
|
617 |
icon = iPauseIcon; |
|
618 |
showTitle = ETrue; |
|
619 |
break; |
|
620 |
} |
|
621 |
default: |
|
622 |
{ |
|
623 |
break; |
|
624 |
} |
|
625 |
} |
|
626 |
if ( icon ) |
|
627 |
{ |
|
628 |
aGc.BitBltMasked( |
|
629 |
iRectPlaybackStatus.iTl, |
|
630 |
icon->Bitmap(), |
|
631 |
TRect( iRectPlaybackStatus.Size() ), |
|
632 |
icon->Mask(), |
|
633 |
EFalse ); |
|
634 |
} |
|
635 |
||
636 |
TRgb color( KMPXIndicatorColor ); |
|
637 |
aGc.UseFont( iTitleLabel->Font() ); |
|
638 |
aGc.SetPenColor( color ); |
|
639 |
||
640 |
if ( iTitleLabel->Text() && showTitle ) |
|
641 |
{ |
|
642 |
HBufC* buf = iTitleLabel->Text()->AllocL(); |
|
643 |
CleanupStack::PushL( buf ); |
|
644 |
TPtr ptr( buf->Des() ); |
|
645 |
AknBidiTextUtils::ConvertToVisualAndClipL( |
|
646 |
ptr, |
|
647 |
*iTitleLabel->Font(), |
|
648 |
iTitleLabel->Rect().Width(), |
|
649 |
iTitleLabel->Rect().Width() ); |
|
650 |
aGc.DrawText( ptr, |
|
651 |
TPoint( iTitleLabel->Rect().iTl.iX, iTitleLabel->Rect().iBr.iY ) ); |
|
652 |
CleanupStack::PopAndDestroy( buf ); |
|
653 |
} |
|
654 |
else |
|
655 |
{ |
|
656 |
TTime time; |
|
657 |
time.HomeTime(); |
|
658 |
HBufC* format = StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO ); |
|
659 |
HBufC* clockTime = HBufC::NewLC( format->Length() + KMPXDurationDisplayResvLen ); |
|
660 |
TPtr clockTimePtr = clockTime->Des(); |
|
661 |
time.FormatL( clockTimePtr, *format ); |
|
662 |
AknTextUtils::LanguageSpecificNumberConversion( clockTimePtr ); |
|
663 |
||
664 |
aGc.DrawText( clockTimePtr, |
|
665 |
TPoint( iTitleLabel->Rect().iTl.iX, iTitleLabel->Rect().iBr.iY ) ); |
|
666 |
||
667 |
CleanupStack::PopAndDestroy( clockTime ); |
|
668 |
CleanupStack::PopAndDestroy( format ); |
|
669 |
} |
|
670 |
aGc.DiscardFont(); |
|
671 |
} |
|
672 |
||
673 |
// ----------------------------------------------------------------------------- |
|
674 |
// CMPXScreenSaverPluginContainer::DrawIndicatorsL |
|
675 |
// ----------------------------------------------------------------------------- |
|
676 |
// |
|
677 |
void CMPXScreenSaverPluginContainer::DrawIndicatorsL( |
|
678 |
CBitmapContext& aGc ) |
|
679 |
{ |
|
680 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawIndicatorsL" ); |
|
681 |
||
682 |
TSize indicatorSize = TSize( iRectIndicators.Height(), |
|
683 |
iRectIndicators.Height() ); |
|
684 |
MPX_DEBUG2( "CMPXScreenSaverPluginContainer::DrawIndicatorsL indicator height %d", iRectIndicators.Height() ); |
|
685 |
iStartX = iRectIndicators.iTl.iX; |
|
686 |
||
687 |
TRgb color( KMPXIndicatorColor ); |
|
688 |
aGc.SetPenColor( color ); |
|
689 |
aGc.UseFont( iIndicatorFont ); |
|
690 |
||
691 |
if ( iKeyguard > 0 ) |
|
692 |
{ |
|
693 |
MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing keyguard %d %d", iStartX, iRectIndicators.iTl.iY ); |
|
694 |
DoDrawIndicatorsL( aGc, -1, iKeyguardIcon, iIndicatorFont, |
|
695 |
iRectIndicators, indicatorSize); |
|
696 |
} |
|
697 |
||
698 |
if ( iMissedCall > 0 ) |
|
699 |
{ |
|
700 |
MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new miss call %d %d", iStartX, iRectIndicators.iTl.iY ); |
|
701 |
DoDrawIndicatorsL( aGc, iMissedCall, iMissedCallIcon, iIndicatorFont, |
|
702 |
iRectIndicators, indicatorSize); |
|
703 |
} |
|
704 |
||
705 |
if ( iNewMessage > 0 ) |
|
706 |
{ |
|
707 |
MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new message %d %d", iStartX, iRectIndicators.iTl.iY ); |
|
708 |
DoDrawIndicatorsL( aGc, iNewMessage, iMessageIcon, iIndicatorFont, |
|
709 |
iRectIndicators, indicatorSize); |
|
710 |
} |
|
711 |
||
712 |
if ( iNewInstantMessage > 0 ) |
|
713 |
{ |
|
714 |
MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new instant message %d %d", iStartX, iRectIndicators.iTl.iY ); |
|
715 |
DoDrawIndicatorsL( aGc, 0, iNewInstantMessageIcon, iIndicatorFont, |
|
716 |
iRectIndicators, indicatorSize); |
|
717 |
} |
|
718 |
||
719 |
if ( iNewEmail > 0 ) |
|
720 |
{ |
|
721 |
MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new email %d %d", iStartX, iRectIndicators.iTl.iY ); |
|
722 |
DoDrawIndicatorsL( aGc, 0, iNewEmailIcon, iIndicatorFont, |
|
723 |
iRectIndicators, indicatorSize); |
|
724 |
} |
|
725 |
||
726 |
if ( iNewVoiceMessage > 0 ) |
|
727 |
{ |
|
728 |
MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new voice message %d %d", iStartX, iRectIndicators.iTl.iY ); |
|
729 |
DoDrawIndicatorsL( aGc, 0, iNewVoiceMessageIcon, |
|
730 |
iIndicatorFont, iRectIndicators, indicatorSize); |
|
731 |
} |
|
732 |
||
733 |
if ( ( iProfileName ) || ( iIsSilent ) ) |
|
734 |
{ |
|
735 |
MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing profile name %d %d", iStartX, iRectIndicators.iTl.iY ); |
|
736 |
// clip text to fit screen |
|
737 |
HBufC* buf; |
|
738 |
if ( iProfileName ) |
|
739 |
{ |
|
740 |
buf = HBufC::NewLC( iProfileName->Length() + |
|
741 |
KMPXDurationDisplayResvLen ); |
|
742 |
} |
|
743 |
else |
|
744 |
{ |
|
745 |
buf = HBufC::NewLC( KMPXDurationDisplayResvLen ); |
|
746 |
} |
|
747 |
TPtr ptr( buf->Des() ); |
|
748 |
if ( iIsSilent ) |
|
749 |
{ |
|
750 |
ptr.Append( KPuaCodeSilentSymbol ); |
|
751 |
} |
|
752 |
if ( iProfileName ) |
|
753 |
{ |
|
754 |
ptr.Append( iProfileName->Des() ); |
|
755 |
AknBidiTextUtils::ConvertToVisualAndClipL( |
|
756 |
ptr, |
|
757 |
*iIndicatorFont, |
|
758 |
iRectIndicators.iBr.iX - iStartX, |
|
759 |
iRectIndicators.iBr.iX - iStartX ); |
|
760 |
} |
|
761 |
aGc.DrawText( *buf, |
|
762 |
TPoint( iStartX, iRectIndicators.iTl.iY + indicatorSize.iHeight ) ); |
|
763 |
CleanupStack::PopAndDestroy( buf ); |
|
764 |
} |
|
765 |
||
766 |
aGc.DiscardFont(); |
|
767 |
} |
|
768 |
||
769 |
// ----------------------------------------------------------------------------- |
|
770 |
// CMPXScreenSaverPluginContainer::DrawIndicatorsL |
|
771 |
// ----------------------------------------------------------------------------- |
|
772 |
// |
|
773 |
void CMPXScreenSaverPluginContainer::DoDrawIndicatorsL( |
|
774 |
CBitmapContext& aGc, TInt aDisplayNumber, CGulIcon* aDisplayIcon, |
|
775 |
CFont* aFont, TRect aRect, TSize aSize ) |
|
776 |
{ |
|
777 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::DoDrawIndicatorsL" ); |
|
778 |
||
779 |
if ( aDisplayNumber > 0 ) |
|
780 |
{ |
|
781 |
HBufC* stringBuf = HBufC::NewLC( 5 ); |
|
782 |
stringBuf->Des().AppendNum( aDisplayNumber ); |
|
783 |
aGc.DrawText( stringBuf->Des(), |
|
784 |
TPoint( iStartX, aRect.iTl.iY + aSize.iHeight ) ); |
|
785 |
iStartX = iStartX + aFont->TextWidthInPixels( stringBuf->Des() ); |
|
786 |
CleanupStack::PopAndDestroy( stringBuf ); |
|
787 |
} |
|
788 |
aGc.BitBltMasked( |
|
789 |
TPoint( iStartX, aRect.iTl.iY ), |
|
790 |
aDisplayIcon->Bitmap(), |
|
791 |
TRect( aSize ), |
|
792 |
aDisplayIcon->Mask(), |
|
793 |
EFalse ); |
|
794 |
iStartX = iStartX + aSize.iWidth; |
|
795 |
} |
|
796 |
||
797 |
// --------------------------------------------------------------------------- |
|
798 |
// Get layout data for an graphical indicator. |
|
799 |
// --------------------------------------------------------------------------- |
|
800 |
// |
|
801 |
TRect CMPXScreenSaverPluginContainer::IndicatorLayout( |
|
802 |
MPXScreenSaverPluginControl aControl ) |
|
803 |
{ |
|
804 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::IndicatorLayout" ); |
|
805 |
TInt resId = 0; |
|
806 |
if ( iScreenSize == TSize( 176, 208 ) ) //lowest portrait |
|
807 |
{ |
|
808 |
switch ( aControl ) |
|
809 |
{ |
|
810 |
case MPXScreenSaverPluginIndicatorPlaybackStatus: |
|
811 |
{ |
|
812 |
resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_LOWRES_PORTRAIT; |
|
813 |
break; |
|
814 |
} |
|
815 |
case MPXScreenSaverPluginIndicatorOther: |
|
816 |
{ |
|
817 |
resId = R_MPX_SCREENSAVER_INDI_LAYOUT_LOWRES_PORTRAIT; |
|
818 |
break; |
|
819 |
} |
|
820 |
default: |
|
821 |
{ |
|
822 |
__ASSERT_ALWAYS(EFalse, |
|
823 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
824 |
break; |
|
825 |
} |
|
826 |
} |
|
827 |
} |
|
828 |
else if ( iScreenSize == TSize( 352, 416 ) ) //double portrait |
|
829 |
{ |
|
830 |
switch (aControl) |
|
831 |
{ |
|
832 |
case MPXScreenSaverPluginIndicatorPlaybackStatus: |
|
833 |
{ |
|
834 |
resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_DOUBLE_PORTRAIT; |
|
835 |
break; |
|
836 |
} |
|
837 |
case MPXScreenSaverPluginIndicatorOther: |
|
838 |
{ |
|
839 |
resId = R_MPX_SCREENSAVER_INDI_LAYOUT_DOUBLE_PORTRAIT; |
|
840 |
break; |
|
841 |
} |
|
842 |
default: |
|
843 |
{ |
|
844 |
__ASSERT_ALWAYS(EFalse, |
|
845 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
846 |
break; |
|
847 |
} |
|
848 |
} |
|
849 |
} |
|
850 |
else if ( iScreenSize == TSize( 240, 320 ) ) //QVGA portrait |
|
851 |
{ |
|
852 |
switch (aControl) |
|
853 |
{ |
|
854 |
case MPXScreenSaverPluginIndicatorPlaybackStatus: |
|
855 |
{ |
|
856 |
resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_QVGA_PORTRAIT; |
|
857 |
break; |
|
858 |
} |
|
859 |
case MPXScreenSaverPluginIndicatorOther: |
|
860 |
{ |
|
861 |
resId = R_MPX_SCREENSAVER_INDI_LAYOUT_QVGA_PORTRAIT; |
|
862 |
break; |
|
863 |
} |
|
864 |
default: |
|
865 |
{ |
|
866 |
__ASSERT_ALWAYS(EFalse, |
|
867 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
868 |
break; |
|
869 |
} |
|
870 |
} |
|
871 |
} |
|
872 |
else if ( iScreenSize == TSize( 208, 176 ) ) //lowest landscape |
|
873 |
{ |
|
874 |
switch ( aControl ) |
|
875 |
{ |
|
876 |
case MPXScreenSaverPluginIndicatorPlaybackStatus: |
|
877 |
{ |
|
878 |
resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_LOWRES_LANDSCAPE; |
|
879 |
break; |
|
880 |
} |
|
881 |
case MPXScreenSaverPluginIndicatorOther: |
|
882 |
{ |
|
883 |
resId = R_MPX_SCREENSAVER_INDI_LAYOUT_LOWRES_LANDSCAPE; |
|
884 |
break; |
|
885 |
} |
|
886 |
default: |
|
887 |
{ |
|
888 |
__ASSERT_ALWAYS(EFalse, |
|
889 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
890 |
break; |
|
891 |
} |
|
892 |
} |
|
893 |
} |
|
894 |
else if ( iScreenSize == TSize( 416, 352 ) ) //double landscape |
|
895 |
{ |
|
896 |
switch (aControl) |
|
897 |
{ |
|
898 |
case MPXScreenSaverPluginIndicatorPlaybackStatus: |
|
899 |
{ |
|
900 |
resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_DOUBLE_LANDSCAPE; |
|
901 |
break; |
|
902 |
} |
|
903 |
case MPXScreenSaverPluginIndicatorOther: |
|
904 |
{ |
|
905 |
resId = R_MPX_SCREENSAVER_INDI_LAYOUT_DOUBLE_LANDSCAPE; |
|
906 |
break; |
|
907 |
} |
|
908 |
default: |
|
909 |
{ |
|
910 |
__ASSERT_ALWAYS(EFalse, |
|
911 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
912 |
break; |
|
913 |
} |
|
914 |
} |
|
915 |
} |
|
916 |
else if ( iScreenSize == TSize( 320, 240 ) ) //QVGA landscape |
|
917 |
{ |
|
918 |
switch (aControl) |
|
919 |
{ |
|
920 |
case MPXScreenSaverPluginIndicatorPlaybackStatus: |
|
921 |
{ |
|
922 |
resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_QVGA_LANDSCAPE; |
|
923 |
break; |
|
924 |
} |
|
925 |
case MPXScreenSaverPluginIndicatorOther: |
|
926 |
{ |
|
927 |
resId = R_MPX_SCREENSAVER_INDI_LAYOUT_QVGA_LANDSCAPE; |
|
928 |
break; |
|
929 |
} |
|
930 |
default: |
|
931 |
{ |
|
932 |
__ASSERT_ALWAYS(EFalse, |
|
933 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
934 |
break; |
|
935 |
} |
|
936 |
} |
|
937 |
} |
|
938 |
else if ( iScreenSize == TSize( 360, 640 ) ) // QHD portrait |
|
939 |
{ |
|
940 |
switch (aControl) |
|
941 |
{ |
|
942 |
case MPXScreenSaverPluginIndicatorPlaybackStatus: |
|
943 |
{ |
|
944 |
resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_QHD_PORTRAIT; |
|
945 |
break; |
|
946 |
} |
|
947 |
case MPXScreenSaverPluginIndicatorOther: |
|
948 |
{ |
|
949 |
resId = R_MPX_SCREENSAVER_INDI_LAYOUT_QHD_PORTRAIT; |
|
950 |
break; |
|
951 |
} |
|
952 |
default: |
|
953 |
{ |
|
954 |
__ASSERT_ALWAYS(EFalse, |
|
955 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
956 |
break; |
|
957 |
} |
|
958 |
} |
|
959 |
} |
|
960 |
else if ( iScreenSize == TSize( 640, 360 ) ) // QHD landscape |
|
961 |
{ |
|
962 |
switch (aControl) |
|
963 |
{ |
|
964 |
case MPXScreenSaverPluginIndicatorPlaybackStatus: |
|
965 |
{ |
|
966 |
resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_QHD_LANDSCAPE; |
|
967 |
break; |
|
968 |
} |
|
969 |
case MPXScreenSaverPluginIndicatorOther: |
|
970 |
{ |
|
971 |
resId = R_MPX_SCREENSAVER_INDI_LAYOUT_QHD_LANDSCAPE; |
|
972 |
break; |
|
973 |
} |
|
974 |
default: |
|
975 |
{ |
|
976 |
__ASSERT_ALWAYS(EFalse, |
|
977 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
978 |
break; |
|
979 |
} |
|
980 |
} |
|
981 |
} |
|
982 |
else if ( iScreenSize == TSize( 480, 640 ) ) // VGA portrait |
|
983 |
{ |
|
984 |
switch (aControl) |
|
985 |
{ |
|
986 |
case MPXScreenSaverPluginIndicatorPlaybackStatus: |
|
987 |
{ |
|
988 |
resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_VGA_PORTRAIT; |
|
989 |
break; |
|
990 |
} |
|
991 |
case MPXScreenSaverPluginIndicatorOther: |
|
992 |
{ |
|
993 |
resId = R_MPX_SCREENSAVER_INDI_LAYOUT_VGA_PORTRAIT; |
|
994 |
break; |
|
995 |
} |
|
996 |
default: |
|
997 |
{ |
|
998 |
__ASSERT_ALWAYS(EFalse, |
|
999 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
1000 |
break; |
|
1001 |
} |
|
1002 |
} |
|
1003 |
} |
|
1004 |
else if ( iScreenSize == TSize( 640, 480 ) ) // VGA landscape |
|
1005 |
{ |
|
1006 |
switch (aControl) |
|
1007 |
{ |
|
1008 |
case MPXScreenSaverPluginIndicatorPlaybackStatus: |
|
1009 |
{ |
|
1010 |
resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_VGA_LANDSCAPE; |
|
1011 |
break; |
|
1012 |
} |
|
1013 |
case MPXScreenSaverPluginIndicatorOther: |
|
1014 |
{ |
|
1015 |
resId = R_MPX_SCREENSAVER_INDI_LAYOUT_VGA_LANDSCAPE; |
|
1016 |
break; |
|
1017 |
} |
|
1018 |
default: |
|
1019 |
{ |
|
1020 |
__ASSERT_ALWAYS(EFalse, |
|
1021 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
1022 |
break; |
|
1023 |
} |
|
1024 |
} |
|
1025 |
} |
|
1026 |
else |
|
1027 |
{ |
|
1028 |
User::Panic( KMXPanicCategory, KErrNotSupported ); |
|
1029 |
} |
|
1030 |
TAknLayoutRect res; |
|
1031 |
res.LayoutRect( TRect( TPoint( 0, 0), |
|
1032 |
TPoint( iOffScreenBitmap->SizeInPixels().iWidth, |
|
1033 |
iOffScreenBitmap->SizeInPixels().iHeight) ), resId ); |
|
1034 |
return res.Rect(); |
|
1035 |
} |
|
1036 |
||
1037 |
// --------------------------------------------------------------------------- |
|
1038 |
// Get layout data for an graphical indicator. |
|
1039 |
// --------------------------------------------------------------------------- |
|
1040 |
// |
|
1041 |
void CMPXScreenSaverPluginContainer::LabelLayoutL( |
|
1042 |
MPXScreenSaverPluginControl aControl ) |
|
1043 |
{ |
|
1044 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::LabelLayoutL" ); |
|
1045 |
TInt resId = 0; |
|
1046 |
CEikLabel* label = NULL; |
|
1047 |
if ( iScreenSize == TSize( 176, 208 ) ) //lowest portrait |
|
1048 |
{ |
|
1049 |
switch ( aControl ) |
|
1050 |
{ |
|
1051 |
case MPXScreenSaverPluginLabelTitle: |
|
1052 |
{ |
|
1053 |
resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_LOWRES_PORTRAIT; |
|
1054 |
label = iTitleLabel; |
|
1055 |
break; |
|
1056 |
} |
|
1057 |
case MPXScreenSaverPluginLabelClock: |
|
1058 |
{ |
|
1059 |
TLanguage uiLanguage = User::Language(); |
|
1060 |
if( uiLanguage == ELangArabic || |
|
1061 |
uiLanguage == ELangUrdu || |
|
1062 |
uiLanguage == ELangFarsi ) |
|
1063 |
{ |
|
1064 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_LOWRES_PORTRAIT_ARABIC; |
|
1065 |
} |
|
1066 |
else |
|
1067 |
{ |
|
1068 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_LOWRES_PORTRAIT; |
|
1069 |
} |
|
1070 |
label = iClockLabel; |
|
1071 |
break; |
|
1072 |
} |
|
1073 |
case MPXScreenSaverPluginLabelAmPm: |
|
1074 |
{ |
|
1075 |
resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_LOWRES_PORTRAIT; |
|
1076 |
label = iAmPmLabel; |
|
1077 |
break; |
|
1078 |
} |
|
1079 |
default: |
|
1080 |
{ |
|
1081 |
__ASSERT_ALWAYS(EFalse, |
|
1082 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
1083 |
break; |
|
1084 |
} |
|
1085 |
} |
|
1086 |
} |
|
1087 |
else if ( iScreenSize == TSize( 352, 416 ) ) //double portrait |
|
1088 |
{ |
|
1089 |
switch (aControl) |
|
1090 |
{ |
|
1091 |
case MPXScreenSaverPluginLabelTitle: |
|
1092 |
{ |
|
1093 |
resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_DOUBLE_PORTRAIT; |
|
1094 |
label = iTitleLabel; |
|
1095 |
break; |
|
1096 |
} |
|
1097 |
case MPXScreenSaverPluginLabelClock: |
|
1098 |
{ |
|
1099 |
TLanguage uiLanguage = User::Language(); |
|
1100 |
if( uiLanguage == ELangArabic || |
|
1101 |
uiLanguage == ELangUrdu || |
|
1102 |
uiLanguage == ELangFarsi ) |
|
1103 |
{ |
|
1104 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_DOUBLE_PORTRAIT_ARABIC; |
|
1105 |
} |
|
1106 |
else |
|
1107 |
{ |
|
1108 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_DOUBLE_PORTRAIT; |
|
1109 |
} |
|
1110 |
||
1111 |
label = iClockLabel; |
|
1112 |
break; |
|
1113 |
} |
|
1114 |
case MPXScreenSaverPluginLabelAmPm: |
|
1115 |
{ |
|
1116 |
resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_DOUBLE_PORTRAIT; |
|
1117 |
label = iAmPmLabel; |
|
1118 |
break; |
|
1119 |
} |
|
1120 |
default: |
|
1121 |
{ |
|
1122 |
__ASSERT_ALWAYS(EFalse, |
|
1123 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
1124 |
break; |
|
1125 |
} |
|
1126 |
} |
|
1127 |
} |
|
1128 |
else if ( iScreenSize == TSize( 240, 320 ) ) //QVGA portrait |
|
1129 |
{ |
|
1130 |
switch (aControl) |
|
1131 |
{ |
|
1132 |
case MPXScreenSaverPluginLabelTitle: |
|
1133 |
{ |
|
1134 |
resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_QVGA_PORTRAIT; |
|
1135 |
label = iTitleLabel; |
|
1136 |
break; |
|
1137 |
} |
|
1138 |
case MPXScreenSaverPluginLabelClock: |
|
1139 |
{ |
|
1140 |
TLanguage uiLanguage = User::Language(); |
|
1141 |
if( uiLanguage == ELangArabic || |
|
1142 |
uiLanguage == ELangUrdu || |
|
1143 |
uiLanguage == ELangFarsi ) |
|
1144 |
{ |
|
1145 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QVGA_PORTRAIT_ARABIC; |
|
1146 |
} |
|
1147 |
else |
|
1148 |
{ |
|
1149 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QVGA_PORTRAIT; |
|
1150 |
} |
|
1151 |
label = iClockLabel; |
|
1152 |
break; |
|
1153 |
} |
|
1154 |
case MPXScreenSaverPluginLabelAmPm: |
|
1155 |
{ |
|
1156 |
resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_QVGA_PORTRAIT; |
|
1157 |
label = iAmPmLabel; |
|
1158 |
break; |
|
1159 |
} |
|
1160 |
default: |
|
1161 |
{ |
|
1162 |
__ASSERT_ALWAYS(EFalse, |
|
1163 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
1164 |
break; |
|
1165 |
} |
|
1166 |
} |
|
1167 |
} |
|
1168 |
else if ( iScreenSize == TSize( 208, 176 ) ) //lowest landscape |
|
1169 |
{ |
|
1170 |
switch ( aControl ) |
|
1171 |
{ |
|
1172 |
case MPXScreenSaverPluginLabelTitle: |
|
1173 |
{ |
|
1174 |
resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_LOWRES_LANDSCAPE; |
|
1175 |
label = iTitleLabel; |
|
1176 |
break; |
|
1177 |
} |
|
1178 |
case MPXScreenSaverPluginLabelClock: |
|
1179 |
{ |
|
1180 |
TLanguage uiLanguage = User::Language(); |
|
1181 |
if( uiLanguage == ELangArabic || |
|
1182 |
uiLanguage == ELangUrdu || |
|
1183 |
uiLanguage == ELangFarsi ) |
|
1184 |
{ |
|
1185 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_LOWRES_LANDSCAPE_ARABIC; |
|
1186 |
} |
|
1187 |
else |
|
1188 |
{ |
|
1189 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_LOWRES_LANDSCAPE; |
|
1190 |
} |
|
1191 |
||
1192 |
label = iClockLabel; |
|
1193 |
break; |
|
1194 |
} |
|
1195 |
case MPXScreenSaverPluginLabelAmPm: |
|
1196 |
{ |
|
1197 |
resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_LOWRES_LANDSCAPE; |
|
1198 |
label = iAmPmLabel; |
|
1199 |
break; |
|
1200 |
} |
|
1201 |
default: |
|
1202 |
{ |
|
1203 |
__ASSERT_ALWAYS(EFalse, |
|
1204 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
1205 |
break; |
|
1206 |
} |
|
1207 |
} |
|
1208 |
} |
|
1209 |
else if ( iScreenSize == TSize( 416, 352 ) ) //double landscape |
|
1210 |
{ |
|
1211 |
switch (aControl) |
|
1212 |
{ |
|
1213 |
case MPXScreenSaverPluginLabelTitle: |
|
1214 |
{ |
|
1215 |
resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_DOUBLE_LANDSCAPE; |
|
1216 |
label = iTitleLabel; |
|
1217 |
break; |
|
1218 |
} |
|
1219 |
case MPXScreenSaverPluginLabelClock: |
|
1220 |
{ |
|
1221 |
TLanguage uiLanguage = User::Language(); |
|
1222 |
if( uiLanguage == ELangArabic || |
|
1223 |
uiLanguage == ELangUrdu || |
|
1224 |
uiLanguage == ELangFarsi ) |
|
1225 |
{ |
|
1226 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_DOUBLE_LANDSCAPE_ARABIC; |
|
1227 |
} |
|
1228 |
else |
|
1229 |
{ |
|
1230 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_DOUBLE_LANDSCAPE; |
|
1231 |
} |
|
1232 |
label = iClockLabel; |
|
1233 |
break; |
|
1234 |
} |
|
1235 |
case MPXScreenSaverPluginLabelAmPm: |
|
1236 |
{ |
|
1237 |
resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_DOUBLE_LANDSCAPE; |
|
1238 |
label = iAmPmLabel; |
|
1239 |
break; |
|
1240 |
} |
|
1241 |
default: |
|
1242 |
{ |
|
1243 |
__ASSERT_ALWAYS(EFalse, |
|
1244 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
1245 |
break; |
|
1246 |
} |
|
1247 |
} |
|
1248 |
} |
|
1249 |
else if ( iScreenSize == TSize( 320, 240 ) ) //QVGA landscape |
|
1250 |
{ |
|
1251 |
switch (aControl) |
|
1252 |
{ |
|
1253 |
case MPXScreenSaverPluginLabelTitle: |
|
1254 |
{ |
|
1255 |
resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_QVGA_LANDSCAPE; |
|
1256 |
label = iTitleLabel; |
|
1257 |
break; |
|
1258 |
} |
|
1259 |
case MPXScreenSaverPluginLabelClock: |
|
1260 |
{ |
|
1261 |
TLanguage uiLanguage = User::Language(); |
|
1262 |
if( uiLanguage == ELangArabic || |
|
1263 |
uiLanguage == ELangUrdu || |
|
1264 |
uiLanguage == ELangFarsi ) |
|
1265 |
{ |
|
1266 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QVGA_LANDSCAPE_ARABIC; |
|
1267 |
} |
|
1268 |
else |
|
1269 |
{ |
|
1270 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QVGA_LANDSCAPE; |
|
1271 |
} |
|
1272 |
||
1273 |
label = iClockLabel; |
|
1274 |
break; |
|
1275 |
} |
|
1276 |
case MPXScreenSaverPluginLabelAmPm: |
|
1277 |
{ |
|
1278 |
resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_QVGA_LANDSCAPE; |
|
1279 |
label = iAmPmLabel; |
|
1280 |
break; |
|
1281 |
} |
|
1282 |
default: |
|
1283 |
{ |
|
1284 |
__ASSERT_ALWAYS(EFalse, |
|
1285 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
1286 |
break; |
|
1287 |
} |
|
1288 |
} |
|
1289 |
} |
|
1290 |
else if ( iScreenSize == TSize( 360, 640 ) ) // QHD portrait |
|
1291 |
{ |
|
1292 |
switch (aControl) |
|
1293 |
{ |
|
1294 |
case MPXScreenSaverPluginLabelTitle: |
|
1295 |
{ |
|
1296 |
resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_QHD_PORTRAIT; |
|
1297 |
label = iTitleLabel; |
|
1298 |
break; |
|
1299 |
} |
|
1300 |
case MPXScreenSaverPluginLabelClock: |
|
1301 |
{ |
|
1302 |
TLanguage uiLanguage = User::Language(); |
|
1303 |
if( uiLanguage == ELangArabic || |
|
1304 |
uiLanguage == ELangUrdu || |
|
1305 |
uiLanguage == ELangFarsi ) |
|
1306 |
{ |
|
1307 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QHD_PORTRAIT_ARABIC; |
|
1308 |
} |
|
1309 |
else |
|
1310 |
{ |
|
1311 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QHD_PORTRAIT; |
|
1312 |
} |
|
1313 |
||
1314 |
label = iClockLabel; |
|
1315 |
break; |
|
1316 |
} |
|
1317 |
case MPXScreenSaverPluginLabelAmPm: |
|
1318 |
{ |
|
1319 |
resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_QHD_PORTRAIT; |
|
1320 |
label = iAmPmLabel; |
|
1321 |
break; |
|
1322 |
} |
|
1323 |
default: |
|
1324 |
{ |
|
1325 |
__ASSERT_ALWAYS(EFalse, |
|
1326 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
1327 |
break; |
|
1328 |
} |
|
1329 |
} |
|
1330 |
} |
|
1331 |
else if ( iScreenSize == TSize( 640, 360 ) ) // QHD landscape |
|
1332 |
{ |
|
1333 |
switch (aControl) |
|
1334 |
{ |
|
1335 |
case MPXScreenSaverPluginLabelTitle: |
|
1336 |
{ |
|
1337 |
resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_QHD_LANDSCAPE; |
|
1338 |
label = iTitleLabel; |
|
1339 |
break; |
|
1340 |
} |
|
1341 |
case MPXScreenSaverPluginLabelClock: |
|
1342 |
{ |
|
1343 |
TLanguage uiLanguage = User::Language(); |
|
1344 |
if( uiLanguage == ELangArabic || |
|
1345 |
uiLanguage == ELangUrdu || |
|
1346 |
uiLanguage == ELangFarsi ) |
|
1347 |
{ |
|
1348 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QHD_LANDSCAPE_ARABIC; |
|
1349 |
} |
|
1350 |
else |
|
1351 |
{ |
|
1352 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QHD_LANDSCAPE; |
|
1353 |
} |
|
1354 |
||
1355 |
label = iClockLabel; |
|
1356 |
break; |
|
1357 |
} |
|
1358 |
case MPXScreenSaverPluginLabelAmPm: |
|
1359 |
{ |
|
1360 |
resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_QHD_LANDSCAPE; |
|
1361 |
label = iAmPmLabel; |
|
1362 |
break; |
|
1363 |
} |
|
1364 |
default: |
|
1365 |
{ |
|
1366 |
__ASSERT_ALWAYS(EFalse, |
|
1367 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
1368 |
break; |
|
1369 |
} |
|
1370 |
} |
|
1371 |
} |
|
1372 |
else if ( iScreenSize == TSize( 480, 640 ) ) // VGA portrait |
|
1373 |
{ |
|
1374 |
switch (aControl) |
|
1375 |
{ |
|
1376 |
case MPXScreenSaverPluginLabelTitle: |
|
1377 |
{ |
|
1378 |
resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_VGA_PORTRAIT; |
|
1379 |
label = iTitleLabel; |
|
1380 |
break; |
|
1381 |
} |
|
1382 |
case MPXScreenSaverPluginLabelClock: |
|
1383 |
{ |
|
1384 |
TLanguage uiLanguage = User::Language(); |
|
1385 |
if( uiLanguage == ELangArabic || |
|
1386 |
uiLanguage == ELangUrdu || |
|
1387 |
uiLanguage == ELangFarsi ) |
|
1388 |
{ |
|
1389 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_VGA_PORTRAIT_ARABIC; |
|
1390 |
} |
|
1391 |
else |
|
1392 |
{ |
|
1393 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_VGA_PORTRAIT; |
|
1394 |
} |
|
1395 |
||
1396 |
label = iClockLabel; |
|
1397 |
break; |
|
1398 |
} |
|
1399 |
case MPXScreenSaverPluginLabelAmPm: |
|
1400 |
{ |
|
1401 |
resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_VGA_PORTRAIT; |
|
1402 |
label = iAmPmLabel; |
|
1403 |
break; |
|
1404 |
} |
|
1405 |
default: |
|
1406 |
{ |
|
1407 |
__ASSERT_ALWAYS(EFalse, |
|
1408 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
1409 |
break; |
|
1410 |
} |
|
1411 |
} |
|
1412 |
} |
|
1413 |
else if ( iScreenSize == TSize( 640, 480 ) ) // VGA landscape |
|
1414 |
{ |
|
1415 |
switch (aControl) |
|
1416 |
{ |
|
1417 |
case MPXScreenSaverPluginLabelTitle: |
|
1418 |
{ |
|
1419 |
resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_VGA_LANDSCAPE; |
|
1420 |
label = iTitleLabel; |
|
1421 |
break; |
|
1422 |
} |
|
1423 |
case MPXScreenSaverPluginLabelClock: |
|
1424 |
{ |
|
1425 |
TLanguage uiLanguage = User::Language(); |
|
1426 |
if( uiLanguage == ELangArabic || |
|
1427 |
uiLanguage == ELangUrdu || |
|
1428 |
uiLanguage == ELangFarsi ) |
|
1429 |
{ |
|
1430 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_VGA_LANDSCAPE_ARABIC; |
|
1431 |
} |
|
1432 |
else |
|
1433 |
{ |
|
1434 |
resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_VGA_LANDSCAPE; |
|
1435 |
} |
|
1436 |
||
1437 |
label = iClockLabel; |
|
1438 |
break; |
|
1439 |
} |
|
1440 |
case MPXScreenSaverPluginLabelAmPm: |
|
1441 |
{ |
|
1442 |
resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_VGA_LANDSCAPE; |
|
1443 |
label = iAmPmLabel; |
|
1444 |
break; |
|
1445 |
} |
|
1446 |
default: |
|
1447 |
{ |
|
1448 |
__ASSERT_ALWAYS(EFalse, |
|
1449 |
User::Panic( KMXPanicCategory, KErrArgument ) ); |
|
1450 |
break; |
|
1451 |
} |
|
1452 |
} |
|
1453 |
} |
|
1454 |
else |
|
1455 |
{ |
|
1456 |
User::Panic( KMXPanicCategory, KErrNotSupported ); |
|
1457 |
} |
|
1458 |
TResourceReader reader; |
|
1459 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, resId ); |
|
1460 |
||
1461 |
// Read the layout from resource file |
|
1462 |
TAknTextComponentLayout textLayout; |
|
1463 |
textLayout.SetFont( reader.ReadInt16() ); |
|
1464 |
textLayout.SetC( reader.ReadInt16() ); |
|
1465 |
textLayout.Setl( reader.ReadInt16() ); |
|
1466 |
textLayout.Setr( reader.ReadInt16() ); |
|
1467 |
textLayout.Setb( reader.ReadInt16() ); |
|
1468 |
textLayout.SetW( reader.ReadInt16() ); |
|
1469 |
textLayout.SetJ( reader.ReadInt16() ); |
|
1470 |
CleanupStack::PopAndDestroy(); // reader |
|
1471 |
||
1472 |
AknLayoutUtils::LayoutLabel( |
|
1473 |
label, TRect( TPoint( 0, 0), |
|
1474 |
TPoint( iOffScreenBitmap->SizeInPixels().iWidth, |
|
1475 |
iOffScreenBitmap->SizeInPixels().iHeight) ), |
|
1476 |
textLayout.LayoutLine() ); |
|
1477 |
} |
|
1478 |
||
1479 |
// --------------------------------------------------------------------------- |
|
1480 |
// Get drawable background height. |
|
1481 |
// --------------------------------------------------------------------------- |
|
1482 |
// |
|
1483 |
TInt CMPXScreenSaverPluginContainer::BackgroundHeightL() |
|
1484 |
{ |
|
1485 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::BackgroundHeightL" ); |
|
1486 |
TInt resId = 0; |
|
1487 |
if ( iScreenSize == TSize( 176, 208 ) ) //lowest portrait |
|
1488 |
{ |
|
1489 |
resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_LOWRES_PORTRAIT; |
|
1490 |
} |
|
1491 |
else if ( iScreenSize == TSize( 352, 416 ) ) //double portrait |
|
1492 |
{ |
|
1493 |
resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_DOUBLE_PORTRAIT; |
|
1494 |
} |
|
1495 |
else if ( iScreenSize == TSize( 240, 320 ) ) //QVGA portrait |
|
1496 |
{ |
|
1497 |
resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QVGA_PORTRAIT; |
|
1498 |
} |
|
1499 |
else if ( iScreenSize == TSize( 208, 176 ) ) //lowest landscape |
|
1500 |
{ |
|
1501 |
resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_LOWRES_LANDSCAPE; |
|
1502 |
} |
|
1503 |
else if ( iScreenSize == TSize( 416, 352 ) ) //double landscape |
|
1504 |
{ |
|
1505 |
resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_DOUBLE_LANDSCAPE; |
|
1506 |
} |
|
1507 |
else if ( iScreenSize == TSize( 320,240 ) ) // QVGA landscape |
|
1508 |
{ |
|
1509 |
resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QVGA_LANDSCAPE; |
|
1510 |
} |
|
1511 |
else if ( iScreenSize == TSize( 360, 640 ) ) // QHD |
|
1512 |
{ |
|
1513 |
resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QHD_PORTRAIT; |
|
1514 |
} |
|
1515 |
else if ( iScreenSize == TSize( 640, 360 ) ) // QHD |
|
1516 |
{ |
|
1517 |
resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QHD_LANDSCAPE; |
|
1518 |
} |
|
1519 |
else if ( iScreenSize == TSize( 480, 640 ) ) // VGA portrait |
|
1520 |
{ |
|
1521 |
resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QHD_PORTRAIT; |
|
1522 |
} |
|
1523 |
else if ( iScreenSize == TSize( 640, 480 ) ) // VGA landscape |
|
1524 |
{ |
|
1525 |
resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QHD_LANDSCAPE; |
|
1526 |
} |
|
1527 |
else |
|
1528 |
{ |
|
1529 |
User::Panic( KMXPanicCategory, KErrNotSupported ); |
|
1530 |
} |
|
1531 |
TResourceReader reader; |
|
1532 |
CCoeEnv::Static()->CreateResourceReaderLC( reader, resId ); |
|
1533 |
TInt res = reader.ReadInt16(); |
|
1534 |
MPX_DEBUG2( "CMPXScreenSaverPluginContainer::BackgroundHeightL %d", res ); |
|
1535 |
CleanupStack::PopAndDestroy(); // reader |
|
1536 |
return res; |
|
1537 |
} |
|
1538 |
||
1539 |
// --------------------------------------------------------------------------- |
|
1540 |
// Get draw position and background color index, draw position is stored |
|
1541 |
// in member variable iStartY |
|
1542 |
// --------------------------------------------------------------------------- |
|
1543 |
// |
|
1544 |
TInt CMPXScreenSaverPluginContainer::GetDrawPositionAndColorIndexL() |
|
1545 |
{ |
|
1546 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::GetDrawPositionAndColorIndexL" ); |
|
1547 |
TTime time; |
|
1548 |
time.HomeTime(); |
|
1549 |
||
1550 |
TInt colorIndex = 0; |
|
1551 |
TInt64 currentTime = time.Int64(); |
|
1552 |
colorIndex = currentTime / 10000000; // not a typo, to get it to the closest 10 seconds |
|
1553 |
colorIndex = colorIndex % KMPXNumBackgrounds; |
|
1554 |
||
1555 |
TReal yReal = Math::FRand( currentTime ); |
|
1556 |
TInt randomRangeY = iScreenSize.iHeight - BackgroundHeightL(); |
|
1557 |
iStartY = ( TInt( yReal * randomRangeY ) ); |
|
1558 |
||
1559 |
MPX_DEBUG3( "CMPXScreenSaverPluginContainer::GetDrawPositionAndColorIndexL index = %d, height = %d", colorIndex, iStartY ); |
|
1560 |
||
1561 |
return colorIndex; |
|
1562 |
} |
|
1563 |
||
1564 |
// --------------------------------------------------------------------------- |
|
1565 |
// Resizes all the icons and rects to match current screen size |
|
1566 |
// --------------------------------------------------------------------------- |
|
1567 |
// |
|
1568 |
void CMPXScreenSaverPluginContainer::UpdateLayoutL() |
|
1569 |
{ |
|
1570 |
MPX_FUNC( "CMPXScreenSaverPluginContainer::UpdateLayoutL" ); |
|
1571 |
||
1572 |
iRectIndicators = IndicatorLayout( MPXScreenSaverPluginIndicatorOther ); |
|
1573 |
AknIconUtils::SetSize( iKeyguardIcon->Bitmap(), |
|
1574 |
TSize( iRectIndicators.Height(), iRectIndicators.Height() ), |
|
1575 |
EAspectRatioNotPreserved ); |
|
1576 |
AknIconUtils::SetSize( iMissedCallIcon->Bitmap(), |
|
1577 |
TSize( iRectIndicators.Height(), iRectIndicators.Height() ), |
|
1578 |
EAspectRatioNotPreserved ); |
|
1579 |
AknIconUtils::SetSize( iMessageIcon->Bitmap(), |
|
1580 |
TSize( iRectIndicators.Height(), iRectIndicators.Height() ), |
|
1581 |
EAspectRatioNotPreserved ); |
|
1582 |
AknIconUtils::SetSize( iNewInstantMessageIcon->Bitmap(), |
|
1583 |
TSize( iRectIndicators.Height(), iRectIndicators.Height() ), |
|
1584 |
EAspectRatioNotPreserved ); |
|
1585 |
AknIconUtils::SetSize( iNewVoiceMessageIcon->Bitmap(), |
|
1586 |
TSize( iRectIndicators.Height(), iRectIndicators.Height() ), |
|
1587 |
EAspectRatioNotPreserved ); |
|
1588 |
AknIconUtils::SetSize( iNewEmailIcon->Bitmap(), |
|
1589 |
TSize( iRectIndicators.Height(), iRectIndicators.Height() ), |
|
1590 |
EAspectRatioNotPreserved ); |
|
1591 |
||
1592 |
iRectPlaybackStatus = |
|
1593 |
IndicatorLayout( MPXScreenSaverPluginIndicatorPlaybackStatus ); |
|
1594 |
AknIconUtils::SetSize( iPlayIcon->Bitmap(), iRectPlaybackStatus.Size(), |
|
1595 |
EAspectRatioNotPreserved ); |
|
1596 |
AknIconUtils::SetSize( iPauseIcon->Bitmap(), iRectPlaybackStatus.Size(), |
|
1597 |
EAspectRatioNotPreserved ); |
|
1598 |
||
1599 |
LabelLayoutL( MPXScreenSaverPluginLabelTitle ); |
|
1600 |
LabelLayoutL( MPXScreenSaverPluginLabelClock ); |
|
1601 |
LabelLayoutL( MPXScreenSaverPluginLabelAmPm ); |
|
1602 |
} |
|
1603 |
||
1604 |
||
1605 |
// End Of file. |
|
1606 |