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