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 Common Playback view |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
// INCLUDE FILES |
|
21 |
#include <aknViewAppUi.h> |
|
22 |
#include <eikmenub.h> |
|
23 |
#include <featmgr.h> |
|
24 |
#include <StringLoader.h> |
|
25 |
#include <eikapp.h> |
|
26 |
#include <AknUtils.h> |
|
27 |
#include <akntitle.h> |
|
28 |
#include <aknnotewrappers.h> |
|
29 |
#include <aknnavi.h> |
|
30 |
#include <hlplch.h> |
|
31 |
#include <bautils.h> |
|
32 |
#include <centralrepository.h> |
|
33 |
#include <avkon.hrh> |
|
34 |
#include <avkon.rsg> |
|
35 |
#include <bldvariant.hrh> |
|
36 |
#include <caf/caferr.h> |
|
37 |
#include <aknsoundsystem.h> |
|
38 |
#include <AknDlgShut.h> |
|
39 |
#include <ctsydomainpskeys.h> |
|
40 |
#include <aknclearer.h> |
|
41 |
||
42 |
||
43 |
#include <e32const.h> |
|
44 |
#ifdef UPNP_INCLUDED |
|
45 |
#include <upnpcopycommand.h> |
|
46 |
#endif |
|
47 |
||
48 |
#include <apgcli.h> // For FF_FMTX |
|
49 |
#include <AknWaitDialog.h> |
|
50 |
||
51 |
#include <aknSDData.h> |
|
52 |
#include <AknMediatorFacade.h> |
|
53 |
#include "mplayersecondarydisplayapi.h" |
|
54 |
||
55 |
#include <data_caging_path_literals.hrh> |
|
56 |
#include <layoutmetadata.cdl.h> |
|
57 |
#include <mpxcommonplaybackview.rsg> |
|
58 |
||
59 |
||
60 |
#include <mpxfmtx.rsg> |
|
61 |
#include <mpxcommonui.rsg> |
|
62 |
#include <mpxplaybackutility.h> |
|
63 |
#include <mpxplaybackmessage.h> |
|
64 |
#include <mpxmessagegeneraldefs.h> |
|
65 |
#include <mpxplaybackmessagedefs.h> |
|
66 |
#include <mpxcollectionplaylist.h> |
|
67 |
#include <mpxcollectionpath.h> |
|
68 |
#include <mpxcollectionmessage.h> |
|
69 |
#include <mpxviewutility.h> |
|
70 |
#include <mpxmusicplayerviewplugin.hrh> |
|
71 |
#include <mpxmedia.h> |
|
72 |
#include <mpxmediaarray.h> |
|
73 |
#include <mpxmediageneraldefs.h> |
|
74 |
#include <mpxmediamusicdefs.h> |
|
75 |
#include <mpxmediadrmdefs.h> |
|
76 |
#include <mpxmediacontainerdefs.h> |
|
77 |
#include <mpxcollectionutility.h> |
|
78 |
#include <mpxcollectionhelperfactory.h> |
|
79 |
#include <mpxviewplugin.h> |
|
80 |
#include <mpxviewpluginmanager.h> |
|
81 |
#include <mpxmusicplayerviewplugin.hrh> |
|
82 |
#include <mpxsubscription.h> |
|
83 |
#include <mpxuser.h> |
|
84 |
#include <mpxpskeywatcher.h> |
|
85 |
#include <mpxcenrepwatcher.h> |
|
86 |
#include <hwrmfmtx.h> // TFmTxState |
|
87 |
#include <AiwServiceHandler.h> |
|
88 |
#include <mediarecognizer.h> |
|
89 |
#ifdef BACKSTEPPING_INCLUDED |
|
90 |
#include <mpxbacksteppingutility.h> |
|
91 |
#endif // BACKSTEPPING_INCLUDED |
|
92 |
#include <UsbWatcherInternalPSKeys.h> |
|
93 |
#include <usbpersonalityids.h> |
|
94 |
||
95 |
#include "mpxconstants.h" |
|
96 |
#include <mpxappui.hrh> |
|
97 |
#include "mpxcommonplaybackview.hrh" |
|
98 |
#include "mpxcommonplaybackviewimp.h" |
|
99 |
#include "mpxcommonplaybackviewcontainer.h" |
|
100 |
#include "mpxcommonplaybackviewlayout.h" |
|
101 |
#include "mpxalbumartutil.h" |
|
102 |
#include "mpxcommonuihelper.h" |
|
103 |
#include <mpxinternalcrkeys.h> |
|
104 |
#include <mpxtlshelper.h> |
|
105 |
#include "mpxlog.h" |
|
106 |
||
107 |
#include <akntoolbar.h> |
|
108 |
#include <aknbutton.h> |
|
109 |
#include "mpxviewprivatepskeys.h" |
|
110 |
#include <gfxtranseffect/gfxtranseffect.h> |
|
111 |
#include <akntranseffect.h> |
|
112 |
||
113 |
// CONSTANTS |
|
114 |
const TInt KMPXOneSecInMilliSecs( 1000 ); |
|
115 |
const TUid KMPXEqualizerViewImplementationId = { 0x101FFC77 }; |
|
116 |
const TInt KMPXPostponeForHandleDelayedError( 1000000 ); // 1S |
|
117 |
const TInt KMPXPlaybackViewWindowBackground = -1; |
|
118 |
const TInt KMPXDelayForTNRequest( 3000000 ); // 3S |
|
119 |
||
120 |
// for freqency display in the format of "XXX.XX" |
|
121 |
const TInt KMPXFMFreqWidth = 6; |
|
122 |
const TInt KMPXFMFreqDecimalPlace = 2; |
|
123 |
const TInt KMPXOneMhzInOneKhz = 1000; |
|
124 |
const TUid KFmTxAppUid = { 0x10282BEF }; |
|
125 |
||
126 |
#ifdef BACKSTEPPING_INCLUDED |
|
127 |
const TInt KMaxIntLen( 10 ); |
|
128 |
_LIT8( KMVPrefix, "MVviewID:" ); |
|
129 |
const TInt KMVPrefixLen( 9 ); |
|
130 |
#endif // BACKSTEPPING_INCLUDED |
|
131 |
||
132 |
// --------------------------------------------------------------------------- |
|
133 |
// NOTE: All the FM Tx related values below originated from the files: |
|
134 |
// - HWRMFmTx.h |
|
135 |
// - HWRMFmTxDomainCRKeys.h |
|
136 |
// - HWRMFmTxDomainPSKeys.h |
|
137 |
// |
|
138 |
// These values should be kept in sync with the original copies. The |
|
139 |
// intention of keeping a copy here is to de-couple the MPX Music Player |
|
140 |
// from the Hardware Resource Manager who is the owner of the keys, as |
|
141 |
// FM Tx is not yet available for the platform. Eventually, this should |
|
142 |
// be removed as FM Tx becomes part of the platform. |
|
143 |
// --------------------------------------------------------------------------- |
|
144 |
// |
|
145 |
const TUid KCRUidFmTxCenRes = { 0x20008EA6 }; // FM TX Repository ID |
|
146 |
const TUid KPSUidHWRMFmTx = { 0x101F7A02 }; // FM TX category ID |
|
147 |
||
148 |
// FM Tx frequency (kHz) key ID of the FM TX CenRep |
|
149 |
const TUint32 KFmTxCenResKeyFrequency = 0x00000001; |
|
150 |
||
151 |
// FM Transmitter status key ID of the FM TX property. |
|
152 |
// Note: This data is interpreted as TFmTxState below |
|
153 |
const TUint32 KHWRMFmTxStatus = 0x00000001; |
|
154 |
||
155 |
_LIT( KMPXCommonPlaybackRscPath, "mpxcommonplaybackview.rsc" ); |
|
156 |
||
157 |
_LIT( KMPXFMTXRscPath, "mpxfmtx.rsc" ); |
|
158 |
||
159 |
#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
160 |
_LIT(KMPXPnRealAudioMimeType, "audio/x-pn-realaudio"); |
|
161 |
_LIT(KMPXRealAudioMimeType, "audio/x-realaudio"); |
|
162 |
_LIT(KMPXRnRealAudioMimeType, "audio/vnd.rn-realaudio"); |
|
163 |
#endif |
|
164 |
||
165 |
// ======== MEMBER FUNCTIONS ======== |
|
166 |
||
167 |
||
168 |
// --------------------------------------------------------------------------- |
|
169 |
// Symbian 2nd phase constructor can leave. |
|
170 |
// --------------------------------------------------------------------------- |
|
171 |
// |
|
172 |
EXPORT_C void CMPXCommonPlaybackViewImp::ConstructL() |
|
173 |
{ |
|
174 |
MPX_FUNC( "CMPXCommonPlaybackViewImp::ConstructL" ); |
|
175 |
||
176 |
CCoeEnv* coeEnv = iEikonEnv; |
|
177 |
TParse parse; |
|
178 |
parse.Set( KMPXCommonPlaybackRscPath, &KDC_APP_RESOURCE_DIR, NULL ); |
|
179 |
TFileName resourceFile( parse.FullName() ); |
|
180 |
User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) ); |
|
181 |
BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile ); |
|
182 |
iResourceOffset = coeEnv->AddResourceFileL( resourceFile ); |
|
183 |
iTvOutConfig = CTvOutConfig::NewL() ; |
|
184 |
if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) ) |
|
185 |
{ |
|
186 |
parse.Set( KMPXFMTXRscPath, &KDC_APP_RESOURCE_DIR, NULL ); |
|
187 |
TFileName fmtxResourceFile( parse.FullName() ); |
|
188 |
User::LeaveIfError( MPXUser::CompleteWithDllPath( fmtxResourceFile ) ); |
|
189 |
BaflUtils::NearestLanguageFile( coeEnv->FsSession(), fmtxResourceFile ); |
|
190 |
iFMTXResourceOffset = coeEnv->AddResourceFileL( fmtxResourceFile ); |
|
191 |
} |
|
192 |
||
193 |
// Monitor for view activation |
|
194 |
AppUi()->AddViewActivationObserverL( this ); |
|
195 |
||
196 |
// Get the playback utility instance from engine. |
|
197 |
iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault ); |
|
198 |
iPlaybackUtility->AddObserverL( *this ); |
|
199 |
||
200 |
iMPXUtility = CMPXAlbumArtUtil::NewL(); |
|
201 |
||
202 |
iEmbedded = iEikonEnv->StartedAsServerApp(); |
|
203 |
||
204 |
// Get an instance of view utility |
|
205 |
iViewUtility = MMPXViewUtility::UtilityL(); |
|
206 |
iViewUtility->AddObserverL( this ); |
|
207 |
||
208 |
TInt flags( 0 ); |
|
209 |
CRepository* repository( CRepository::NewLC( KCRUidMPXMPFeatures )); |
|
210 |
User::LeaveIfError( repository->Get( KMPXMPLocalVariation, flags )); |
|
211 |
CleanupStack::PopAndDestroy( repository ); |
|
212 |
repository = NULL; |
|
213 |
||
214 |
iChangeRTForAllProfiles = |
|
215 |
static_cast<TBool>( flags & KMPXChangeRTForAll ); |
|
216 |
||
217 |
iLayout = new (ELeave) CMPXCommonPlaybackViewLayout(); |
|
218 |
||
219 |
iCollectionUtility = MMPXCollectionUtility::NewL( this ); |
|
220 |
||
221 |
#ifdef __USE_MESSAGE_SUBSCRIPTION |
|
222 |
// Subscribe to only a few messages from collection utility |
|
223 |
CMPXSubscription* subscription( CMPXSubscription::NewL() ); |
|
224 |
CleanupStack::PushL( subscription ); |
|
225 |
CMPXSubscriptionItem* subItem1( CMPXSubscriptionItem::NewL() ); |
|
226 |
CleanupStack::PushL( subItem1 ); |
|
227 |
subItem1->SetTObjectValueL( KMPXMessageGeneralId, KMPXMessageGeneral ); |
|
228 |
subItem1->SetTObjectValueL( KMPXMessageGeneralEvent, TMPXCollectionMessage::EBroadcastEvent ); |
|
229 |
subItem1->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgDiskRemoved ); |
|
230 |
subscription->AddItemL( *subItem1 ); |
|
231 |
CMPXSubscriptionItem* subItem2( CMPXSubscriptionItem::CopyL( *subItem1 )); |
|
232 |
CleanupStack::PushL( subItem2 ); |
|
233 |
subItem2->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgUSBMassStorageStart ); |
|
234 |
subscription->AddItemL( *subItem2 ); |
|
235 |
CMPXSubscriptionItem* subItem3( CMPXSubscriptionItem::CopyL( *subItem1 )); |
|
236 |
CleanupStack::PushL( subItem3 ); |
|
237 |
subItem3->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgUSBMTPStart ); |
|
238 |
subscription->AddItemL( *subItem3 ); |
|
239 |
CMPXSubscriptionItem* subItem4( CMPXSubscriptionItem::CopyL( *subItem1 )); |
|
240 |
CleanupStack::PushL( subItem4 ); |
|
241 |
subItem4->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgFormatStart ); |
|
242 |
subscription->AddItemL( *subItem4 ); |
|
243 |
CMPXSubscriptionItem* subItem5( CMPXSubscriptionItem::CopyL( *subItem1 )); |
|
244 |
CleanupStack::PushL( subItem5 ); |
|
245 |
subItem5->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgUSBMassStorageEnd ); |
|
246 |
subscription->AddItemL( *subItem5 ); |
|
247 |
CMPXSubscriptionItem* subItem6( CMPXSubscriptionItem::CopyL( *subItem1 )); |
|
248 |
CleanupStack::PushL( subItem6 ); |
|
249 |
subItem6->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgUSBMTPEnd ); |
|
250 |
subscription->AddItemL( *subItem6 ); |
|
251 |
CMPXSubscriptionItem* subItem7( CMPXSubscriptionItem::CopyL( *subItem1 )); |
|
252 |
CleanupStack::PushL( subItem7 ); |
|
253 |
subItem7->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgFormatEnd ); |
|
254 |
subscription->AddItemL( *subItem7 ); |
|
255 |
CMPXSubscriptionItem* subItem8( CMPXSubscriptionItem::NewL() ); |
|
256 |
CleanupStack::PushL( subItem8 ); |
|
257 |
subItem8->SetTObjectValueL( KMPXMessageGeneralId, KMPXMessageGeneral ); |
|
258 |
subItem8->SetTObjectValueL( KMPXMessageGeneralEvent, TMPXCollectionMessage::EPathChanged ); |
|
259 |
subItem8->SetTObjectValueL( KMPXMessageGeneralType, EMcPathChangedByOpen ); |
|
260 |
subItem8->SetTObjectValueL( KMPXMessageGeneralData, EMcItemOpened ); |
|
261 |
subscription->AddItemL( *subItem8 ); |
|
262 |
iCollectionUtility->Collection().AddSubscriptionL( *subscription ); |
|
263 |
CleanupStack::PopAndDestroy( subItem8 ); |
|
264 |
CleanupStack::PopAndDestroy( subItem7 ); |
|
265 |
CleanupStack::PopAndDestroy( subItem6 ); |
|
266 |
CleanupStack::PopAndDestroy( subItem5 ); |
|
267 |
CleanupStack::PopAndDestroy( subItem4 ); |
|
268 |
CleanupStack::PopAndDestroy( subItem3 ); |
|
269 |
CleanupStack::PopAndDestroy( subItem2 ); |
|
270 |
CleanupStack::PopAndDestroy( subItem1 ); |
|
271 |
CleanupStack::PopAndDestroy( subscription ); |
|
272 |
#endif |
|
273 |
||
274 |
iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL(); |
|
275 |
iCommonUiHelper = CMPXCommonUiHelper::NewL( iCollectionUtility ); |
|
276 |
||
277 |
// initialize FeatureManager |
|
278 |
FeatureManager::InitializeLibL(); |
|
279 |
||
280 |
if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) ) |
|
281 |
{ |
|
282 |
// Since support of FM Tx remains the same within the lifetime of this |
|
283 |
// view, it is safe to determine whether to create the associated |
|
284 |
// PS & CR watcher here. |
|
285 |
||
286 |
// create the PS Key watcher to receive notification when FM |
|
287 |
// transmission status changes |
|
288 |
iPSKeyWatcher = |
|
289 |
CMPXPSKeyWatcher::NewL( KPSUidHWRMFmTx, KHWRMFmTxStatus, this ); |
|
290 |
||
291 |
// create the Central Repository watcher to receive notification when |
|
292 |
// the value of the FM Frequency CR key is changed. |
|
293 |
iCRWatcher = CMPXCenRepWatcher::NewL( |
|
294 |
KCRUidFmTxCenRes, |
|
295 |
KFmTxCenResKeyFrequency, |
|
296 |
this ); |
|
297 |
} |
|
298 |
||
299 |
iStartPlaybackIndex = KErrNotFound; |
|
300 |
iLastSkipDirection = 1; |
|
301 |
iSkipBtnPressed = EFalse; |
|
302 |
||
303 |
// Set to EFalse to avoid handling |
|
304 |
// errors if the view has not been activated |
|
305 |
// before. |
|
306 |
iLastPBViewActivated = EFalse; |
|
307 |
||
308 |
iDatabaseNotReady = EFalse; |
|
309 |
iIgnoredByUsbEvent = EFalse; |
|
310 |
#ifdef _DEBUG |
|
311 |
iExitOptionHidden = EFalse; |
|
312 |
#else // _DEBUG |
|
313 |
iExitOptionHidden = iCommonUiHelper->ExitOptionHiddenL() && !iEmbedded; |
|
314 |
#endif // _DEBUG |
|
315 |
||
316 |
// Support for Camese Super Distribution |
|
317 |
#ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT |
|
318 |
iCameseSuperDistSupport = ETrue; |
|
319 |
#endif |
|
320 |
iMediaRecognizer = CMediaRecognizer::NewL(); |
|
321 |
if ( iServiceHandler == NULL) |
|
322 |
{ |
|
323 |
iServiceHandler = CAiwServiceHandler::NewL(); |
|
324 |
MPX_DEBUG1("CMPXCollectionViewImp::ConstructL() Attaching 'Assign as' menu service..."); |
|
325 |
MPX_TRAP( iErrorAttachAssignMenu, iServiceHandler->AttachMenuL( R_MPX_USE_AS_CASCADE, |
|
326 |
R_MPX_AIW_ASSIGN_INTEREST ) ); |
|
327 |
} |
|
328 |
#ifdef BACKSTEPPING_INCLUDED |
|
329 |
// Initialize the Back Stepping Service Utility with the MPX Music Player |
|
330 |
iBackSteppingUtility = MMPXBackSteppingUtility::UtilityL(); |
|
331 |
iBackSteppingUtility->InitializeL( |
|
332 |
TUid::Uid( KMusicPlayerAppUidConstant ) ); |
|
333 |
#endif // BACKSTEPPING_INCLUDED |
|
334 |
||
335 |
#ifdef UPNP_INCLUDED |
|
336 |
if (!iUpnpCopyCommand ) |
|
337 |
{ |
|
338 |
MPX_TRAPD ( error, iUpnpCopyCommand = CUpnpCopyCommand::NewL() ); |
|
339 |
if ( error == KErrNone ) |
|
340 |
{ |
|
341 |
iUpnpFrameworkSupport = ETrue; |
|
342 |
} |
|
343 |
else |
|
344 |
{ |
|
345 |
iUpnpFrameworkSupport = EFalse; |
|
346 |
iUpnpCopyCommand = NULL; |
|
347 |
} |
|
348 |
} |
|
349 |
#endif |
|
350 |
iIsffButtonPressed = EFalse; |
|
351 |
iDelayedErrorTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
352 |
iFmTxActivity = EFmTxStateUnknown; |
|
353 |
||
354 |
iTNRequestTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
355 |
} |
|
356 |
||
357 |
||
358 |
// --------------------------------------------------------------------------- |
|
359 |
// Destructor |
|
360 |
// --------------------------------------------------------------------------- |
|
361 |
// |
|
362 |
EXPORT_C CMPXCommonPlaybackViewImp::~CMPXCommonPlaybackViewImp() |
|
363 |
{ |
|
364 |
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::~CMPXCommonPlaybackViewImp entering" ); |
|
365 |
||
366 |
AppUi()->RemoveViewActivationObserver( this ); |
|
367 |
||
368 |
delete iMPXUtility; |
|
369 |
delete iMedia; |
|
370 |
delete iIdle; |
|
371 |
||
372 |
if ( iServiceHandler ) |
|
373 |
{ |
|
374 |
iServiceHandler->DetachMenu( R_MPX_USE_AS_CASCADE, |
|
375 |
R_MPX_AIW_ASSIGN_INTEREST ); |
|
376 |
delete iServiceHandler; |
|
377 |
delete iMediaRecognizer; |
|
378 |
} |
|
379 |
||
380 |
delete iDelayedExit; |
|
381 |
||
382 |
if ( iPSKeyWatcher ) |
|
383 |
{ |
|
384 |
delete iPSKeyWatcher; |
|
385 |
} |
|
386 |
||
387 |
if ( iCRWatcher ) |
|
388 |
{ |
|
389 |
delete iCRWatcher; |
|
390 |
} |
|
391 |
||
392 |
if ( iPlaybackUtility ) |
|
393 |
{ |
|
394 |
TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) ); |
|
395 |
iPlaybackUtility->Close(); |
|
396 |
} |
|
397 |
||
398 |
if ( iViewUtility ) |
|
399 |
{ |
|
400 |
iViewUtility->RemoveObserver( this ); |
|
401 |
iViewUtility->Close(); |
|
402 |
} |
|
403 |
||
404 |
if ( iResourceOffset ) |
|
405 |
{ |
|
406 |
iEikonEnv->DeleteResourceFile( iResourceOffset ); |
|
407 |
} |
|
408 |
||
409 |
if ( iFMTXResourceOffset ) |
|
410 |
{ |
|
411 |
iEikonEnv->DeleteResourceFile( iFMTXResourceOffset ); |
|
412 |
} |
|
413 |
||
414 |
#ifdef BACKSTEPPING_INCLUDED |
|
415 |
if( iBackSteppingUtility ) |
|
416 |
{ |
|
417 |
iBackSteppingUtility->Close(); |
|
418 |
} |
|
419 |
#endif // BACKSTEPPING_INCLUDED |
|
420 |
||
421 |
if ( iContainer ) |
|
422 |
{ |
|
423 |
AppUi()->RemoveFromStack( iContainer ); |
|
424 |
delete iContainer; |
|
425 |
} |
|
426 |
delete iLayout; |
|
427 |
||
428 |
if ( iUpnpFrameworkSupport ) |
|
429 |
{ |
|
430 |
iPlayersList.Close(); |
|
431 |
delete iSubPlayerName; |
|
432 |
#ifdef UPNP_INCLUDED |
|
433 |
if (iUpnpCopyCommand) |
|
434 |
{ |
|
435 |
delete iUpnpCopyCommand; |
|
436 |
} |
|
437 |
#endif |
|
438 |
} |
|
439 |
delete iWaitNote; |
|
440 |
||
441 |
if ( iCollectionUtility ) |
|
442 |
{ |
|
443 |
iCollectionUtility->Close(); |
|
444 |
} |
|
445 |
||
446 |
if ( iCollectionUiHelper ) |
|
447 |
{ |
|
448 |
iCollectionUiHelper->Close(); |
|
449 |
} |
|
450 |
||
451 |
delete iCommonUiHelper; |
|
452 |
delete iUserPlaylists; |
|
453 |
||
454 |
if ( iKeySoundDisabled ) |
|
455 |
{ |
|
456 |
iAvkonViewAppUi->KeySounds()->PopContext(); |
|
457 |
} |
|
458 |
||
459 |
// free up the FeatureManager |
|
460 |
FeatureManager::UnInitializeLib(); |
|
461 |
if(iDelayedErrorTimer) |
|
462 |
{ |
|
463 |
iDelayedErrorTimer->Cancel(); |
|
464 |
delete iDelayedErrorTimer; |
|
465 |
} |
|
466 |
||
467 |
delete iOldUri; |
|
468 |
||
469 |
if ( iTNRequestTimer ) |
|
470 |
{ |
|
471 |
iTNRequestTimer->Cancel(); |
|
472 |
delete iTNRequestTimer; |
|
473 |
} |
|
474 |
if(iTvOutConfig) |
|
475 |
{ |
|
476 |
delete iTvOutConfig; |
|
477 |
} |
|
478 |
||
479 |
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::~CMPXCommonPlaybackViewImp exiting" ); |
|
480 |
} |
|
481 |
||
482 |
// --------------------------------------------------------------------------- |
|
483 |
// Updates playback view. |
|
484 |
// --------------------------------------------------------------------------- |
|
485 |
// |
|
486 |
EXPORT_C void CMPXCommonPlaybackViewImp::UpdateViewL() |
|
487 |
{ |
|
488 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateViewL" ); |
|
489 |
||
490 |
if ( iContainer && !iSwitchingView ) |
|
491 |
{ |
|
492 |
UpdatePlaybackStateL( iPlaybackState ); |
|
493 |
UpdateTrackInfoL( iMedia ); |
|
494 |
UpdateTrackPlaybackPositionL( iPosition, iDuration ); |
|
495 |
UpdateTrackPosInPlaylistL(); |
|
496 |
UpdateAlbumArtL( iMedia ); |
|
497 |
UpdateDownloadStateLabelL(); |
|
498 |
||
499 |
UpdateFMTransmitterInfoL( ETrue ); |
|
500 |
||
501 |
// Retrieve current repeat & random modes |
|
502 |
iPlaybackUtility->PropertyL( *this, EPbPropertyRandomMode ); |
|
503 |
iPlaybackUtility->PropertyL( *this, EPbPropertyRepeatMode ); |
|
504 |
} |
|
505 |
} |
|
506 |
||
507 |
// --------------------------------------------------------------------------- |
|
508 |
// Updates track info field. |
|
509 |
// --------------------------------------------------------------------------- |
|
510 |
// |
|
511 |
EXPORT_C void CMPXCommonPlaybackViewImp::UpdateTrackInfoL( |
|
512 |
const CMPXMedia* aMedia ) |
|
513 |
{ |
|
514 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateTrackInfo" ); |
|
515 |
||
516 |
if ( iContainer && !iSwitchingView ) |
|
517 |
{ |
|
518 |
if ( aMedia ) |
|
519 |
{ |
|
520 |
if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) ) |
|
521 |
{ |
|
522 |
iContainer->UpdateLabelL( |
|
523 |
ETextTrack, |
|
524 |
aMedia->ValueText( KMPXMediaGeneralTitle ) ); |
|
525 |
} |
|
526 |
else if ( aMedia->IsSupported( KMPXMediaGeneralUri ) ) |
|
527 |
{ |
|
528 |
TParsePtrC filePath( |
|
529 |
aMedia->ValueText( KMPXMediaGeneralUri ) ); |
|
530 |
iContainer->UpdateLabelL( |
|
531 |
ETextTrack, filePath.Name() ); |
|
532 |
} |
|
533 |
else |
|
534 |
{ |
|
535 |
iContainer->UpdateLabelL( |
|
536 |
ETextTrack, KNullDesC ); |
|
537 |
} |
|
538 |
||
539 |
if ( aMedia->IsSupported( KMPXMediaMusicArtist ) ) |
|
540 |
{ |
|
541 |
const TDesC& artist = |
|
542 |
aMedia->ValueText( KMPXMediaMusicArtist ); |
|
543 |
if ( artist != KNullDesC ) |
|
544 |
{ |
|
545 |
iContainer->UpdateLabelL( |
|
546 |
ETextArtist, |
|
547 |
artist ); |
|
548 |
} |
|
549 |
else |
|
550 |
{ |
|
551 |
// Display unknown artist as artist |
|
552 |
HBufC* unknownArtistText = |
|
553 |
StringLoader::LoadLC( R_MPX_PBV_UNKNOWN_ARTIST_LABEL ); |
|
554 |
iContainer->UpdateLabelL( |
|
555 |
ETextArtist, *unknownArtistText ); |
|
556 |
CleanupStack::PopAndDestroy( unknownArtistText ); |
|
557 |
} |
|
558 |
} |
|
559 |
else |
|
560 |
{ |
|
561 |
// Display unknown artist as artist |
|
562 |
HBufC* unknownArtistText = |
|
563 |
StringLoader::LoadLC( R_MPX_PBV_UNKNOWN_ARTIST_LABEL ); |
|
564 |
iContainer->UpdateLabelL( |
|
565 |
ETextArtist, *unknownArtistText ); |
|
566 |
CleanupStack::PopAndDestroy( unknownArtistText ); |
|
567 |
} |
|
568 |
||
569 |
#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
570 |
if ( iMedia->IsSupported( KMPXMediaGeneralMimeType ) ) |
|
571 |
{ |
|
572 |
// Get mime type |
|
573 |
const TDesC& mimeType = iMedia->ValueText( |
|
574 |
KMPXMediaGeneralMimeType ); |
|
575 |
const TBool realAudioMode = |
|
576 |
( mimeType.Compare( KMPXPnRealAudioMimeType ) == 0 ) || |
|
577 |
( mimeType.Compare( KMPXRealAudioMimeType ) == 0) || |
|
578 |
( mimeType.Compare( KMPXRnRealAudioMimeType ) == 0 ); |
|
579 |
||
580 |
// Set the real audio mode |
|
581 |
iContainer->SetRealAudioMode( realAudioMode ); |
|
582 |
} |
|
583 |
#endif |
|
584 |
} |
|
585 |
else |
|
586 |
{ |
|
587 |
// Display nothing if properties is NULL |
|
588 |
iContainer->UpdateLabelL( |
|
589 |
ETextTrack, KNullDesC ); |
|
590 |
iContainer->UpdateLabelL( |
|
591 |
ETextArtist, KNullDesC ); |
|
592 |
#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER |
|
593 |
// reset real audio mode |
|
594 |
iContainer->SetRealAudioMode( EFalse ); |
|
595 |
#endif |
|
596 |
} |
|
597 |
} |
|
598 |
} |
|
599 |
||
600 |
// --------------------------------------------------------------------------- |
|
601 |
// Update current playback state. |
|
602 |
// --------------------------------------------------------------------------- |
|
603 |
// |
|
604 |
EXPORT_C void CMPXCommonPlaybackViewImp::UpdatePlaybackStateL( |
|
605 |
TMPXPlaybackState aPlaybackState ) |
|
606 |
{ |
|
607 |
MPX_DEBUG2("CMPXCommonPlaybackViewImp::UpdatePlaybackState(%d): Entering", aPlaybackState); |
|
608 |
||
609 |
if ( iContainer && !iSwitchingView ) |
|
610 |
{ |
|
611 |
TMPXPbvPlaybackMode mode( EInvalidMode ); |
|
612 |
||
613 |
switch ( aPlaybackState ) |
|
614 |
{ |
|
615 |
case EPbStateNotInitialised: |
|
616 |
{ |
|
617 |
mode = iPlaybackUtility->Source() ? EUninitialized: ENoTracksMode; |
|
618 |
break; |
|
619 |
} |
|
620 |
case EPbStateInitialising: |
|
621 |
{ |
|
622 |
mode = EInitialising; |
|
623 |
break; |
|
624 |
} |
|
625 |
case EPbStatePlaying: |
|
626 |
{ |
|
627 |
mode = EPlayMode; |
|
628 |
iIgnoredByUsbEvent = EFalse; |
|
629 |
break; |
|
630 |
} |
|
631 |
case EPbStatePaused: |
|
632 |
{ |
|
633 |
mode = EPauseMode; |
|
634 |
break; |
|
635 |
} |
|
636 |
case EPbStateStopped: |
|
637 |
{ |
|
638 |
mode = EStopMode; |
|
639 |
break; |
|
640 |
} |
|
641 |
case EPbStateBuffering: |
|
642 |
{ |
|
643 |
mode = EBufferingMode; |
|
644 |
break; |
|
645 |
} |
|
646 |
default: |
|
647 |
{ |
|
648 |
// Pass |
|
649 |
break; |
|
650 |
} |
|
651 |
} |
|
652 |
||
653 |
if ( EInvalidMode != mode ) |
|
654 |
{ |
|
655 |
iPlaybackState = aPlaybackState; |
|
656 |
iContainer->SetMode( mode ); |
|
657 |
} |
|
658 |
||
659 |
iContainer->UpdateButtons( aPlaybackState ); |
|
660 |
} |
|
661 |
else |
|
662 |
{ |
|
663 |
// If no container, just need to update state |
|
664 |
switch ( aPlaybackState ) |
|
665 |
{ |
|
666 |
case EPbStateNotInitialised: |
|
667 |
case EPbStateInitialising: |
|
668 |
case EPbStatePlaying: |
|
669 |
case EPbStatePaused: |
|
670 |
case EPbStateStopped: |
|
671 |
{ |
|
672 |
iPlaybackState = aPlaybackState; |
|
673 |
break; |
|
674 |
} |
|
675 |
default: |
|
676 |
{ |
|
677 |
// Pass |
|
678 |
// Ignore other state changes such as skipping, etc. |
|
679 |
break; |
|
680 |
} |
|
681 |
} |
|
682 |
} |
|
683 |
MPX_DEBUG1("CMPXCommonPlaybackViewImp::UpdatePlaybackState(): Exiting"); |
|
684 |
} |
|
685 |
||
686 |
// --------------------------------------------------------------------------- |
|
687 |
// Updates track's playback position. |
|
688 |
// --------------------------------------------------------------------------- |
|
689 |
// |
|
690 |
EXPORT_C void CMPXCommonPlaybackViewImp::UpdateTrackPlaybackPositionL( |
|
691 |
TInt aPos, |
|
692 |
TInt aDuration ) |
|
693 |
{ |
|
694 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateTrackPlaybackPosition" ); |
|
695 |
||
696 |
if ( iContainer && !iSwitchingView ) |
|
697 |
{ |
|
698 |
if ( aPos > aDuration ) |
|
699 |
{ |
|
700 |
aPos = aDuration; |
|
701 |
} |
|
702 |
switch ( iPlaybackState ) |
|
703 |
{ |
|
704 |
case EPbStatePaused: |
|
705 |
case EPbStatePlaying: |
|
706 |
{ |
|
707 |
iContainer->UpdateTimeIndicatorsL( aPos, aDuration ); |
|
708 |
break; |
|
709 |
} |
|
710 |
case EPbStateStopped: |
|
711 |
case EPbStateInitialising: |
|
712 |
{ |
|
713 |
iContainer->UpdateTimeIndicatorsL( aPos, aDuration ); |
|
714 |
} // falls through |
|
715 |
case EPbStateNotInitialised: |
|
716 |
{ |
|
717 |
iContainer->UpdateDurationLabelL( aDuration ); |
|
718 |
break; |
|
719 |
} |
|
720 |
default: |
|
721 |
{ |
|
722 |
// Do nothing |
|
723 |
break; |
|
724 |
} |
|
725 |
} |
|
726 |
} |
|
727 |
} |
|
728 |
||
729 |
// --------------------------------------------------------------------------- |
|
730 |
// Updates track's album art. |
|
731 |
// --------------------------------------------------------------------------- |
|
732 |
// |
|
733 |
EXPORT_C void CMPXCommonPlaybackViewImp::UpdateAlbumArtL( |
|
734 |
const CMPXMedia* aMedia ) |
|
735 |
{ |
|
736 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateAlbumArt" ); |
|
737 |
||
738 |
if ( iContainer && !iSwitchingView ) |
|
739 |
{ |
|
740 |
TInt err( KErrNone ); |
|
741 |
if ( aMedia && aMedia->IsSupported(KMPXMediaGeneralUri)) |
|
742 |
{ |
|
743 |
const TDesC& album = aMedia->ValueText( KMPXMediaGeneralUri ); |
|
744 |
if(!iOldUri || iOldUri->Compare(album)!= 0) |
|
745 |
{ |
|
746 |
TRect albumArtRect( iLayout->IndicatorLayout( ClientRect(), EAlbumArtArea )); |
|
747 |
// Request for pre-generated TN size |
|
748 |
MPX_TRAP( err, |
|
749 |
iMPXUtility->ExtractAlbumArtL( |
|
750 |
*aMedia, |
|
751 |
*iContainer, |
|
752 |
albumArtRect.Size() ); ); |
|
753 |
||
754 |
// cancel timer |
|
755 |
if ( iTNRequestTimer->IsActive()) |
|
756 |
{ |
|
757 |
iTNRequestTimer->Cancel(); |
|
758 |
} |
|
759 |
||
760 |
if ( err == KErrNone ) |
|
761 |
{ |
|
762 |
// startup timer for updating album art with custom size |
|
763 |
TCallBack cb( HandleTNRequestForCustomSizeL, this ); |
|
764 |
iTNRequestTimer->Start( KMPXDelayForTNRequest, |
|
765 |
KMPXDelayForTNRequest, |
|
766 |
cb ); |
|
767 |
} |
|
768 |
} |
|
769 |
||
770 |
delete iOldUri; |
|
771 |
iOldUri = NULL; |
|
772 |
iOldUri = album.AllocL(); |
|
773 |
} |
|
774 |
||
775 |
if (KErrNone != err ) |
|
776 |
{ |
|
777 |
// If error, show default album art |
|
778 |
MPX_DEBUG2("CMPXCommonPlaybackViewImp::UpdateAlbumArt(): err = %d", err); |
|
779 |
iContainer->ExtractAlbumArtCompleted( NULL, KErrNone ); |
|
780 |
} |
|
781 |
} |
|
782 |
} |
|
783 |
||
784 |
// --------------------------------------------------------------------------- |
|
785 |
// Updates track position in playlist field. |
|
786 |
// --------------------------------------------------------------------------- |
|
787 |
// |
|
788 |
EXPORT_C void CMPXCommonPlaybackViewImp::UpdateTrackPosInPlaylistL() |
|
789 |
{ |
|
790 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateTrackPosInPlaylist" ); |
|
791 |
||
792 |
if ( iContainer && !iSwitchingView ) |
|
793 |
{ |
|
794 |
TBool emptyCount( EFalse ); |
|
795 |
TInt count( 0 ); |
|
796 |
TInt index( 0 ); |
|
797 |
||
798 |
MMPXSource* s = iPlaybackUtility->Source(); |
|
799 |
if ( s ) |
|
800 |
{ |
|
801 |
CMPXCollectionPlaylist* playlist = s->PlaylistL(); |
|
802 |
if ( playlist ) |
|
803 |
{ |
|
804 |
count = playlist->Count(); |
|
805 |
index = playlist->PathIndex( playlist->Index() ); |
|
806 |
delete playlist; |
|
807 |
playlist = NULL; |
|
808 |
} |
|
809 |
} |
|
810 |
MPX_DEBUG3("CMPXCommonPlaybackViewImp::UpdateTrackPosInPlaylistL: index = %d, count = %d", index, count ); |
|
811 |
||
812 |
// not display for progressive mode & embedded track mode |
|
813 |
TMPXLaunchMode mode = MPXTlsHelper::LaunchMode(); |
|
814 |
||
815 |
if ( count ) |
|
816 |
{ |
|
817 |
if ( EMPXLaunchModeTrack != mode ) |
|
818 |
{ |
|
819 |
// Current index (1-based) if playlist is non-empty |
|
820 |
// Magic: array granularity |
|
821 |
CArrayFixFlat<TInt>* params = |
|
822 |
new ( ELeave ) CArrayFixFlat<TInt>( 2 ); |
|
823 |
CleanupStack::PushL( params ); |
|
824 |
params->AppendL( index + 1 ); |
|
825 |
params->AppendL( count ); |
|
826 |
HBufC* plcounter = StringLoader::LoadLC( |
|
827 |
R_MPX_PBV_PLAYLIST_ITEM_COUNTER_LABEL, *params ); |
|
828 |
iContainer->UpdateLabelL( |
|
829 |
ETextPlaylistCount, |
|
830 |
*plcounter ); |
|
831 |
CleanupStack::PopAndDestroy( plcounter ); |
|
832 |
CleanupStack::PopAndDestroy( params ); |
|
833 |
//iContainer->UpdateLabelL( ETextEmpty, KNullDesC ); |
|
834 |
} |
|
835 |
else |
|
836 |
{ |
|
837 |
emptyCount = ETrue; |
|
838 |
} |
|
839 |
} |
|
840 |
else |
|
841 |
{ |
|
842 |
emptyCount = ETrue; |
|
843 |
||
844 |
// Display empty state text |
|
845 |
//HBufC* noTracksText = |
|
846 |
// StringLoader::LoadLC( R_MPX_PBV_NO_TRACKS_LABEL ); |
|
847 |
//iContainer->UpdateLabelL( |
|
848 |
// ETextEmpty, *noTracksText ); |
|
849 |
//CleanupStack::PopAndDestroy( noTracksText ); |
|
850 |
} |
|
851 |
||
852 |
if ( emptyCount ) |
|
853 |
{ |
|
854 |
// Empty string if playlist is empty |
|
855 |
iContainer->UpdateLabelL( |
|
856 |
ETextPlaylistCount, |
|
857 |
KNullDesC ); |
|
858 |
} |
|
859 |
} |
|
860 |
} |
|
861 |
||
862 |
// --------------------------------------------------------------------------- |
|
863 |
// Updates download state label. |
|
864 |
// --------------------------------------------------------------------------- |
|
865 |
// |
|
866 |
EXPORT_C void CMPXCommonPlaybackViewImp::UpdateDownloadStateLabelL() |
|
867 |
{ |
|
868 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateDownloadStateLabelL" ); |
|
869 |
// Do not show opening popup |
|
870 |
} |
|
871 |
||
872 |
// --------------------------------------------------------------------------- |
|
873 |
// Updates Title Pane. |
|
874 |
// --------------------------------------------------------------------------- |
|
875 |
// |
|
876 |
EXPORT_C void CMPXCommonPlaybackViewImp::UpdateTitlePaneL() |
|
877 |
{ |
|
878 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateTitlePaneL" ); |
|
879 |
||
880 |
CAknTitlePane* title( static_cast<CAknTitlePane*> |
|
881 |
( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle )))); |
|
882 |
if ( title ) |
|
883 |
{ |
|
884 |
HBufC* titleText( StringLoader::LoadLC( |
|
885 |
R_MPX_PLAYBACKVIEW_TITLE )); |
|
886 |
title->SetTextL( *titleText ); |
|
887 |
CleanupStack::PopAndDestroy( titleText ); |
|
888 |
} |
|
889 |
} |
|
890 |
||
891 |
// --------------------------------------------------------------------------- |
|
892 |
// Updates FM Transmitter Info |
|
893 |
// --------------------------------------------------------------------------- |
|
894 |
// |
|
895 |
EXPORT_C void CMPXCommonPlaybackViewImp::UpdateFMTransmitterInfoL( |
|
896 |
TBool aForceUpdate ) |
|
897 |
{ |
|
898 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateFMTransmitterInfoL" ); |
|
899 |
||
900 |
if ( iContainer && !iSwitchingView ) |
|
901 |
{ |
|
902 |
if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) ) |
|
903 |
{ |
|
904 |
// if FM Transmitter is supported feature, retrieve the state of |
|
905 |
// the FM Transmitter |
|
906 |
TInt value(EFmTxStateUnknown); |
|
907 |
TInt freqKHz = 0; |
|
908 |
||
909 |
if ( iPSKeyWatcher->GetValue( value ) == KErrNone ) |
|
910 |
{ |
|
911 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::UpdateFMTransmitterInfoL iPSKeyWatcher value %d", value); |
|
912 |
// EFmTxStatePowerSaveAccessory & EFmTxStatePowerSaveInactivity |
|
913 |
// are considered as off |
|
914 |
if ( value == EFmTxStateActive || |
|
915 |
value == EFmTxStateInactive ) |
|
916 |
{ |
|
917 |
// if FM Transmitter is turned on, retrieve the frequency |
|
918 |
MPX_TRAPD( err, freqKHz = iCRWatcher->CurrentValueL() ); |
|
919 |
if ( err != KErrNone ) |
|
920 |
{ |
|
921 |
freqKHz = 0; |
|
922 |
} |
|
923 |
} |
|
924 |
} |
|
925 |
iFmTxActivity = value; |
|
926 |
||
927 |
MPX_DEBUG4( "CMPXCommonPlaybackViewImp::UpdateFMTransmitterInfoL iFMTxFreqKHz %d freqKHz %d aForceUpdate %d", iFMTxFreqKHz, freqKHz, aForceUpdate); |
|
928 |
if ( iFMTxFreqKHz != freqKHz || aForceUpdate ) |
|
929 |
{ |
|
930 |
// if the FM Transmitter state has been changed from one active |
|
931 |
// to another and it's frequency value changed, or if FM |
|
932 |
// Transmitter is changed from an active to an inactive state, |
|
933 |
// or vice versa, update the frequency display and save the new |
|
934 |
// value |
|
935 |
iFMTxFreqKHz = freqKHz; |
|
936 |
||
937 |
// Create display string and default it to an empty string |
|
938 |
RBuf freqTxt; |
|
939 |
freqTxt.Assign( NULL ); |
|
940 |
||
941 |
CleanupClosePushL( freqTxt ); |
|
942 |
||
943 |
// display the frequncy if it's a valid value |
|
944 |
if ( iFMTxFreqKHz > 0 ) |
|
945 |
{ |
|
946 |
TReal freqMHz = static_cast<TReal> (iFMTxFreqKHz) / |
|
947 |
static_cast<TReal> (KMPXOneMhzInOneKhz); |
|
948 |
||
949 |
TRealFormat realFormat( |
|
950 |
KMPXFMFreqWidth, |
|
951 |
KMPXFMFreqDecimalPlace); |
|
952 |
||
953 |
// display frequecy as : XXX.XX Mhz |
|
954 |
TBuf<KMPXFMFreqWidth + 1> freqMHzStr; |
|
955 |
TInt err = freqMHzStr.Num( freqMHz, realFormat ); |
|
956 |
if ( err > 0 ) |
|
957 |
{ |
|
958 |
AknTextUtils::LanguageSpecificNumberConversion( freqMHzStr ); |
|
959 |
HBufC* labelFormatText = StringLoader::LoadL( |
|
960 |
R_MPX_FM_FREQUENCY_LABEL, |
|
961 |
freqMHzStr ); |
|
962 |
||
963 |
// ownership transferred |
|
964 |
freqTxt.Assign(labelFormatText); |
|
965 |
} |
|
966 |
} |
|
967 |
||
968 |
iContainer->UpdateLabelL( |
|
969 |
ETextFMFrequency, freqTxt ); |
|
970 |
||
971 |
CleanupStack::PopAndDestroy( &freqTxt ); |
|
972 |
} |
|
973 |
} |
|
974 |
} |
|
975 |
} |
|
976 |
||
977 |
// --------------------------------------------------------------------------- |
|
978 |
// Handle playback message. |
|
979 |
// --------------------------------------------------------------------------- |
|
980 |
// |
|
981 |
EXPORT_C void CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL( |
|
982 |
const CMPXMessage& aMessage ) |
|
983 |
{ |
|
984 |
MPX_FUNC_EX("CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL"); |
|
985 |
||
986 |
TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) ); |
|
987 |
if ( KMPXMessagePbMediaChanged == id ) |
|
988 |
{ |
|
989 |
MPX_DEBUG1("CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL: PbMediaChanged"); |
|
990 |
if ( aMessage.IsSupported( KMPXMessagePbMedia ) ) |
|
991 |
{ |
|
992 |
CMPXMedia* media( aMessage.Value<CMPXMedia>( KMPXMessagePbMedia ) ); |
|
993 |
User::LeaveIfNull( media ); |
|
994 |
DoHandleMediaL( *media, KErrNone ); |
|
995 |
} |
|
996 |
} |
|
997 |
else if ( KMPXMessageGeneral == id ) |
|
998 |
{ |
|
999 |
TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) ); |
|
1000 |
TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) ); |
|
1001 |
switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) ) |
|
1002 |
{ |
|
1003 |
case TMPXPlaybackMessage::EPropertyChanged: |
|
1004 |
{ |
|
1005 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL - EPropertyChanged(%d)", type ); |
|
1006 |
TMPXPlaybackProperty property( |
|
1007 |
static_cast<TMPXPlaybackProperty>( type ) ); |
|
1008 |
TInt error( KErrNone ); |
|
1009 |
||
1010 |
DoHandlePropertyL( property, data, error ); |
|
1011 |
break; |
|
1012 |
} |
|
1013 |
case TMPXPlaybackMessage::EStateChanged: |
|
1014 |
{ |
|
1015 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL - EStateChanged(%d)", type ); |
|
1016 |
||
1017 |
TMPXPlaybackState state = |
|
1018 |
static_cast<TMPXPlaybackState>( type ); |
|
1019 |
if ( ( data == KErrNotSupported ) && |
|
1020 |
( state == EPbStatePaused ) ) |
|
1021 |
{ |
|
1022 |
if ( iLastPBViewActivated ) |
|
1023 |
{ |
|
1024 |
// In UPnP case, this will display an error message |
|
1025 |
iCommandSender = ECsMediaKey; |
|
1026 |
IsCommandSupportedL(); |
|
1027 |
} |
|
1028 |
} |
|
1029 |
else if ( (( data == KErrAccessDenied ) || ( data == KErrDied ) || ( data == KErrInUse )) && |
|
1030 |
( state == EPbStatePaused )) |
|
1031 |
{ |
|
1032 |
if ( iLastPBViewActivated && |
|
1033 |
MPXUser::IsCallOngoing( EPSCTsyCallTypeH324Multimedia )) |
|
1034 |
{ |
|
1035 |
iCommonUiHelper->HandleErrorL( KMPXErrorVideoCall ); |
|
1036 |
} |
|
1037 |
} |
|
1038 |
else |
|
1039 |
{ |
|
1040 |
DoHandleStateChangedL( state, data ); |
|
1041 |
} |
|
1042 |
break; |
|
1043 |
} |
|
1044 |
case TMPXPlaybackMessage::EMediaChanged: |
|
1045 |
{ |
|
1046 |
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL - EMediaChanged()"); |
|
1047 |
RequestMediaL(); |
|
1048 |
if ( iIdle ) |
|
1049 |
{ |
|
1050 |
if ( iIdle->IsActive() ) |
|
1051 |
{ |
|
1052 |
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL() iIdle active, canceling" ); |
|
1053 |
iIdle->Cancel(); |
|
1054 |
} |
|
1055 |
delete iIdle; |
|
1056 |
iIdle = NULL; |
|
1057 |
} |
|
1058 |
break; |
|
1059 |
} |
|
1060 |
case TMPXPlaybackMessage::ECommandReceived: |
|
1061 |
{ |
|
1062 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL - ECommandReceived(%d)", type ); |
|
1063 |
break; |
|
1064 |
} |
|
1065 |
case TMPXPlaybackMessage::ESkipping: |
|
1066 |
{ |
|
1067 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL - ESkipping(%d)", data ); |
|
1068 |
if ( iContainer ) |
|
1069 |
{ |
|
1070 |
iContainer->SetMode( EMediaKeySkipping ); |
|
1071 |
} |
|
1072 |
TInt offset( data ); |
|
1073 |
if ( offset < 0 ) |
|
1074 |
{ |
|
1075 |
iLastSkipDirection = -1; |
|
1076 |
} |
|
1077 |
else |
|
1078 |
{ |
|
1079 |
iLastSkipDirection = 1; |
|
1080 |
} |
|
1081 |
iSkipping = ETrue; |
|
1082 |
break; |
|
1083 |
} |
|
1084 |
case TMPXPlaybackMessage::ESkipEnd: |
|
1085 |
{ |
|
1086 |
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL - ESkipEnd()"); |
|
1087 |
iSkipping = EFalse; |
|
1088 |
break; |
|
1089 |
} |
|
1090 |
case TMPXPlaybackMessage::EPlaylistUpdated: |
|
1091 |
{ |
|
1092 |
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL - EPlaylistUpdated()"); |
|
1093 |
// Do not retrive media again if in the middle of handling an error |
|
1094 |
if ( KErrNone == iDelayedError ) |
|
1095 |
{ |
|
1096 |
TBool noTracks( ETrue ); |
|
1097 |
MMPXSource* source = iPlaybackUtility->Source(); |
|
1098 |
if ( source ) |
|
1099 |
{ |
|
1100 |
CMPXCollectionPlaylist* pl( source->PlaylistL() ); |
|
1101 |
if ( pl ) |
|
1102 |
{ |
|
1103 |
CleanupStack::PushL( pl ); |
|
1104 |
if ( pl->Count() > 0 ) |
|
1105 |
{ |
|
1106 |
// Only update media if in foreground |
|
1107 |
if ( iContainer ) |
|
1108 |
{ |
|
1109 |
RequestMediaL(); |
|
1110 |
} |
|
1111 |
else |
|
1112 |
{ |
|
1113 |
// If in background, wait for view to be activated |
|
1114 |
// before requesting media again |
|
1115 |
delete iMedia; |
|
1116 |
iMedia = NULL; |
|
1117 |
} |
|
1118 |
noTracks = EFalse; |
|
1119 |
} |
|
1120 |
CleanupStack::PopAndDestroy( pl ); |
|
1121 |
} |
|
1122 |
} |
|
1123 |
if ( noTracks ) |
|
1124 |
{ |
|
1125 |
delete iMedia; |
|
1126 |
iMedia = NULL; |
|
1127 |
iPlaybackState = EPbStateNotInitialised; |
|
1128 |
UpdateViewL(); |
|
1129 |
} |
|
1130 |
} |
|
1131 |
break; |
|
1132 |
} |
|
1133 |
case TMPXPlaybackMessage::EInitializeComplete: |
|
1134 |
{ |
|
1135 |
// Reset flag, done opening new item. |
|
1136 |
MPX_DEBUG1("CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL()"); |
|
1137 |
MPX_DEBUG1(" > EInitializeComplete Reset New Item Opened Flag"); |
|
1138 |
iNewItemOpened = EFalse; |
|
1139 |
break; |
|
1140 |
} |
|
1141 |
default: |
|
1142 |
{ |
|
1143 |
MPX_DEBUG4("CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL(): Ignore message %d %d %d", |
|
1144 |
aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ), type, data); |
|
1145 |
break; |
|
1146 |
} |
|
1147 |
} |
|
1148 |
} |
|
1149 |
} |
|
1150 |
||
1151 |
// --------------------------------------------------------------------------- |
|
1152 |
// Handle playback property. |
|
1153 |
// --------------------------------------------------------------------------- |
|
1154 |
// |
|
1155 |
EXPORT_C void CMPXCommonPlaybackViewImp::DoHandlePropertyL( |
|
1156 |
TMPXPlaybackProperty aProperty, |
|
1157 |
TInt aValue, |
|
1158 |
TInt aError ) |
|
1159 |
{ |
|
1160 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::DoHandlePropertyL" ); |
|
1161 |
MPX_DEBUG4( "HandlePropertyL - Property(%d); Value(%d); Error(%d)", aProperty, aValue, aError ); |
|
1162 |
||
1163 |
if ( KErrNone == aError ) |
|
1164 |
{ |
|
1165 |
switch ( aProperty ) |
|
1166 |
{ |
|
1167 |
case EPbPropertyPosition: |
|
1168 |
{ |
|
1169 |
iPosition = aValue / KMPXOneSecInMilliSecs; |
|
1170 |
if( !iIsTapped ) |
|
1171 |
{ |
|
1172 |
UpdateTrackPlaybackPositionL( iPosition, iDuration ); |
|
1173 |
break; |
|
1174 |
} |
|
1175 |
else |
|
1176 |
{ |
|
1177 |
iIsTapped = EFalse; |
|
1178 |
// retrieve iCurrentPlayerType info |
|
1179 |
GetCurrentPlayerDetails(); |
|
1180 |
if ( iCurrentPlayerType == EPbRemote ) |
|
1181 |
{ |
|
1182 |
UpdateTrackPlaybackPositionL( iOldPosition, iDuration ); |
|
1183 |
break; |
|
1184 |
} |
|
1185 |
else |
|
1186 |
{ |
|
1187 |
UpdateTrackPlaybackPositionL( iPosition, iDuration ); |
|
1188 |
break; |
|
1189 |
} |
|
1190 |
} |
|
1191 |
} |
|
1192 |
case EPbPropertyDuration: |
|
1193 |
{ |
|
1194 |
iDuration = aValue / KMPXOneSecInMilliSecs; |
|
1195 |
break; |
|
1196 |
} |
|
1197 |
case EPbPropertyRandomMode: |
|
1198 |
{ |
|
1199 |
iRandomMode = aValue; |
|
1200 |
if ( iContainer ) |
|
1201 |
{ |
|
1202 |
iContainer->SetRandomMode( aValue ); |
|
1203 |
} |
|
1204 |
break; |
|
1205 |
} |
|
1206 |
case EPbPropertyRepeatMode: |
|
1207 |
{ |
|
1208 |
iRepeatMode = aValue; |
|
1209 |
if ( iContainer ) |
|
1210 |
{ |
|
1211 |
iContainer->SetRepeatMode( |
|
1212 |
EPbRepeatAll == aValue, EPbRepeatOne == aValue ); |
|
1213 |
} |
|
1214 |
break; |
|
1215 |
} |
|
1216 |
default: |
|
1217 |
{ |
|
1218 |
break; |
|
1219 |
} |
|
1220 |
} |
|
1221 |
} |
|
1222 |
else |
|
1223 |
{ |
|
1224 |
HandleErrorL( aError ); |
|
1225 |
} |
|
1226 |
} |
|
1227 |
||
1228 |
// --------------------------------------------------------------------------- |
|
1229 |
// Handle media properties. |
|
1230 |
// Notes: The client is responsible for delete the object of aProperties. |
|
1231 |
// --------------------------------------------------------------------------- |
|
1232 |
// |
|
1233 |
EXPORT_C void CMPXCommonPlaybackViewImp::DoHandleMediaL( |
|
1234 |
const CMPXMedia& aMedia, |
|
1235 |
TInt aError ) |
|
1236 |
{ |
|
1237 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::DoHandleMediaL" ); |
|
1238 |
MPX_DEBUG2("CMPXCommonPlaybackViewImp::DoHandleMediaL(): aError = %d", aError); |
|
1239 |
||
1240 |
delete iMedia; |
|
1241 |
iMedia = NULL; |
|
1242 |
if ( KErrNone == aError ) |
|
1243 |
{ |
|
1244 |
iMedia = CMPXMedia::NewL( aMedia ); |
|
1245 |
||
1246 |
UpdateTrackPosInPlaylistL(); |
|
1247 |
UpdateTrackInfoL( iMedia ); |
|
1248 |
UpdateAlbumArtL( iMedia ); |
|
1249 |
||
1250 |
||
1251 |
// Update duration if previously not available |
|
1252 |
if ( iMedia->IsSupported( KMPXMediaGeneralDuration ) ) |
|
1253 |
{ |
|
1254 |
iDuration = iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration ) / |
|
1255 |
KMPXOneSecInMilliSecs; |
|
1256 |
UpdateTrackPlaybackPositionL( iPosition, iDuration ); |
|
1257 |
} |
|
1258 |
||
1259 |
// If there's a delayed error, handle it now |
|
1260 |
// that the media object has arrived |
|
1261 |
if ( iDelayedError != KErrNone ) |
|
1262 |
{ |
|
1263 |
// if repeat mode is off, delay to handle this error. |
|
1264 |
if ( EPbRepeatOff == iRepeatMode ) |
|
1265 |
{ |
|
1266 |
// save current index |
|
1267 |
iErrIndex = KErrNotFound; |
|
1268 |
if (iPlaybackUtility) |
|
1269 |
{ |
|
1270 |
MMPXSource* source( iPlaybackUtility->Source() ); |
|
1271 |
if ( source ) |
|
1272 |
{ |
|
1273 |
CMPXCollectionPlaylist* pl( source->PlaylistL() ); |
|
1274 |
if ( pl ) |
|
1275 |
{ |
|
1276 |
CleanupStack::PushL( pl ); |
|
1277 |
iErrIndex = pl->Index(); |
|
1278 |
CleanupStack::PopAndDestroy( pl ); |
|
1279 |
} |
|
1280 |
} |
|
1281 |
} |
|
1282 |
// startup timer for handling delayed error |
|
1283 |
TCallBack cb( HandleDelayedError, this ); |
|
1284 |
if (iDelayedErrorTimer->IsActive()) |
|
1285 |
{ |
|
1286 |
iDelayedErrorTimer->Cancel(); |
|
1287 |
} |
|
1288 |
iDelayedErrorTimer->Start( KMPXPostponeForHandleDelayedError, |
|
1289 |
KMPXPostponeForHandleDelayedError, |
|
1290 |
cb ); |
|
1291 |
// reset iDelayedError |
|
1292 |
iLastDelayedErr = iDelayedError; |
|
1293 |
iDelayedError = KErrNone; |
|
1294 |
} |
|
1295 |
else |
|
1296 |
{ |
|
1297 |
// if repeat mode isn't off, handle it at once. |
|
1298 |
if (iDelayedErrorTimer->IsActive()) |
|
1299 |
{ |
|
1300 |
iDelayedErrorTimer->Cancel(); |
|
1301 |
} |
|
1302 |
||
1303 |
// Copy error code and reset iDelayedError, this is becuase |
|
1304 |
// a media event may be called while handling this error |
|
1305 |
TInt err( iDelayedError ); |
|
1306 |
iDelayedError = KErrNone; |
|
1307 |
HandleErrorL( err ); |
|
1308 |
} |
|
1309 |
} |
|
1310 |
} |
|
1311 |
else |
|
1312 |
{ |
|
1313 |
||
1314 |
#ifndef CAMESE_IN_DRM_UTILITY |
|
1315 |
// Check if Camese Support is enabled and |
|
1316 |
// if the error is caused by PV being unable |
|
1317 |
// to retrieve media properties before handling |
|
1318 |
// the error here. |
|
1319 |
if (iCameseSuperDistSupport && aError == KErrPermissionDenied) |
|
1320 |
{ |
|
1321 |
// Clear delayed errors. |
|
1322 |
iDelayedError = KErrNone; |
|
1323 |
return; |
|
1324 |
} |
|
1325 |
#endif |
|
1326 |
HandleErrorL(aError); |
|
1327 |
||
1328 |
if ( aError == iDelayedError ) |
|
1329 |
{ |
|
1330 |
iDelayedError = KErrNone; |
|
1331 |
} |
|
1332 |
} |
|
1333 |
} |
|
1334 |
||
1335 |
// --------------------------------------------------------------------------- |
|
1336 |
// Handle playback state changed. |
|
1337 |
// --------------------------------------------------------------------------- |
|
1338 |
// |
|
1339 |
EXPORT_C void CMPXCommonPlaybackViewImp::DoHandleStateChangedL( |
|
1340 |
TMPXPlaybackState aState, |
|
1341 |
TInt aData ) |
|
1342 |
{ |
|
1343 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::DoHandleStateChangedL" ); |
|
1344 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DoHandleStateChangedL %d", aState ); |
|
1345 |
UpdatePlaybackStateL( aState ); |
|
1346 |
||
1347 |
switch ( aState ) |
|
1348 |
{ |
|
1349 |
case EPbStateStopped: |
|
1350 |
case EPbStateNotInitialised: |
|
1351 |
{ |
|
1352 |
iPosition = 0; |
|
1353 |
UpdateTrackPlaybackPositionL( iPosition, iDuration ); |
|
1354 |
break; |
|
1355 |
} |
|
1356 |
case EPbStateInitialising: |
|
1357 |
{ |
|
1358 |
// Save the start playback index |
|
1359 |
if ( KErrNotFound == iStartPlaybackIndex && |
|
1360 |
KErrNotFound != aData ) |
|
1361 |
{ |
|
1362 |
iStartPlaybackIndex = aData; |
|
1363 |
} |
|
1364 |
UpdateDownloadStateLabelL(); |
|
1365 |
iDelayedErrorTimer->Cancel(); |
|
1366 |
break; |
|
1367 |
} |
|
1368 |
case EPbStatePlaying: |
|
1369 |
case EPbStatePaused: |
|
1370 |
default: |
|
1371 |
{ |
|
1372 |
MPX_PERF_CHECKPT("Playback state changes to Play/Pause"); |
|
1373 |
iStartPlaybackIndex = KErrNotFound; |
|
1374 |
iLastSkipDirection = 1; |
|
1375 |
break; |
|
1376 |
} |
|
1377 |
} |
|
1378 |
} |
|
1379 |
||
1380 |
// --------------------------------------------------------------------------- |
|
1381 |
// Get simple embedded mode. |
|
1382 |
// --------------------------------------------------------------------------- |
|
1383 |
// |
|
1384 |
EXPORT_C TBool CMPXCommonPlaybackViewImp::SimpleEmbeddedMode() const |
|
1385 |
{ |
|
1386 |
return iEmbedded; |
|
1387 |
} |
|
1388 |
||
1389 |
// --------------------------------------------------------------------------- |
|
1390 |
// Get embedded status. |
|
1391 |
// --------------------------------------------------------------------------- |
|
1392 |
// |
|
1393 |
EXPORT_C TBool CMPXCommonPlaybackViewImp::IsEmbedded() const |
|
1394 |
{ |
|
1395 |
return iEmbedded; |
|
1396 |
} |
|
1397 |
||
1398 |
// --------------------------------------------------------------------------- |
|
1399 |
// Displays error notes. |
|
1400 |
// --------------------------------------------------------------------------- |
|
1401 |
// |
|
1402 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleErrorL( TInt aError ) |
|
1403 |
{ |
|
1404 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleErrorL(%d): Entering", aError ); |
|
1405 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleErrorL iIgnoredByUsbEvent(%d):", iIgnoredByUsbEvent ); |
|
1406 |
if ( aError ) |
|
1407 |
{ |
|
1408 |
TInt currentIndex( KErrNotFound ); |
|
1409 |
TInt nextIndex( KErrNotFound ); |
|
1410 |
TInt plCount( KErrNotFound ); |
|
1411 |
MMPXSource* source( iPlaybackUtility->Source() ); |
|
1412 |
if ( source ) |
|
1413 |
{ |
|
1414 |
CMPXCollectionPlaylist* pl( source->PlaylistL() ); |
|
1415 |
if ( pl ) |
|
1416 |
{ |
|
1417 |
CleanupStack::PushL( pl ); |
|
1418 |
currentIndex = pl->Index(); |
|
1419 |
if ( iLastSkipDirection < 0 ) |
|
1420 |
{ |
|
1421 |
pl->Previous( ETrue ); |
|
1422 |
} |
|
1423 |
else |
|
1424 |
{ |
|
1425 |
pl->Next( ETrue ); |
|
1426 |
} |
|
1427 |
nextIndex = pl->Index(); |
|
1428 |
plCount = pl->Count(); |
|
1429 |
CleanupStack::PopAndDestroy( pl ); |
|
1430 |
} |
|
1431 |
} |
|
1432 |
||
1433 |
// MMF framework will return KErrArgument/KErrCompletion if it reaches |
|
1434 |
// the end of a partially downloaded file. The downloaded portion of |
|
1435 |
// the file should still be playable in this case. |
|
1436 |
if ( KErrNotFound != nextIndex && !iIgnoredByUsbEvent && |
|
1437 |
KErrDisMounted != aError && |
|
1438 |
( ( KErrArgument != aError && KErrCompletion != aError ) || |
|
1439 |
iPlaybackState != EPbStatePlaying )) |
|
1440 |
{ |
|
1441 |
// Check if all tracks are invalid, or if there's only |
|
1442 |
// 1 track in the playlist |
|
1443 |
if ( nextIndex == iStartPlaybackIndex || |
|
1444 |
plCount == 1 || |
|
1445 |
EPbRepeatOne == iRepeatMode) |
|
1446 |
{ |
|
1447 |
aError = KMPXAllTracksInvalid; |
|
1448 |
} |
|
1449 |
} |
|
1450 |
||
1451 |
// Igore these messages when USB event just happened |
|
1452 |
if (iIgnoredByUsbEvent && |
|
1453 |
(aError == KErrCANoRights || |
|
1454 |
aError == KErrPathNotFound || |
|
1455 |
aError == KErrDisMounted ) |
|
1456 |
) |
|
1457 |
{ |
|
1458 |
iIgnoredByUsbEvent = EFalse; |
|
1459 |
return; |
|
1460 |
} |
|
1461 |
||
1462 |
// else iIgnoredByUsbEvent==EFalse, then furtherly check USB status in central repository. |
|
1463 |
else if ( !iIgnoredByUsbEvent ) |
|
1464 |
{ |
|
1465 |
TInt usbStatus; |
|
1466 |
RProperty::Get( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, usbStatus ); |
|
1467 |
||
1468 |
if ( KUsbPersonalityIdMS == usbStatus && KErrDisMounted == aError ) |
|
1469 |
{ |
|
1470 |
// Igore this error when USB is avtive in MassStrorage mode. |
|
1471 |
return; |
|
1472 |
} |
|
1473 |
} |
|
1474 |
||
1475 |
switch ( aError ) |
|
1476 |
{ |
|
1477 |
case KMPXRightsAboutToExpire: |
|
1478 |
case KErrCANotSupported: |
|
1479 |
case KErrCANoPermission: |
|
1480 |
case KErrCANoRights: |
|
1481 |
case KErrCANoAgent: |
|
1482 |
case KErrCAOutOfRange: |
|
1483 |
case KErrCAPendingRights: |
|
1484 |
case KErrCASizeNotDetermined: |
|
1485 |
case KErrCANewFileHandleRequired: |
|
1486 |
case KErrPermissionDenied: |
|
1487 |
{ |
|
1488 |
if (aError == KErrCANoPermission || |
|
1489 |
aError == KErrCANoRights) |
|
1490 |
{ |
|
1491 |
iCommonUiHelper->HandleErrorL( KMPXErrorExpiredRights, iMedia ); |
|
1492 |
} |
|
1493 |
TBool skip(ETrue); |
|
1494 |
||
1495 |
if ( iMedia ) |
|
1496 |
{ |
|
1497 |
if ( iMedia->IsSupported( KMPXMediaDrmType ) ) |
|
1498 |
{ |
|
1499 |
TMPXMediaDrmType type( |
|
1500 |
iMedia->ValueTObjectL<TMPXMediaDrmType>( |
|
1501 |
KMPXMediaDrmType ) ); |
|
1502 |
||
1503 |
// Only display DRM error message for WMDRM |
|
1504 |
// if it's the first song selected |
|
1505 |
if ( EMPXDrmTypeWMA == type && |
|
1506 |
currentIndex == iStartPlaybackIndex) |
|
1507 |
{ |
|
1508 |
#ifndef CAMESE_IN_DRM_UTILITY |
|
1509 |
MPX_DEBUG2("CMPXCommonPlaybackViewImp::HandleErrorL iCameseSuperDistSupport %d", iCameseSuperDistSupport); |
|
1510 |
// Only handle the error if Camese is disabled. |
|
1511 |
if (!iCameseSuperDistSupport) |
|
1512 |
{ |
|
1513 |
MPX_DEBUG2("CMPXCommonPlaybackViewImp::HandleErrorL iNewItemOpened %d", iNewItemOpened); |
|
1514 |
if (iNewItemOpened) |
|
1515 |
{ |
|
1516 |
iPlaybackUtility->CommandL( EPbCmdStop ); |
|
1517 |
iCommonUiHelper->HandleErrorL( aError, iMedia ); |
|
1518 |
// If Camese is off and we |
|
1519 |
// received the collection message |
|
1520 |
// indicating we are opening a new item, |
|
1521 |
// disable skipping on this error. |
|
1522 |
// We just stop playback. |
|
1523 |
skip = EFalse; |
|
1524 |
||
1525 |
// Reset the Start Playback Index. |
|
1526 |
iStartPlaybackIndex = KErrNotFound; |
|
1527 |
} |
|
1528 |
} |
|
1529 |
else if (iNewItemOpened) |
|
1530 |
#else |
|
1531 |
if (iNewItemOpened) |
|
1532 |
#endif |
|
1533 |
{ |
|
1534 |
MPX_DEBUG1("CMPXPlaybackViewImp::HandleErrorL Skip Disabled - New Item"); |
|
1535 |
||
1536 |
// If Camese is on and we |
|
1537 |
// received the collection message |
|
1538 |
// indicating we are opening a new item, |
|
1539 |
// disable skipping on this error. Camese will handle |
|
1540 |
// postdelivery in this case. |
|
1541 |
skip = EFalse; |
|
1542 |
||
1543 |
// Reset the Start Playback Index. |
|
1544 |
iStartPlaybackIndex = KErrNotFound; |
|
1545 |
} |
|
1546 |
} |
|
1547 |
} |
|
1548 |
} |
|
1549 |
||
1550 |
if (skip) |
|
1551 |
{ |
|
1552 |
SkipOnErrorL( currentIndex, plCount ); |
|
1553 |
} |
|
1554 |
break; |
|
1555 |
} |
|
1556 |
case KErrAccessDenied: |
|
1557 |
{ |
|
1558 |
// Only display error message if first one selected to play |
|
1559 |
if ( currentIndex == iStartPlaybackIndex ) |
|
1560 |
{ |
|
1561 |
iCommonUiHelper->HandleErrorL( aError, iMedia ); |
|
1562 |
} |
|
1563 |
SkipOnErrorL( currentIndex, plCount ); |
|
1564 |
break; |
|
1565 |
} |
|
1566 |
case KErrNotSupported: |
|
1567 |
case KErrCorrupt: |
|
1568 |
case KErrNotFound: |
|
1569 |
case KErrPathNotFound: |
|
1570 |
case KErrDivideByZero: |
|
1571 |
case KErrGeneral: |
|
1572 |
{ |
|
1573 |
// USB dismounts the disk, it cannot find any records |
|
1574 |
if( !iDatabaseNotReady ) |
|
1575 |
{ |
|
1576 |
SkipOnErrorL( currentIndex, plCount ); |
|
1577 |
} |
|
1578 |
break; |
|
1579 |
} |
|
1580 |
case KMPXAllTracksInvalid: |
|
1581 |
{ |
|
1582 |
HandleAllTracksInvalidL(); |
|
1583 |
break; |
|
1584 |
} |
|
1585 |
case KErrArgument: |
|
1586 |
case KErrCompletion: |
|
1587 |
{ |
|
1588 |
TBool skip( ETrue ); |
|
1589 |
||
1590 |
// UI specs say theres two cases where it stops and |
|
1591 |
// does not skip to the next song. |
|
1592 |
// First case is if not repeat all and playback has |
|
1593 |
// reached the end of the list and gone to the first song. |
|
1594 |
// Second case is if not repeat all and the user is skipping |
|
1595 |
// backwards and reached the first song |
|
1596 |
if ( EPbRepeatAll != iRepeatMode && |
|
1597 |
0 == currentIndex && |
|
1598 |
-1 == iLastSkipDirection) |
|
1599 |
{ |
|
1600 |
skip = EFalse; |
|
1601 |
} |
|
1602 |
||
1603 |
// Skip to next/previous track |
|
1604 |
if ( skip ) |
|
1605 |
{ |
|
1606 |
if ( iLastSkipDirection < 0 ) |
|
1607 |
{ |
|
1608 |
iPlaybackUtility->CommandL( EPbCmdPrevious ); |
|
1609 |
} |
|
1610 |
else |
|
1611 |
{ |
|
1612 |
iPlaybackUtility->CommandL( EPbCmdNext ); |
|
1613 |
} |
|
1614 |
} |
|
1615 |
break; |
|
1616 |
} |
|
1617 |
case KErrDiskFull: |
|
1618 |
{ |
|
1619 |
iCommonUiHelper->HandleErrorL( aError, iMedia ); |
|
1620 |
break; |
|
1621 |
} |
|
1622 |
default: |
|
1623 |
{ |
|
1624 |
iPlaybackUtility->CommandL( EPbCmdStop ); |
|
1625 |
iCommonUiHelper->HandleErrorL( aError, iMedia ); |
|
1626 |
break; |
|
1627 |
} |
|
1628 |
} |
|
1629 |
} |
|
1630 |
||
1631 |
// Reset flag after error handling is done. |
|
1632 |
MPX_DEBUG1("CMPXPlaybackViewImp::HandleErrorL()"); |
|
1633 |
MPX_DEBUG1(" > Reset New Item Opened Flag"); |
|
1634 |
iNewItemOpened = EFalse; |
|
66
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
1635 |
|
53 | 1636 |
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleErrorL: Exiting"); |
1637 |
} |
|
1638 |
||
1639 |
// --------------------------------------------------------------------------- |
|
1640 |
// Displays error note for when all tracks are invalid, |
|
1641 |
// and goes back to collection list view |
|
1642 |
// --------------------------------------------------------------------------- |
|
1643 |
// |
|
1644 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleAllTracksInvalidL() |
|
1645 |
{ |
|
1646 |
MPX_DEBUG1("CMPXCommonPlaybackViewImp::HandleAllTracksInvalidL: Entering"); |
|
1647 |
MPX_DEBUG2("CMPXCommonPlaybackViewImp::HandleAllTracksInvalidL: iDatabaseNotReady (%d)", iDatabaseNotReady); |
|
1648 |
||
1649 |
iPlaybackUtility->CommandL( EPbCmdStop ); |
|
1650 |
UpdatePlaybackStateL( EPbStateStopped ); |
|
1651 |
||
1652 |
TInt mpxWindowGroupId = CEikonEnv::Static()->RootWin().Identifier(); |
|
1653 |
||
1654 |
// Usb event happened. |
|
1655 |
if (iDatabaseNotReady) |
|
1656 |
{ |
|
1657 |
iIgnoredByUsbEvent = ETrue; |
|
1658 |
} |
|
1659 |
||
1660 |
// Do not display error if view is not active |
|
1661 |
if ( iContainer && !iDatabaseNotReady && |
|
1662 |
iCommonUiHelper->IsForegroundApplication(mpxWindowGroupId) && |
|
1663 |
iViewUtility->ActiveViewType() != TUid::Uid( KMPXPluginTypeEqualizerUid ) ) |
|
1664 |
{ |
|
1665 |
iCommonUiHelper->HandleErrorL( KMPXAllTracksInvalid, iMedia ); |
|
1666 |
||
1667 |
// Check foreground again just in case of user presses end key and switch |
|
1668 |
// to idle application while error notes are showing |
|
1669 |
// do not switch view when USB events ongoing |
|
1670 |
if (!iDatabaseNotReady && |
|
1671 |
iCommonUiHelper->IsForegroundApplication(mpxWindowGroupId)) |
|
1672 |
{ |
|
1673 |
HandleCommandL( EAknSoftkeyBack ); |
|
1674 |
} |
|
1675 |
||
1676 |
iStartPlaybackIndex = KErrNotFound; |
|
1677 |
iLastSkipDirection = 1; |
|
1678 |
||
1679 |
// Reset the playlist to point to the first item |
|
1680 |
// in list, but do not initialize the song for |
|
1681 |
// playback |
|
1682 |
MMPXSource* source( iPlaybackUtility->Source() ); |
|
1683 |
if ( source ) |
|
1684 |
{ |
|
1685 |
CMPXCollectionPlaylist* pl( source->PlaylistL() ); |
|
1686 |
if ( pl ) |
|
1687 |
{ |
|
1688 |
CleanupStack::PushL( pl ); |
|
1689 |
pl->SetToFirst(); |
|
1690 |
iPlaybackUtility->InitL( *pl, EFalse ); |
|
1691 |
CleanupStack::PopAndDestroy( pl ); |
|
1692 |
} |
|
1693 |
} |
|
1694 |
} |
|
1695 |
||
1696 |
||
1697 |
MPX_DEBUG1("CMPXCommonPlaybackViewImp::HandleAllTracksInvalidL: Exiting"); |
|
1698 |
} |
|
1699 |
||
1700 |
// --------------------------------------------------------------------------- |
|
1701 |
// Checks whether or not to skip to next track on an error |
|
1702 |
// --------------------------------------------------------------------------- |
|
1703 |
// |
|
1704 |
EXPORT_C void CMPXCommonPlaybackViewImp::SkipOnErrorL( |
|
1705 |
TInt aCurrentIndex, |
|
1706 |
TInt aCount ) |
|
1707 |
{ |
|
1708 |
MPX_DEBUG3("CMPXCommonPlaybackViewImp::SkipOnErrorL(%d %d): Entering", aCurrentIndex, aCount); |
|
1709 |
||
1710 |
TBool skip( ETrue ); |
|
1711 |
TBool displayError( EFalse ); |
|
1712 |
||
1713 |
// If playlist is invalid, don't skip. Fix for error EJPJ-7CVAJX. |
|
1714 |
if ( aCurrentIndex == KErrNotFound && aCount == KErrNotFound ) |
|
1715 |
{ |
|
1716 |
skip = EFalse; |
|
1717 |
iCommonUiHelper->HandleErrorL( KErrCorrupt ); |
|
1718 |
} |
|
1719 |
// UI specs say theres two cases where it stops and |
|
1720 |
// does not skip to the next song. |
|
1721 |
// First case is if not repeat all and playback has |
|
1722 |
// reached the end of the list and gone to the first song. |
|
1723 |
// Second case is if not repeat all and the user is skipping |
|
1724 |
// backwards and reached the first song |
|
1725 |
else if ( EPbRepeatAll != iRepeatMode ) |
|
1726 |
{ |
|
1727 |
if ( 0 == aCurrentIndex && |
|
1728 |
-1 == iLastSkipDirection ) |
|
1729 |
{ |
|
1730 |
skip = EFalse; |
|
1731 |
displayError = ETrue; |
|
1732 |
} |
|
1733 |
else if ( aCurrentIndex == aCount-1 && |
|
1734 |
1 == iLastSkipDirection ) |
|
1735 |
{ |
|
1736 |
skip = EFalse; |
|
1737 |
displayError = ETrue; |
|
1738 |
} |
|
1739 |
} |
|
1740 |
if ( EPbRepeatAll == iRepeatMode ) |
|
1741 |
{ |
|
1742 |
if ( aCurrentIndex == aCount-1 && |
|
1743 |
1 == iLastSkipDirection && |
|
1744 |
1 != iRandomMode ) |
|
1745 |
{ |
|
1746 |
skip = EFalse; |
|
1747 |
displayError = ETrue; |
|
1748 |
} |
|
1749 |
} |
|
1750 |
||
1751 |
// Skip to next/previous track |
|
1752 |
if ( skip ) |
|
1753 |
{ |
|
1754 |
if ( iLastSkipDirection < 0 ) |
|
1755 |
{ |
|
1756 |
iPlaybackUtility->CommandL( EPbCmdPrevious ); |
|
1757 |
} |
|
1758 |
else |
|
1759 |
{ |
|
1760 |
iPlaybackUtility->CommandL( EPbCmdNext ); |
|
1761 |
} |
|
1762 |
} |
|
1763 |
||
1764 |
// Display error message |
|
1765 |
if ( displayError ) |
|
1766 |
{ |
|
1767 |
HandleAllTracksInvalidL(); |
|
1768 |
} |
|
1769 |
||
1770 |
MPX_DEBUG1("CMPXCommonPlaybackViewImp::SkipOnErrorL: Exiting"); |
|
1771 |
} |
|
1772 |
||
1773 |
// --------------------------------------------------------------------------- |
|
1774 |
// Function to display information notes |
|
1775 |
// --------------------------------------------------------------------------- |
|
1776 |
// |
|
1777 |
EXPORT_C void CMPXCommonPlaybackViewImp::DisplayInfoNoteL( TInt aResourceId ) |
|
1778 |
{ |
|
1779 |
HBufC* text = StringLoader::LoadLC( aResourceId ); |
|
1780 |
CAknInformationNote* dlg = new ( ELeave ) CAknInformationNote( ETrue ); |
|
1781 |
dlg->ExecuteLD( *text ); |
|
1782 |
CleanupStack::PopAndDestroy( text ); |
|
1783 |
} |
|
1784 |
||
1785 |
// --------------------------------------------------------------------------- |
|
1786 |
// Function to display confirmation notes |
|
1787 |
// --------------------------------------------------------------------------- |
|
1788 |
// |
|
1789 |
EXPORT_C void CMPXCommonPlaybackViewImp::DisplayConfirmionNoteL( TInt aResourceId ) |
|
1790 |
{ |
|
1791 |
HBufC* text = StringLoader::LoadLC( aResourceId ); |
|
1792 |
CAknConfirmationNote* dlg = new ( ELeave ) CAknConfirmationNote( ETrue ); |
|
1793 |
dlg->ExecuteLD( *text ); |
|
1794 |
CleanupStack::PopAndDestroy( text ); |
|
1795 |
} |
|
1796 |
||
1797 |
// --------------------------------------------------------------------------- |
|
1798 |
// Set process priority. |
|
1799 |
// --------------------------------------------------------------------------- |
|
1800 |
// |
|
1801 |
EXPORT_C void CMPXCommonPlaybackViewImp::SetProcessPriority() |
|
1802 |
{ |
|
1803 |
RProcess thisProcess; |
|
1804 |
TProcessPriority pPriority = thisProcess.Priority(); |
|
1805 |
||
1806 |
// Check if playback state is not playing, set to background |
|
1807 |
TMPXPlaybackState state( EPbStateNotInitialised ); |
|
1808 |
TRAP_IGNORE( state = iPlaybackUtility->StateL() ); |
|
1809 |
||
1810 |
if ( EPbStatePlaying != state && pPriority == EPriorityHigh ) |
|
1811 |
{ |
|
1812 |
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::SetProcessPriority -- setting process priority to EPriorityBackground" ); |
|
1813 |
thisProcess.SetPriority( EPriorityBackground ); |
|
1814 |
} |
|
1815 |
} |
|
1816 |
||
1817 |
// --------------------------------------------------------------------------- |
|
1818 |
// Launch equalizer dialog. |
|
1819 |
// --------------------------------------------------------------------------- |
|
1820 |
// |
|
1821 |
EXPORT_C void CMPXCommonPlaybackViewImp::LaunchEqualizerL() |
|
1822 |
{ |
|
1823 |
||
1824 |
// Activate Equalizer dialog via View Framework |
|
1825 |
iViewUtility->ActivateViewL( TUid::Uid( KMPXPluginTypeEqualizerUid ) ); |
|
1826 |
||
1827 |
iContainer->SetRect( ClientRect() ); |
|
1828 |
iContainer->DrawDeferred(); |
|
1829 |
iSwitchingView = EFalse; |
|
1830 |
} |
|
1831 |
||
1832 |
||
1833 |
// --------------------------------------------------------------------------- |
|
1834 |
// Launch Music Settings view. |
|
1835 |
// --------------------------------------------------------------------------- |
|
1836 |
// |
|
1837 |
EXPORT_C void CMPXCommonPlaybackViewImp::LaunchMusicSettingsL() |
|
1838 |
{ |
|
1839 |
// Activate Audio Effects view via View Framework |
|
1840 |
iViewUtility->ActivateViewL( |
|
1841 |
TUid::Uid( KMPXPluginTypeAudioEffectsUid ) ); |
|
1842 |
} |
|
1843 |
||
1844 |
// --------------------------------------------------------------------------- |
|
1845 |
// Launch FM Transmitter application |
|
1846 |
// --------------------------------------------------------------------------- |
|
1847 |
// |
|
1848 |
EXPORT_C void CMPXCommonPlaybackViewImp::LaunchFMTransmitterL() |
|
1849 |
{ |
|
1850 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::LaunchFMTransmitterL" ); |
|
1851 |
||
1852 |
if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) ) |
|
1853 |
{ |
|
1854 |
TApaTaskList tasList( iCoeEnv->WsSession() ); |
|
1855 |
TApaTask task = tasList.FindApp( KFmTxAppUid ); |
|
1856 |
if ( task.Exists() ) |
|
1857 |
{ |
|
1858 |
GfxTransEffect::BeginFullScreen( |
|
1859 |
AknTransEffect::EApplicationStart, |
|
1860 |
TRect(), |
|
1861 |
AknTransEffect::EParameterType, |
|
1862 |
AknTransEffect::GfxTransParam( KFmTxAppUid, |
|
1863 |
AknTransEffect::TParameter::EActivateExplicitContinue )); |
|
1864 |
task.BringToForeground(); |
|
1865 |
} |
|
1866 |
else |
|
1867 |
{ |
|
1868 |
RProcess process; |
|
1869 |
TApaAppInfo appInfo; |
|
1870 |
RApaLsSession session; |
|
1871 |
if ( KErrNone == session.Connect() ) |
|
1872 |
{ |
|
1873 |
CleanupClosePushL( session ); |
|
1874 |
TThreadId threadId; |
|
1875 |
session.CreateDocument( KNullDesC, KFmTxAppUid, threadId ); |
|
1876 |
CleanupStack::PopAndDestroy(&session); |
|
1877 |
} |
|
1878 |
} |
|
1879 |
} |
|
1880 |
} |
|
1881 |
||
1882 |
// --------------------------------------------------------------------------- |
|
1883 |
// Request for the media object |
|
1884 |
// --------------------------------------------------------------------------- |
|
1885 |
// |
|
1886 |
EXPORT_C void CMPXCommonPlaybackViewImp::RequestMediaL( TBool aDrm /*=EFalse*/ ) |
|
1887 |
{ |
|
1888 |
MPX_DEBUG1("CMPXCommonPlaybackViewImp::RequestMediaL(): entering"); |
|
1889 |
||
1890 |
MMPXSource* s = iPlaybackUtility->Source(); |
|
1891 |
if ( s ) |
|
1892 |
{ |
|
1893 |
RArray<TMPXAttribute> attrs; |
|
1894 |
CleanupClosePushL(attrs); |
|
1895 |
attrs.Append( KMPXMediaGeneralBasic | |
|
1896 |
KMPXMediaGeneralUri | |
|
1897 |
KMPXMediaGeneralMimeType | |
|
1898 |
KMPXMediaGeneralDuration ); |
|
1899 |
attrs.Append( KMPXMediaMusicAlbumArtFileName | |
|
1900 |
KMPXMediaMusicArtist | |
|
1901 |
KMPXMediaMusicAlbum ); |
|
1902 |
if ( aDrm ) |
|
1903 |
{ |
|
1904 |
attrs.Append( KMPXMediaDrmAll ); |
|
1905 |
} |
|
1906 |
else |
|
1907 |
{ |
|
1908 |
// If not retrieving all drm attributes, then |
|
1909 |
// minimal is retrieve the protected flag and |
|
1910 |
// automated flag |
|
1911 |
attrs.Append( KMPXMediaDrmProtected | |
|
1912 |
KMPXMediaDrmCanSetAutomated ); |
|
1913 |
} |
|
1914 |
s->MediaL( attrs.Array(), *this ); |
|
1915 |
CleanupStack::PopAndDestroy( &attrs ); |
|
1916 |
} |
|
1917 |
MPX_DEBUG1("CMPXCommonPlaybackViewImp::RequestMediaL(): exiting"); |
|
1918 |
} |
|
1919 |
||
1920 |
// ----------------------------------------------------------------------------- |
|
1921 |
// CMPXCommonPlaybackViewImp::PrepareStatusPaneForPlaybackViewL |
|
1922 |
// ----------------------------------------------------------------------------- |
|
1923 |
// |
|
1924 |
void CMPXCommonPlaybackViewImp::PrepareStatusPaneForPlaybackViewL() |
|
1925 |
{ |
|
1926 |
iPreviousStatusPaneLayout = StatusPane()->CurrentLayoutResId(); |
|
1927 |
TInt resId( KErrNone ); |
|
1928 |
||
1929 |
// We need to restore the status pane if not visible. |
|
1930 |
if (!StatusPane()->IsVisible()) |
|
1931 |
{ |
|
1932 |
StatusPane()->MakeVisible(ETrue); |
|
1933 |
} |
|
1934 |
||
1935 |
if ( !Layout_Meta_Data::IsLandscapeOrientation() ) |
|
1936 |
{ |
|
1937 |
if ( iPreviousStatusPaneLayout != R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ) |
|
1938 |
{ |
|
1939 |
resId = R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT; |
|
1940 |
} |
|
1941 |
} |
|
1942 |
||
1943 |
if ( KErrNone != resId ) |
|
1944 |
{ |
|
1945 |
CAknLocalScreenClearer* clearer = CAknLocalScreenClearer::NewLC( ETrue ); |
|
1946 |
StatusPane()->SwitchLayoutL( resId ); |
|
1947 |
CleanupStack::PopAndDestroy( clearer ); |
|
1948 |
} |
|
1949 |
else if ( iContainer ) |
|
1950 |
{ |
|
1951 |
iContainer->SetRect( ClientRect() ); |
|
1952 |
} |
|
1953 |
} |
|
1954 |
||
1955 |
// ----------------------------------------------------------------------------- |
|
1956 |
// CMPXCommonPlaybackViewImp::PrepareStatusPaneForExitingViewL |
|
1957 |
// ----------------------------------------------------------------------------- |
|
1958 |
// |
|
1959 |
void CMPXCommonPlaybackViewImp::PrepareStatusPaneForExitingViewL() |
|
1960 |
{ |
|
1961 |
MPX_FUNC_EX("CMPXCommonPlaybackViewImp::PrepareStatusPaneForExitingViewL()"); |
|
1962 |
if ( StatusPane()->CurrentLayoutResId() != |
|
1963 |
iPreviousStatusPaneLayout) |
|
1964 |
{ |
|
1965 |
StatusPane()->SwitchLayoutL( iPreviousStatusPaneLayout ); |
|
1966 |
} |
|
1967 |
} |
|
1968 |
||
1969 |
// --------------------------------------------------------------------------- |
|
1970 |
// From MMPXPlaybackObserver |
|
1971 |
// Handle playback message. |
|
1972 |
// --------------------------------------------------------------------------- |
|
1973 |
// |
|
1974 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandlePlaybackMessage( |
|
1975 |
CMPXMessage* aMessage, TInt aError ) |
|
1976 |
{ |
|
1977 |
MPX_DEBUG2("-->CMPXCommonPlaybackViewImp::HandlePlaybackMessage(): aError = %d", aError); |
|
1978 |
if ( aError == KErrNone && aMessage ) |
|
1979 |
{ |
|
1980 |
TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) ); |
|
1981 |
} |
|
1982 |
else if ( aError != KErrNone && iLastPBViewActivated ) |
|
1983 |
{ |
|
1984 |
TRAP_IGNORE( DoHandleErrorPlaybackMessageL( aError ) ); |
|
1985 |
} |
|
1986 |
MPX_DEBUG2("<--CMPXCommonPlaybackViewImp::HandlePlaybackMessage(): aError = %d", aError); |
|
1987 |
} |
|
1988 |
||
1989 |
// --------------------------------------------------------------------------- |
|
1990 |
// From MMPXPlaybackCallback |
|
1991 |
// Handle playback property. |
|
1992 |
// --------------------------------------------------------------------------- |
|
1993 |
// |
|
1994 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandlePropertyL( |
|
1995 |
TMPXPlaybackProperty aProperty, |
|
1996 |
TInt aValue, |
|
1997 |
TInt aError ) |
|
1998 |
{ |
|
1999 |
TRAP_IGNORE( DoHandlePropertyL( aProperty, aValue, aError ) ); |
|
2000 |
} |
|
2001 |
||
2002 |
// --------------------------------------------------------------------------- |
|
2003 |
// From MMPXPlaybackCallback |
|
2004 |
// Method is called continously until aComplete=ETrue, signifying that |
|
2005 |
// it is done and there will be no more callbacks |
|
2006 |
// Only new items are passed each time |
|
2007 |
// --------------------------------------------------------------------------- |
|
2008 |
// |
|
2009 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleSubPlayerNamesL( |
|
2010 |
TUid /* aPlayer */, |
|
2011 |
const MDesCArray* /* aSubPlayers */, |
|
2012 |
TBool /* aComplete */, |
|
2013 |
TInt /* aError */ ) |
|
2014 |
{ |
|
2015 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::HandleSubPlayerNamesL" ); |
|
2016 |
} |
|
2017 |
||
2018 |
// --------------------------------------------------------------------------- |
|
2019 |
// From MMPXPlaybackCallback |
|
2020 |
// Handle media event. |
|
2021 |
// Notes: The client is responsible for delete the object of aProperties. |
|
2022 |
// --------------------------------------------------------------------------- |
|
2023 |
// |
|
2024 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleMediaL( |
|
2025 |
const CMPXMedia& aMedia, |
|
2026 |
TInt aError ) |
|
2027 |
{ |
|
2028 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::HandleMediaL" ); |
|
2029 |
TRAP_IGNORE( DoHandleMediaL( aMedia, aError )); |
|
2030 |
} |
|
2031 |
||
2032 |
// --------------------------------------------------------------------------- |
|
2033 |
// From MMPXCollectionMediaObserver |
|
2034 |
// Handle extended media properties |
|
2035 |
// --------------------------------------------------------------------------- |
|
2036 |
// |
|
2037 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleCollectionMediaL( |
|
2038 |
const CMPXMedia& aMedia, |
|
2039 |
TInt aError ) |
|
2040 |
{ |
|
2041 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::HandleCollectionMediaL" ); |
|
2042 |
TRAP_IGNORE( DoHandleMediaL( aMedia, aError )); |
|
2043 |
} |
|
2044 |
||
2045 |
// --------------------------------------------------------------------------- |
|
2046 |
// From CAknView |
|
2047 |
// Command handling function. |
|
2048 |
// --------------------------------------------------------------------------- |
|
2049 |
// |
|
2050 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleCommandL( TInt aCommand ) |
|
2051 |
{ |
|
2052 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleCommandL(%d) entering", aCommand ); |
|
2053 |
||
2054 |
switch (aCommand) |
|
2055 |
{ |
|
2056 |
case EAknCmdHelp: |
|
2057 |
{ |
|
2058 |
HlpLauncher::LaunchHelpApplicationL( |
|
2059 |
iEikonEnv->WsSession(), |
|
2060 |
AppUi()->AppHelpContextL() ); |
|
2061 |
break; |
|
2062 |
} |
|
2063 |
case EAknSoftkeyBack: |
|
2064 |
{ |
|
2065 |
||
2066 |
#ifdef BACKSTEPPING_INCLUDED |
|
2067 |
// let Back Stepping Service handle the event |
|
2068 |
TInt statusInfo( KMPXBackSteppingNotConsumed ); |
|
2069 |
if ( iViewUtility && |
|
2070 |
( iViewUtility->ActiveViewType() != KNullUid ) ) |
|
2071 |
{ |
|
2072 |
TInt viewId( iViewUtility->ActiveViewType().iUid ); |
|
2073 |
TBuf8<KMVPrefixLen + KMaxIntLen> buf; |
|
2074 |
buf.Copy( KMVPrefix ); |
|
2075 |
buf.AppendNum( viewId ); |
|
2076 |
statusInfo = iBackSteppingUtility->HandleBackCommandL( buf ); |
|
2077 |
MPX_DEBUG3("CMPXCommonPlaybackViewImp::HandleCommandL - viewid=0x%x, statusInfo=%d", |
|
2078 |
viewId, statusInfo ); |
|
2079 |
} |
|
2080 |
if ( statusInfo == KMPXBackSteppingNotConsumed ) |
|
2081 |
#endif // BACKSTEPPING_INCLUDED |
|
2082 |
{ |
|
2083 |
if ( !iBacking ) |
|
2084 |
{ |
|
2085 |
// event not consumed by Back Stepping utility, handle here |
|
2086 |
||
2087 |
MMPXSource* source = iPlaybackUtility->Source(); |
|
2088 |
if ( source ) |
|
2089 |
{ |
|
2090 |
CMPXCollectionPlaylist* playlist = source->PlaylistL(); |
|
2091 |
if ( playlist ) |
|
2092 |
{ |
|
2093 |
CleanupStack::PushL( playlist ); |
|
2094 |
||
2095 |
if ( playlist->Count() ) |
|
2096 |
{ |
|
2097 |
CMPXCollectionPath* pbPath = CMPXCollectionPath::NewL( playlist->Path() ); |
|
2098 |
CleanupStack::PushL( pbPath ); |
|
2099 |
pbPath->Back(); |
|
2100 |
iViewUtility->PushDefaultHistoryL(); |
|
2101 |
MPX_DEBUG_PATH(*pbPath); |
|
2102 |
iCollectionUtility->Collection().OpenL( *pbPath ); |
|
2103 |
CleanupStack::PopAndDestroy( pbPath ); |
|
2104 |
} |
|
2105 |
else |
|
2106 |
{ |
|
2107 |
// TO-DO: check if collection is empty, activate |
|
2108 |
// music main menu? or change ui spec |
|
2109 |
AppUi()->HandleCommandL( EAknSoftkeyBack ); |
|
2110 |
} |
|
2111 |
CleanupStack::PopAndDestroy( playlist ); |
|
2112 |
} |
|
2113 |
else |
|
2114 |
{ |
|
2115 |
AppUi()->HandleCommandL( EAknSoftkeyBack ); |
|
2116 |
} |
|
2117 |
} |
|
2118 |
else |
|
2119 |
{ |
|
2120 |
CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL(); |
|
2121 |
CleanupStack::PushL( cpath ); |
|
2122 |
while ( cpath->Levels() > 2 ) |
|
2123 |
{ |
|
2124 |
cpath->Back(); |
|
2125 |
} |
|
2126 |
iCollectionUtility->Collection().OpenL( *cpath ); |
|
2127 |
CleanupStack::PopAndDestroy( cpath ); |
|
2128 |
} |
|
2129 |
iBacking = ETrue; |
|
2130 |
} |
|
2131 |
} |
|
2132 |
break; |
|
2133 |
} |
|
2134 |
case EAknCmdExit: |
|
2135 |
case EAknSoftkeyExit: |
|
2136 |
case EEikCmdExit: |
|
2137 |
{ |
|
2138 |
AppUi()->HandleCommandL( aCommand ); |
|
2139 |
break; |
|
2140 |
} |
|
2141 |
case EMPXPbvCmdGotoMusicMenu: |
|
2142 |
{ |
|
2143 |
AppUi()->HandleCommandL( EMPXCmdGotoCollection ); |
|
2144 |
TInt val(0); |
|
2145 |
CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures ); |
|
2146 |
repository->Get( KMPXMPLocalVariation, val ); |
|
2147 |
TBool startInAlbumMenu = val&KMPXStartMusicPlayerinArtistsandAlbums ? ETrue : EFalse; |
|
2148 |
delete repository; |
|
2149 |
||
2150 |
if ( startInAlbumMenu ) |
|
2151 |
{ |
|
2152 |
CMPXCollectionPath* cpath = iCollectionUiHelper->MusicMenuPathL(); |
|
2153 |
CleanupStack::PushL( cpath ); |
|
2154 |
cpath->AppendL(3); // Albums |
|
2155 |
MPX_DEBUG_PATH(*cpath); |
|
2156 |
iCollectionUtility->Collection().OpenL( *cpath ); |
|
2157 |
CleanupStack::PopAndDestroy( cpath ); |
|
2158 |
} |
|
2159 |
else |
|
2160 |
{ |
|
2161 |
// Handle Goto Music menu |
|
2162 |
CMPXCollectionPath* cpath = iCollectionUiHelper->MusicMenuPathL(); |
|
2163 |
CleanupStack::PushL( cpath ); |
|
2164 |
MPX_DEBUG_PATH (*cpath); |
|
2165 |
iCollectionUtility->Collection().OpenL( *cpath ); |
|
2166 |
CleanupStack::PopAndDestroy( cpath ); |
|
2167 |
} |
|
2168 |
// Make sure status pane layout is usual when going |
|
2169 |
// directly to music menu |
|
2170 |
// Status pane has to be modified before view gets deactivated |
|
2171 |
break; |
|
2172 |
} |
|
2173 |
case EMPXPbvCmdSongDetails: |
|
2174 |
{ |
|
66
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2175 |
LaunchFileDetailsDialogL(); |
53 | 2176 |
break; |
2177 |
} |
|
2178 |
case EMPXPbvCmdPlay: |
|
2179 |
{ |
|
2180 |
if ( iEmbedded ) |
|
2181 |
{ |
|
2182 |
iPlaybackUtility->CommandL( EPbCmdDisableEffect ); |
|
2183 |
} |
|
2184 |
iPlaybackUtility->CommandL( EPbCmdPlay ); |
|
2185 |
break; |
|
2186 |
} |
|
2187 |
case EMPXPbvCmdStop: |
|
2188 |
{ |
|
2189 |
iPlaybackUtility->CommandL( EPbCmdStop ); |
|
2190 |
break; |
|
2191 |
} |
|
2192 |
case EMPXPbvCmdPause: |
|
2193 |
{ |
|
2194 |
MPX_PERF_CHECKPT("Pause command issued"); |
|
2195 |
iPlaybackUtility->CommandL( EPbCmdPause ); |
|
2196 |
break; |
|
2197 |
} |
|
2198 |
case EMPXPbvCmdPlayPause: |
|
2199 |
{ |
|
2200 |
iPlaybackUtility->CommandL( EPbCmdPlayPause ); |
|
2201 |
break; |
|
2202 |
} |
|
2203 |
case EMPXPbvCmdSeekForward: |
|
2204 |
{ |
|
2205 |
iSkipBtnPressed = ETrue; |
|
2206 |
iCommandSender = ECsRenderer; |
|
2207 |
if ( IsCommandSupportedL() ) |
|
2208 |
{ |
|
2209 |
iPlaybackUtility->CommandL( EPbCmdStartSeekForward ); |
|
2210 |
if ( !iKeySoundDisabled ) |
|
2211 |
{ |
|
2212 |
iAvkonViewAppUi->KeySounds()->PushContextL( |
|
2213 |
R_MPX_PBV_LEFT_RIGHT_KEYS_SILENT ); |
|
2214 |
iKeySoundDisabled = ETrue; |
|
2215 |
} |
|
2216 |
} |
|
2217 |
iUnsupportedNoteDisabled = EFalse; |
|
2218 |
iIsffButtonPressed = ETrue; |
|
2219 |
break; |
|
2220 |
} |
|
2221 |
case EMPXPbvCmdSeekBackward: |
|
2222 |
{ |
|
2223 |
iSkipBtnPressed = ETrue; |
|
2224 |
iCommandSender = ECsRenderer; |
|
2225 |
if ( IsCommandSupportedL() ) |
|
2226 |
{ |
|
2227 |
iPlaybackUtility->CommandL( EPbCmdStartSeekBackward ); |
|
2228 |
if ( !iKeySoundDisabled ) |
|
2229 |
{ |
|
2230 |
iAvkonViewAppUi->KeySounds()->PushContextL( |
|
2231 |
R_MPX_PBV_LEFT_RIGHT_KEYS_SILENT ); |
|
2232 |
iKeySoundDisabled = ETrue; |
|
2233 |
} |
|
2234 |
} |
|
2235 |
iUnsupportedNoteDisabled = EFalse; |
|
2236 |
iIsffButtonPressed = ETrue; |
|
2237 |
break; |
|
2238 |
} |
|
2239 |
case EMPXPbvCmdEndSeek: |
|
2240 |
{ |
|
2241 |
iSkipBtnPressed = EFalse; |
|
2242 |
iIsffButtonPressed = EFalse; |
|
2243 |
iUnsupportedNoteDisabled = EFalse; |
|
2244 |
iPlaybackUtility->CommandL( EPbCmdStopSeeking ); |
|
2245 |
if ( iKeySoundDisabled ) |
|
2246 |
{ |
|
2247 |
iAvkonViewAppUi->KeySounds()->PopContext(); |
|
2248 |
iKeySoundDisabled = EFalse; |
|
2249 |
} |
|
2250 |
break; |
|
2251 |
} |
|
2252 |
case EMPXPbvCmdNextListItem: |
|
2253 |
{ |
|
2254 |
// When user skips a track, reset the start playback index |
|
2255 |
iStartPlaybackIndex = KErrNotFound; |
|
2256 |
iDelayedErrorTimer->Cancel(); |
|
2257 |
||
2258 |
iPlaybackUtility->CommandL( EPbCmdNext ); |
|
2259 |
break; |
|
2260 |
} |
|
2261 |
case EMPXPbvCmdPreviousListItem: |
|
2262 |
{ |
|
2263 |
// When user skips a track, reset the start playback index |
|
2264 |
iStartPlaybackIndex = KErrNotFound; |
|
2265 |
iDelayedErrorTimer->Cancel(); |
|
2266 |
||
2267 |
iPlaybackUtility->CommandL( EPbCmdPrevious ); |
|
2268 |
break; |
|
2269 |
} |
|
2270 |
case EMPXPbvCmdDecreaseVolume: |
|
2271 |
{ |
|
2272 |
iPlaybackUtility->CommandL( EPbCmdDecreaseVolume ); |
|
2273 |
break; |
|
2274 |
} |
|
2275 |
case EMPXPbvCmdIncreaseVolume: |
|
2276 |
{ |
|
2277 |
iPlaybackUtility->CommandL( EPbCmdIncreaseVolume ); |
|
2278 |
break; |
|
2279 |
} |
|
2280 |
case EMPXPbvCmdPosition: |
|
2281 |
{ |
|
2282 |
iIsTapped = ETrue; |
|
2283 |
iCommandSender = ECsRenderer; |
|
2284 |
if ( IsCommandSupportedL() && ( iCurrentPlayerType != EPbRemote ) ) |
|
2285 |
{ |
|
2286 |
TInt newPosition = iContainer->GetNewSongPosition(); |
|
2287 |
iPlaybackUtility->SetL( EPbPropertyPosition, newPosition); |
|
2288 |
} |
|
2289 |
else |
|
2290 |
{ |
|
2291 |
iUnsupportedNoteDisabled = EFalse; |
|
2292 |
} |
|
2293 |
break; |
|
2294 |
} |
|
2295 |
case EMPXPbvCmdRepeatOne: |
|
2296 |
{ |
|
2297 |
iPlaybackUtility->SetL( EPbPropertyRepeatMode, EPbRepeatOne ); |
|
2298 |
break; |
|
2299 |
} |
|
2300 |
case EMPXPbvCmdRepeatAll: |
|
2301 |
{ |
|
2302 |
iPlaybackUtility->SetL( EPbPropertyRepeatMode, EPbRepeatAll ); |
|
2303 |
break; |
|
2304 |
} |
|
2305 |
case EMPXPbvCmdRepeatOff: |
|
2306 |
{ |
|
2307 |
iPlaybackUtility->SetL( EPbPropertyRepeatMode, EPbRepeatOff ); |
|
2308 |
break; |
|
2309 |
} |
|
2310 |
case EMPXPbvCmdRandomOn: |
|
2311 |
{ |
|
2312 |
iPlaybackUtility->SetL( EPbPropertyRandomMode, ETrue ); |
|
2313 |
break; |
|
2314 |
} |
|
2315 |
case EMPXPbvCmdRandomOff: |
|
2316 |
{ |
|
2317 |
iPlaybackUtility->SetL( EPbPropertyRandomMode, EFalse ); |
|
2318 |
break; |
|
2319 |
} |
|
2320 |
case EMPXCmdAfterSaveUseAsCascade: |
|
2321 |
{ |
|
2322 |
CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
2323 |
MPX_DEBUG1( "Todd CMPXCommonPlaybackViewImp::HandleCommandL aCommand=EMPXCmdAfterSaveUseAsCascade" ); |
|
2324 |
FillAiwParametersL(paramList, ETrue); |
|
2325 |
iServiceHandler->ExecuteMenuCmdL(EMPXPbvCmdUseAsCascade, paramList, |
|
2326 |
iServiceHandler->OutParamListL()); |
|
2327 |
break; |
|
2328 |
} |
|
2329 |
// The clip was saved before setting clip as profile ringtone |
|
2330 |
case EMPXCmdAfterSaveAiwCmdAssign: |
|
2331 |
{ |
|
2332 |
CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
2333 |
MPX_DEBUG1( "Todd CMPXCommonPlaybackViewImp::HandleCommandL aCommand=EMPXCmdAfterSaveAiwCmdAssign" ); |
|
2334 |
FillAiwParametersL(paramList, ETrue); |
|
2335 |
iServiceHandler->ExecuteMenuCmdL(EMPXPbvCmdAiwCmdAssign, paramList, |
|
2336 |
iServiceHandler->OutParamListL()); |
|
2337 |
break; |
|
2338 |
} |
|
2339 |
case EMPXPbvCmdUseAsCascade: |
|
2340 |
case EMPXPbvCmdAiwCmdAssign: |
|
2341 |
{ |
|
2342 |
CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
2343 |
FillAiwParametersL(paramList, EFalse); |
|
2344 |
iServiceHandler->ExecuteMenuCmdL(aCommand, paramList, |
|
2345 |
iServiceHandler->OutParamListL()); |
|
2346 |
break; |
|
2347 |
} |
|
2348 |
case EMPXPbvCmdEqualizer: |
|
2349 |
{ |
|
2350 |
LaunchEqualizerL(); |
|
2351 |
break; |
|
2352 |
} |
|
2353 |
case EMPXPbvCmdOpenMusicSettings: |
|
2354 |
{ |
|
2355 |
LaunchMusicSettingsL(); |
|
2356 |
break; |
|
2357 |
} |
|
2358 |
||
2359 |
case EMPXPbvCmdUpnpPlayViaLocal: |
|
2360 |
{ |
|
2361 |
if ( iUpnpFrameworkSupport ) |
|
2362 |
{ |
|
2363 |
SelectNewPlayerL( aCommand ); |
|
2364 |
} |
|
2365 |
break; |
|
2366 |
} |
|
2367 |
case EMPXPbvCmdFMTransmitter: |
|
2368 |
{ |
|
2369 |
LaunchFMTransmitterL(); |
|
2370 |
break; |
|
2371 |
} |
|
2372 |
case EMPXPbvCmdAddToSavedPlaylist: |
|
2373 |
{ |
|
2374 |
AddToSavedPlaylistL(); |
|
2375 |
break; |
|
2376 |
} |
|
2377 |
case EMPXPbvCmdAddToNewPlaylist: |
|
2378 |
{ |
|
2379 |
AddToNewPlaylistL(); |
|
2380 |
break; |
|
2381 |
} |
|
2382 |
case EMPXCmdNext: |
|
2383 |
case EMPXCmdPrevious: |
|
2384 |
// When user skips a track, reset the start playback index |
|
2385 |
iStartPlaybackIndex = KErrNotFound; |
|
2386 |
case EMPXCmdPlay: |
|
2387 |
case EMPXCmdPause: |
|
2388 |
case EMPXCmdPlayPause: |
|
2389 |
case EMPXCmdStop: |
|
2390 |
case EMPXCmdSeekForward: |
|
2391 |
case EMPXCmdSeekBackward: |
|
2392 |
case EMPXCmdStopSeeking: |
|
2393 |
{ |
|
2394 |
// check if current view is empty |
|
2395 |
TInt count( 0 ); |
|
2396 |
MMPXSource* s = iPlaybackUtility->Source(); |
|
2397 |
if ( s ) |
|
2398 |
{ |
|
2399 |
CMPXCollectionPlaylist* playlist = s->PlaylistL(); |
|
2400 |
if ( playlist ) |
|
2401 |
{ |
|
2402 |
count = playlist->Count(); |
|
2403 |
} |
|
2404 |
delete playlist; |
|
2405 |
} |
|
2406 |
#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD |
|
2407 |
AppUi()->HandleCommandL( aCommand ); |
|
2408 |
count = count; // avoid compilation warning. |
|
2409 |
#else |
|
2410 |
if ( count > 0 ) |
|
2411 |
{ |
|
2412 |
// only handle command if current playlist is not empty |
|
2413 |
AppUi()->HandleCommandL( aCommand ); |
|
2414 |
} |
|
2415 |
#endif |
|
2416 |
break; |
|
2417 |
} |
|
2418 |
case EMPXCmdVolumeUp: |
|
2419 |
case EMPXCmdVolumeDown: |
|
2420 |
case EMPXCmdVolumeMute: |
|
2421 |
case EMPXCmdVolumeUnMute: |
|
2422 |
case EMPXCmdVolumeChanged: |
|
2423 |
{ |
|
2424 |
//Do not try to update volume if FMTx (transmission) is on. |
|
2425 |
if (iFmTxActivity != EFmTxStateActive) |
|
2426 |
{ |
|
2427 |
AppUi()->HandleCommandL( aCommand ); |
|
2428 |
} |
|
2429 |
break; |
|
2430 |
} |
|
2431 |
default: |
|
2432 |
{ |
|
2433 |
if ( iUpnpFrameworkSupport ) |
|
2434 |
{ |
|
2435 |
if ( aCommand >= EMPXPbvCmdUpnpPlayViaRemotePlayer ) |
|
2436 |
{ |
|
2437 |
SelectNewPlayerL( aCommand ); |
|
2438 |
} |
|
2439 |
else |
|
2440 |
{ |
|
2441 |
AppUi()->HandleCommandL( aCommand ); |
|
2442 |
} |
|
2443 |
} |
|
2444 |
else |
|
2445 |
{ |
|
2446 |
AppUi()->HandleCommandL( aCommand ); |
|
2447 |
} |
|
2448 |
break; |
|
2449 |
} |
|
2450 |
} |
|
2451 |
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleCommandL() exiting" ); |
|
2452 |
} |
|
2453 |
||
2454 |
// --------------------------------------------------------------------------- |
|
2455 |
// From CAknView |
|
2456 |
// Processes user commands. |
|
2457 |
// --------------------------------------------------------------------------- |
|
2458 |
// |
|
2459 |
EXPORT_C void CMPXCommonPlaybackViewImp::ProcessCommandL( TInt aCommand ) |
|
2460 |
{ |
|
2461 |
MPX_DEBUG2("CMPXCommonPlaybackViewImp::ProcessCommandL(%d): entering", aCommand); |
|
2462 |
if ( aCommand == EAknCmdExit ) |
|
2463 |
{ |
|
2464 |
if ( MenuBar() ) |
|
2465 |
{ |
|
2466 |
MenuBar()->StopDisplayingMenuBar(); |
|
2467 |
} |
|
2468 |
HandleCommandL( aCommand ); |
|
2469 |
} |
|
2470 |
CAknView::ProcessCommandL( aCommand ); |
|
2471 |
MPX_DEBUG1("CMPXCommonPlaybackViewImp::ProcessCommandL(): exiting"); |
|
2472 |
} |
|
2473 |
||
2474 |
// --------------------------------------------------------------------------- |
|
2475 |
// From CAknView |
|
2476 |
// Event handler for status pane size changes. |
|
2477 |
// --------------------------------------------------------------------------- |
|
2478 |
// |
|
2479 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleStatusPaneSizeChange() |
|
2480 |
{ |
|
2481 |
if ( iContainer && !iSwitchingView ) |
|
2482 |
{ |
|
2483 |
TUid activeView = iViewUtility->ActiveViewImplementationUid(); |
|
2484 |
if ( KMPXEqualizerViewImplementationId == activeView ) |
|
2485 |
{ |
|
2486 |
iContainer->AdjustOrdinalPosition( KMPXPlaybackViewWindowBackground ); |
|
2487 |
} |
|
2488 |
else |
|
2489 |
{ |
|
2490 |
iContainer->SetRect( ClientRect() ); |
|
2491 |
iContainer->DrawDeferred(); |
|
2492 |
} |
|
2493 |
} |
|
2494 |
} |
|
2495 |
||
2496 |
// --------------------------------------------------------------------------- |
|
2497 |
// From CAknView |
|
2498 |
// Handles a view activation. |
|
2499 |
// --------------------------------------------------------------------------- |
|
2500 |
// |
|
2501 |
EXPORT_C void CMPXCommonPlaybackViewImp::DoActivateL( |
|
2502 |
const TVwsViewId& aPrevViewId, |
|
2503 |
TUid /* aCustomMessageId */, |
|
2504 |
const TDesC8& /* aCustomMessage */ ) |
|
2505 |
{ |
|
2506 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::DoActivateL()" ); |
|
2507 |
||
2508 |
iSwitchingView = EFalse; |
|
2509 |
iDatabaseNotReady = EFalse; |
|
2510 |
iUnsupportedNoteDisabled = EFalse; |
|
2511 |
delete iOldUri; |
|
2512 |
iOldUri = NULL; |
|
2513 |
CAknToolbar* toolbar = Toolbar(); |
|
2514 |
if ( toolbar ) |
|
2515 |
{ |
|
2516 |
AppUi()->AddToStackL(toolbar, |
|
2517 |
ECoeStackPriorityCba, |
|
2518 |
ECoeStackFlagRefusesFocus |
|
2519 |
| ECoeStackFlagRefusesAllKeys ); |
|
2520 |
toolbar->MakeVisible( ETrue ); |
|
2521 |
toolbar->HideItemsAndDrawOnlyBackground(EFalse); |
|
2522 |
toolbar->SetToolbarVisibility(ETrue); |
|
2523 |
} |
|
2524 |
PrepareStatusPaneForPlaybackViewL(); |
|
2525 |
||
2526 |
iRandomMode = KErrNotFound; |
|
2527 |
iRepeatMode = KErrNotFound; |
|
2528 |
||
2529 |
iBacking = EFalse; |
|
2530 |
// Update view |
|
2531 |
// use idle call back since extracting album art binary data is slow |
|
2532 |
if ( iIdle ) |
|
2533 |
{ |
|
2534 |
if ( iIdle->IsActive() ) |
|
2535 |
{ |
|
2536 |
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::DoActivateL() iIdle active, canceling" ); |
|
2537 |
iIdle->Cancel(); |
|
2538 |
} |
|
2539 |
delete iIdle; |
|
2540 |
iIdle = NULL; |
|
2541 |
} |
|
2542 |
iIdle = CIdle::NewL( CActive::EPriorityIdle ); |
|
2543 |
iIdle->Start( TCallBack( CMPXCommonPlaybackViewImp::DeferredAlbumArtExtractCallback, this ) ); |
|
2544 |
||
2545 |
// Retrieve current repeat & random modes, fix for EJZU-7NZ9CD |
|
2546 |
iPlaybackUtility->PropertyL( *this, EPbPropertyRandomMode ); |
|
2547 |
iPlaybackUtility->PropertyL( *this, EPbPropertyRepeatMode ); |
|
2548 |
||
2549 |
// Set title |
|
2550 |
// Ignore errors from updating title pane since if that is not |
|
2551 |
// updated, still want to activate view |
|
2552 |
TRAP_IGNORE( UpdateTitlePaneL() ); |
|
2553 |
||
2554 |
if ( !AknLayoutUtils::PenEnabled() ) |
|
2555 |
{ |
|
2556 |
CEikButtonGroupContainer* cba = Cba(); |
|
2557 |
if ( cba ) |
|
2558 |
{ |
|
2559 |
#ifdef __ENABLE_MSK |
|
2560 |
iCommonUiHelper->SetMiddleSoftKeyLabelL( |
|
2561 |
*cba, |
|
2562 |
R_TEXT_SOFTKEY_EMPTY, |
|
2563 |
EAknSoftkeyForwardKeyEvent ); |
|
2564 |
#endif // __ENABLE_MSK |
|
2565 |
} |
|
2566 |
} |
|
2567 |
||
2568 |
if( aPrevViewId.iAppUid == KAppUidMusicPlayerX && iContainer ) |
|
2569 |
{ |
|
2570 |
iContainer->SetTransitionType(EMPXTranstionToLeft); |
|
2571 |
// Transition was started in collection view, we end it here. |
|
2572 |
iContainer->EndTransition(); |
|
2573 |
} |
|
2574 |
||
2575 |
||
2576 |
iPlaybackState = iPlaybackUtility->StateL(); |
|
2577 |
MPX_DEBUG2("CMPXCommonPlaybackViewImp::DoActivateL(): state = %d", iPlaybackState); |
|
2578 |
if ( iPlaybackState == EPbStateInitialising ) |
|
2579 |
{ |
|
2580 |
delete iMedia; |
|
2581 |
iMedia = NULL; |
|
2582 |
UpdatePlaybackStateL( iPlaybackState ); |
|
2583 |
UpdateTrackInfoL( iMedia ); |
|
2584 |
} |
|
2585 |
else |
|
2586 |
{ |
|
2587 |
// reset iNewItemOpened when Playback view is activated when state is |
|
2588 |
// not initializing (e.g. user pressed Go to Now Playing view) |
|
2589 |
MPX_DEBUG1("CMPXCommonPlaybackViewImp::DoActivateL() reset iNewItemOpened"); |
|
2590 |
#ifndef CAMESE_IN_DRM_UTILITY |
|
2591 |
if (iCameseSuperDistSupport) |
|
2592 |
{ |
|
2593 |
iNewItemOpened = EFalse; |
|
2594 |
} |
|
2595 |
#endif |
|
2596 |
if ( iMedia == NULL ) |
|
2597 |
{ |
|
2598 |
MMPXSource* s = iPlaybackUtility->Source(); |
|
2599 |
if ( s ) |
|
2600 |
{ |
|
2601 |
CMPXCollectionPlaylist* playlist( s->PlaylistL() ); |
|
2602 |
if ( playlist ) |
|
2603 |
{ |
|
2604 |
CleanupStack::PushL( playlist ); |
|
2605 |
if ( playlist->Count() > 0 ) |
|
2606 |
{ |
|
2607 |
RequestMediaL(); |
|
2608 |
UpdatePlaybackStateL( iPlaybackState ); |
|
2609 |
} |
|
2610 |
else |
|
2611 |
{ |
|
2612 |
// playlist count is 0, no tracks |
|
2613 |
iPlaybackState = EPbStateNotInitialised; |
|
2614 |
} |
|
2615 |
CleanupStack::PopAndDestroy( playlist ); |
|
2616 |
} |
|
2617 |
else |
|
2618 |
{ |
|
2619 |
// If empty playlist, then no tracks |
|
2620 |
iPlaybackState = EPbStateNotInitialised; |
|
2621 |
} |
|
2622 |
} |
|
2623 |
} |
|
2624 |
} |
|
2625 |
} |
|
2626 |
||
2627 |
// --------------------------------------------------------------------------- |
|
2628 |
// From CAknView |
|
2629 |
// View deactivation function. |
|
2630 |
// --------------------------------------------------------------------------- |
|
2631 |
// |
|
2632 |
EXPORT_C void CMPXCommonPlaybackViewImp::DoDeactivate() |
|
2633 |
{ |
|
2634 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::DoDeactivate()" ); |
|
2635 |
iMPXUtility->CancelRequest(); |
|
2636 |
||
2637 |
if ( iContainer ) |
|
2638 |
{ |
|
2639 |
AppUi()->RemoveFromStack( iContainer ); |
|
2640 |
delete iContainer; |
|
2641 |
iContainer = NULL; |
|
2642 |
iBacking = ETrue; |
|
2643 |
} |
|
2644 |
// Hide the toolbar when view is deactivated. Otherwise it may interfere |
|
2645 |
// with other views (e.g. Antriksh based collection view) that doesn't have |
|
2646 |
// toolbar to not draw correctly. |
|
2647 |
CAknToolbar* toolbar = Toolbar(); |
|
2648 |
if ( toolbar ) |
|
2649 |
{ |
|
2650 |
toolbar->HideItemsAndDrawOnlyBackground(ETrue); |
|
2651 |
toolbar->SetToolbarVisibility(EFalse); |
|
2652 |
toolbar->MakeVisible(EFalse); |
|
2653 |
AppUi()->RemoveFromStack( toolbar ); |
|
2654 |
} |
|
2655 |
||
2656 |
if ( iTNRequestTimer->IsActive()) |
|
2657 |
{ |
|
2658 |
iTNRequestTimer->Cancel(); |
|
2659 |
} |
|
2660 |
} |
|
2661 |
||
2662 |
// --------------------------------------------------------------------------- |
|
2663 |
// From CAknView |
|
2664 |
// Foreground event handling function. |
|
2665 |
// --------------------------------------------------------------------------- |
|
2666 |
// |
|
2667 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleForegroundEventL( TBool aForeground ) |
|
2668 |
{ |
|
2669 |
MPX_DEBUG2( "--->CMPXCommonPlaybackViewImp::HandleForegroundEventL(%d)", aForeground ); |
|
2670 |
||
2671 |
#ifdef BACKSTEPPING_INCLUDED |
|
2672 |
TInt statusInfo( KMPXBackSteppingNotConsumed ); |
|
2673 |
MPX_DEBUG3("CMPXCommonPlaybackViewImp::HandleForegroundEventL - is in foreground=%d, this view=0x%x", |
|
2674 |
aForeground, Id().iUid ); |
|
2675 |
if( aForeground && |
|
2676 |
iViewUtility && |
|
2677 |
( iViewUtility->ActiveViewImplementationUid() != KNullUid ) ) |
|
2678 |
{ |
|
2679 |
TInt viewId( iViewUtility->ActiveViewType().iUid ); |
|
2680 |
TBuf8<KMVPrefixLen + KMaxIntLen> buf; |
|
2681 |
buf.Copy( KMVPrefix ); |
|
2682 |
buf.AppendNum( viewId ); |
|
2683 |
||
2684 |
TRAP_IGNORE( |
|
2685 |
statusInfo = |
|
2686 |
iBackSteppingUtility->ForwardActivationEventL( buf, ETrue ); |
|
2687 |
); |
|
2688 |
MPX_DEBUG3("CMPXCommonPlaybackViewImp::HandleForegroundEventL - viewId=0x%x, statusInfo=%d", viewId, statusInfo ); |
|
2689 |
} |
|
2690 |
#endif // BACKSTEPPING_INCLUDED |
|
2691 |
||
2692 |
// Reset state when view's visibility is changed. |
|
2693 |
iSwitchingView = EFalse; |
|
2694 |
||
2695 |
CAknView::HandleForegroundEventL( aForeground ); |
|
2696 |
if ( iContainer ) |
|
2697 |
{ |
|
2698 |
iContainer->HandleForegroundEventL( aForeground ); |
|
2699 |
if ( aForeground ) |
|
2700 |
{ |
|
2701 |
if ( iMedia ) |
|
2702 |
{ |
|
2703 |
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleForegroundEventL iMedia valid" ); |
|
2704 |
MMPXSource* s = iPlaybackUtility->Source(); |
|
2705 |
if ( s && iMedia->IsSupported( KMPXMediaGeneralId ) ) |
|
2706 |
{ |
|
2707 |
CMPXCollectionPlaylist* playlist = s->PlaylistL(); |
|
2708 |
if ( playlist ) |
|
2709 |
{ |
|
2710 |
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleForegroundEventL playlist valid" ); |
|
2711 |
const CMPXCollectionPath& path = playlist->Path(); |
|
2712 |
TMPXItemId id( path.Id() ); |
|
2713 |
delete playlist; |
|
2714 |
TMPXItemId cacheId( |
|
2715 |
iMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ); |
|
2716 |
if ( id != cacheId ) |
|
2717 |
{ |
|
2718 |
MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleForegroundEventL requesting media" ); |
|
2719 |
RequestMediaL(); |
|
66
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
2720 |
UpdateTitlePaneL(); |
53 | 2721 |
} |
2722 |
} |
|
2723 |
} |
|
2724 |
} |
|
2725 |
||
2726 |
iContainer->StartMarquee( ETextTrack ); |
|
2727 |
iContainer->StartMarquee( ETextArtist ); |
|
2728 |
iContainer->DrawNow(); |
|
2729 |
} |
|
2730 |
} |
|
2731 |
||
2732 |
// to stop seek when music player goes to background. |
|
2733 |
if ( iContainer && !aForeground && iIsffButtonPressed ) |
|
2734 |
{ |
|
2735 |
iIsffButtonPressed = EFalse; |
|
2736 |
iContainer->RestoreButtons( iPlaybackState ); |
|
2737 |
iPlaybackUtility->CommandL( EPbCmdStopSeeking ); |
|
2738 |
} |
|
2739 |
||
2740 |
if ( aForeground && ( iViewUtility->ActiveViewType() == TUid::Uid( KMPXPluginTypePlaybackUid )) ) |
|
2741 |
TRAP_IGNORE(UpdateTitlePaneL()); |
|
2742 |
||
2743 |
MPX_DEBUG1( "<---CMPXCommonPlaybackViewImp::HandleForegroundEventL()" ); |
|
2744 |
} |
|
2745 |
||
2746 |
// --------------------------------------------------------------------------- |
|
2747 |
// From MEikMenuObserver |
|
2748 |
// Dynamically initialises a menu pane. |
|
2749 |
// --------------------------------------------------------------------------- |
|
2750 |
// |
|
2751 |
EXPORT_C void CMPXCommonPlaybackViewImp::DynInitMenuPaneL( |
|
2752 |
TInt aResourceId, |
|
2753 |
CEikMenuPane* aMenuPane ) |
|
2754 |
{ |
|
2755 |
TInt usbUnblockingStatus; |
|
2756 |
RProperty::Get( KMPXViewPSUid, |
|
2757 |
KMPXUSBUnblockingPSStatus, |
|
2758 |
usbUnblockingStatus); |
|
2759 |
||
2760 |
switch ( aResourceId ) |
|
2761 |
{ |
|
2762 |
case R_MPX_PLAYBACK_VIEW_MENU: |
|
2763 |
{ |
|
2764 |
if ( iIsffButtonPressed ) |
|
2765 |
{ |
|
2766 |
iIsffButtonPressed = EFalse; |
|
2767 |
iContainer->RestoreButtons( iPlaybackState ); |
|
2768 |
iPlaybackUtility->CommandL( EPbCmdStopSeeking ); |
|
2769 |
} |
|
2770 |
||
2771 |
aMenuPane->SetItemDimmed( EMPXPbvCmdAddToPlaylist, ETrue ); |
|
2772 |
if ( !iMedia ) |
|
2773 |
{ |
|
2774 |
aMenuPane->SetItemDimmed( |
|
2775 |
EMPXPbvCmdRandom, |
|
2776 |
ETrue ); |
|
2777 |
aMenuPane->SetItemDimmed( |
|
2778 |
EMPXPbvCmdRepeat, |
|
2779 |
ETrue ); |
|
2780 |
aMenuPane->SetItemDimmed( |
|
2781 |
EMPXPbvCmdFMTransmitter, |
|
2782 |
ETrue ); |
|
2783 |
aMenuPane->SetItemDimmed( |
|
2784 |
EMPXPbvCmdUpnpPlayVia, |
|
2785 |
ETrue ); |
|
2786 |
aMenuPane->SetItemDimmed( |
|
2787 |
EMPXPbvCmdEqualizer, |
|
2788 |
ETrue ); |
|
2789 |
aMenuPane->SetItemDimmed( |
|
2790 |
EMPXPbvCmdOpenMusicSettings, |
|
2791 |
ETrue ); |
|
2792 |
aMenuPane->SetItemDimmed( |
|
2793 |
EMPXPbvCmdUseAsCascade, |
|
2794 |
ETrue ); |
|
2795 |
} |
|
2796 |
else |
|
2797 |
{ |
|
2798 |
if ( KErrNotFound == iRandomMode && iEmbedded ) |
|
2799 |
{ |
|
2800 |
aMenuPane->SetItemDimmed( |
|
2801 |
EMPXPbvCmdRandom, |
|
2802 |
ETrue ); |
|
2803 |
} |
|
2804 |
if ( KErrNotFound == iRepeatMode && iEmbedded ) |
|
2805 |
{ |
|
2806 |
aMenuPane->SetItemDimmed( |
|
2807 |
EMPXPbvCmdRepeat, |
|
2808 |
ETrue ); |
|
2809 |
} |
|
2810 |
||
2811 |
TBool addToPlDimmed( ETrue ); |
|
2812 |
MMPXSource* s( iPlaybackUtility->Source() ); |
|
2813 |
if ( s ) |
|
2814 |
{ |
|
2815 |
CMPXCollectionPlaylist* playlist( s->PlaylistL() ); |
|
2816 |
if ( playlist ) |
|
2817 |
{ |
|
2818 |
CleanupStack::PushL( playlist ); |
|
2819 |
TInt count( playlist->Count() ); |
|
2820 |
if ( count > 0 ) |
|
2821 |
{ |
|
2822 |
addToPlDimmed = EFalse; |
|
2823 |
} |
|
2824 |
CleanupStack::PopAndDestroy( playlist ); |
|
2825 |
} |
|
2826 |
} |
|
2827 |
TBool isOfflineMode( EFalse ); |
|
2828 |
TBool isFormatNotSupported( EFalse ); |
|
2829 |
if ( !isOfflineMode && iMedia ) |
|
2830 |
{ |
|
2831 |
if ( iMedia->IsSupported( KMPXMediaDrmProtected ) ) |
|
2832 |
{ |
|
2833 |
if ( iMedia->ValueTObjectL<TBool>( KMPXMediaDrmProtected ) && |
|
2834 |
iMedia->IsSupported( KMPXMediaDrmCanSetAutomated ) ) |
|
2835 |
{ |
|
2836 |
// if it's drm protected, check if |
|
2837 |
// KMPXMediaDrmCanSetAutomated |
|
2838 |
isFormatNotSupported = !( |
|
2839 |
iMedia->ValueTObjectL<TBool>( KMPXMediaDrmCanSetAutomated ) ); |
|
2840 |
} |
|
2841 |
} |
|
2842 |
} |
|
2843 |
aMenuPane->SetItemDimmed( |
|
2844 |
EMPXPbvCmdUseAsCascade, |
|
2845 |
!iMedia || isFormatNotSupported || |
|
2846 |
iPlaybackState == EPbStateInitialising ); |
|
2847 |
||
2848 |
// if help is not enabled, do not show "help" |
|
2849 |
if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
2850 |
{ |
|
2851 |
aMenuPane->SetItemDimmed( |
|
2852 |
EAknCmdHelp, |
|
2853 |
ETrue ); |
|
2854 |
} |
|
2855 |
||
2856 |
// Check if HDMI cable is connected |
|
2857 |
TBool isHDMIConnected = iTvOutConfig->HdmiCableConnected(); |
|
2858 |
aMenuPane->SetItemDimmed( EMPXPbvCmdOpenMusicSettings, isHDMIConnected ); |
|
2859 |
aMenuPane->SetItemDimmed( EMPXPbvCmdEqualizer, isHDMIConnected ); |
|
2860 |
||
2861 |
// Check if FM Transmitter is supported |
|
2862 |
if ( !FeatureManager::FeatureSupported( KFeatureIdFmtx ) || isHDMIConnected ) |
|
2863 |
{ |
|
2864 |
aMenuPane->SetItemDimmed( |
|
2865 |
EMPXPbvCmdFMTransmitter, |
|
2866 |
ETrue ); |
|
2867 |
} |
|
2868 |
||
2869 |
||
2870 |
if ( iUpnpFrameworkSupport ) |
|
2871 |
{ |
|
2872 |
if ( !iMedia || !IsUpnpVisibleL() ) |
|
2873 |
{ |
|
2874 |
GetCurrentPlayerDetails(); |
|
2875 |
if ( iCurrentPlayerType == EPbLocal ) |
|
2876 |
{ |
|
2877 |
aMenuPane->SetItemDimmed( |
|
2878 |
EMPXPbvCmdUpnpPlayVia, |
|
2879 |
ETrue); |
|
2880 |
} |
|
2881 |
} |
|
2882 |
} |
|
2883 |
else |
|
2884 |
{ |
|
2885 |
aMenuPane->SetItemDimmed( EMPXPbvCmdUpnpPlayVia, ETrue); |
|
2886 |
} |
|
2887 |
aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden ); |
|
2888 |
if (iServiceHandler->HandleSubmenuL(*aMenuPane)) |
|
2889 |
{ |
|
2890 |
return; |
|
2891 |
} |
|
2892 |
} |
|
2893 |
break; |
|
2894 |
} |
|
2895 |
case R_MPX_PLAYBACK_PLAY_VIA_SUB_MENU: |
|
2896 |
{ |
|
2897 |
if ( iUpnpFrameworkSupport ) |
|
2898 |
{ |
|
2899 |
AddPlayersNamesToMenuL( *aMenuPane ); |
|
2900 |
} |
|
2901 |
break; |
|
2902 |
} |
|
2903 |
case R_MPX_PLAYBACK_REPEAT_SUB_MENU: |
|
2904 |
{ |
|
2905 |
TInt symbolOff = EEikMenuItemSymbolIndeterminate; |
|
2906 |
TInt symbolAll = EEikMenuItemSymbolIndeterminate; |
|
2907 |
TInt symbolOne = EEikMenuItemSymbolIndeterminate; |
|
2908 |
||
2909 |
if ( EPbRepeatOff == iRepeatMode ) |
|
2910 |
{ |
|
2911 |
symbolOff = EEikMenuItemSymbolOn; |
|
2912 |
} |
|
2913 |
else if ( EPbRepeatAll == iRepeatMode ) |
|
2914 |
{ |
|
2915 |
symbolAll = EEikMenuItemSymbolOn; |
|
2916 |
} |
|
2917 |
else |
|
2918 |
{ |
|
2919 |
symbolOne = EEikMenuItemSymbolOn; |
|
2920 |
} |
|
2921 |
||
2922 |
aMenuPane->SetItemButtonState( |
|
2923 |
EMPXPbvCmdRepeatOff, |
|
2924 |
symbolOff ); |
|
2925 |
aMenuPane->SetItemButtonState( |
|
2926 |
EMPXPbvCmdRepeatAll, |
|
2927 |
symbolAll ); |
|
2928 |
aMenuPane->SetItemButtonState( |
|
2929 |
EMPXPbvCmdRepeatOne, |
|
2930 |
symbolOne ); |
|
2931 |
break; |
|
2932 |
} |
|
2933 |
case R_MPX_PLAYBACK_RANDOM_SUB_MENU: |
|
2934 |
{ |
|
2935 |
TInt symbolOff = EEikMenuItemSymbolOn; |
|
2936 |
TInt symbolOn = EEikMenuItemSymbolIndeterminate; |
|
2937 |
||
2938 |
if ( iRandomMode ) |
|
2939 |
{ |
|
2940 |
symbolOff = EEikMenuItemSymbolIndeterminate; |
|
2941 |
symbolOn = EEikMenuItemSymbolOn; |
|
2942 |
} |
|
2943 |
||
2944 |
aMenuPane->SetItemButtonState( |
|
2945 |
EMPXPbvCmdRandomOn, |
|
2946 |
symbolOn ); |
|
2947 |
aMenuPane->SetItemButtonState( |
|
2948 |
EMPXPbvCmdRandomOff, |
|
2949 |
symbolOff ); |
|
2950 |
break; |
|
2951 |
} |
|
2952 |
case R_MPX_PBV_ADD_TO_PL_SUB_MENU: |
|
2953 |
{ |
|
2954 |
TBool dim( ETrue ); |
|
2955 |
delete iUserPlaylists; |
|
2956 |
iUserPlaylists = NULL; |
|
2957 |
iUserPlaylists = iCommonUiHelper->FindPlaylistsL(); |
|
2958 |
if ( iUserPlaylists ) |
|
2959 |
{ |
|
2960 |
const CMPXMediaArray* mediaArray = |
|
2961 |
iUserPlaylists->Value<CMPXMediaArray>( |
|
2962 |
KMPXMediaArrayContents ); |
|
2963 |
User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray)); |
|
2964 |
||
2965 |
TInt entriesCount( mediaArray->Count() ); |
|
2966 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DynInitMenuPaneL Entry count = %d", entriesCount ); |
|
2967 |
if ( entriesCount > 0 ) |
|
2968 |
{ |
|
2969 |
dim = EFalse; |
|
2970 |
} |
|
2971 |
} |
|
2972 |
aMenuPane->SetItemDimmed( EMPXPbvCmdAddToSavedPlaylist, dim ); |
|
2973 |
break; |
|
2974 |
} |
|
2975 |
default: |
|
2976 |
{ |
|
2977 |
// Do nothing |
|
2978 |
break; |
|
2979 |
} |
|
2980 |
} |
|
2981 |
if ( iServiceHandler->IsAiwMenu(aResourceId)) |
|
2982 |
{ |
|
2983 |
MPX_DEBUG1( "CMPXCollectionViewImp::DynInitMenuPaneL(): Aiw menu for assign" ); |
|
2984 |
CAiwGenericParamList& paramList = iServiceHandler->InParamListL(); |
|
2985 |
FillAiwParametersL(paramList, EFalse); |
|
2986 |
iServiceHandler->InitializeMenuPaneL(*aMenuPane, |
|
2987 |
aResourceId, |
|
2988 |
EMPXPbvCmdAiwCmdAssign, |
|
2989 |
paramList); |
|
2990 |
MPX_DEBUG1( "CMPXCollectionViewImp::DynInitMenuPaneL(): Aiw menu for assign end" ); |
|
2991 |
} |
|
2992 |
} |
|
2993 |
||
2994 |
// --------------------------------------------------------------------------- |
|
2995 |
// From MMPXLayoutSwitchObserver |
|
2996 |
// Callback function when layout is changed. |
|
2997 |
// --------------------------------------------------------------------------- |
|
2998 |
// |
|
2999 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleLayoutChange() |
|
3000 |
{ |
|
3001 |
if (iContainer && !iSwitchingView) |
|
3002 |
{ |
|
3003 |
if ( !Layout_Meta_Data::IsLandscapeOrientation() ) |
|
3004 |
{ |
|
3005 |
TUid activeView = iViewUtility->ActiveViewImplementationUid(); |
|
3006 |
||
3007 |
// only switch to flat if current view is not equalizer |
|
3008 |
// since it'll mess up equilizer's screen |
|
3009 |
if ( StatusPane()->CurrentLayoutResId() != |
|
3010 |
R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT && |
|
66
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
3011 |
activeView != KMPXEqualizerViewImplementationId ) |
53 | 3012 |
{ |
3013 |
TRAP_IGNORE( |
|
3014 |
StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT )); |
|
3015 |
} |
|
3016 |
} |
|
3017 |
else |
|
3018 |
{ |
|
3019 |
if ( StatusPane()->CurrentLayoutResId() != |
|
3020 |
R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT ) |
|
3021 |
{ |
|
3022 |
TRAP_IGNORE( |
|
3023 |
StatusPane()->SwitchLayoutL( R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT )); |
|
3024 |
} |
|
3025 |
} |
|
3026 |
||
3027 |
iContainer->SetRect( ClientRect() ); |
|
3028 |
iContainer->DrawDeferred(); |
|
3029 |
} |
|
3030 |
} |
|
3031 |
||
3032 |
// --------------------------------------------------------------------------- |
|
3033 |
// From MCoeViewDeactivationObserver |
|
3034 |
// Handles the activation of the view aNewlyActivatedViewId before |
|
3035 |
// the old view aViewIdToBeDeactivated is to be deactivated. |
|
3036 |
// --------------------------------------------------------------------------- |
|
3037 |
// |
|
3038 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleViewActivation( |
|
3039 |
const TVwsViewId& aNewlyActivatedViewId, |
|
3040 |
const TVwsViewId& aViewIdToBeDeactivated ) |
|
3041 |
{ |
|
3042 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::HandleViewActivation AV" ); |
|
3043 |
// Check if this view is going to be deactivated |
|
3044 |
if ( aViewIdToBeDeactivated.iViewUid == Id() ) |
|
3045 |
{ |
|
3046 |
if ( aNewlyActivatedViewId.iViewUid != Id() ) |
|
3047 |
{ |
|
3048 |
iSwitchingView = ETrue; |
|
3049 |
} |
|
3050 |
} |
|
3051 |
||
3052 |
if ( iPBViewToBeActivated ) |
|
3053 |
{ |
|
3054 |
iLastPBViewActivated = ( aNewlyActivatedViewId.iViewUid == Id() ); |
|
3055 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleViewActivation iLastPBViewActivated %d", iLastPBViewActivated ); |
|
3056 |
} |
|
3057 |
} |
|
3058 |
||
3059 |
// --------------------------------------------------------------------------- |
|
3060 |
// From MMPXViewActivationObserver |
|
3061 |
// Handle view activation. |
|
3062 |
// --------------------------------------------------------------------------- |
|
3063 |
// |
|
3064 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleViewActivation( |
|
3065 |
const TUid& aCurrentViewType, |
|
3066 |
const TUid& /*aPreviousViewType*/ ) |
|
3067 |
{ |
|
3068 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::HandleViewActivation VF" ); |
|
3069 |
iPBViewToBeActivated = ( KMPXPluginTypePlaybackUid == aCurrentViewType.iUid ); |
|
3070 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleViewActivation iPBViewToBeActivated %d", iPBViewToBeActivated ); |
|
3071 |
} |
|
3072 |
// --------------------------------------------------------------------------- |
|
3073 |
// From MMPXViewActivationObserver |
|
3074 |
// --------------------------------------------------------------------------- |
|
3075 |
// |
|
3076 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleViewUpdate( |
|
3077 |
TUid /* aViewUid */, |
|
3078 |
MMPXViewActivationObserver::TViewUpdateEvent /* aUpdateEvent */, |
|
3079 |
TBool /* aLoaded */, |
|
3080 |
TInt /* aData */) |
|
3081 |
{ |
|
3082 |
// Do nothing, this should be handled by the AppUI |
|
3083 |
} |
|
3084 |
||
3085 |
// --------------------------------------------------------------------------- |
|
3086 |
// From MMPXPSKeyObserver |
|
3087 |
// Handle PS event |
|
3088 |
// --------------------------------------------------------------------------- |
|
3089 |
// |
|
3090 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandlePSEvent( |
|
3091 |
TUid aUid, |
|
3092 |
TInt aKey ) |
|
3093 |
{ |
|
3094 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandlePSEvent %d", aKey ); |
|
3095 |
||
3096 |
if ( aUid == KPSUidHWRMFmTx && aKey == KHWRMFmTxStatus ) |
|
3097 |
{ |
|
3098 |
// only responds to FM TX key value change |
|
3099 |
TRAP_IGNORE( UpdateFMTransmitterInfoL() ); |
|
3100 |
} |
|
3101 |
} |
|
3102 |
||
3103 |
// --------------------------------------------------------------------------- |
|
3104 |
// From MMPXCenRepObserver |
|
3105 |
// Handle PS event |
|
3106 |
// --------------------------------------------------------------------------- |
|
3107 |
// |
|
3108 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleSettingChange( |
|
3109 |
const TUid& aRepositoryUid, |
|
3110 |
TUint32 aSettingId ) |
|
3111 |
{ |
|
3112 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleSettingChange %d", aSettingId ); |
|
3113 |
||
3114 |
if ( aRepositoryUid == KCRUidFmTxCenRes && |
|
3115 |
aSettingId == KFmTxCenResKeyFrequency ) |
|
3116 |
{ |
|
3117 |
// only responds to FM Tx Frequency value change |
|
3118 |
TRAP_IGNORE( UpdateFMTransmitterInfoL() ); |
|
3119 |
} |
|
3120 |
} |
|
3121 |
||
3122 |
// ----------------------------------------------------------------------------- |
|
3123 |
// CMPXCommonPlaybackViewImp::IsUpnpVisible |
|
3124 |
// Taken from Gallery upnp support implementation |
|
3125 |
// ----------------------------------------------------------------------------- |
|
3126 |
// |
|
3127 |
EXPORT_C TBool CMPXCommonPlaybackViewImp::IsUpnpVisibleL() |
|
3128 |
{ |
|
3129 |
MPX_FUNC( "CMPXCommonPlaybackViewImp::IsUpnpVisible" ); |
|
3130 |
TBool returnValue = EFalse; |
|
3131 |
||
3132 |
#ifdef UPNP_INCLUDED |
|
3133 |
if ( iUpnpCopyCommand && iUpnpFrameworkSupport ) |
|
3134 |
{ |
|
3135 |
returnValue = iUpnpCopyCommand->IsAvailableL(); |
|
3136 |
} |
|
3137 |
#endif |
|
3138 |
return returnValue; |
|
3139 |
||
3140 |
} |
|
3141 |
||
3142 |
// ----------------------------------------------------------------------------- |
|
3143 |
// CMPXCommonPlaybackViewImp::AddPlayersNamesToMenuL |
|
3144 |
// Add all available players names to the Play via submenu |
|
3145 |
// ----------------------------------------------------------------------------- |
|
3146 |
// |
|
3147 |
EXPORT_C void CMPXCommonPlaybackViewImp::AddPlayersNamesToMenuL( |
|
3148 |
CEikMenuPane& aMenuPane ) |
|
3149 |
{ |
|
3150 |
if ( iUpnpFrameworkSupport ) |
|
3151 |
{ |
|
3152 |
RArray<TMPXPlaybackPlayerType> playerTypes; |
|
3153 |
CleanupClosePushL(playerTypes); |
|
3154 |
||
3155 |
MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager(); |
|
3156 |
manager.GetPlayerTypesL(playerTypes); |
|
3157 |
||
3158 |
GetCurrentPlayerDetails(); |
|
3159 |
||
3160 |
TInt countPlayersTypes( playerTypes.Count() ); |
|
3161 |
TInt countLocalType( 0 ); |
|
3162 |
TInt countRemoteType( 0 ); |
|
3163 |
||
3164 |
if ( countPlayersTypes >= 1 ) |
|
3165 |
{ |
|
3166 |
iPlayersList.Close(); |
|
3167 |
||
3168 |
for ( TInt i = 0; i < countPlayersTypes; i++) |
|
3169 |
{ |
|
3170 |
MPX_DEBUG3( "playerTypes[%d]: %d", i, playerTypes[i] ); |
|
3171 |
switch (playerTypes[i]) |
|
3172 |
{ |
|
3173 |
case EPbLocal: |
|
3174 |
{ |
|
3175 |
// we only show 1 specific type once in the menu |
|
3176 |
if ( countLocalType == 0 ) |
|
3177 |
{ |
|
3178 |
AddPlayerNameToMenuL( aMenuPane, |
|
3179 |
EMPXPbvCmdUpnpPlayViaLocal, |
|
3180 |
manager, |
|
3181 |
playerTypes[i] ); |
|
3182 |
||
3183 |
countLocalType++; |
|
3184 |
} |
|
3185 |
break; |
|
3186 |
} |
|
3187 |
case EPbRemote: |
|
3188 |
{ |
|
3189 |
// we only show 1 specific type once in the menu |
|
3190 |
if ( countRemoteType == 0 ) |
|
3191 |
{ |
|
3192 |
AddPlayerNameToMenuL( aMenuPane, |
|
3193 |
EMPXPbvCmdUpnpPlayViaRemotePlayer, |
|
3194 |
manager, |
|
3195 |
playerTypes[i] ); |
|
3196 |
countRemoteType++; |
|
3197 |
} |
|
3198 |
break; |
|
3199 |
} |
|
3200 |
default: |
|
3201 |
{ |
|
3202 |
// default case is handled in the next loop, we want |
|
3203 |
// to add any "other" player at the end of the list |
|
3204 |
break; |
|
3205 |
} |
|
3206 |
} |
|
3207 |
} // for loop |
|
3208 |
||
3209 |
for ( TInt i = 0; i < countPlayersTypes; i++) |
|
3210 |
{ |
|
3211 |
MPX_DEBUG3( "playerTypes[%d]: %d", i, playerTypes[i] ); |
|
3212 |
// EPbLocal and EPbRemote were already added to the |
|
3213 |
// submenu in the previous loop |
|
3214 |
if ( playerTypes[i] != EPbLocal && |
|
3215 |
playerTypes[i] != EPbRemote ) |
|
3216 |
{ |
|
3217 |
// EPbUnknown or else |
|
3218 |
TBool alreadyInTheList( EFalse ); |
|
3219 |
||
3220 |
for ( TInt j = 0; j < i; j++) |
|
3221 |
{ |
|
3222 |
// if the new playertype is already in the list |
|
3223 |
if ( playerTypes[i] == playerTypes[j] ) |
|
3224 |
{ |
|
3225 |
alreadyInTheList = ETrue; |
|
3226 |
break; |
|
3227 |
} |
|
3228 |
} |
|
3229 |
||
3230 |
if ( !alreadyInTheList ) |
|
3231 |
{ |
|
3232 |
HBufC* buf = manager.PlayerTypeDisplayNameL(playerTypes[i]); |
|
3233 |
||
3234 |
if ( buf ) |
|
3235 |
{ |
|
3236 |
CleanupStack::PushL(buf); |
|
3237 |
AddPlayerNameToMenuL( aMenuPane, |
|
3238 |
EMPXPbvCmdUpnpPlayViaRemotePlayer, |
|
3239 |
manager, |
|
3240 |
playerTypes[i], |
|
3241 |
*buf ); |
|
3242 |
CleanupStack::PopAndDestroy(buf); |
|
3243 |
} |
|
3244 |
// else we don't do anything. other player type is not |
|
3245 |
// currently supported. Implementation will be finalized |
|
3246 |
// when the requirement is defined. |
|
3247 |
} |
|
3248 |
} |
|
3249 |
} |
|
3250 |
} |
|
3251 |
||
3252 |
CleanupStack::PopAndDestroy(&playerTypes); |
|
3253 |
||
3254 |
if ( iPlayersList.Count() <= 1 ) |
|
3255 |
{ |
|
3256 |
aMenuPane.SetItemDimmed( EMPXPbvCmdUpnpPlayViaRemotePlayer, |
|
3257 |
ETrue ); |
|
3258 |
} |
|
3259 |
} |
|
3260 |
else |
|
3261 |
{ |
|
3262 |
// Remove compilation warnings |
|
3263 |
(void)aMenuPane; |
|
3264 |
} |
|
3265 |
} |
|
3266 |
||
3267 |
// ----------------------------------------------------------------------------- |
|
3268 |
// CMPXCommonPlaybackViewImp::AddPlayerNameToMenuL |
|
3269 |
// Add 1 player name to the submenu |
|
3270 |
// ----------------------------------------------------------------------------- |
|
3271 |
// |
|
3272 |
EXPORT_C void CMPXCommonPlaybackViewImp::AddPlayerNameToMenuL( |
|
3273 |
CEikMenuPane& aMenuPane, |
|
3274 |
TInt aCommandId, |
|
3275 |
MMPXPlayerManager& aPlayerManager, |
|
3276 |
TMPXPlaybackPlayerType& aPlayerType, |
|
3277 |
const TDesC& aMenuText ) |
|
3278 |
{ |
|
3279 |
if ( iUpnpFrameworkSupport ) |
|
3280 |
{ |
|
3281 |
RArray<TUid> players; |
|
3282 |
CleanupClosePushL(players); |
|
3283 |
aPlayerManager.GetPlayerListL(players, aPlayerType); |
|
3284 |
||
3285 |
// For now we only keep the first player we find |
|
3286 |
// Local player is always the first one in the list |
|
3287 |
// Ui spec limitation |
|
3288 |
MPX_DEBUG2( "players[0]: %d", players[0].iUid ); |
|
3289 |
if ( aCommandId == EMPXPbvCmdUpnpPlayViaLocal ) |
|
3290 |
{ |
|
3291 |
iPlayersList.Insert(players[0], 0); |
|
3292 |
} |
|
3293 |
else if ( ( aCommandId == EMPXPbvCmdUpnpPlayViaRemotePlayer ) && |
|
3294 |
(iPlayersList.Count() > 1) ) |
|
3295 |
{ |
|
3296 |
iPlayersList.Insert(players[0], 1); |
|
3297 |
} |
|
3298 |
else |
|
3299 |
{ |
|
3300 |
iPlayersList.AppendL(players[0]); |
|
3301 |
} |
|
3302 |
CleanupStack::PopAndDestroy(&players); |
|
3303 |
||
3304 |
// if the player is of unknown type |
|
3305 |
if ( ( aCommandId != EMPXPbvCmdUpnpPlayViaRemotePlayer ) && |
|
3306 |
( aCommandId != EMPXPbvCmdUpnpPlayViaLocal ) ) |
|
3307 |
{ |
|
3308 |
CEikMenuPaneItem::SData menuItem; |
|
3309 |
menuItem.iText.Copy( aMenuText ); |
|
3310 |
menuItem.iCascadeId = 0; |
|
3311 |
menuItem.iFlags = EEikMenuItemRadioEnd; |
|
3312 |
||
3313 |
menuItem.iCommandId = aCommandId + (iPlayersList.Count() - 1); |
|
3314 |
aCommandId = menuItem.iCommandId; |
|
3315 |
||
3316 |
aMenuPane.AddMenuItemL( menuItem ); |
|
3317 |
} |
|
3318 |
||
3319 |
if ( iCurrentPlayerType == aPlayerType ) |
|
3320 |
{ |
|
3321 |
aMenuPane.SetItemButtonState( aCommandId, EEikMenuItemSymbolOn ); |
|
3322 |
} |
|
3323 |
} |
|
3324 |
else |
|
3325 |
{ |
|
3326 |
// Remove compilation warnings |
|
3327 |
(void)aMenuPane; |
|
3328 |
(void)aCommandId; |
|
3329 |
(void)aPlayerManager; |
|
3330 |
(void)aPlayerType; |
|
3331 |
(void)aMenuText; |
|
3332 |
} |
|
3333 |
} |
|
3334 |
||
3335 |
// ----------------------------------------------------------------------------- |
|
3336 |
// CMPXCommonPlaybackViewImp::GetCurrentPlayerDetails |
|
3337 |
// Retrieves the current player name and type |
|
3338 |
// ----------------------------------------------------------------------------- |
|
3339 |
// |
|
3340 |
EXPORT_C void CMPXCommonPlaybackViewImp::GetCurrentPlayerDetails() |
|
3341 |
{ |
|
3342 |
if ( iUpnpFrameworkSupport ) |
|
3343 |
{ |
|
3344 |
||
3345 |
MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager(); |
|
3346 |
TUid currentlyUsedPlayer; |
|
3347 |
TInt currentlyUsedSubPlayer; |
|
3348 |
iCurrentPlayerType = EPbLocal; |
|
3349 |
delete iSubPlayerName; |
|
3350 |
iSubPlayerName = NULL; |
|
3351 |
||
3352 |
TRAP_IGNORE( manager.GetSelectionL( iCurrentPlayerType, |
|
3353 |
currentlyUsedPlayer, |
|
3354 |
currentlyUsedSubPlayer, |
|
3355 |
iSubPlayerName) ); |
|
3356 |
} |
|
3357 |
} |
|
3358 |
||
3359 |
// ----------------------------------------------------------------------------- |
|
3360 |
// CMPXCommonPlaybackViewImp::SelectNewPlayerL |
|
3361 |
// Selects a new player for audio playback |
|
3362 |
// ----------------------------------------------------------------------------- |
|
3363 |
// |
|
3364 |
EXPORT_C void CMPXCommonPlaybackViewImp::SelectNewPlayerL( |
|
3365 |
TInt aCommand ) |
|
3366 |
{ |
|
3367 |
if ( iUpnpFrameworkSupport ) |
|
3368 |
{ |
|
3369 |
MPX_FUNC_EX( "CMPXPlaybackViewImp::SelectNewPlayerL()" ); |
|
3370 |
MPX_DEBUG2( "CMPXPlaybackViewImp::SelectNewPlayerL(%d)", aCommand ); |
|
3371 |
||
3372 |
TInt errorSelectPlayer( KErrCancel ); |
|
3373 |
||
3374 |
MMPXSource* source = iPlaybackUtility->Source(); |
|
3375 |
CMPXCollectionPlaylist* playlist = NULL; |
|
3376 |
if ( source ) |
|
3377 |
{ |
|
3378 |
playlist = source->PlaylistL(); |
|
3379 |
if ( playlist ) |
|
3380 |
{ |
|
3381 |
CleanupStack::PushL( playlist ); |
|
3382 |
iPlaybackUtility->CommandL(EPbCmdPreserveState); |
|
3383 |
} |
|
3384 |
} |
|
3385 |
||
3386 |
switch (aCommand) |
|
3387 |
{ |
|
3388 |
case EMPXPbvCmdUpnpPlayViaLocal: |
|
3389 |
{ |
|
3390 |
// if Local is not already the current player, select it |
|
3391 |
if ( iCurrentPlayerType != EPbLocal ) |
|
3392 |
{ |
|
3393 |
MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager(); |
|
3394 |
MPX_TRAP( errorSelectPlayer, manager.ClearSelectPlayersL() ); |
|
3395 |
} |
|
3396 |
break; |
|
3397 |
} |
|
3398 |
default: |
|
3399 |
{ |
|
3400 |
if ( aCommand >= EMPXPbvCmdUpnpPlayViaRemotePlayer ) |
|
3401 |
{ |
|
3402 |
HBufC* buf = HBufC::NewLC( KMaxUidName ); |
|
3403 |
buf->Des().AppendNum( |
|
3404 |
(iPlayersList[aCommand - |
|
3405 |
EMPXPbvCmdUpnpPlayViaLocal]).iUid ); |
|
3406 |
||
3407 |
// ActivateViewL leaves with KErrCancel if the dialog is |
|
3408 |
// cancelled |
|
3409 |
// ActivateViewL leaves with KErrInUse if the selected player |
|
3410 |
// is already the active player |
|
3411 |
MPX_TRAP(errorSelectPlayer, iViewUtility->ActivateViewL( |
|
3412 |
TUid::Uid( KMPXPluginTypeUPnPBrowseDialogUid ), |
|
3413 |
buf )); |
|
3414 |
CleanupStack::PopAndDestroy( buf ); |
|
3415 |
} |
|
3416 |
break; |
|
3417 |
} |
|
3418 |
} |
|
3419 |
||
3420 |
// A new player was successfully selected, playback view changes |
|
3421 |
if ( errorSelectPlayer == KErrNone ) |
|
3422 |
{ |
|
3423 |
if ( playlist ) |
|
3424 |
{ |
|
3425 |
iViewUtility->PushDefaultHistoryL(); |
|
3426 |
iPlaybackUtility->InitL( *playlist, ETrue ); |
|
3427 |
} |
|
3428 |
} |
|
3429 |
||
3430 |
if (playlist) |
|
3431 |
{ |
|
3432 |
CleanupStack::PopAndDestroy( playlist ); |
|
3433 |
} |
|
3434 |
} |
|
3435 |
else |
|
3436 |
{ |
|
3437 |
// Remove compilation warnings |
|
3438 |
(void)aCommand; |
|
3439 |
} |
|
3440 |
} |
|
3441 |
||
3442 |
// ----------------------------------------------------------------------------- |
|
3443 |
// CMPXCommonPlaybackViewImp::AddToSavedPlaylistL |
|
3444 |
// Adds current item to a saved playlist |
|
3445 |
// ----------------------------------------------------------------------------- |
|
3446 |
// |
|
3447 |
EXPORT_C void CMPXCommonPlaybackViewImp::AddToSavedPlaylistL() |
|
3448 |
{ |
|
3449 |
MPX_DEBUG1("CMPXPlaybackViewImp::AddToSavedPlaylistL(): entering"); |
|
3450 |
||
3451 |
ASSERT( iMedia ); |
|
3452 |
if ( !iUserPlaylists ) |
|
3453 |
{ |
|
3454 |
iUserPlaylists = iCommonUiHelper->FindPlaylistsL(); |
|
3455 |
} |
|
3456 |
||
3457 |
CMPXMedia* media = PrepareMediaForPlaylistLC( *iMedia ); |
|
3458 |
MPX_TRAPD( err, iCommonUiHelper->AddToSavedPlaylistL( |
|
3459 |
*iUserPlaylists, |
|
3460 |
*media, |
|
3461 |
this, |
|
3462 |
this ) ); |
|
3463 |
CleanupStack::PopAndDestroy( media ); |
|
3464 |
if ( KErrNone != err ) |
|
3465 |
{ |
|
3466 |
HandleErrorL( err ); |
|
3467 |
} |
|
3468 |
delete iUserPlaylists; |
|
3469 |
iUserPlaylists = NULL; |
|
3470 |
||
3471 |
MPX_DEBUG1("CMPXPlaybackViewImp::AddToSavedPlaylistL(): exiting"); |
|
3472 |
} |
|
3473 |
||
3474 |
// ----------------------------------------------------------------------------- |
|
3475 |
// CMPXCommonPlaybackViewImp::AddToNewPlaylistL |
|
3476 |
// Adds current item to a new playlist |
|
3477 |
// ----------------------------------------------------------------------------- |
|
3478 |
// |
|
3479 |
EXPORT_C void CMPXCommonPlaybackViewImp::AddToNewPlaylistL() |
|
3480 |
{ |
|
3481 |
MPX_DEBUG1("CMPXPlaybackViewImp::AddToNewPlaylistL(): entering"); |
|
3482 |
||
3483 |
if ( iMedia ) |
|
3484 |
{ |
|
3485 |
CMPXMedia* media( PrepareMediaForPlaylistLC( *iMedia )); |
|
3486 |
iCommonUiHelper->CreatePlaylistL( |
|
3487 |
*media, |
|
3488 |
this, |
|
3489 |
this ); |
|
3490 |
CleanupStack::PopAndDestroy( media ); |
|
3491 |
} |
|
3492 |
delete iUserPlaylists; |
|
3493 |
iUserPlaylists = NULL; |
|
3494 |
||
3495 |
MPX_DEBUG1("CMPXPlaybackViewImp::AddToNewPlaylistL(): exiting"); |
|
3496 |
} |
|
3497 |
||
3498 |
// --------------------------------------------------------------------------- |
|
3499 |
// PrepareMediaForPlaylistLC |
|
3500 |
// Prepares media for adding to a playlist |
|
3501 |
// --------------------------------------------------------------------------- |
|
3502 |
// |
|
3503 |
EXPORT_C CMPXMedia* CMPXCommonPlaybackViewImp::PrepareMediaForPlaylistLC( |
|
3504 |
const CMPXMedia& aMedia ) |
|
3505 |
{ |
|
3506 |
MPX_DEBUG1("CMPXPlaybackViewImp::PrepareMediaForPlaylistLC() entering"); |
|
3507 |
||
3508 |
CMPXMedia* media = CMPXMedia::NewL(); |
|
3509 |
CleanupStack::PushL( media ); |
|
3510 |
CMPXMediaArray* mediaArray = CMPXMediaArray::NewL(); |
|
3511 |
CleanupStack::PushL( mediaArray ); |
|
3512 |
CMPXMedia* entry = CMPXMedia::NewL( aMedia ); |
|
3513 |
CleanupStack::PushL( entry ); |
|
3514 |
mediaArray->AppendL( entry ); |
|
3515 |
CleanupStack::Pop( entry ); |
|
3516 |
media->SetCObjectValueL( |
|
3517 |
KMPXMediaArrayContents, |
|
3518 |
mediaArray ); |
|
3519 |
media->SetTObjectValueL( |
|
3520 |
KMPXMediaArrayCount, |
|
3521 |
mediaArray->Count() ); |
|
3522 |
CleanupStack::PopAndDestroy( mediaArray ); |
|
3523 |
MPX_DEBUG1("CMPXPlaybackViewImp::PrepareMediaForPlaylistLC() exiting"); |
|
3524 |
return media; |
|
3525 |
} |
|
3526 |
||
3527 |
// ----------------------------------------------------------------------------- |
|
3528 |
// CMPXCommonPlaybackViewImp::IsCommandSupportedL |
|
3529 |
// Check if the command is supported by the remote player |
|
3530 |
// ----------------------------------------------------------------------------- |
|
3531 |
// |
|
3532 |
EXPORT_C TBool CMPXCommonPlaybackViewImp::IsCommandSupportedL() |
|
3533 |
{ |
|
3534 |
TBool forwardCommand = ETrue; |
|
3535 |
if ( iUpnpFrameworkSupport && IsUpnpVisibleL() ) |
|
3536 |
{ |
|
3537 |
// retrieve iCurrentPlayerType info |
|
3538 |
GetCurrentPlayerDetails(); |
|
3539 |
||
3540 |
if ( iCurrentPlayerType != EPbLocal) |
|
3541 |
{ |
|
3542 |
// show error note, only in first key press |
|
3543 |
if( !iUnsupportedNoteDisabled ) |
|
3544 |
{ |
|
3545 |
iUnsupportedNoteDisabled = ETrue; |
|
3546 |
iOldPosition = iPosition; |
|
3547 |
if( iContainer && iIsTapped ) |
|
3548 |
{ |
|
3549 |
iContainer->SetNewSongPosition( iPosition * KMPXOneSecInMilliSecs ); |
|
3550 |
} |
|
3551 |
HBufC* dialogText = NULL; |
|
3552 |
TBool setText = EFalse; |
|
3553 |
switch ( iCommandSender ) |
|
3554 |
{ |
|
3555 |
case ECsMediaKey: |
|
3556 |
{ |
|
3557 |
dialogText = StringLoader::LoadLC( R_MPX_MEDIA_KEYS_NOT_SUPPORTED ); |
|
3558 |
setText = ETrue; |
|
3559 |
break; |
|
3560 |
} |
|
3561 |
case ECsRenderer: |
|
3562 |
{ |
|
3563 |
dialogText = StringLoader::LoadLC( R_MPX_REQUEST_REJECTED ); |
|
3564 |
setText = ETrue; |
|
3565 |
break; |
|
3566 |
} |
|
3567 |
default: |
|
3568 |
{ |
|
3569 |
break; |
|
3570 |
} |
|
3571 |
} |
|
3572 |
||
3573 |
if( setText ) |
|
3574 |
{ |
|
3575 |
CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue); |
|
3576 |
errNote->SetTimeout(CAknNoteDialog::ELongTimeout); |
|
3577 |
errNote->ExecuteLD( *dialogText ); |
|
3578 |
CleanupStack::PopAndDestroy( dialogText ); |
|
3579 |
forwardCommand = EFalse; |
|
3580 |
} |
|
3581 |
} |
|
3582 |
} |
|
3583 |
} |
|
3584 |
return forwardCommand; |
|
3585 |
} |
|
3586 |
||
3587 |
// --------------------------------------------------------------------------- |
|
3588 |
// From MProgressDialogCallback |
|
3589 |
// Callback method. Get's called when a dialog is dismissed |
|
3590 |
// --------------------------------------------------------------------------- |
|
3591 |
// |
|
3592 |
EXPORT_C void CMPXCommonPlaybackViewImp::DialogDismissedL( TInt aButtonId ) |
|
3593 |
{ |
|
3594 |
MPX_DEBUG2("--->CMPXCommonPlaybackViewImp::DialogDismissedL(%d)", aButtonId); |
|
3595 |
switch (aButtonId) |
|
3596 |
{ |
|
3597 |
case EAknSoftkeyCancel: |
|
3598 |
case EAknSoftkeyDone: |
|
3599 |
{ |
|
3600 |
break; |
|
3601 |
} |
|
3602 |
default: |
|
3603 |
{ |
|
3604 |
break; |
|
3605 |
} |
|
3606 |
} |
|
3607 |
MPX_DEBUG1("<---CMPXCommonPlaybackViewImp::DialogDismissedL()"); |
|
3608 |
} |
|
3609 |
||
3610 |
// --------------------------------------------------------------------------- |
|
3611 |
// From MMPXCHelperObserver |
|
3612 |
// Callback method. Get's called when a dialog is dismissed |
|
3613 |
// --------------------------------------------------------------------------- |
|
3614 |
// |
|
3615 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleOperationCompleteL( TCHelperOperation /*aOperation*/, |
|
3616 |
TInt aError, |
|
3617 |
void* aArgument ) |
|
3618 |
{ |
|
3619 |
MPX_DEBUG2("CMPXPlaybackViewImp::HandleAddCompletedL(%d) entering", aError); |
|
3620 |
||
3621 |
CMPXMedia* playlist = (CMPXMedia*) aArgument; |
|
3622 |
CleanupStack::PushL( playlist ); |
|
3623 |
||
3624 |
iCommonUiHelper->DismissWaitNoteL(); |
|
3625 |
if ( KErrNone == aError ) |
|
3626 |
{ |
|
3627 |
const TDesC& title( playlist->ValueText( KMPXMediaGeneralTitle ) ); |
|
3628 |
HBufC* confirmTxt( StringLoader::LoadLC( |
|
3629 |
R_MPX_QTN_MUS_NOTE_TRACK_ADDED_TO_PL, |
|
3630 |
title )); |
|
3631 |
CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote(); |
|
3632 |
||
3633 |
TMPlayerSecondaryDisplayNote noteId( EMPlayerNoteAddSongToPlaylist ); |
|
3634 |
note->PublishDialogL( |
|
3635 |
noteId, |
|
3636 |
KMPlayerNoteCategory ); |
|
3637 |
CAknMediatorFacade* covercl( AknMediatorFacade( note ) ); |
|
3638 |
if ( covercl ) |
|
3639 |
{ |
|
3640 |
covercl->BufStream() << title; |
|
3641 |
} |
|
3642 |
||
3643 |
note->ExecuteLD( *confirmTxt ); |
|
3644 |
CleanupStack::PopAndDestroy( confirmTxt ); |
|
3645 |
} |
|
3646 |
else |
|
3647 |
{ |
|
3648 |
HandleErrorL( aError ); |
|
3649 |
} |
|
3650 |
CleanupStack::PopAndDestroy( playlist ); |
|
3651 |
MPX_DEBUG1("CMPXPlaybackViewImp::HandleAddCompletedL() exiting"); |
|
3652 |
} |
|
3653 |
||
3654 |
// ----------------------------------------------------------------------------- |
|
3655 |
// From MMPXCollectionObserver |
|
3656 |
// ----------------------------------------------------------------------------- |
|
3657 |
// |
|
3658 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleCollectionMessage(CMPXMessage* aMsg, |
|
3659 |
TInt aErr ) |
|
3660 |
{ |
|
3661 |
TRAP_IGNORE( DoHandleCollectionMessageL( aMsg, aErr ) ); |
|
3662 |
} |
|
3663 |
||
3664 |
// ----------------------------------------------------------------------------- |
|
3665 |
// From MMPXCollectionObserver |
|
3666 |
// ----------------------------------------------------------------------------- |
|
3667 |
// |
|
3668 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleOpenL(const CMPXMedia& /*aEntries*/, TInt /*aIndex*/, |
|
3669 |
TBool /*aComplete*/, TInt /*aError*/) |
|
3670 |
{ |
|
3671 |
// Do Nothing |
|
3672 |
} |
|
3673 |
||
3674 |
// ----------------------------------------------------------------------------- |
|
3675 |
// From MMPXCollectionObserver |
|
3676 |
// ----------------------------------------------------------------------------- |
|
3677 |
// |
|
3678 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleOpenL(const CMPXCollectionPlaylist& /*aPlaylist*/, |
|
3679 |
TInt /*aError*/) |
|
3680 |
{ |
|
3681 |
// Do Nothing |
|
3682 |
} |
|
3683 |
||
3684 |
// ----------------------------------------------------------------------------- |
|
3685 |
// From MMPXCollectionObserver |
|
3686 |
// ----------------------------------------------------------------------------- |
|
3687 |
// |
|
3688 |
EXPORT_C void CMPXCommonPlaybackViewImp::HandleCommandComplete(CMPXCommand* /*aCommandResult*/, |
|
3689 |
TInt /*aError*/) |
|
3690 |
{ |
|
3691 |
// Do Nothing |
|
3692 |
} |
|
3693 |
||
3694 |
// ---------------------------------------------------------------------------- |
|
3695 |
// void CMPXCommonPlaybackViewImp::DeferredAlbumArtExtractCallback |
|
3696 |
// call back function for deferred view updates. |
|
3697 |
// ---------------------------------------------------------------------------- |
|
3698 |
// |
|
3699 |
TInt CMPXCommonPlaybackViewImp::DeferredAlbumArtExtractCallback( TAny* aPtr ) |
|
3700 |
{ |
|
3701 |
MPX_FUNC( "CMPXCommonPlaybackViewImp::DeferredAlbumArtExtractCallback" ); |
|
3702 |
CMPXCommonPlaybackViewImp* self = |
|
3703 |
static_cast<CMPXCommonPlaybackViewImp*>( aPtr ); |
|
3704 |
TRAP_IGNORE( self->UpdateViewL() ); |
|
3705 |
return KErrNone; |
|
3706 |
} |
|
3707 |
||
3708 |
//---------------------------------------------------------------------------- |
|
3709 |
// CMPXCommonPlaybackViewImp::DelayedExit |
|
3710 |
// call back function for delayed view deactivation |
|
3711 |
//---------------------------------------------------------------------------- |
|
3712 |
// |
|
3713 |
TInt CMPXCommonPlaybackViewImp::DelayedExit( TAny* aPtr ) |
|
3714 |
{ |
|
3715 |
MPX_FUNC( "CMPXCommonPlaybackViewImp::DelayedExit" ); |
|
3716 |
CMPXCommonPlaybackViewImp* self = |
|
3717 |
static_cast<CMPXCommonPlaybackViewImp*>( aPtr ); |
|
3718 |
TRAP_IGNORE( self->HandleCommandL(EAknSoftkeyBack) ); |
|
3719 |
return KErrNone; |
|
3720 |
} |
|
3721 |
||
3722 |
// --------------------------------------------------------------------------- |
|
3723 |
// Handle playback error message. |
|
3724 |
// --------------------------------------------------------------------------- |
|
3725 |
// |
|
3726 |
void CMPXCommonPlaybackViewImp::DoHandleErrorPlaybackMessageL( TInt aError ) |
|
3727 |
{ |
|
3728 |
MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DoHandleErrorPlaybackMessage(): Handle the error %d", aError); |
|
3729 |
||
3730 |
// Request media to handle error. We need to do that in |
|
3731 |
// order to request DRM details. |
|
3732 |
iDelayedError = aError; |
|
3733 |
RequestMediaL( ETrue ); |
|
3734 |
} |
|
3735 |
||
3736 |
// --------------------------------------------------------------------------- |
|
3737 |
// Handle collection message |
|
3738 |
// --------------------------------------------------------------------------- |
|
3739 |
// |
|
3740 |
void CMPXCommonPlaybackViewImp::DoHandleCollectionMessageL( |
|
3741 |
CMPXMessage* aMsg, TInt /*aErr*/ ) |
|
3742 |
{ |
|
3743 |
MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::DoHandleCollectionMessageL" ); |
|
3744 |
if( aMsg ) |
|
3745 |
{ |
|
3746 |
TMPXMessageId id( aMsg->ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) ); |
|
3747 |
if ( KMPXMessageGeneral == id ) |
|
3748 |
{ |
|
3749 |
TInt event( aMsg->ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) ); |
|
3750 |
TInt op( aMsg->ValueTObjectL<TInt>( KMPXMessageGeneralType ) ); |
|
3751 |
TInt data( aMsg->ValueTObjectL<TInt>( KMPXMessageGeneralData ) ); |
|
3752 |
||
3753 |
if( event == TMPXCollectionMessage::EBroadcastEvent && |
|
3754 |
op == EMcMsgDiskRemoved && |
|
3755 |
iContainer && |
|
3756 |
iViewUtility->ActiveViewType() != TUid::Uid(KMPXPluginTypeWaitNoteDialogUid) ) |
|
3757 |
{ |
|
3758 |
TRAP_IGNORE( AknDialogShutter::ShutDialogsL( *CEikonEnv::Static() ) ); |
|
3759 |
StopDisplayingMenuBar(); |
|
3760 |
TRAP_IGNORE( UpdateTitlePaneL() ); // some dialogs change the title. ie equalizer |
|
3761 |
} |
|
3762 |
else if( event == TMPXCollectionMessage::EBroadcastEvent ) |
|
3763 |
{ |
|
3764 |
if( op == EMcMsgUSBMassStorageStart || |
|
3765 |
op == EMcMsgUSBMTPStart || |
|
3766 |
op == EMcMsgFormatStart ) |
|
3767 |
{ |
|
3768 |
iDatabaseNotReady = ETrue; |
|
3769 |
} |
|
3770 |
else if( op == EMcMsgUSBMassStorageEnd || |
|
3771 |
op == EMcMsgUSBMTPEnd || |
|
3772 |
op == EMcMsgFormatEnd ) |
|
3773 |
{ |
|
3774 |
iDatabaseNotReady = EFalse; |
|
3775 |
} |
|
3776 |
else if( op == EMcMsgDiskInserted ) |
|
3777 |
{ |
|
3778 |
// Need to reset the prev/next buttons state if they are pressed at the moment. |
|
3779 |
if (iSkipBtnPressed) |
|
3780 |
{ |
|
3781 |
if ( AknLayoutUtils::PenEnabled() ) |
|
3782 |
{ |
|
3783 |
if ( Toolbar() ) |
|
3784 |
{ |
|
3785 |
CAknToolbar* toolbar = Toolbar(); |
|
3786 |
CAknButton* skipControl; |
|
3787 |
skipControl = (CAknButton*)(toolbar->ComponentControl( 0 )); |
|
3788 |
skipControl->ResetState(); |
|
3789 |
skipControl->DrawNow(); |
|
3790 |
||
3791 |
skipControl = (CAknButton*)(toolbar->ComponentControl( 2 )); |
|
3792 |
skipControl->ResetState(); |
|
3793 |
skipControl->DrawNow(); |
|
3794 |
} |
|
3795 |
} |
|
3796 |
iSkipBtnPressed = EFalse; |
|
3797 |
} |
|
3798 |
} |
|
3799 |
} |
|
3800 |
else if (event == TMPXCollectionMessage::EPathChanged && |
|
3801 |
op == EMcPathChangedByOpen && |
|
3802 |
data == EMcItemOpened) |
|
3803 |
{ // Open new entries |
|
3804 |
MPX_DEBUG1("CMPXPlaybackViewImp::HandleCollectionMessage() New Item Opened"); |
|
3805 |
iNewItemOpened = ETrue; |
|
3806 |
delete iMedia; |
|
3807 |
iMedia = NULL; |
|
3808 |
} |
|
3809 |
} |
|
3810 |
} |
|
3811 |
} |
|
3812 |
||
3813 |
// ----------------------------------------------------------------------------- |
|
3814 |
// CMPXCommonPlaybackViewImp::FillAiwParameters |
|
3815 |
// ----------------------------------------------------------------------------- |
|
3816 |
// |
|
3817 |
void CMPXCommonPlaybackViewImp::FillAiwParametersL( |
|
3818 |
CAiwGenericParamList& aParamList, TBool aSaved ) |
|
3819 |
{ |
|
3820 |
TFileName location(NULL); |
|
3821 |
if ( aSaved ) |
|
3822 |
{ |
|
3823 |
location = MPXTlsHelper::FilePath(); |
|
3824 |
} |
|
3825 |
||
3826 |
if ( !location.Length()) |
|
3827 |
{ |
|
3828 |
location = iMedia->ValueText( KMPXMediaGeneralUri ); |
|
3829 |
} |
|
3830 |
||
3831 |
MPX_DEBUG1( "Todd CMPXCommonPlaybackViewImp::FillAiwParametersL location=" ); |
|
3832 |
#ifdef _DEBUG |
|
3833 |
RDebug::RawPrint(location); |
|
3834 |
#endif |
|
3835 |
||
3836 |
TPtrC mimeType(iMedia->ValueText( KMPXMediaGeneralMimeType )); |
|
3837 |
MPX_DEBUG1( "Todd CMPXCommonPlaybackViewImp::FillAiwParametersL mime=" ); |
|
3838 |
#ifdef _DEBUG |
|
3839 |
RDebug::RawPrint(mimeType); |
|
3840 |
#endif |
|
3841 |
TAiwVariant varMime(mimeType); |
|
3842 |
if ( !mimeType.Length() && ( iMediaRecognizer ) ) |
|
3843 |
{ |
|
3844 |
varMime.Set(iMediaRecognizer->MimeTypeL(location)); |
|
3845 |
} |
|
3846 |
TAiwGenericParam paramMime(EGenericParamMIMEType, varMime); |
|
3847 |
aParamList.Reset(); |
|
3848 |
aParamList.AppendL(paramMime); |
|
3849 |
TAiwVariant varFile(location); |
|
3850 |
TAiwGenericParam paramFile(EGenericParamFile, varFile); |
|
3851 |
aParamList.AppendL(paramFile); |
|
3852 |
} |
|
3853 |
||
3854 |
// --------------------------------------------------------------------------- |
|
3855 |
// Updates the middle softkey display |
|
3856 |
// --------------------------------------------------------------------------- |
|
3857 |
// |
|
3858 |
EXPORT_C void CMPXCommonPlaybackViewImp::UpdateMiddleSoftKeyDisplayL() |
|
3859 |
{ |
|
3860 |
MPX_FUNC("CMPXCommonPlaybackViewImp::UpdateMiddleSoftKeyDisplayL"); |
|
3861 |
||
3862 |
if (iContainer && !AknLayoutUtils::PenEnabled() ) |
|
3863 |
{ |
|
3864 |
CEikButtonGroupContainer* cba = Cba(); |
|
3865 |
if (cba) |
|
3866 |
{ |
|
3867 |
MMPXSource* s = iPlaybackUtility->Source(); |
|
3868 |
if ( s ) |
|
3869 |
{ |
|
3870 |
CMPXCollectionPlaylist* playlist = s->PlaylistL(); |
|
3871 |
if ( playlist ) |
|
3872 |
{ |
|
3873 |
CleanupStack::PushL( playlist ); |
|
3874 |
if ( playlist->Count() > 0 ) |
|
3875 |
{ |
|
3876 |
TMPXPlaybackState state = iPlaybackUtility->StateL(); |
|
3877 |
||
3878 |
if ((state == EPbStateInitialising) ||(state == EPbStatePlaying)) |
|
3879 |
{ |
|
3880 |
iCommonUiHelper->SetMiddleSoftKeyLabelL( *cba, R_QTN_MSK_PAUSE, EAknSoftkeyForwardKeyEvent); |
|
3881 |
} |
|
3882 |
else |
|
3883 |
{ |
|
3884 |
iCommonUiHelper->SetMiddleSoftKeyLabelL( *cba, R_QTN_MSK_PLAY, EAknSoftkeyForwardKeyEvent); |
|
3885 |
} |
|
3886 |
} |
|
3887 |
CleanupStack::PopAndDestroy( playlist ); |
|
3888 |
} |
|
3889 |
} |
|
3890 |
MPX_DEBUG1("CMPXCommonPlaybackViewImp::UpdateMiddleSoftKeyDisplayL - new label displayed"); |
|
3891 |
||
3892 |
cba->DrawDeferred(); |
|
3893 |
} |
|
3894 |
} |
|
3895 |
} |
|
3896 |
||
3897 |
// --------------------------------------------------------------------------- |
|
3898 |
// Updates the middle toolbar button |
|
3899 |
// --------------------------------------------------------------------------- |
|
3900 |
// |
|
3901 |
EXPORT_C void CMPXCommonPlaybackViewImp::UpdateToolbarL() |
|
3902 |
{ |
|
3903 |
MPX_FUNC("CMPXCommonPlaybackViewImp::UpdateToolbarL"); |
|
3904 |
||
3905 |
if ( AknLayoutUtils::PenEnabled() ) |
|
3906 |
{ |
|
3907 |
if ( Toolbar() ) |
|
3908 |
{ |
|
3909 |
CAknToolbar* toolbar = Toolbar(); |
|
3910 |
toolbar->SetDimmed( EFalse ); |
|
3911 |
CAknButton* rwControl; |
|
3912 |
rwControl = (CAknButton*)(toolbar->ComponentControl( 0 )); |
|
3913 |
CAknButton* pausePlayControl; |
|
3914 |
pausePlayControl = (CAknButton*)(toolbar->ComponentControl( 1 )); |
|
3915 |
CAknButton* fwControl; |
|
3916 |
fwControl = (CAknButton*)(toolbar->ComponentControl( 2 )); |
|
3917 |
MMPXSource* s = iPlaybackUtility->Source(); |
|
3918 |
if ( s ) |
|
3919 |
{ |
|
3920 |
CMPXCollectionPlaylist* playlist = s->PlaylistL(); |
|
3921 |
if ( playlist ) |
|
3922 |
{ |
|
3923 |
CleanupStack::PushL( playlist ); |
|
3924 |
if ( playlist->Count() > 0 ) |
|
3925 |
{ |
|
3926 |
if( pausePlayControl ) |
|
3927 |
{ |
|
3928 |
TMPXPlaybackState state = iPlaybackUtility->StateL(); |
|
66
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
3929 |
if ((state == EPbStateInitialising) || (state == EPbStatePlaying)) |
53 | 3930 |
{ |
3931 |
pausePlayControl->SetCurrentState(0, ETrue); |
|
3932 |
} |
|
66
1f1dad4af8f8
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
53
diff
changeset
|
3933 |
else |
53 | 3934 |
{ |
3935 |
pausePlayControl->SetCurrentState(1, ETrue); |
|
3936 |
} |
|
3937 |
} |
|
3938 |
||
3939 |
if( rwControl && fwControl ) |
|
3940 |
{ |
|
3941 |
rwControl->SetDimmed( EFalse ); |
|
3942 |
rwControl->DrawNow(); |
|
3943 |
fwControl->SetDimmed( EFalse ); |
|
3944 |
fwControl->DrawNow(); |
|
3945 |
} |
|
3946 |
} |
|
3947 |
||
3948 |
CleanupStack::PopAndDestroy( playlist ); |
|
3949 |
} |
|
3950 |
else |
|
3951 |
{ |
|
3952 |
if( pausePlayControl ) |
|
3953 |
{ |
|
3954 |
TMPXPlaybackState state = iPlaybackUtility->StateL(); |
|
3955 |
if ( ( state == EPbStateInitialising ) || |
|
3956 |
( state == EPbStatePlaying ) ) |
|
3957 |
{ |
|
3958 |
pausePlayControl->SetCurrentState( 0, ETrue ); |
|
3959 |
} |
|
3960 |
else |
|
3961 |
{ |
|
3962 |
pausePlayControl->SetCurrentState( 1, ETrue ); |
|
3963 |
} |
|
3964 |
} |
|
3965 |
} |
|
3966 |
} |
|
3967 |
else |
|
3968 |
{ |
|
3969 |
toolbar->SetDimmed( ETrue ); |
|
3970 |
} |
|
3971 |
} |
|
3972 |
} |
|
3973 |
} |
|
3974 |
// ---------------------------------------------------------------------------- |
|
3975 |
// Callback function of timer to handle delayed error |
|
3976 |
// ---------------------------------------------------------------------------- |
|
3977 |
// |
|
3978 |
TInt CMPXCommonPlaybackViewImp::HandleDelayedError( TAny* aPtr ) |
|
3979 |
{ |
|
3980 |
TInt ret( KErrNone ); |
|
3981 |
TInt index( KErrNotFound ); |
|
3982 |
CMPXCommonPlaybackViewImp* pv = reinterpret_cast<CMPXCommonPlaybackViewImp*>( aPtr ); |
|
3983 |
pv->iDelayedErrorTimer->Cancel(); |
|
3984 |
// compare index |
|
3985 |
if ( pv->iPlaybackUtility ) |
|
3986 |
{ |
|
3987 |
MMPXSource* source( pv->iPlaybackUtility->Source() ); |
|
3988 |
if ( source ) |
|
3989 |
{ |
|
3990 |
CMPXCollectionPlaylist* pl( NULL ); |
|
3991 |
MPX_TRAP( ret, pl = source->PlaylistL() ); |
|
3992 |
if( ret != KErrNone ) |
|
3993 |
{ |
|
3994 |
return ret; |
|
3995 |
} |
|
3996 |
if ( pl ) |
|
3997 |
{ |
|
3998 |
index = pl->Index(); |
|
3999 |
} |
|
4000 |
if ( pv->iErrIndex == index ) |
|
4001 |
{ |
|
4002 |
MPX_TRAP( ret, pv->HandleErrorL( pv->iLastDelayedErr ) ); |
|
4003 |
} |
|
4004 |
||
4005 |
delete pl; |
|
4006 |
pl = NULL; |
|
4007 |
||
4008 |
} |
|
4009 |
} |
|
4010 |
||
4011 |
return ret; |
|
4012 |
} |
|
4013 |
||
4014 |
// --------------------------------------------------------------------------- |
|
4015 |
// Updates track's album art. |
|
4016 |
// --------------------------------------------------------------------------- |
|
4017 |
// |
|
4018 |
TInt CMPXCommonPlaybackViewImp::HandleTNRequestForCustomSizeL( TAny* aPtr ) |
|
4019 |
{ |
|
4020 |
MPX_DEBUG1("CMPXCommonPlaybackViewImp::HandleTNRequestForCustomSizeL()"); |
|
4021 |
||
4022 |
ASSERT( aPtr ); |
|
4023 |
CMPXCommonPlaybackViewImp* pv = reinterpret_cast<CMPXCommonPlaybackViewImp*>( aPtr ); |
|
4024 |
||
4025 |
ASSERT( pv->iOldUri ); |
|
4026 |
if ( pv->iContainer && !pv->iSwitchingView ) |
|
4027 |
{ |
|
4028 |
TInt err( KErrNone ); |
|
4029 |
if ( pv->iMedia && pv->iMedia->IsSupported(KMPXMediaGeneralUri) ) |
|
4030 |
{ |
|
4031 |
const TDesC& album = pv->iMedia->ValueText( KMPXMediaGeneralUri ); |
|
4032 |
||
4033 |
if ( pv->iOldUri->Compare( album ) == 0 ) |
|
4034 |
{ |
|
4035 |
TRect albumArtRect( |
|
4036 |
pv->iLayout->IndicatorLayout( |
|
4037 |
pv->ClientRect(), EAlbumArtArea ) ); |
|
4038 |
||
4039 |
// Request for custom TN size |
|
4040 |
MPX_TRAP( err, |
|
4041 |
pv->iMPXUtility->ExtractAlbumArtL( |
|
4042 |
*pv->iMedia, |
|
4043 |
*pv->iContainer, |
|
4044 |
albumArtRect.Size(), |
|
4045 |
EFalse ); ); |
|
4046 |
} |
|
4047 |
} |
|
4048 |
||
4049 |
if ( KErrNone != err ) |
|
4050 |
{ |
|
4051 |
// If error, show default album art |
|
4052 |
MPX_DEBUG2("CMPXCommonPlaybackViewImp::HandleTNRequestForCustomSizeL(): err = %d", err); |
|
4053 |
pv->iContainer->ExtractAlbumArtCompleted( NULL, KErrNone ); |
|
4054 |
} |
|
4055 |
} |
|
4056 |
||
4057 |
// cancel timer |
|
4058 |
if ( pv->iTNRequestTimer->IsActive()) |
|
4059 |
{ |
|
4060 |
pv->iTNRequestTimer->Cancel(); |
|
4061 |
} |
|
4062 |
||
4063 |
return KErrNone; |
|
4064 |
} |
|
4065 |
||
4066 |
// --------------------------------------------------------------------------- |
|
4067 |
// Launch Metadata Dialog to show the file details |
|
4068 |
// --------------------------------------------------------------------------- |
|
4069 |
// |
|
4070 |
EXPORT_C void CMPXCommonPlaybackViewImp::LaunchFileDetailsDialogL() |
|
4071 |
{ |
|
4072 |
MPX_FUNC("CMPXCommonPlaybackViewImp::LaunchFileDetailsDialogL"); |
|
4073 |
||
4074 |
// Activate Metadata dialog via View Framework |
|
4075 |
CAknToolbar* toolbar = Toolbar(); |
|
4076 |
if ( toolbar ) |
|
4077 |
{ |
|
4078 |
toolbar->SetToolbarVisibility(EFalse); |
|
4079 |
} |
|
4080 |
TRAP_IGNORE( iViewUtility->ActivateViewL( TUid::Uid(KMPXPluginTypeMetadataEditorUid) ) ); |
|
4081 |
if ( toolbar ) |
|
4082 |
{ |
|
4083 |
toolbar->SetToolbarVisibility(ETrue); |
|
4084 |
} |
|
4085 |
iContainer->SetRect( ClientRect()); |
|
4086 |
iContainer->DrawDeferred(); |
|
4087 |
} |
|
4088 |
||
4089 |
// End of File |