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 <bautils.h>
|
|
23 |
#include <AknUtils.h>
|
|
24 |
#include <data_caging_path_literals.hrh>
|
|
25 |
#include <MProfileEngine.h>
|
|
26 |
#include <MProfile.h>
|
|
27 |
#include <MProfileName.h>
|
|
28 |
#include <Profile.hrh> // profile ID
|
|
29 |
#include <StringLoader.h>
|
|
30 |
|
|
31 |
#include <mpxscreensaverplugin.rsg>
|
|
32 |
#include <mpxscreensaverplugin.mbg>
|
|
33 |
#include <mpxplaybackutility.h>
|
|
34 |
#include <mpxplaybackmessage.h>
|
|
35 |
#include <mpxmedia.h>
|
|
36 |
#include <mpxmediageneraldefs.h>
|
|
37 |
#include <mpxmessagegeneraldefs.h>
|
|
38 |
#include <mpxlog.h>
|
|
39 |
#include <mpxuser.h>
|
|
40 |
|
|
41 |
#include "mpxscreensaverplugin.hrh"
|
|
42 |
#include "mpxscreensaverplugincontainer.h"
|
|
43 |
#include "mpxscreensaverplugin.h"
|
|
44 |
|
|
45 |
// Constants
|
|
46 |
const TInt KTimerInterval = 30000000; // 30 seconds
|
|
47 |
const TInt KTimerForceNextUpdateInterval = 1000; // 1 milli second
|
|
48 |
|
|
49 |
_LIT( KResourceFileName, "mpxscreensaverplugin.rsc" );
|
|
50 |
|
|
51 |
// ---------------------------------------------------------------------------
|
|
52 |
// CMPXScreenSaverPlugin::NewL
|
|
53 |
// ---------------------------------------------------------------------------
|
|
54 |
//
|
|
55 |
CMPXScreenSaverPlugin* CMPXScreenSaverPlugin::NewL()
|
|
56 |
{
|
|
57 |
MPX_FUNC( "CMPXScreenSaverPlugin::NewL" );
|
|
58 |
CMPXScreenSaverPlugin* self = new ( ELeave ) CMPXScreenSaverPlugin();
|
|
59 |
CleanupStack::PushL( self );
|
|
60 |
self->ConstructL();
|
|
61 |
CleanupStack::Pop( self );
|
|
62 |
return self;
|
|
63 |
}
|
|
64 |
|
|
65 |
// ----------------------------------------------------------------------------
|
|
66 |
// CMPXScreenSaverPlugin::~CMPXScreenSaverPlugin
|
|
67 |
// ----------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
CMPXScreenSaverPlugin::~CMPXScreenSaverPlugin()
|
|
70 |
{
|
|
71 |
MPX_DEBUG1( "CMPXScreenSaverPlugin::~CMPXScreenSaverPlugin START" );
|
|
72 |
if ( iResourceOffset != 0 )
|
|
73 |
{
|
|
74 |
iEikEnv->DeleteResourceFile( iResourceOffset );
|
|
75 |
}
|
|
76 |
if ( iPlaybackUtility )
|
|
77 |
{
|
|
78 |
iPlaybackUtility->Close();
|
|
79 |
}
|
|
80 |
|
|
81 |
if ( iProfileEngine )
|
|
82 |
{
|
|
83 |
iProfileEngine->Release();
|
|
84 |
}
|
|
85 |
|
|
86 |
if ( iContainer )
|
|
87 |
{
|
|
88 |
delete iContainer;
|
|
89 |
}
|
|
90 |
|
|
91 |
delete iDisplayName;
|
|
92 |
|
|
93 |
MPX_DEBUG1( "CMPXScreenSaverPlugin::~CMPXScreenSaverPlugin END" );
|
|
94 |
}
|
|
95 |
|
|
96 |
// -----------------------------------------------------------------------------
|
|
97 |
// CMPXScreenSaverPlugin::InitializeL
|
|
98 |
// -----------------------------------------------------------------------------
|
|
99 |
//
|
|
100 |
TInt CMPXScreenSaverPlugin::InitializeL( MScreensaverPluginHost *aHost )
|
|
101 |
{
|
|
102 |
MPX_FUNC( "CMPXScreenSaverPlugin::InitializeL" );
|
|
103 |
if ( !aHost )
|
|
104 |
{
|
|
105 |
return KErrCancel;
|
|
106 |
}
|
|
107 |
iScreenSaverHost = aHost;
|
|
108 |
iScreenSaverHost->OverrideStandardIndicators();
|
|
109 |
iScreenSaverHost->UseRefreshTimer( ETrue );
|
|
110 |
iScreenSaverHost->SetRefreshTimerValue( KTimerInterval );
|
|
111 |
|
|
112 |
CreateContainerL();
|
|
113 |
|
|
114 |
return KErrNone;
|
|
115 |
}
|
|
116 |
|
|
117 |
// -----------------------------------------------------------------------------
|
|
118 |
// CMPXScreenSaverPlugin::Draw
|
|
119 |
// -----------------------------------------------------------------------------
|
|
120 |
//
|
|
121 |
TInt CMPXScreenSaverPlugin::Draw( CWindowGc& aGc )
|
|
122 |
{
|
|
123 |
MPX_FUNC( "CMPXScreenSaverPlugin::Draw" );
|
|
124 |
|
|
125 |
TInt status = KErrNone;
|
|
126 |
TIndicatorPayload result;
|
|
127 |
|
|
128 |
// EScreensaverEventStarting event should come before draw
|
|
129 |
// iContainer should be available
|
|
130 |
// Check for missed calls
|
|
131 |
status = iScreenSaverHost->GetIndicatorPayload(
|
|
132 |
EScreensaverIndicatorIndexNewMissedCalls, result );
|
|
133 |
MPX_DEBUG2( "CMPXScreenSaverPlugin::Draw status = %d", status );
|
|
134 |
MPX_DEBUG4( "CMPXScreenSaverPlugin::Draw EScreensaverIndicatorIndexNewMissedCalls iType = %d, iInteger = %d, iIsDisplayed = %d", result.iType, result.iInteger, result.iIsDisplayed );
|
|
135 |
if ( KErrNone == status)
|
|
136 |
{
|
|
137 |
iContainer->SetParam( MPXScreenSaverPluginParamMissedCall,
|
|
138 |
result.iInteger );
|
|
139 |
}
|
|
140 |
|
|
141 |
// Check for new messages
|
|
142 |
status = iScreenSaverHost->GetIndicatorPayload(
|
|
143 |
EScreensaverIndicatorIndexNewMessages, result );
|
|
144 |
MPX_DEBUG2( "CMPXScreenSaverPlugin::Draw status = %d", status );
|
|
145 |
MPX_DEBUG4( "CMPXScreenSaverPlugin::Draw EScreensaverIndicatorIndexNewMessages iType = %d, iInteger = %d, iIsDisplayed = %d", result.iType, result.iInteger, result.iIsDisplayed );
|
|
146 |
if ( KErrNone == status )
|
|
147 |
{
|
|
148 |
iContainer->SetParam( MPXScreenSaverPluginParamNewMessage,
|
|
149 |
result.iInteger );
|
|
150 |
}
|
|
151 |
|
|
152 |
// Check for new instant messages
|
|
153 |
status = iScreenSaverHost->GetIndicatorPayload(
|
|
154 |
EScreensaverIndicatorIndexChatMessage, result );
|
|
155 |
MPX_DEBUG2( "CMPXScreenSaverPlugin::Draw status = %d", status );
|
|
156 |
MPX_DEBUG4( "CMPXScreenSaverPlugin::Draw EScreensaverIndicatorIndexChatMessage iType = %d, iInteger = %d, iIsDisplayed = %d", result.iType, result.iInteger, result.iIsDisplayed );
|
|
157 |
if ( KErrNone == status )
|
|
158 |
{
|
|
159 |
iContainer->SetParam( MPXScreenSaverPluginParamInstantMessage,
|
|
160 |
result.iIsDisplayed ? 1: 0 );
|
|
161 |
}
|
|
162 |
|
|
163 |
// Check for new email
|
|
164 |
status = iScreenSaverHost->GetIndicatorPayload(
|
|
165 |
EScreensaverIndicatorIndexEmail, result );
|
|
166 |
MPX_DEBUG2( "CMPXScreenSaverPlugin::Draw status = %d", status );
|
|
167 |
MPX_DEBUG4( "CMPXScreenSaverPlugin::Draw EScreensaverIndicatorIndexEmail iType = %d, iInteger = %d, iIsDisplayed = %d", result.iType, result.iInteger, result.iIsDisplayed );
|
|
168 |
if ( KErrNone == status )
|
|
169 |
{
|
|
170 |
iContainer->SetParam( MPXScreenSaverPluginParamEmail,
|
|
171 |
result.iIsDisplayed ? 1: 0 );
|
|
172 |
}
|
|
173 |
|
|
174 |
// Check for new voice messages
|
|
175 |
status = iScreenSaverHost->GetIndicatorPayload(
|
|
176 |
EScreensaverIndicatorIndexVoicemail, result );
|
|
177 |
MPX_DEBUG2( "CMPXScreenSaverPlugin::Draw status = %d", status );
|
|
178 |
MPX_DEBUG4( "CMPXScreenSaverPlugin::Draw EScreensaverIndicatorIndexVoicemail iType = %d, iInteger = %d, iIsDisplayed = %d", result.iType, result.iInteger, result.iIsDisplayed );
|
|
179 |
if ( KErrNone == status )
|
|
180 |
{
|
|
181 |
iContainer->SetParam( MPXScreenSaverPluginParamVoiceMessage,
|
|
182 |
result.iIsDisplayed ? 1: 0 );
|
|
183 |
}
|
|
184 |
|
|
185 |
// Check for keyguard
|
|
186 |
status = iScreenSaverHost->GetIndicatorPayload(
|
|
187 |
EScreensaverIndicatorIndexKeyGuardState, result );
|
|
188 |
MPX_DEBUG2( "CMPXScreenSaverPlugin::Draw status = %d", status );
|
|
189 |
MPX_DEBUG4( "CMPXScreenSaverPlugin::Draw EScreensaverIndicatorIndexKeyGuardState iType = %d, iInteger = %d, iIsDisplayed = %d", result.iType, result.iInteger, result.iIsDisplayed );
|
|
190 |
if ( KErrNone == status )
|
|
191 |
{
|
|
192 |
iContainer->SetParam( MPXScreenSaverPluginParamKeyguard,
|
|
193 |
result.iIsDisplayed ? 1: 0 );
|
|
194 |
}
|
|
195 |
|
|
196 |
TRAP_IGNORE( iContainer->DrawL( aGc, iPlaybackState ) );
|
|
197 |
|
|
198 |
if ( iTimerChanged )
|
|
199 |
{
|
|
200 |
MPX_DEBUG1( "CMPXScreenSaverPlugin::Draw Revert back to original timer" );
|
|
201 |
iScreenSaverHost->SetRefreshTimerValue( KTimerInterval );
|
|
202 |
iScreenSaverHost->UseRefreshTimer( ETrue );
|
|
203 |
iTimerChanged = EFalse;
|
|
204 |
}
|
|
205 |
|
|
206 |
return status;
|
|
207 |
}
|
|
208 |
|
|
209 |
// -----------------------------------------------------------------------------
|
|
210 |
// CMPXScreenSaverPlugin::Name
|
|
211 |
// -----------------------------------------------------------------------------
|
|
212 |
//
|
|
213 |
const TDesC16& CMPXScreenSaverPlugin::Name() const
|
|
214 |
{
|
|
215 |
MPX_FUNC( "CMPXScreenSaverPlugin::Name" );
|
|
216 |
if ( iDisplayName )
|
|
217 |
{
|
|
218 |
return *iDisplayName;
|
|
219 |
}
|
|
220 |
else
|
|
221 |
{
|
|
222 |
return KNullDesC;
|
|
223 |
}
|
|
224 |
}
|
|
225 |
|
|
226 |
// -----------------------------------------------------------------------------
|
|
227 |
// CMPXScreenSaverPlugin::Capabilities
|
|
228 |
// -----------------------------------------------------------------------------
|
|
229 |
//
|
|
230 |
TInt CMPXScreenSaverPlugin::Capabilities()
|
|
231 |
{
|
|
232 |
MPX_FUNC( "CMPXScreenSaverPlugin::Capabilities" );
|
|
233 |
return EScpCapsNone;
|
|
234 |
}
|
|
235 |
|
|
236 |
// -----------------------------------------------------------------------------
|
|
237 |
// CMPXScreenSaverPlugin::PluginFunction
|
|
238 |
// -----------------------------------------------------------------------------
|
|
239 |
//
|
|
240 |
TInt CMPXScreenSaverPlugin::PluginFunction(
|
|
241 |
TScPluginCaps /*aFunction*/,
|
|
242 |
TAny* /*aParam*/)
|
|
243 |
{
|
|
244 |
MPX_FUNC( "CMPXScreenSaverPlugin::PluginFunction" );
|
|
245 |
return KErrNone;
|
|
246 |
}
|
|
247 |
|
|
248 |
// -----------------------------------------------------------------------------
|
|
249 |
// CMPXScreenSaverPlugin::HandleScreensaverEventL
|
|
250 |
// -----------------------------------------------------------------------------
|
|
251 |
//
|
|
252 |
TInt CMPXScreenSaverPlugin::HandleScreensaverEventL(
|
|
253 |
TScreensaverEvent aEvent,
|
|
254 |
TAny* /*aData*/ )
|
|
255 |
{
|
|
256 |
MPX_DEBUG2( "-->CMPXScreenSaverPlugin::HandleScreensaverEventL event = %d", aEvent );
|
|
257 |
|
|
258 |
if ( aEvent == EScreensaverEventDisplayChanged )
|
|
259 |
{
|
|
260 |
if ( iContainer )
|
|
261 |
{
|
|
262 |
iContainer->RefreshDisplayInfo();
|
|
263 |
}
|
|
264 |
}
|
|
265 |
else if ( aEvent == EScreensaverEventStarting )
|
|
266 |
{
|
|
267 |
if ( !iContainer )
|
|
268 |
{
|
|
269 |
CreateContainerL();
|
|
270 |
}
|
|
271 |
iContainer->RequestTimeout( 0 );
|
|
272 |
MProfile* profile = iProfileEngine->ActiveProfileL();
|
|
273 |
if( profile )
|
|
274 |
{
|
|
275 |
if ( iProfileEngine->ActiveProfileId() != EProfileGeneralId )
|
|
276 |
{
|
|
277 |
// active profile is not general profile
|
|
278 |
const MProfileName& profileName = profile->ProfileName();
|
|
279 |
TRAP_IGNORE( iContainer->SetProfileNameL( profileName.Name(), ETrue ) );
|
|
280 |
}
|
|
281 |
else
|
|
282 |
{
|
|
283 |
TRAP_IGNORE( iContainer->SetProfileNameL( KNullDesC, EFalse ) );
|
|
284 |
}
|
|
285 |
iContainer->SetParam( MPXScreenSaverPluginParamIsSilent,
|
|
286 |
profile->IsSilent() );
|
|
287 |
profile->Release();
|
|
288 |
}
|
|
289 |
profile = NULL;
|
|
290 |
}
|
|
291 |
else if ( aEvent == EScreensaverEventStopping )
|
|
292 |
{
|
|
293 |
delete iContainer;
|
|
294 |
iContainer = NULL;
|
|
295 |
}
|
|
296 |
MPX_DEBUG1( "<--CMPXScreenSaverPlugin::HandleScreensaverEventL" );
|
|
297 |
return KErrNone;
|
|
298 |
}
|
|
299 |
|
|
300 |
// -----------------------------------------------------------------------------
|
|
301 |
// CMPXScreenSaverPlugin::CMPXScreenSaverPlugin
|
|
302 |
// -----------------------------------------------------------------------------
|
|
303 |
//
|
|
304 |
CMPXScreenSaverPlugin::CMPXScreenSaverPlugin():
|
|
305 |
iPlaybackState( EPbStateNotInitialised )
|
|
306 |
{
|
|
307 |
}
|
|
308 |
|
|
309 |
// -----------------------------------------------------------------------------
|
|
310 |
// CMPXScreenSaverPlugin::ConstructL
|
|
311 |
// -----------------------------------------------------------------------------
|
|
312 |
//
|
|
313 |
void CMPXScreenSaverPlugin::ConstructL()
|
|
314 |
{
|
|
315 |
MPX_FUNC( "CMPXScreenSaverPlugin::ConstructL" );
|
|
316 |
iEikEnv = CEikonEnv::Static();
|
|
317 |
TParse lParse;
|
|
318 |
lParse.Set( KResourceFileName, &KDC_APP_RESOURCE_DIR, NULL);
|
|
319 |
TFileName resourceFile( lParse.FullName() );
|
|
320 |
User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
|
|
321 |
|
|
322 |
BaflUtils::NearestLanguageFile( iEikEnv->FsSession(), resourceFile );
|
|
323 |
iResourceOffset = iEikEnv->AddResourceFileL( resourceFile );
|
|
324 |
|
|
325 |
iPlaybackUtility = MMPXPlaybackUtility::NewL( KPbModeActivePlayer, this );
|
|
326 |
iProfileEngine = CreateProfileEngineL();
|
|
327 |
iDisplayName = StringLoader::LoadL( R_MPX_SCREENSAVER_DISPLAY_NAME );
|
|
328 |
}
|
|
329 |
|
|
330 |
// ---------------------------------------------------------------------------
|
|
331 |
// From MMPXPlaybackObserver
|
|
332 |
// Handle playback message.
|
|
333 |
// ---------------------------------------------------------------------------
|
|
334 |
//
|
|
335 |
void CMPXScreenSaverPlugin::HandlePlaybackMessage(
|
|
336 |
CMPXMessage* aMessage, TInt aError )
|
|
337 |
{
|
|
338 |
if ( aError == KErrNone && aMessage )
|
|
339 |
{
|
|
340 |
TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
|
|
341 |
}
|
|
342 |
}
|
|
343 |
|
|
344 |
// ---------------------------------------------------------------------------
|
|
345 |
// From MMPXPlaybackCallback
|
|
346 |
// Handle playback property.
|
|
347 |
// ---------------------------------------------------------------------------
|
|
348 |
//
|
|
349 |
void CMPXScreenSaverPlugin::HandlePropertyL(
|
|
350 |
TMPXPlaybackProperty /* aProperty */,
|
|
351 |
TInt /* aValue */,
|
|
352 |
TInt /* aError */ )
|
|
353 |
{
|
|
354 |
// do nothing
|
|
355 |
}
|
|
356 |
|
|
357 |
// ---------------------------------------------------------------------------
|
|
358 |
// From MMPXPlaybackCallback
|
|
359 |
// Method is called continously until aComplete=ETrue, signifying that
|
|
360 |
// it is done and there will be no more callbacks
|
|
361 |
// Only new items are passed each time
|
|
362 |
// ---------------------------------------------------------------------------
|
|
363 |
//
|
|
364 |
void CMPXScreenSaverPlugin::HandleSubPlayerNamesL(
|
|
365 |
TUid /* aPlayer */,
|
|
366 |
const MDesCArray* /* aSubPlayers */,
|
|
367 |
TBool /* aComplete */,
|
|
368 |
TInt /* aError */ )
|
|
369 |
{
|
|
370 |
// do nothing
|
|
371 |
}
|
|
372 |
|
|
373 |
// ---------------------------------------------------------------------------
|
|
374 |
// From MMPXPlaybackCallback
|
|
375 |
// Handle media properties.
|
|
376 |
// Notes: The client is responsible for delete the object of aProperties.
|
|
377 |
// ---------------------------------------------------------------------------
|
|
378 |
//
|
|
379 |
void CMPXScreenSaverPlugin::HandleMediaL(
|
|
380 |
const CMPXMedia& aMedia,
|
|
381 |
TInt aError )
|
|
382 |
{
|
|
383 |
TRAP_IGNORE( DoHandleMediaL( aMedia, aError ) );
|
|
384 |
}
|
|
385 |
|
|
386 |
// ---------------------------------------------------------------------------
|
|
387 |
// Handle playback message.
|
|
388 |
// ---------------------------------------------------------------------------
|
|
389 |
//
|
|
390 |
void CMPXScreenSaverPlugin::DoHandlePlaybackMessageL(
|
|
391 |
const CMPXMessage& aMessage )
|
|
392 |
{
|
|
393 |
MPX_FUNC( "CMPXScreenSaverPlugin::DoHandlePlaybackMessageL" );
|
|
394 |
TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
|
|
395 |
if ( KMPXMessageGeneral == id )
|
|
396 |
{
|
|
397 |
TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
|
|
398 |
TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
|
|
399 |
switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
|
|
400 |
{
|
|
401 |
case TMPXPlaybackMessage::EStateChanged:
|
|
402 |
{
|
|
403 |
MPX_DEBUG2( "CMPXScreenSaverPlugin::DoHandlePlaybackMessageL - EStateChanged(%d)", type );
|
|
404 |
|
|
405 |
TMPXPlaybackState state =
|
|
406 |
static_cast<TMPXPlaybackState>( type );
|
|
407 |
DoHandleStateChangedL( state );
|
|
408 |
break;
|
|
409 |
}
|
|
410 |
case TMPXPlaybackMessage::EMediaChanged:
|
|
411 |
{
|
|
412 |
MPX_DEBUG2( "CMPXScreenSaverPlugin::DoHandlePlaybackMessageL - EMediaChanged(%d)", type );
|
|
413 |
MMPXSource* s( iPlaybackUtility->Source() );
|
|
414 |
if ( s )
|
|
415 |
{
|
|
416 |
RArray<TMPXAttribute> attrs;
|
|
417 |
CleanupClosePushL(attrs);
|
|
418 |
attrs.Append( KMPXMediaGeneralTitle );
|
|
419 |
s->MediaL( attrs.Array(), *this );
|
|
420 |
CleanupStack::PopAndDestroy( &attrs );
|
|
421 |
}
|
|
422 |
break;
|
|
423 |
}
|
|
424 |
case TMPXPlaybackMessage::EActivePlayerChanged:
|
|
425 |
{
|
|
426 |
MPX_DEBUG3( "CMPXScreenSaverPlugin::DoHandlePlaybackMessageL - Active player changed(%d, %d)", type, data );
|
|
427 |
if ( type && data )
|
|
428 |
{
|
|
429 |
// binded to active player, change state to active
|
|
430 |
DoHandleStateChangedL( EPbStatePlaying );
|
|
431 |
// refresh media property
|
|
432 |
MMPXSource* s = iPlaybackUtility->Source();
|
|
433 |
if ( s )
|
|
434 |
{
|
|
435 |
RArray<TMPXAttribute> attrs;
|
|
436 |
CleanupClosePushL(attrs);
|
|
437 |
attrs.Append( KMPXMediaGeneralTitle );
|
|
438 |
s->MediaL( attrs.Array(), *this );
|
|
439 |
CleanupStack::PopAndDestroy( &attrs );
|
|
440 |
}
|
|
441 |
}
|
|
442 |
break;
|
|
443 |
}
|
|
444 |
default:
|
|
445 |
{
|
|
446 |
break;
|
|
447 |
}
|
|
448 |
}
|
|
449 |
}
|
|
450 |
}
|
|
451 |
|
|
452 |
// ---------------------------------------------------------------------------
|
|
453 |
// Handle media properties.
|
|
454 |
// Notes: The client is responsible for delete the object of aProperties.
|
|
455 |
// ---------------------------------------------------------------------------
|
|
456 |
//
|
|
457 |
void CMPXScreenSaverPlugin::DoHandleMediaL(
|
|
458 |
const CMPXMedia& aMedia,
|
|
459 |
TInt aError )
|
|
460 |
{
|
|
461 |
MPX_FUNC( "CMPXScreenSaverPlugin::DoHandleMediaL" );
|
|
462 |
if ( iContainer && KErrNone == aError)
|
|
463 |
{
|
|
464 |
iContainer->SetSongPropertiesL( aMedia );
|
|
465 |
// force a redraw after title update
|
|
466 |
iScreenSaverHost->SetRefreshTimerValue( KTimerForceNextUpdateInterval );
|
|
467 |
iScreenSaverHost->UseRefreshTimer( ETrue );
|
|
468 |
iTimerChanged = ETrue;
|
|
469 |
}
|
|
470 |
}
|
|
471 |
|
|
472 |
// ---------------------------------------------------------------------------
|
|
473 |
// Handle playback state changed.
|
|
474 |
// ---------------------------------------------------------------------------
|
|
475 |
//
|
|
476 |
void CMPXScreenSaverPlugin::DoHandleStateChangedL(
|
|
477 |
TMPXPlaybackState aState )
|
|
478 |
{
|
|
479 |
MPX_FUNC( "CMPXScreenSaverPlugin::DoHandleStateChangedL" );
|
|
480 |
iPlaybackState = aState;
|
|
481 |
|
|
482 |
// force a redraw after play state change
|
|
483 |
iScreenSaverHost->SetRefreshTimerValue( KTimerForceNextUpdateInterval );
|
|
484 |
iScreenSaverHost->UseRefreshTimer( ETrue );
|
|
485 |
iTimerChanged = ETrue;
|
|
486 |
}
|
|
487 |
|
|
488 |
// ---------------------------------------------------------------------------
|
|
489 |
// create container.
|
|
490 |
// ---------------------------------------------------------------------------
|
|
491 |
//
|
|
492 |
void CMPXScreenSaverPlugin::CreateContainerL()
|
|
493 |
{
|
|
494 |
MPX_FUNC( "CMPXScreenSaverPlugin::CreateContainerL" );
|
|
495 |
|
|
496 |
iContainer = new ( ELeave )
|
|
497 |
CMPXScreenSaverPluginContainer( iScreenSaverHost );
|
|
498 |
iContainer->ConstructL();
|
|
499 |
|
|
500 |
iPlaybackState = iPlaybackUtility->StateL();
|
|
501 |
|
|
502 |
// get current playing song (if any)
|
|
503 |
MMPXSource* s = iPlaybackUtility->Source();
|
|
504 |
if ( s )
|
|
505 |
{
|
|
506 |
RArray<TMPXAttribute> attrs;
|
|
507 |
CleanupClosePushL(attrs);
|
|
508 |
attrs.Append( KMPXMediaGeneralTitle );
|
|
509 |
s->MediaL( attrs.Array(), *this );
|
|
510 |
CleanupStack::PopAndDestroy( &attrs );
|
|
511 |
}
|
|
512 |
}
|
|
513 |
|
|
514 |
// End Of file.
|
|
515 |
|