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 Collection view container
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <e32cmn.h>
|
|
21 |
#include <e32math.h>
|
|
22 |
#include <s32file.h>
|
|
23 |
#include <gulicon.h>
|
|
24 |
#include <hlplch.h>
|
|
25 |
#include <StringLoader.h>
|
|
26 |
#include <aknview.h>
|
|
27 |
#include <aknappui.h>
|
|
28 |
#include <AknIconArray.h>
|
|
29 |
#include <aknlists.h>
|
|
30 |
#include <aknPopup.h>
|
|
31 |
#include <akncontext.h>
|
|
32 |
#include <AknsBasicBackgroundControlContext.h>
|
|
33 |
#include <data_caging_path_literals.hrh>
|
|
34 |
|
|
35 |
#include <mpxlog.h>
|
|
36 |
#include <mpxuser.h>
|
|
37 |
#include <mpxmedia.h>
|
|
38 |
#include <mpxmediaarray.h>
|
|
39 |
#include <mpxconstants.h>
|
|
40 |
#include <mpxmediageneraldefs.h>
|
|
41 |
#include <mpxplaybackframeworkdefs.h>
|
|
42 |
#include <mpxmediacontainerdefs.h>
|
|
43 |
#include <mpxmediageneraldefs.h>
|
|
44 |
#include <mpxmediamusicdefs.h>
|
|
45 |
#include <mpxmediacollectiondetaildefs.h>
|
|
46 |
#include <mpxcommandgeneraldefs.h>
|
|
47 |
#include <mpxpodcastdefs.h>
|
|
48 |
#include <mpxcommonuihelper.h>
|
|
49 |
#include <mpxcollectionplaylist.h>
|
|
50 |
#include <mpxcollectionuihelper.h>
|
|
51 |
#include <mpxcollectionhelperfactory.h>
|
|
52 |
#include <mpxcollectionutility.h>
|
|
53 |
#include <mpxcollectionpath.h>
|
|
54 |
#include <mpxplaybackutility.h>
|
|
55 |
#include <mpxcollectionviewhg.rsg>
|
|
56 |
#include <mpxcollectionviewhg.mbg>
|
|
57 |
#include <mpxappui.hrh>
|
|
58 |
#include <mpxmusicplayerviewplugin.hrh>
|
|
59 |
|
|
60 |
#include <ganes/HgDoubleGraphicListFlat.h>
|
|
61 |
#include <ganes/HgSingleGraphicList.h>
|
|
62 |
#include <ganes/HgSingleTextListWithIcon.h>
|
|
63 |
#include <ganes/HgVgItem.h>
|
|
64 |
#include <ganes/HgItem.h>
|
|
65 |
#include <ganes/HgScrollerWithTitle.h>
|
|
66 |
#include <ganes/HgVgMediaWall.h>
|
|
67 |
|
|
68 |
#include <layoutmetadata.cdl.h>
|
|
69 |
#include <AknLayout2ScalableDef.h>
|
|
70 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
71 |
#include <akntranseffect.h> // For transition effects
|
|
72 |
#include <gfxtranseffect/gfxtranseffect.h> // For transition effects
|
|
73 |
|
|
74 |
#include "mpxcommoncontainer.hrh"
|
|
75 |
#include "mpxcollectionviewhg.hrh"
|
|
76 |
#include "mpxcollectionviewhglistboxarray.h"
|
|
77 |
#include "mpxcollectionviewhg.hlp.hrh"
|
|
78 |
#include "mpxcollectionviewhgcontainer.h"
|
|
79 |
#include "mpxcollectionviewhgplaylisthelper.h"
|
|
80 |
#include "mpxcollectionviewhgtnloader.h"
|
|
81 |
#include "mpxcbahandler.h"
|
|
82 |
#include "mpxselectedalbumhandler.h"
|
|
83 |
#include "mpxpopuplist.h"
|
|
84 |
#include "mpxcollectionviewhgswitchbuffer.h"
|
|
85 |
|
|
86 |
// CONSTANTS
|
|
87 |
_LIT( KMPXCollectionViewRscPath, "mpxcollectionviewhg.rsc" );
|
|
88 |
_LIT( KMPXCollectionViewIconFile, "mpxcollectionviewhg.mbm" );
|
|
89 |
const TInt KMPXListSelectionCount = 5;
|
|
90 |
const TInt KMPXMinSecSeparatorIndex = 2;
|
|
91 |
const TInt KOneHourInSeconds = 3600;
|
|
92 |
const TInt KMPXTimeIndicatorLength = 16;
|
|
93 |
#ifdef __WINS__
|
|
94 |
const TInt KMPXListBufferSize = 20;
|
|
95 |
#else
|
|
96 |
const TInt KMPXListBufferSize = 400;
|
|
97 |
#endif
|
|
98 |
// Added by Harri. Buffer size has to be smaller with mediawall, otherwise IVE3 runs out of memory
|
|
99 |
#ifdef __WINS__
|
|
100 |
const TInt KMPXListBufferSizeWithMediaWall = 20;
|
|
101 |
#else
|
|
102 |
const TInt KMPXListBufferSizeWithMediaWall = 40;
|
|
103 |
#endif
|
|
104 |
const TInt KMPXMaxFileLength = 256;
|
|
105 |
const TReal KIconFactor = 0.7;
|
|
106 |
|
|
107 |
const TInt KThumbLoadingPauseForTransition(500000);
|
|
108 |
const TInt KMPXInterviewTransition = 0;
|
|
109 |
const TInt KMPXIntraviewTransition = 1;
|
|
110 |
const TInt KMPXNoTransition = 2;
|
|
111 |
|
|
112 |
_LIT( KMPXDash, " - " );
|
|
113 |
#ifdef HG_MP_LOC_AVAILABLE
|
|
114 |
_LIT( KMPXSpace, " ");
|
|
115 |
#endif //HG_MP_LOC_AVAILABLE
|
|
116 |
_LIT( KMPXZeroDurationMark, "--");
|
|
117 |
|
|
118 |
|
|
119 |
// ======== MEMBER FUNCTIONS ========
|
|
120 |
|
|
121 |
// ---------------------------------------------------------------------------
|
|
122 |
// Two-phased constructor.
|
|
123 |
// ---------------------------------------------------------------------------
|
|
124 |
//
|
|
125 |
CMPXCollectionViewHgContainer* CMPXCollectionViewHgContainer::NewL(
|
|
126 |
MEikCommandObserver* aView,
|
|
127 |
MEikListBoxObserver* aObserver,
|
|
128 |
MMPXSelectedAlbumHandler* aSelectedAlbumHandler,
|
|
129 |
TBool aIsEmbedded)
|
|
130 |
{
|
|
131 |
MPX_FUNC( "CMPXCollectionViewHgContainer::NewL" );
|
|
132 |
CMPXCollectionViewHgContainer* self =
|
|
133 |
new ( ELeave ) CMPXCollectionViewHgContainer(
|
|
134 |
aView, aObserver, aSelectedAlbumHandler, aIsEmbedded);
|
|
135 |
CleanupStack::PushL( self );
|
|
136 |
self->ConstructL();
|
|
137 |
CleanupStack::Pop( self );
|
|
138 |
return self;
|
|
139 |
}
|
|
140 |
|
|
141 |
// ---------------------------------------------------------------------------
|
|
142 |
// C++ constructor can NOT contain any code that might leave.
|
|
143 |
// ---------------------------------------------------------------------------
|
|
144 |
//
|
|
145 |
CMPXCollectionViewHgContainer::CMPXCollectionViewHgContainer(
|
|
146 |
MEikCommandObserver* aView,
|
|
147 |
MEikListBoxObserver* aObserver,
|
|
148 |
MMPXSelectedAlbumHandler* aSelectedAlbumHandler,
|
|
149 |
TBool aIsEmbedded) :
|
|
150 |
iView( aView ),
|
|
151 |
iListBoxObserver( aObserver ),
|
|
152 |
iReady( EFalse ),
|
|
153 |
iIsEmbedded(aIsEmbedded),
|
|
154 |
iCurrentDefaultIcon( EMPXDefaultIconNotSet ),
|
|
155 |
iContext( EContextUnknown ),
|
|
156 |
iTopIndex( 0 ),
|
|
157 |
iBottomIndex( KErrNotFound ),
|
|
158 |
iAlbumIndex(KErrNotFound),
|
|
159 |
iSelectedAlbumIndex(KErrNotFound),
|
|
160 |
iRestoredAlbumIndex(KErrNotFound),
|
|
161 |
iSelectedAlbumHandler (aSelectedAlbumHandler),
|
|
162 |
iOpenAlbumTracks(EFalse),
|
|
163 |
iShuffleItem(0),
|
|
164 |
iSetEmptyTextNeeded(EFalse),
|
|
165 |
iPopupListRect(TRect(0,0,0,0)),
|
|
166 |
iPreviousViewId(TUid::Uid(0)),
|
|
167 |
iDrawBackGround(EFalse),
|
|
168 |
iIsNowPlayingView(EFalse)
|
|
169 |
{
|
|
170 |
}
|
|
171 |
|
|
172 |
// ---------------------------------------------------------------------------
|
|
173 |
// Destructor
|
|
174 |
// ---------------------------------------------------------------------------
|
|
175 |
//
|
|
176 |
CMPXCollectionViewHgContainer::~CMPXCollectionViewHgContainer()
|
|
177 |
{
|
|
178 |
MPX_FUNC( "CMPXCollectionViewHgContainer::~CMPXCollectionViewHgContainer" );
|
|
179 |
delete iSongTitle;
|
|
180 |
delete iAlbumTitle;
|
|
181 |
|
|
182 |
if ( iResourceOffset )
|
|
183 |
{
|
|
184 |
iEikonEnv->DeleteResourceFile( iResourceOffset );
|
|
185 |
}
|
|
186 |
delete iListSelections;
|
|
187 |
delete iListBoxArray;
|
|
188 |
delete iIconArray;
|
|
189 |
delete iMediaWall;
|
|
190 |
delete iMwListWidget;
|
|
191 |
delete iListWidget;
|
|
192 |
delete iOrigIcon;
|
|
193 |
delete iCommonUiHelper;
|
|
194 |
CancelTNRequest();
|
|
195 |
iThumbnailReqMap.Close();
|
|
196 |
delete iThumbnailManager;
|
|
197 |
delete iBgContext;
|
|
198 |
delete iSelectedMediaInAlbumView;
|
|
199 |
if ( iCollectionUtility )
|
|
200 |
{
|
|
201 |
iCollectionUtility->Close();
|
|
202 |
}
|
|
203 |
|
|
204 |
if ( iCollectionUiHelper)
|
|
205 |
{
|
|
206 |
iCollectionUiHelper->Close();
|
|
207 |
}
|
|
208 |
|
|
209 |
if ( iPlaybackUtility )
|
|
210 |
{
|
|
211 |
iPlaybackUtility->Close();
|
|
212 |
}
|
|
213 |
|
|
214 |
delete iPlaylist;
|
|
215 |
delete iPlaylistHelper;
|
|
216 |
|
|
217 |
iCoeEnv->RemoveForegroundObserver( *this );
|
|
218 |
}
|
|
219 |
|
|
220 |
// ---------------------------------------------------------------------------
|
|
221 |
// Symbian 2nd phase constructor can leave.
|
|
222 |
// ---------------------------------------------------------------------------
|
|
223 |
//
|
|
224 |
void CMPXCollectionViewHgContainer::ConstructL()
|
|
225 |
{
|
|
226 |
MPX_FUNC( "CMPXCollectionViewHgContainer::ConstructL" );
|
|
227 |
|
|
228 |
CCoeEnv* coeEnv( iEikonEnv );
|
|
229 |
TParse parse;
|
|
230 |
parse.Set( KMPXCollectionViewRscPath, &KDC_APP_RESOURCE_DIR, NULL );
|
|
231 |
TFileName resourceFile( parse.FullName() );
|
|
232 |
User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
|
|
233 |
BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
|
|
234 |
iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
|
|
235 |
|
|
236 |
iAlbumTitle = StringLoader::LoadL( R_MPX_COLLECTION_DETAILS_ONE_ALBUM );
|
|
237 |
iSongTitle = StringLoader::LoadL( R_MPX_COLLECTION_DETAILS_ONE_SONG );
|
|
238 |
|
|
239 |
if ( !iCollectionUiHelper )
|
|
240 |
{
|
|
241 |
iCollectionUiHelper = CMPXCollectionHelperFactory:: NewCollectionUiHelperL();
|
|
242 |
}
|
|
243 |
iCollectionUtility = MMPXCollectionUtility::NewL( NULL, KMcModeDefault );
|
|
244 |
iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
|
|
245 |
|
|
246 |
iPlaylistHelper = CMPXCollectionViewHgPlaylistHelper::NewL(iPlaybackUtility, iCollectionUiHelper);
|
|
247 |
|
|
248 |
TRect mainPane( 0,0,0,0 );
|
|
249 |
iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgScreen, mainPane, ETrue);
|
|
250 |
|
|
251 |
iBgContext->SetRect(((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect());
|
|
252 |
|
|
253 |
// Common methods used for 2-line list support
|
|
254 |
iCommonUiHelper = CMPXCommonUiHelper::NewL();
|
|
255 |
iListSelections = new (ELeave) CArrayFixFlat<TInt>( KMPXListSelectionCount );
|
|
256 |
|
|
257 |
iThumbnailManager = CMpxTNLoader::NewL( *this, EAudioListThumbnailSize );
|
|
258 |
|
|
259 |
iImageSize = CHgDoubleGraphicListFlat::PreferredImageSize();
|
|
260 |
iListBoxArray = static_cast<CMPXCollectionViewListBoxArray*>(
|
|
261 |
CreateListBoxArrayL() );
|
|
262 |
|
|
263 |
CreateIconArrayL();
|
|
264 |
|
|
265 |
iIsForeground = ETrue;
|
|
266 |
iCoeEnv->AddForegroundObserverL( *this );
|
|
267 |
|
|
268 |
iPreviousOrientation = Layout_Meta_Data::IsLandscapeOrientation();
|
|
269 |
|
|
270 |
GfxTransEffect::Enable();
|
|
271 |
|
|
272 |
CreateWindowL();
|
|
273 |
ActivateL();
|
|
274 |
}
|
|
275 |
|
|
276 |
// -----------------------------------------------------------------------------
|
|
277 |
// CMPXCollectionViewHgContainer::MopSupplyObject
|
|
278 |
// -----------------------------------------------------------------------------
|
|
279 |
//
|
|
280 |
TTypeUid::Ptr CMPXCollectionViewHgContainer::MopSupplyObject( TTypeUid aId )
|
|
281 |
{
|
|
282 |
MPX_FUNC( "CMPXCollectionViewHgContainer::MopSupplyObject" );
|
|
283 |
if( aId.iUid == MAknsControlContext::ETypeId && iBgContext )
|
|
284 |
{
|
|
285 |
return MAknsControlContext::SupplyMopObject(aId, iBgContext );
|
|
286 |
}
|
|
287 |
|
|
288 |
return CCoeControl::MopSupplyObject(aId);
|
|
289 |
}
|
|
290 |
|
|
291 |
// ---------------------------------------------------------------------------
|
|
292 |
// Sets playback status
|
|
293 |
// ---------------------------------------------------------------------------
|
|
294 |
//
|
|
295 |
void CMPXCollectionViewHgContainer::SetPlaybackStatusByIdL(
|
|
296 |
TMPXItemId aId, TMPXPlaybackState aStatus, TInt aIndex)
|
|
297 |
{
|
|
298 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetPlaybackStatusByIdL" );
|
|
299 |
if ( iListBoxArray )
|
|
300 |
{
|
|
301 |
TInt index( iListBoxArray->SetPlaybackStatusByIdL( aId, aStatus, aIndex ) );
|
|
302 |
if ( index != KErrNotFound )
|
|
303 |
{
|
|
304 |
// Update the previous item as not playing anymore
|
|
305 |
DrawLbxItemL( index );
|
|
306 |
}
|
|
307 |
index = iListBoxArray->GetPlaybackIndex();
|
|
308 |
if ( index != KErrNotFound )
|
|
309 |
{
|
|
310 |
// Update new item as playing
|
|
311 |
DrawLbxItemL( index );
|
|
312 |
}
|
|
313 |
}
|
|
314 |
}
|
|
315 |
|
|
316 |
// ---------------------------------------------------------------------------
|
|
317 |
// Get playback index
|
|
318 |
// ---------------------------------------------------------------------------
|
|
319 |
//
|
|
320 |
TInt CMPXCollectionViewHgContainer::PlaybackIndex()
|
|
321 |
{
|
|
322 |
MPX_FUNC( "CMPXCollectionViewHgContainer::PlaybackIndex" );
|
|
323 |
return ( iListBoxArray ? iListBoxArray->GetPlaybackIndex() : KErrNotFound );
|
|
324 |
}
|
|
325 |
|
|
326 |
// ---------------------------------------------------------------------------
|
|
327 |
// Activate reorder mode
|
|
328 |
// ---------------------------------------------------------------------------
|
|
329 |
//
|
|
330 |
void CMPXCollectionViewHgContainer::ActivateReorderMode( TBool aEnable )
|
|
331 |
{
|
|
332 |
MPX_FUNC( "CMPXCollectionViewHgContainer::ActivateReorderMode" );
|
|
333 |
if ( iListBoxArray )
|
|
334 |
{
|
|
335 |
iReorder = aEnable;
|
|
336 |
iListBoxArray->ActivateReorderMode( iReorder );
|
|
337 |
}
|
|
338 |
}
|
|
339 |
|
|
340 |
// ---------------------------------------------------------------------------
|
|
341 |
// Set reorder mode
|
|
342 |
// ---------------------------------------------------------------------------
|
|
343 |
//
|
|
344 |
void CMPXCollectionViewHgContainer::SetReorderGrabbedMode(
|
|
345 |
TBool aEnable, TInt aIndex )
|
|
346 |
{
|
|
347 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetReorderGrabbedMode" );
|
|
348 |
if ( iListBoxArray )
|
|
349 |
{
|
|
350 |
iListBoxArray->SetReorderGrabbedMode( aEnable, aIndex );
|
|
351 |
}
|
|
352 |
}
|
|
353 |
|
|
354 |
// ---------------------------------------------------------------------------
|
|
355 |
// Determines if it's currently in reorder mode
|
|
356 |
// ---------------------------------------------------------------------------
|
|
357 |
//
|
|
358 |
TBool CMPXCollectionViewHgContainer::IsInReorderMode()
|
|
359 |
{
|
|
360 |
MPX_FUNC( "CMPXCollectionViewHgContainer::IsInReorderMode" );
|
|
361 |
return iReorder;
|
|
362 |
}
|
|
363 |
|
|
364 |
// ---------------------------------------------------------------------------
|
|
365 |
// Move current reorder index
|
|
366 |
// ---------------------------------------------------------------------------
|
|
367 |
//
|
|
368 |
void CMPXCollectionViewHgContainer::MoveReorderIndex( TInt aDirection )
|
|
369 |
{
|
|
370 |
MPX_FUNC( "CMPXCollectionViewHgContainer::MoveReorderIndex" );
|
|
371 |
if ( iListBoxArray )
|
|
372 |
{
|
|
373 |
iListBoxArray->MoveReorderIndex( aDirection );
|
|
374 |
}
|
|
375 |
}
|
|
376 |
|
|
377 |
// ---------------------------------------------------------------------------
|
|
378 |
// set current reorder index
|
|
379 |
// ---------------------------------------------------------------------------
|
|
380 |
//
|
|
381 |
void CMPXCollectionViewHgContainer::SetReorderIndex( TInt aIndex )
|
|
382 |
{
|
|
383 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetReorderIndex" );
|
|
384 |
if ( iListBoxArray )
|
|
385 |
{
|
|
386 |
iListBoxArray->SetReorderIndex( aIndex );
|
|
387 |
}
|
|
388 |
}
|
|
389 |
|
|
390 |
// ---------------------------------------------------------------------------
|
|
391 |
// Confirm reorder
|
|
392 |
// ---------------------------------------------------------------------------
|
|
393 |
//
|
|
394 |
void CMPXCollectionViewHgContainer::ConfirmReorderL()
|
|
395 |
{
|
|
396 |
MPX_FUNC( "CMPXCollectionViewHgContainer::ConfirmReorderL" );
|
|
397 |
if ( iListBoxArray )
|
|
398 |
{
|
|
399 |
iListBoxArray->ConfirmReorderL();
|
|
400 |
}
|
|
401 |
}
|
|
402 |
|
|
403 |
// ---------------------------------------------------------------------------
|
|
404 |
// Cancel reorder
|
|
405 |
// ---------------------------------------------------------------------------
|
|
406 |
//
|
|
407 |
void CMPXCollectionViewHgContainer::CancelReorder()
|
|
408 |
{
|
|
409 |
MPX_FUNC( "CMPXCollectionViewHgContainer::CancelReorder" );
|
|
410 |
TInt originalIndex( GetOriginalIndex() );
|
|
411 |
if ( iListBoxArray )
|
|
412 |
{
|
|
413 |
iListBoxArray->CancelReorder();
|
|
414 |
}
|
|
415 |
SetLbxCurrentItemIndexAndDraw( originalIndex );
|
|
416 |
}
|
|
417 |
|
|
418 |
// ---------------------------------------------------------------------------
|
|
419 |
// Gets original index of currently selected item
|
|
420 |
// ---------------------------------------------------------------------------
|
|
421 |
//
|
|
422 |
TInt CMPXCollectionViewHgContainer::GetOriginalIndex()
|
|
423 |
{
|
|
424 |
MPX_FUNC( "CMPXCollectionViewHgContainer::GetOriginalIndex" );
|
|
425 |
TInt index( KErrNotFound );
|
|
426 |
if ( iListBoxArray )
|
|
427 |
{
|
|
428 |
index = iListBoxArray->GetOriginalIndex();
|
|
429 |
}
|
|
430 |
return index;
|
|
431 |
}
|
|
432 |
|
|
433 |
// -----------------------------------------------------------------------------
|
|
434 |
// Update Titlepane icon to reorder image
|
|
435 |
// -----------------------------------------------------------------------------
|
|
436 |
//
|
|
437 |
void CMPXCollectionViewHgContainer::UpdateReorderTitleIconL()
|
|
438 |
{
|
|
439 |
MPX_FUNC( "CMPXCollectionViewHgContainer::UpdateReorderTitleIconL" );
|
|
440 |
// For status changes
|
|
441 |
CEikStatusPane* sp = iAvkonAppUi->StatusPane();
|
|
442 |
TParse parse;
|
|
443 |
parse.Set( KMPXCollectionViewIconFile, &KDC_APP_RESOURCE_DIR, NULL );
|
|
444 |
TFileName iconFile( parse.FullName() );
|
|
445 |
User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
|
|
446 |
|
|
447 |
MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
|
|
448 |
|
|
449 |
CFbsBitmap* bitmap( NULL );
|
|
450 |
CFbsBitmap* mask( NULL );
|
|
451 |
|
|
452 |
AknsUtils::CreateIconLC(
|
|
453 |
skin,
|
|
454 |
KAknsIIDNone,
|
|
455 |
bitmap,
|
|
456 |
mask,
|
|
457 |
iconFile,
|
|
458 |
EMbmMpxcollectionviewhgQgn_graf_mup_ctx_reordersong,
|
|
459 |
EMbmMpxcollectionviewhgQgn_graf_mup_ctx_reordersong_mask );
|
|
460 |
|
|
461 |
CEikImage* newIcon = new ( ELeave ) CEikImage();
|
|
462 |
CleanupStack::PushL( newIcon );
|
|
463 |
newIcon->SetPicture( bitmap, mask );
|
|
464 |
newIcon->SetPictureOwnedExternally( EFalse );
|
|
465 |
iContextPane = static_cast<CAknContextPane*>
|
|
466 |
( sp->ControlL( TUid::Uid( EEikStatusPaneUidContext ) ) );
|
|
467 |
if ( iOrigIcon )
|
|
468 |
{
|
|
469 |
delete iOrigIcon;
|
|
470 |
}
|
|
471 |
iOrigIcon = iContextPane->SwapPicture( newIcon );
|
|
472 |
CleanupStack::Pop( 3 ); // bitmap, mask, newIcon
|
|
473 |
}
|
|
474 |
|
|
475 |
// -----------------------------------------------------------------------------
|
|
476 |
// Update Titlepane icon to use original image
|
|
477 |
// -----------------------------------------------------------------------------
|
|
478 |
//
|
|
479 |
void CMPXCollectionViewHgContainer::RestoreOriginalTitleIconL()
|
|
480 |
{
|
|
481 |
MPX_FUNC( "CMPXCollectionViewHgContainer::RestoreOriginalTitleIconL" );
|
|
482 |
if ( iOrigIcon )
|
|
483 |
{
|
|
484 |
CEikImage* newIcon = iContextPane->SwapPicture( iOrigIcon );
|
|
485 |
delete newIcon;
|
|
486 |
iOrigIcon = NULL;
|
|
487 |
}
|
|
488 |
}
|
|
489 |
|
|
490 |
// -----------------------------------------------------------------------------
|
|
491 |
// Creates listbox array
|
|
492 |
// -----------------------------------------------------------------------------
|
|
493 |
//
|
|
494 |
CMPXCommonListBoxArrayBase* CMPXCollectionViewHgContainer::CreateListBoxArrayL()
|
|
495 |
{
|
|
496 |
MPX_FUNC( "CMPXCollectionViewHgContainer::CreateListBoxArrayL" );
|
|
497 |
CMPXCollectionViewListBoxArray* array = CMPXCollectionViewListBoxArray::NewL();
|
|
498 |
array->ConstructListBoxArrayL();
|
|
499 |
array->SetObserver( this );
|
|
500 |
return array;
|
|
501 |
}
|
|
502 |
|
|
503 |
// ---------------------------------------------------------------------------
|
|
504 |
// From CCoeControl
|
|
505 |
// Handles key events.
|
|
506 |
// ---------------------------------------------------------------------------
|
|
507 |
//
|
|
508 |
TKeyResponse CMPXCollectionViewHgContainer::OfferKeyEventL(
|
|
509 |
const TKeyEvent& aKeyEvent,
|
|
510 |
TEventCode aType )
|
|
511 |
{
|
|
512 |
MPX_DEBUG4( "CMPXCollectionViewHgContainer::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)",
|
|
513 |
aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
|
|
514 |
|
|
515 |
if ( aKeyEvent.iCode == EKeyUpArrow ||
|
|
516 |
aKeyEvent.iCode == EKeyPrevious )
|
|
517 |
{
|
|
518 |
iView->ProcessCommandL( EMPXCmdUpArrow );
|
|
519 |
}
|
|
520 |
else if ( aKeyEvent.iCode == EKeyDownArrow ||
|
|
521 |
aKeyEvent.iCode == EKeyNext )
|
|
522 |
{
|
|
523 |
iView->ProcessCommandL( EMPXCmdDownArrow );
|
|
524 |
}
|
|
525 |
TKeyResponse response = EKeyWasNotConsumed;
|
|
526 |
|
|
527 |
if( iReady )
|
|
528 |
{
|
|
529 |
const CMPXMedia& containerMedia(iListBoxArray->ContainerMedia() );
|
|
530 |
TMPXGeneralType containerType(
|
|
531 |
containerMedia.ValueTObjectL<TMPXGeneralType>(
|
|
532 |
KMPXMediaGeneralType ) );
|
|
533 |
TMPXGeneralCategory containerCategory(
|
|
534 |
containerMedia.ValueTObjectL<TMPXGeneralCategory>(
|
|
535 |
KMPXMediaGeneralCategory ) );
|
|
536 |
|
|
537 |
// Hashkey mark/unmark works in all song's view and other tracks view,
|
|
538 |
// not on other category views
|
|
539 |
if( containerCategory == EMPXSong ||
|
|
540 |
(( containerCategory == EMPXPlaylist ||
|
|
541 |
containerCategory == EMPXAlbum ||
|
|
542 |
containerCategory == EMPXGenre ||
|
|
543 |
containerCategory == EMPXComposer ) &&
|
|
544 |
containerType == EMPXItem ) ||
|
|
545 |
aKeyEvent.iScanCode != EStdKeyHash )
|
|
546 |
{
|
|
547 |
response = HandleKeyEventL( aKeyEvent, aType );
|
|
548 |
}
|
|
549 |
}
|
|
550 |
else
|
|
551 |
{
|
|
552 |
response = HandleKeyEventL( aKeyEvent, aType );
|
|
553 |
MPX_DEBUG2( "CMPXCollectionViewHgContainer::OfferKeyEventL commoncontainer offerkey res = %d", response);
|
|
554 |
}
|
|
555 |
|
|
556 |
if ( aKeyEvent.iCode == EKeyUpArrow ||
|
|
557 |
aKeyEvent.iCode == EKeyPrevious )
|
|
558 |
{
|
|
559 |
iView->ProcessCommandL( EMPXCmdUpArrowAfterListboxHandled );
|
|
560 |
}
|
|
561 |
else if ( aKeyEvent.iCode == EKeyDownArrow ||
|
|
562 |
aKeyEvent.iCode == EKeyNext )
|
|
563 |
{
|
|
564 |
iView->ProcessCommandL( EMPXCmdDownArrowAfterListboxHandled );
|
|
565 |
}
|
|
566 |
return response;
|
|
567 |
}
|
|
568 |
|
|
569 |
|
|
570 |
// ---------------------------------------------------------------------------
|
|
571 |
// Handles key events.
|
|
572 |
// ---------------------------------------------------------------------------
|
|
573 |
//
|
|
574 |
TKeyResponse CMPXCollectionViewHgContainer::HandleKeyEventL(
|
|
575 |
const TKeyEvent& aKeyEvent,
|
|
576 |
TEventCode aType )
|
|
577 |
{
|
|
578 |
MPX_DEBUG5( "CMPXCollectionViewHgContainer::HandleKeyEventL(iCode=%d, iScanCode=%d, iModifiers=0x%x, aType=%d)",
|
|
579 |
aKeyEvent.iCode, aKeyEvent.iScanCode, aKeyEvent.iModifiers, aType );
|
|
580 |
|
|
581 |
TKeyResponse response( EKeyWasNotConsumed );
|
|
582 |
|
|
583 |
CHgScroller* list = CurrentListWidget();
|
|
584 |
if ( list )
|
|
585 |
{
|
|
586 |
response = list->OfferKeyEventL( aKeyEvent, aType );
|
|
587 |
}
|
|
588 |
if ( response == EKeyWasNotConsumed && iMediaWall )
|
|
589 |
{
|
|
590 |
response = iMediaWall->OfferKeyEventL( aKeyEvent, aType );
|
|
591 |
// Softkeys are hidden when left/right keys are used in mediawall.
|
|
592 |
if ( response == EKeyWasConsumed && iCurrentViewType == EMPXViewMediawall )
|
|
593 |
{
|
|
594 |
if( iCbaHandler )
|
|
595 |
iCbaHandler->ChangeCbaVisibility( EFalse );
|
|
596 |
}
|
|
597 |
}
|
|
598 |
|
|
599 |
// When LSK is pressed, make the softkeys visible.
|
|
600 |
if ( response == EKeyWasNotConsumed && aKeyEvent.iCode == EKeyDevice0 )
|
|
601 |
{
|
|
602 |
if( iCbaHandler )
|
|
603 |
iCbaHandler->ChangeCbaVisibility( ETrue );
|
|
604 |
}
|
|
605 |
|
|
606 |
if ( response == EKeyWasNotConsumed &&
|
|
607 |
(aKeyEvent.iCode == EKeyOK ||
|
|
608 |
aKeyEvent.iCode == EKeyEnter ) )
|
|
609 |
{
|
|
610 |
// Handle enter key pressed
|
|
611 |
iView->ProcessCommandL( EMPXCmdCommonEnterKey );
|
|
612 |
}
|
|
613 |
if ( response == EKeyWasNotConsumed &&
|
|
614 |
aType == EEventKey &&
|
|
615 |
aKeyEvent.iCode == EKeyBackspace && iView )
|
|
616 |
{
|
|
617 |
iView->ProcessCommandL( EMPXCmdCommonDelete );
|
|
618 |
response = EKeyWasConsumed;
|
|
619 |
}
|
|
620 |
|
|
621 |
return response;
|
|
622 |
}
|
|
623 |
|
|
624 |
// ---------------------------------------------------------------------------
|
|
625 |
// From CCoeControl
|
|
626 |
// Gets the control's help context.
|
|
627 |
// ---------------------------------------------------------------------------
|
|
628 |
//
|
|
629 |
void CMPXCollectionViewHgContainer::GetHelpContext(
|
|
630 |
TCoeHelpContext& aContext ) const
|
|
631 |
{
|
|
632 |
MPX_FUNC( "CMPXCollectionViewHgContainer::HandleHelpContext" );
|
|
633 |
aContext.iMajor = KAppUidMusicPlayerX;
|
|
634 |
|
|
635 |
const CMPXMedia& containerMedia(iListBoxArray->ContainerMedia() );
|
|
636 |
TMPXGeneralType containerType(
|
|
637 |
containerMedia.ValueTObjectL<TMPXGeneralType>(
|
|
638 |
KMPXMediaGeneralType ) );
|
|
639 |
TMPXGeneralCategory containerCategory(
|
|
640 |
containerMedia.ValueTObjectL<TMPXGeneralCategory>(
|
|
641 |
KMPXMediaGeneralCategory ) );
|
|
642 |
MPX_DEBUG3( "CMPXCollectionViewHgContainer::HandleHelpContext containertype = %d, containercategory = %d", containerType, containerCategory );
|
|
643 |
|
|
644 |
switch ( containerCategory )
|
|
645 |
{
|
|
646 |
case EMPXCollection:
|
|
647 |
{
|
|
648 |
// music menu view
|
|
649 |
aContext.iContext = KMusHlpLibMainView;
|
|
650 |
break;
|
|
651 |
}
|
|
652 |
case EMPXPlaylist:
|
|
653 |
{
|
|
654 |
if (iIsEmbedded)
|
|
655 |
{
|
|
656 |
aContext.iContext = KMusHlpEmbeddedPlaylistTracksView;
|
|
657 |
}
|
|
658 |
else
|
|
659 |
{
|
|
660 |
if ( containerType == EMPXGroup )
|
|
661 |
{
|
|
662 |
// playlist view
|
|
663 |
aContext.iContext = KMusHlpPlaylistView;
|
|
664 |
}
|
|
665 |
else if ( containerType == EMPXItem )
|
|
666 |
{
|
|
667 |
// playlist tracks view
|
|
668 |
aContext.iContext = KMusHlpPlaylistTracksView;
|
|
669 |
}
|
|
670 |
else
|
|
671 |
{
|
|
672 |
// default to music main view help context
|
|
673 |
aContext.iContext = KMusHlpLibMainView;
|
|
674 |
}
|
|
675 |
}
|
|
676 |
break;
|
|
677 |
}
|
|
678 |
case EMPXAlbum:
|
|
679 |
case EMPXGenre:
|
|
680 |
case EMPXComposer:
|
|
681 |
{
|
|
682 |
if ( containerType == EMPXGroup )
|
|
683 |
{
|
|
684 |
// album, genre, composer view
|
|
685 |
aContext.iContext = KMusHlpCategoryView;
|
|
686 |
}
|
|
687 |
else if ( containerType == EMPXItem )
|
|
688 |
{
|
|
689 |
// album, genre, composer tracks view
|
|
690 |
aContext.iContext = KMusHlpTracksView;
|
|
691 |
}
|
|
692 |
else
|
|
693 |
{
|
|
694 |
// default to music main view help context
|
|
695 |
aContext.iContext = KMusHlpLibMainView;
|
|
696 |
}
|
|
697 |
break;
|
|
698 |
}
|
|
699 |
case EMPXArtist:
|
|
700 |
{
|
|
701 |
// artist view
|
|
702 |
// artist/album view
|
|
703 |
aContext.iContext = KMusHlpCategoryView;
|
|
704 |
break;
|
|
705 |
}
|
|
706 |
case EMPXSong:
|
|
707 |
{
|
|
708 |
// all songs view
|
|
709 |
aContext.iContext = KMusHlpTracksView;
|
|
710 |
break;
|
|
711 |
}
|
|
712 |
default:
|
|
713 |
{
|
|
714 |
// default to music main view help context
|
|
715 |
aContext.iContext = KMusHlpLibMainView;
|
|
716 |
break;
|
|
717 |
}
|
|
718 |
}
|
|
719 |
}
|
|
720 |
|
|
721 |
// ---------------------------------------------------------------------------
|
|
722 |
// From CCoeControl
|
|
723 |
// Handles a change to the control's resources.
|
|
724 |
// ---------------------------------------------------------------------------
|
|
725 |
//
|
|
726 |
void CMPXCollectionViewHgContainer::HandleResourceChange( TInt aType )
|
|
727 |
{
|
|
728 |
MPX_FUNC( "CMPXCollectionViewHgContainer::HandleResourceChange" );
|
|
729 |
CCoeControl::HandleResourceChange( aType );
|
|
730 |
|
|
731 |
TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
|
|
732 |
TRAP_IGNORE(
|
|
733 |
if ( aType == KAknsMessageSkinChange )
|
|
734 |
{
|
|
735 |
delete iIconArray;
|
|
736 |
iIconArray = NULL;
|
|
737 |
|
|
738 |
if( iCurrentViewType == EMPXViewMediawall || iCurrentViewType == EMPXViewTBone )
|
|
739 |
{
|
|
740 |
iMediaWall->SetDefaultIconL(NULL);
|
|
741 |
CreateIconArrayL();
|
|
742 |
iMediaWall->EnableScrollBufferL(*this, KMPXListBufferSizeWithMediaWall, KMPXListBufferSizeWithMediaWall/4);
|
|
743 |
}
|
|
744 |
else
|
|
745 |
{
|
|
746 |
CHgScroller* list = CurrentListWidget();
|
|
747 |
if( list )
|
|
748 |
{
|
|
749 |
list->SetDefaultIconL(NULL);
|
|
750 |
CreateIconArrayL();
|
|
751 |
list->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
|
|
752 |
}
|
|
753 |
}
|
|
754 |
// Reset the shuffle item for TBone view
|
|
755 |
if ( iCurrentViewType == EMPXViewTBone )
|
|
756 |
{
|
|
757 |
if (iMwListWidget && iMwListWidget->ItemCount() > 1)
|
|
758 |
{
|
|
759 |
SetShuffleItemToListL(iMwListWidget);
|
|
760 |
}
|
|
761 |
}
|
|
762 |
// Songs dialog is opened in mediawall, we need to reset its shuffle item
|
|
763 |
else if ( iCurrentViewType == EMPXViewMediawall && iDialog )
|
|
764 |
{
|
|
765 |
CAknIconArray* iconArray = new( ELeave ) CAknIconArray( 1 );
|
|
766 |
CleanupStack::PushL( iconArray );
|
|
767 |
// Prepare icon array.
|
|
768 |
CGulIcon* icon = (*iIconArray)[EMPXClvIconShuffle];
|
|
769 |
CGulIcon* iconCopy = CGulIcon::NewL(icon->Bitmap(), icon->Mask());
|
|
770 |
iconCopy->SetBitmapsOwnedExternally(ETrue);
|
|
771 |
iconArray->AppendL(iconCopy);
|
|
772 |
CAknSingleGraphicPopupMenuStyleListBox* listbox = (CAknSingleGraphicPopupMenuStyleListBox *)iDialog->ListBox();
|
|
773 |
listbox->ItemDrawer()->ColumnData()->SetIconArrayL( iconArray );
|
|
774 |
CleanupStack::Pop(); // iconArray
|
|
775 |
}
|
|
776 |
else
|
|
777 |
{
|
|
778 |
// Reset the shuffle item for other views
|
|
779 |
SetDetailIconShuffleL();
|
|
780 |
}
|
|
781 |
}
|
|
782 |
else if ( aType == KEikDynamicLayoutVariantSwitch &&
|
|
783 |
( iPreviousOrientation != landscapeOrientation ) )
|
|
784 |
{
|
|
785 |
iLayoutSwitch = ETrue;
|
|
786 |
// To prevent multiple layout change causing multiple repopulation of the list.
|
|
787 |
// Temporary fix until rootcause is found.
|
|
788 |
iPreviousOrientation = landscapeOrientation;
|
|
789 |
|
|
790 |
if ( iCurrentViewType == EMPXViewMediawall )
|
|
791 |
{
|
|
792 |
if ( iDialog )
|
|
793 |
{
|
|
794 |
iDialog->CancelPopup();
|
|
795 |
}
|
|
796 |
}
|
|
797 |
iSetEmptyTextNeeded = ETrue;
|
|
798 |
|
|
799 |
|
|
800 |
TRect clientRect = ((CAknView*)iView)->ClientRect();
|
|
801 |
SetRect( clientRect );
|
|
802 |
iBgContext->SetRect(((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect());
|
|
803 |
|
|
804 |
// call HandleLbxItemAdditionL
|
|
805 |
HandleLbxItemAdditionL();
|
|
806 |
}
|
|
807 |
);
|
|
808 |
if(iMediaWall)
|
|
809 |
iMediaWall->HandleResourceChange( aType );
|
|
810 |
if(iListWidget)
|
|
811 |
iListWidget->HandleResourceChange( aType );
|
|
812 |
if(iMwListWidget)
|
|
813 |
iMwListWidget->HandleResourceChange( aType );
|
|
814 |
}
|
|
815 |
|
|
816 |
|
|
817 |
// ---------------------------------------------------------------------------
|
|
818 |
// From CCoeControl
|
|
819 |
// Draw this application's view to the screen
|
|
820 |
// ---------------------------------------------------------------------------
|
|
821 |
//
|
|
822 |
void CMPXCollectionViewHgContainer::Draw(const TRect& /*aRect*/) const
|
|
823 |
{
|
|
824 |
if ( iContext == EContextUnknown || iDrawBackGround != EFalse )
|
|
825 |
{
|
|
826 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|
827 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
|
|
828 |
AknsDrawUtils::DrawBackground( skin, cc, this, SystemGc(),
|
|
829 |
TPoint(0,0), Rect(), KAknsDrawParamDefault );
|
|
830 |
}
|
|
831 |
}
|
|
832 |
|
|
833 |
// ---------------------------------------------------------------------------
|
|
834 |
// From CCoeControl
|
|
835 |
// Provide control input capabilities
|
|
836 |
// ---------------------------------------------------------------------------
|
|
837 |
//
|
|
838 |
TCoeInputCapabilities CMPXCollectionViewHgContainer::InputCapabilities() const
|
|
839 |
{
|
|
840 |
switch( iCurrentViewType )
|
|
841 |
{
|
|
842 |
case EMPXViewMediawall:
|
|
843 |
case EMPXViewTBone:
|
|
844 |
{
|
|
845 |
return iMediaWall->InputCapabilities();
|
|
846 |
}
|
|
847 |
case EMPXViewList:
|
|
848 |
{
|
|
849 |
return iListWidget->InputCapabilities();
|
|
850 |
}
|
|
851 |
default:
|
|
852 |
break;
|
|
853 |
}
|
|
854 |
return CCoeControl::InputCapabilities();
|
|
855 |
}
|
|
856 |
|
|
857 |
// ---------------------------------------------------------------------------
|
|
858 |
// From MCoeControlObserver
|
|
859 |
// Handle control event
|
|
860 |
// ---------------------------------------------------------------------------
|
|
861 |
//
|
|
862 |
void CMPXCollectionViewHgContainer::HandleControlEventL(
|
|
863 |
CCoeControl* /*aControl*/,
|
|
864 |
TCoeEvent /*aEventType*/ )
|
|
865 |
{
|
|
866 |
}
|
|
867 |
// ---------------------------------------------------------------------------
|
|
868 |
// From MMPXViewContainer
|
|
869 |
// Returns the indicators for the specified item within the view container
|
|
870 |
// ---------------------------------------------------------------------------
|
|
871 |
//
|
|
872 |
RArray<TInt> CMPXCollectionViewHgContainer::IndicatorsL( TInt aIndex )
|
|
873 |
{
|
|
874 |
return iListBoxArray->IndicatorIconIndicesL( aIndex );
|
|
875 |
}
|
|
876 |
|
|
877 |
// ---------------------------------------------------------------------------
|
|
878 |
// From MMPXCommonListBoxArrayObserver
|
|
879 |
// Handle listbox array events.
|
|
880 |
// ---------------------------------------------------------------------------
|
|
881 |
//
|
|
882 |
void CMPXCollectionViewHgContainer::HandleListBoxArrayEventL(
|
|
883 |
TMPXCommonListBoxArrayEvents aEvent )
|
|
884 |
{
|
|
885 |
MPX_FUNC( "CMPXCollectionViewHgContainer::HandleListBoxArrayEventL" );
|
|
886 |
|
|
887 |
if ( aEvent == MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventIconArrayChange )
|
|
888 |
{
|
|
889 |
delete iIconArray;
|
|
890 |
iIconArray = NULL;
|
|
891 |
CreateIconArrayL();
|
|
892 |
}
|
|
893 |
else if ( aEvent == MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventMediaArrayChange )
|
|
894 |
{
|
|
895 |
|
|
896 |
// Update list widget with new items in the media array.
|
|
897 |
// We start the update from last valid media item index.
|
|
898 |
if ( iListWidget )
|
|
899 |
{
|
|
900 |
ProvideDataWithoutThumbnailsL(iListBoxArray->MediaArray(), iLastValidMediaItemIndex);
|
|
901 |
|
|
902 |
|
|
903 |
if ( iLastValidMediaItemIndex >= iRequestStart && iLastValidMediaItemIndex >= iRequestEnd )
|
|
904 |
{
|
|
905 |
|
|
906 |
Request(iRequestStart, iRequestEnd, EHgBufferReset );
|
|
907 |
}
|
|
908 |
iListWidget->RefreshScreen(iListWidget->FirstIndexOnScreen());
|
|
909 |
}
|
|
910 |
}
|
|
911 |
}
|
|
912 |
|
|
913 |
// ---------------------------------------------------------------------------
|
|
914 |
// Content is ready.
|
|
915 |
// ---------------------------------------------------------------------------
|
|
916 |
//
|
|
917 |
void CMPXCollectionViewHgContainer::ContentIsReady( TBool aReady )
|
|
918 |
{
|
|
919 |
iReady = aReady;
|
|
920 |
}
|
|
921 |
|
|
922 |
|
|
923 |
void CMPXCollectionViewHgContainer::SetCbaHandler( MMpxCbaHandler* aCbaHandler )
|
|
924 |
{
|
|
925 |
iCbaHandler = aCbaHandler;
|
|
926 |
}
|
|
927 |
|
|
928 |
// -----------------------------------------------------------------------------
|
|
929 |
// Creates icon array, populates iIconArray to be used by listbox
|
|
930 |
// -----------------------------------------------------------------------------
|
|
931 |
//
|
|
932 |
void CMPXCollectionViewHgContainer::CreateIconArrayL()
|
|
933 |
{
|
|
934 |
MPX_FUNC( "CMPXCollectionViewHgContainer::CreateIconArrayL" );
|
|
935 |
if ( iListBoxArray )
|
|
936 |
{
|
|
937 |
iIconArray = iListBoxArray->CreateIconArrayL();
|
|
938 |
}
|
|
939 |
SetDefaultIconL();
|
|
940 |
}
|
|
941 |
|
|
942 |
// -----------------------------------------------------------------------------
|
|
943 |
// Returns a pointer to the listboxarray
|
|
944 |
// -----------------------------------------------------------------------------
|
|
945 |
//
|
|
946 |
CMPXCommonListBoxArrayBase* CMPXCollectionViewHgContainer::ListBoxArray() const
|
|
947 |
{
|
|
948 |
return iListBoxArray;
|
|
949 |
}
|
|
950 |
|
|
951 |
// -----------------------------------------------------------------------------
|
|
952 |
// Return number of listbox items shown in the current listbox.
|
|
953 |
// -----------------------------------------------------------------------------
|
|
954 |
//
|
|
955 |
TInt CMPXCollectionViewHgContainer::CurrentListItemCount() const
|
|
956 |
{
|
|
957 |
MPX_FUNC( "CMPXCollectionViewHgContainer::CurrentListItemCount" );
|
|
958 |
TInt count = 0;
|
|
959 |
|
|
960 |
switch( iCurrentViewType )
|
|
961 |
{
|
|
962 |
case EMPXViewMediawall:
|
|
963 |
case EMPXViewTBone:
|
|
964 |
{
|
|
965 |
count = iMediaWall->ItemCount();
|
|
966 |
break;
|
|
967 |
}
|
|
968 |
case EMPXViewList:
|
|
969 |
{
|
|
970 |
count = iListWidget->ItemCount();
|
|
971 |
break;
|
|
972 |
}
|
|
973 |
default:
|
|
974 |
break;
|
|
975 |
}
|
|
976 |
|
|
977 |
return count - iShuffleItem;
|
|
978 |
}
|
|
979 |
|
|
980 |
|
|
981 |
// -----------------------------------------------------------------------------
|
|
982 |
// Return total number of listbox items in the listbox.
|
|
983 |
// -----------------------------------------------------------------------------
|
|
984 |
//
|
|
985 |
TInt CMPXCollectionViewHgContainer::TotalListItemCount() const
|
|
986 |
{
|
|
987 |
MPX_FUNC( "CMPXCollectionViewHgContainer::TotalListItemCount" );
|
|
988 |
TInt count = 0;
|
|
989 |
if ( iListBoxArray )
|
|
990 |
{
|
|
991 |
count = iListBoxArray->MediaArray().Count();
|
|
992 |
}
|
|
993 |
return count;
|
|
994 |
}
|
|
995 |
|
|
996 |
|
|
997 |
// -----------------------------------------------------------------------------
|
|
998 |
// Gets top listbox item index (relative to the original listbox).
|
|
999 |
// -----------------------------------------------------------------------------
|
|
1000 |
//
|
|
1001 |
TInt CMPXCollectionViewHgContainer::TopLbxItemIndex() const
|
|
1002 |
{
|
|
1003 |
MPX_FUNC( "CMPXCollectionViewHgContainer::TopLbxItemIndex" );
|
|
1004 |
return iTopIndex;
|
|
1005 |
}
|
|
1006 |
|
|
1007 |
|
|
1008 |
// -----------------------------------------------------------------------------
|
|
1009 |
// Gets first listbox item index on screen(relative to the original listbox).
|
|
1010 |
// -----------------------------------------------------------------------------
|
|
1011 |
//
|
|
1012 |
TInt CMPXCollectionViewHgContainer::FirstIndexOnScreen() const
|
|
1013 |
{
|
|
1014 |
MPX_FUNC( "CMPXCollectionViewHgContainer::FirstIndexOnScreen" );
|
|
1015 |
TInt index = 0;
|
|
1016 |
if ( iListWidget )
|
|
1017 |
{
|
|
1018 |
index = iListWidget->FirstIndexOnScreen();
|
|
1019 |
}
|
|
1020 |
return index;
|
|
1021 |
}
|
|
1022 |
|
|
1023 |
|
|
1024 |
// -----------------------------------------------------------------------------
|
|
1025 |
// Gets bottom listbox item index (relative to the original listbox).
|
|
1026 |
// -----------------------------------------------------------------------------
|
|
1027 |
//
|
|
1028 |
TInt CMPXCollectionViewHgContainer::BottomLbxItemIndex() const
|
|
1029 |
{
|
|
1030 |
MPX_FUNC( "CMPXCollectionViewHgContainer::BottomLbxItemIndex" );
|
|
1031 |
return iBottomIndex;
|
|
1032 |
}
|
|
1033 |
|
|
1034 |
|
|
1035 |
// -----------------------------------------------------------------------------
|
|
1036 |
// Gets current listbox item index (relative to the original listbox).
|
|
1037 |
// -----------------------------------------------------------------------------
|
|
1038 |
//
|
|
1039 |
TInt CMPXCollectionViewHgContainer::CurrentLbxItemIndex() const
|
|
1040 |
{
|
|
1041 |
MPX_FUNC( "CMPXCollectionViewHgContainer::CurrentLbxItemIndex" );
|
|
1042 |
TInt index( KErrNotFound );
|
|
1043 |
|
|
1044 |
const TInt count = CurrentListItemCount();
|
|
1045 |
|
|
1046 |
if ( count <= 0 )
|
|
1047 |
return index;
|
|
1048 |
|
|
1049 |
switch( iCurrentViewType )
|
|
1050 |
{
|
|
1051 |
case EMPXViewMediawall:
|
|
1052 |
case EMPXViewTBone:
|
|
1053 |
{
|
|
1054 |
index = MediaIndex(iMediaWall->SelectedIndex());
|
|
1055 |
break;
|
|
1056 |
}
|
|
1057 |
case EMPXViewList:
|
|
1058 |
{
|
|
1059 |
index = MediaIndex(iListWidget->SelectedIndex());
|
|
1060 |
break;
|
|
1061 |
}
|
|
1062 |
default:
|
|
1063 |
break;
|
|
1064 |
}
|
|
1065 |
|
|
1066 |
return index;
|
|
1067 |
}
|
|
1068 |
|
|
1069 |
|
|
1070 |
// -----------------------------------------------------------------------------
|
|
1071 |
// Get current selected listbox items indices (relative to the original listbox)
|
|
1072 |
// -----------------------------------------------------------------------------
|
|
1073 |
//
|
|
1074 |
const CArrayFix<TInt>* CMPXCollectionViewHgContainer::CurrentSelectionIndicesL() const
|
|
1075 |
{
|
|
1076 |
MPX_FUNC( "CMPXCollectionViewHgContainer::CurrentSelectionIndicesL" );
|
|
1077 |
|
|
1078 |
// TODO, check if selection is available only with views that have only list.
|
|
1079 |
if ( iListWidget )
|
|
1080 |
{
|
|
1081 |
iListSelections->Reset();
|
|
1082 |
RArray<TInt> selectionArray;
|
|
1083 |
CleanupClosePushL( selectionArray );
|
|
1084 |
iListWidget->GetMarkedItemsL(selectionArray);
|
|
1085 |
int count = selectionArray.Count();
|
|
1086 |
for( int i = 0; i < count; i++ )
|
|
1087 |
{
|
|
1088 |
iListSelections->AppendL( selectionArray[i] );
|
|
1089 |
}
|
|
1090 |
CleanupStack::PopAndDestroy( &selectionArray );
|
|
1091 |
}
|
|
1092 |
return iListSelections;
|
|
1093 |
}
|
|
1094 |
|
|
1095 |
|
|
1096 |
// -----------------------------------------------------------------------------
|
|
1097 |
// Set current selected listbox items indices (relative to the original listbox)
|
|
1098 |
// -----------------------------------------------------------------------------
|
|
1099 |
//
|
|
1100 |
void CMPXCollectionViewHgContainer::SetCurrentSelectionIndicesL(
|
|
1101 |
CArrayFix<TInt>* aIndices ) const
|
|
1102 |
{
|
|
1103 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetCurrentSelectionIndicesL" );
|
|
1104 |
TInt count = aIndices->Count();
|
|
1105 |
if ( count > 0 && iListWidget )
|
|
1106 |
{
|
|
1107 |
for( TInt i = 0; i < count; i++ )
|
|
1108 |
{
|
|
1109 |
iListWidget->Mark( (*aIndices)[i] );
|
|
1110 |
}
|
|
1111 |
iListWidget->RefreshScreen( (*aIndices)[0] );
|
|
1112 |
}
|
|
1113 |
}
|
|
1114 |
|
|
1115 |
|
|
1116 |
// -----------------------------------------------------------------------------
|
|
1117 |
// Set top listbox item index.
|
|
1118 |
// -----------------------------------------------------------------------------
|
|
1119 |
//
|
|
1120 |
void CMPXCollectionViewHgContainer::SetLbxTopItemIndex( TInt /*aIndex*/ )
|
|
1121 |
{
|
|
1122 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetLbxTopItemIndex" );
|
|
1123 |
}
|
|
1124 |
|
|
1125 |
|
|
1126 |
// -----------------------------------------------------------------------------
|
|
1127 |
// Set current listbox item index.
|
|
1128 |
// -----------------------------------------------------------------------------
|
|
1129 |
//
|
|
1130 |
void CMPXCollectionViewHgContainer::SetLbxCurrentItemIndex( TInt aIndex )
|
|
1131 |
{
|
|
1132 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetLbxCurrentItemIndex" );
|
|
1133 |
|
|
1134 |
// TODO, check if we need to support this with other view types also
|
|
1135 |
// David: This needs to be supported for Mediawall and Tbone
|
|
1136 |
if ( iListWidget && iCurrentViewType == EMPXViewList )
|
|
1137 |
{
|
|
1138 |
iListWidget->SetSelectedIndex( aIndex );
|
|
1139 |
}
|
|
1140 |
}
|
|
1141 |
|
|
1142 |
|
|
1143 |
// -----------------------------------------------------------------------------
|
|
1144 |
// Set current listbox item index and highlight it.
|
|
1145 |
// -----------------------------------------------------------------------------
|
|
1146 |
//
|
|
1147 |
void CMPXCollectionViewHgContainer::SetLbxCurrentItemIndexAndDraw(
|
|
1148 |
TInt aIndex )
|
|
1149 |
{
|
|
1150 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetLbxCurrentItemIndexAndDraw" );
|
|
1151 |
SetLbxCurrentItemIndex(aIndex);
|
|
1152 |
}
|
|
1153 |
|
|
1154 |
|
|
1155 |
// -----------------------------------------------------------------------------
|
|
1156 |
// Clear listbox selection.
|
|
1157 |
// -----------------------------------------------------------------------------
|
|
1158 |
//
|
|
1159 |
void CMPXCollectionViewHgContainer::ClearLbxSelection()
|
|
1160 |
{
|
|
1161 |
MPX_FUNC( "CMPXCollectionViewHgContainer::ClearLbxSelection" );
|
|
1162 |
if ( iListWidget )
|
|
1163 |
{
|
|
1164 |
iListWidget->UnMarkAll();
|
|
1165 |
}
|
|
1166 |
}
|
|
1167 |
|
|
1168 |
// -----------------------------------------------------------------------------
|
|
1169 |
// Sets the text for an empty list box
|
|
1170 |
// -----------------------------------------------------------------------------
|
|
1171 |
//
|
|
1172 |
void CMPXCollectionViewHgContainer::SetLbxEmptyTextL( const TDesC& aText )
|
|
1173 |
{
|
|
1174 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetLbxEmptyTextL" );
|
|
1175 |
|
|
1176 |
if ( iListWidget && aText != KNullDesC )
|
|
1177 |
{
|
|
1178 |
iListWidget->SetEmptyTextL( aText );
|
|
1179 |
}
|
|
1180 |
else if ( iMediaWall && aText != KNullDesC )
|
|
1181 |
{
|
|
1182 |
iMediaWall->SetEmptyTextL( aText );
|
|
1183 |
}
|
|
1184 |
}
|
|
1185 |
|
|
1186 |
// -----------------------------------------------------------------------------
|
|
1187 |
// Draws a list box item
|
|
1188 |
// -----------------------------------------------------------------------------
|
|
1189 |
//
|
|
1190 |
void CMPXCollectionViewHgContainer::DrawLbxItemL( TInt aIndex )
|
|
1191 |
{
|
|
1192 |
MPX_DEBUG2( "CMPXCollectionViewHgContainer::DrawLbxItem (aIndex=%d)", aIndex );
|
|
1193 |
|
|
1194 |
CHgScroller* list = CurrentListWidget();
|
|
1195 |
|
|
1196 |
TInt listIndex = aIndex + iShuffleItem;
|
|
1197 |
if( list && listIndex < list->ItemCount() )
|
|
1198 |
{
|
|
1199 |
CHgItem* item = &list->ItemL(listIndex);
|
|
1200 |
SetDetailIndicatorL(item, aIndex);
|
|
1201 |
list->RefreshScreen(listIndex);
|
|
1202 |
}
|
|
1203 |
}
|
|
1204 |
|
|
1205 |
|
|
1206 |
// -----------------------------------------------------------------------------
|
|
1207 |
// Set Find box's focus.
|
|
1208 |
// -----------------------------------------------------------------------------
|
|
1209 |
//
|
|
1210 |
void CMPXCollectionViewHgContainer::SetFindBoxFocus( TBool /*aFocus*/ )
|
|
1211 |
{
|
|
1212 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetFindBoxFocus" );
|
|
1213 |
}
|
|
1214 |
|
|
1215 |
|
|
1216 |
// -----------------------------------------------------------------------------
|
|
1217 |
// Handle listbox item addition.
|
|
1218 |
// -----------------------------------------------------------------------------
|
|
1219 |
//
|
|
1220 |
void CMPXCollectionViewHgContainer::HandleLbxItemAdditionL()
|
|
1221 |
{
|
|
1222 |
MPX_FUNC( "CMPXCollectionViewHgContainer::HandleLbxItemAdditionL" );
|
|
1223 |
SetCollectionContextL();
|
|
1224 |
|
|
1225 |
// When the collection is reopened after coming from playback view,
|
|
1226 |
// it is reopened in Album-Tracks level (EContextItemAlbum).
|
|
1227 |
// We don't display its content in that context but inturn reopen the
|
|
1228 |
// collection at one level up (Albums) and display it in T-bone view.
|
|
1229 |
// T-Bone view is just a list of albums presented differently.
|
|
1230 |
if ( iContext == EContextItemAlbum )
|
|
1231 |
{
|
|
1232 |
iCollectionUtility->Collection().BackL();
|
|
1233 |
iOpenAlbumTracks = ETrue;
|
|
1234 |
return;
|
|
1235 |
}
|
|
1236 |
|
|
1237 |
iLastValidMediaItemIndex = 0;
|
|
1238 |
|
|
1239 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
1240 |
TInt count( mediaArray.Count() );
|
|
1241 |
MPX_DEBUG2( "CMPXCollectionViewHgContainer::HandleLbxItemAdditionL count=%d", count);
|
|
1242 |
|
|
1243 |
HandleLbxItemRemovalL();
|
|
1244 |
TViewType prevViewType = iCurrentViewType;
|
|
1245 |
|
|
1246 |
ResolveCurrentViewType( count );
|
|
1247 |
|
|
1248 |
iThumbnailReqMap.Reset();
|
|
1249 |
if (ShuffleItemPresent())
|
|
1250 |
iShuffleItem = 1;
|
|
1251 |
else
|
|
1252 |
iShuffleItem = 0;
|
|
1253 |
|
|
1254 |
count = count + iShuffleItem;
|
|
1255 |
iThumbnailReqMap.ReserveL(count );
|
|
1256 |
for ( TInt i = 0; i < count ; i++ )
|
|
1257 |
{
|
|
1258 |
iThumbnailReqMap.Append( EFalse );
|
|
1259 |
}
|
|
1260 |
|
|
1261 |
iThumbnailManager->CancelAll();
|
|
1262 |
|
|
1263 |
if( prevViewType == iCurrentViewType && iContext == iPrevContext )
|
|
1264 |
{
|
|
1265 |
ResizeListL( mediaArray, count );
|
|
1266 |
}
|
|
1267 |
else
|
|
1268 |
{
|
|
1269 |
// MediaWall sets the default icon in the construction phase.
|
|
1270 |
iDefaultIconSet = EFalse;
|
|
1271 |
|
|
1272 |
if( !iLayoutSwitch )
|
|
1273 |
{
|
|
1274 |
// We only need to use this for one transition coming
|
|
1275 |
// from playback view.
|
|
1276 |
TBool pbv = (iPreviousViewId == TUid::Uid(KMPXPluginTypePlaybackUid)) ? ETrue : EFalse;
|
|
1277 |
if ( pbv )
|
|
1278 |
{
|
|
1279 |
iIsNowPlayingView = ETrue;
|
|
1280 |
iPreviousViewId = TUid::Uid(0);
|
|
1281 |
SetupTransitionType(KMPXInterviewTransition, pbv);
|
|
1282 |
}
|
|
1283 |
else // intraview transitions
|
|
1284 |
{
|
|
1285 |
SetupTransitionType(KMPXIntraviewTransition);
|
|
1286 |
}
|
|
1287 |
BeginFullScreenAnimation();
|
|
1288 |
}
|
|
1289 |
|
|
1290 |
switch (iCurrentViewType)
|
|
1291 |
{
|
|
1292 |
case EMPXViewMediawall:
|
|
1293 |
{
|
|
1294 |
TMPXPlaybackState pbState( iPlaybackUtility->StateL() );
|
|
1295 |
if ( pbState == EPbStatePlaying || pbState == EPbStatePaused || pbState == EPbStateStopped )
|
|
1296 |
{
|
|
1297 |
RestoreSelectedAlbumItemL(mediaArray);
|
|
1298 |
}
|
|
1299 |
PrepareMediaWallL(mediaArray, count);
|
|
1300 |
iOpenAlbumTracks = EFalse;
|
|
1301 |
break;
|
|
1302 |
}
|
|
1303 |
case EMPXViewTBone:
|
|
1304 |
{
|
|
1305 |
RestoreSelectedAlbumItemL(mediaArray);
|
|
1306 |
PrepareMediaWallWithListL( mediaArray, count );
|
|
1307 |
// We need to adjust the CBA for this view.
|
|
1308 |
if( iCbaHandler )
|
|
1309 |
{
|
|
1310 |
iCbaHandler->UpdateCba();
|
|
1311 |
}
|
|
1312 |
break;
|
|
1313 |
}
|
|
1314 |
case EMPXViewList:
|
|
1315 |
{
|
|
1316 |
PrepareListL(mediaArray, count);
|
|
1317 |
iOpenAlbumTracks = EFalse;
|
|
1318 |
break;
|
|
1319 |
}
|
|
1320 |
default:
|
|
1321 |
User::Leave( KErrGeneral );
|
|
1322 |
break;
|
|
1323 |
}
|
|
1324 |
}
|
|
1325 |
|
|
1326 |
DrawableWindow()->SetOrdinalPosition( -1 );
|
|
1327 |
|
|
1328 |
iPrevViewType = iCurrentViewType;
|
|
1329 |
iPrevContext = iContext;
|
|
1330 |
if ( iSetEmptyTextNeeded )
|
|
1331 |
{
|
|
1332 |
LoadAndSetEmptyTextL();
|
|
1333 |
iSetEmptyTextNeeded = EFalse;
|
|
1334 |
}
|
|
1335 |
iLayoutSwitch = EFalse;
|
|
1336 |
}
|
|
1337 |
|
|
1338 |
// -----------------------------------------------------------------------------
|
|
1339 |
// Handle listbox item addition, preserving the current display index
|
|
1340 |
// -----------------------------------------------------------------------------
|
|
1341 |
//
|
|
1342 |
void CMPXCollectionViewHgContainer::HandleLbxItemAdditionPreserveIndexL()
|
|
1343 |
{
|
|
1344 |
MPX_FUNC( "CMPXCollectionViewHgContainer::HandleLbxItemAdditionPreserveIndexL" );
|
|
1345 |
HandleLbxItemAdditionL();
|
|
1346 |
}
|
|
1347 |
|
|
1348 |
|
|
1349 |
// -----------------------------------------------------------------------------
|
|
1350 |
// Handle listbox item removal.
|
|
1351 |
// -----------------------------------------------------------------------------
|
|
1352 |
//
|
|
1353 |
void CMPXCollectionViewHgContainer::HandleLbxItemRemovalL()
|
|
1354 |
{
|
|
1355 |
MPX_FUNC( "CMPXCollectionViewHgContainer::HandleLbxItemRemovalL" );
|
|
1356 |
iTopIndex = 0;
|
|
1357 |
iBottomIndex = KErrNotFound;
|
|
1358 |
if ( iContext != iPrevContext )
|
|
1359 |
{
|
|
1360 |
CancelTNRequest();
|
|
1361 |
iThumbnailReqMap.Close();
|
|
1362 |
|
|
1363 |
}
|
|
1364 |
}
|
|
1365 |
|
|
1366 |
|
|
1367 |
// -----------------------------------------------------------------------------
|
|
1368 |
// Show/hide find box.
|
|
1369 |
// -----------------------------------------------------------------------------
|
|
1370 |
//
|
|
1371 |
void CMPXCollectionViewHgContainer::SetFindBoxVisibilityL( TBool /*aIsVisible*/ )
|
|
1372 |
{
|
|
1373 |
}
|
|
1374 |
|
|
1375 |
|
|
1376 |
// -----------------------------------------------------------------------------
|
|
1377 |
// Determine find box visibility
|
|
1378 |
// -----------------------------------------------------------------------------
|
|
1379 |
//
|
|
1380 |
TBool CMPXCollectionViewHgContainer::FindBoxVisibility()
|
|
1381 |
{
|
|
1382 |
return EFalse;
|
|
1383 |
}
|
|
1384 |
|
|
1385 |
|
|
1386 |
// -----------------------------------------------------------------------------
|
|
1387 |
// Restore the PopupCBA of find box
|
|
1388 |
// -----------------------------------------------------------------------------
|
|
1389 |
//
|
|
1390 |
void CMPXCollectionViewHgContainer::RestoreFindBoxPopupCBA()
|
|
1391 |
{
|
|
1392 |
}
|
|
1393 |
|
|
1394 |
|
|
1395 |
// -----------------------------------------------------------------------------
|
|
1396 |
// Calculate the top index of the visible items
|
|
1397 |
// -----------------------------------------------------------------------------
|
|
1398 |
//
|
|
1399 |
TInt CMPXCollectionViewHgContainer::CalculateTopIndex( TInt /*aBottomIndex*/ )
|
|
1400 |
{
|
|
1401 |
MPX_FUNC( "CMPXCollectionViewHgContainer::CalculateTopIndex" );
|
|
1402 |
return 0;
|
|
1403 |
}
|
|
1404 |
|
|
1405 |
// ---------------------------------------------------------------------------
|
|
1406 |
// Enable/disable find box
|
|
1407 |
// ---------------------------------------------------------------------------
|
|
1408 |
//
|
|
1409 |
void CMPXCollectionViewHgContainer::EnableFindBox( TBool /*aEnable*/ )
|
|
1410 |
{
|
|
1411 |
MPX_FUNC( "CMPXCollectionViewHgContainer::EnableFindBox" );
|
|
1412 |
}
|
|
1413 |
|
|
1414 |
|
|
1415 |
// ---------------------------------------------------------------------------
|
|
1416 |
// Enable/disable marking
|
|
1417 |
// ---------------------------------------------------------------------------
|
|
1418 |
//
|
|
1419 |
void CMPXCollectionViewHgContainer::EnableMarking( TBool /*aEnable*/ )
|
|
1420 |
{
|
|
1421 |
MPX_FUNC( "CMPXCollectionViewHgContainer::EnableMarking" );
|
|
1422 |
}
|
|
1423 |
|
|
1424 |
// ---------------------------------------------------------------------------
|
|
1425 |
// Custom handling of commands for markable lists.
|
|
1426 |
// ---------------------------------------------------------------------------
|
|
1427 |
//
|
|
1428 |
void CMPXCollectionViewHgContainer::HandleMarkableListProcessCommandL(
|
|
1429 |
TInt aCommand )
|
|
1430 |
{
|
|
1431 |
MPX_FUNC( "CMPXCollectionViewHgContainer::HandleMarkableListProcessCommandL" );
|
|
1432 |
|
|
1433 |
if ( iListWidget )
|
|
1434 |
{
|
|
1435 |
switch ( aCommand )
|
|
1436 |
{
|
|
1437 |
case EAknCmdMark:
|
|
1438 |
iListWidget->Mark(iListWidget->SelectedIndex());
|
|
1439 |
break;
|
|
1440 |
case EAknCmdUnmark:
|
|
1441 |
iListWidget->UnMark(iListWidget->SelectedIndex());
|
|
1442 |
break;
|
|
1443 |
case EAknMarkAll:
|
|
1444 |
iListWidget->MarkAll();
|
|
1445 |
break;
|
|
1446 |
case EAknUnmarkAll:
|
|
1447 |
iListWidget->UnMarkAll();
|
|
1448 |
break;
|
|
1449 |
}
|
|
1450 |
iListWidget->RefreshScreen(iListWidget->SelectedIndex());
|
|
1451 |
}
|
|
1452 |
}
|
|
1453 |
|
|
1454 |
|
|
1455 |
// ---------------------------------------------------------------------------
|
|
1456 |
// Custom handling of menu pane for markable lists
|
|
1457 |
// ---------------------------------------------------------------------------
|
|
1458 |
//
|
|
1459 |
void CMPXCollectionViewHgContainer::HandleMarkableListDynInitMenuPane(
|
|
1460 |
TInt aResourceId,
|
|
1461 |
CEikMenuPane* aMenuPane )
|
|
1462 |
{
|
|
1463 |
MPX_FUNC( "CMPXCollectionViewHgContainer::HandleMarkableListDynInitMenuPane" );
|
|
1464 |
|
|
1465 |
if ( aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST )
|
|
1466 |
{
|
|
1467 |
TInt currentItem = CurrentLbxItemIndex();
|
|
1468 |
if ( currentItem == KErrNotFound )
|
|
1469 |
{
|
|
1470 |
aMenuPane->SetItemDimmed( EAknCmdEditListMenu, ETrue );
|
|
1471 |
}
|
|
1472 |
else
|
|
1473 |
{
|
|
1474 |
aMenuPane->SetItemDimmed( EAknCmdEditListMenu, EFalse );
|
|
1475 |
}
|
|
1476 |
}
|
|
1477 |
else if ( aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST_IMPLEMENTATION )
|
|
1478 |
{
|
|
1479 |
TRAP_IGNORE(CurrentSelectionIndicesL());
|
|
1480 |
TInt currentItem = CurrentLbxItemIndex();
|
|
1481 |
if ( currentItem != KErrNotFound )
|
|
1482 |
{
|
|
1483 |
TBool currentItemMarked = EFalse;
|
|
1484 |
for( int i = 0; i < iListSelections->Count(); i++ )
|
|
1485 |
{
|
|
1486 |
if ( currentItem == iListSelections->At(i) )
|
|
1487 |
{
|
|
1488 |
currentItemMarked = ETrue;
|
|
1489 |
break;
|
|
1490 |
}
|
|
1491 |
}
|
|
1492 |
|
|
1493 |
TInt count = 0;
|
|
1494 |
if( iListWidget )
|
|
1495 |
{
|
|
1496 |
count = iListWidget->ItemCount();
|
|
1497 |
}
|
|
1498 |
else if ( iMediaWall )
|
|
1499 |
{
|
|
1500 |
count = iMediaWall->ItemCount();
|
|
1501 |
}
|
|
1502 |
aMenuPane->SetItemDimmed( EAknCmdMark, currentItemMarked );
|
|
1503 |
aMenuPane->SetItemDimmed( EAknCmdUnmark, !currentItemMarked );
|
|
1504 |
aMenuPane->SetItemDimmed( EAknMarkAll, iListSelections->Count() == count );
|
|
1505 |
aMenuPane->SetItemDimmed( EAknUnmarkAll, iListSelections->Count() == 0 );
|
|
1506 |
}
|
|
1507 |
}
|
|
1508 |
}
|
|
1509 |
|
|
1510 |
|
|
1511 |
|
|
1512 |
|
|
1513 |
// ---------------------------------------------------------------------------
|
|
1514 |
// Resize the list when contents of media array changed.
|
|
1515 |
// ---------------------------------------------------------------------------
|
|
1516 |
//
|
|
1517 |
void CMPXCollectionViewHgContainer::ResizeListL(const CMPXMediaArray& aMediaArray, TInt aCount)
|
|
1518 |
{
|
|
1519 |
MPX_FUNC( "CMPXCollectionViewHgContainer::ResizeListL" );
|
|
1520 |
TInt mediaCount = aMediaArray.Count();
|
|
1521 |
SetupTransitionType( KMPXNoTransition );
|
|
1522 |
if( iListWidget )
|
|
1523 |
{
|
|
1524 |
TRect clientRect = ((CAknView*)iView)->ClientRect();
|
|
1525 |
TInt index = MediaIndex(iListWidget->SelectedIndex());
|
|
1526 |
TInt mediaIndex (index);
|
|
1527 |
mediaIndex = ( KErrNotFound == mediaIndex ) ? iListWidget->FirstIndexOnScreen() : mediaIndex;
|
|
1528 |
mediaIndex = ( mediaIndex >= 0 && (mediaIndex < (mediaCount)) ) ? mediaIndex : (mediaCount - 1);
|
|
1529 |
// No need to modify index of first item, if reorder is activated
|
|
1530 |
if ( IsInReorderMode() && index == KErrNotFound )
|
|
1531 |
{
|
|
1532 |
mediaIndex = KErrNotFound;
|
|
1533 |
}
|
|
1534 |
TInt prevItemCount = iListWidget->ItemCount();
|
|
1535 |
|
|
1536 |
iListWidget->InitScreenL( clientRect );
|
|
1537 |
iListWidget->Reset();
|
|
1538 |
if ( aCount )
|
|
1539 |
{
|
|
1540 |
// enable scroll buffering now as it has not been enabled when empty list was constructed
|
|
1541 |
if ( !prevItemCount )
|
|
1542 |
{
|
|
1543 |
iListWidget->EnableScrollBufferL( *this, KMPXListBufferSize, KMPXListBufferSize/4 );
|
|
1544 |
}
|
|
1545 |
iListWidget->ResizeL( aCount );
|
|
1546 |
ProvideDataWithoutThumbnailsL(aMediaArray);
|
|
1547 |
iListWidget->SetSelectedIndex( mediaIndex + iShuffleItem );
|
|
1548 |
// Reserve mark icon for playlist in reorder mode
|
|
1549 |
if ( IsInReorderMode() )
|
|
1550 |
{
|
|
1551 |
MarkGrabedItemL( CurrentLbxItemIndex() + 1 );
|
|
1552 |
}
|
|
1553 |
|
|
1554 |
// To remove flicker of default albumart in playlist track level
|
|
1555 |
if ( iContext == EContextItemPlaylist )
|
|
1556 |
{
|
|
1557 |
iDefaultIconSet = EFalse;
|
|
1558 |
// Setting an empty icon to the list as default icon.
|
|
1559 |
iListWidget->SetDefaultIconL(CGulIcon::NewL(new CFbsBitmap()));
|
|
1560 |
}
|
|
1561 |
}
|
|
1562 |
else
|
|
1563 |
{
|
|
1564 |
iListWidget->RefreshScreen(0);
|
|
1565 |
}
|
|
1566 |
}
|
|
1567 |
else if( iMediaWall )
|
|
1568 |
{
|
|
1569 |
// In case of mediawall components we switch to different view type if orientation changes
|
|
1570 |
// so there is no need to set new client rect for mediawall.
|
|
1571 |
TInt mediaIndex = MediaIndex(iMediaWall->SelectedIndex());
|
|
1572 |
|
|
1573 |
// Correct the array index if it is out of range
|
|
1574 |
// This case may happen when last album or album beside selected album is deleted
|
|
1575 |
// mediaIndex -1 is valid and it represents shuffle item
|
|
1576 |
|
|
1577 |
if ( mediaIndex >= mediaCount || mediaIndex < -1)
|
|
1578 |
{
|
|
1579 |
mediaIndex = mediaCount - 1; // last item of the list
|
|
1580 |
}
|
|
1581 |
|
|
1582 |
//in case of shuffle item is seleted (mediaIndex -1), there is no need to save it.
|
|
1583 |
if( (iSelectedAlbumIndex != mediaIndex) && ( mediaIndex != -1) )
|
|
1584 |
{
|
|
1585 |
iSelectedAlbumIndex = mediaIndex;
|
|
1586 |
SaveSelectedAlbumItemL( iSelectedAlbumIndex );
|
|
1587 |
}
|
|
1588 |
|
|
1589 |
TInt prevItemCount( iMediaWall->ItemCount() );
|
|
1590 |
iMediaWall->Reset();
|
|
1591 |
if ( aCount )
|
|
1592 |
{
|
|
1593 |
// enable scroll buffering now as it has not been enabled when empty mediawall was constructed
|
|
1594 |
if ( !prevItemCount )
|
|
1595 |
{
|
|
1596 |
iMediaWall->EnableScrollBufferL( *this, KMPXListBufferSizeWithMediaWall, KMPXListBufferSizeWithMediaWall/4 );
|
|
1597 |
}
|
|
1598 |
iMediaWall->ResizeL( aCount );
|
|
1599 |
ProvideDataWithoutThumbnailsMwL(aMediaArray);
|
|
1600 |
|
|
1601 |
iMediaWall->SetSelectedIndex( mediaIndex + iShuffleItem);
|
|
1602 |
if ( iCurrentViewType == EMPXViewTBone )
|
|
1603 |
{
|
|
1604 |
OpenAlbumL( mediaIndex );
|
|
1605 |
}
|
|
1606 |
}
|
|
1607 |
else
|
|
1608 |
{
|
|
1609 |
iMediaWall->RefreshScreen(0);
|
|
1610 |
}
|
|
1611 |
}
|
|
1612 |
}
|
|
1613 |
|
|
1614 |
// ----------------------------------------------------------------------------
|
|
1615 |
// Prepare view for displaying data in list format.
|
|
1616 |
// ----------------------------------------------------------------------------
|
|
1617 |
void CMPXCollectionViewHgContainer::PrepareListL(const CMPXMediaArray& aMediaArray, TInt aCount)
|
|
1618 |
{
|
|
1619 |
MPX_FUNC("CMPXCollectionViewHgContainer::PrepareListL");
|
|
1620 |
|
|
1621 |
if (!((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->IsVisible())
|
|
1622 |
((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(ETrue);
|
|
1623 |
|
|
1624 |
if( iCbaHandler )
|
|
1625 |
iCbaHandler->UpdateCba();
|
|
1626 |
|
|
1627 |
TRect clientRect = ((CAknView*)iView)->ClientRect();
|
|
1628 |
iThumbnailManager->SetSizeL( EAudioListThumbnailSize );
|
|
1629 |
iImageSize = CHgDoubleGraphicListFlat::PreferredImageSize();
|
|
1630 |
|
|
1631 |
if( !iListWidget )
|
|
1632 |
{
|
|
1633 |
iListWidget = CHgDoubleGraphicListFlat::NewL (
|
|
1634 |
clientRect,
|
|
1635 |
aCount,
|
|
1636 |
NULL,
|
|
1637 |
NULL );
|
|
1638 |
iListWidget->SetMenuProviderL(this);
|
|
1639 |
iListWidget->SetSelectionObserver(*this);
|
|
1640 |
// TODO. check if this is correct for all lists
|
|
1641 |
iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
|
|
1642 |
iListWidget->SetFocus(ETrue);
|
|
1643 |
if( iContext == EContextItemPlaylist )
|
|
1644 |
{
|
|
1645 |
iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar);
|
|
1646 |
}
|
|
1647 |
else
|
|
1648 |
{
|
|
1649 |
iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerLetterStripLite );
|
|
1650 |
}
|
|
1651 |
iListWidget->DrawableWindow()->SetOrdinalPosition( -1 );
|
|
1652 |
iListWidget->DrawableWindow()->SetFaded(((CAknAppUi*)iCoeEnv->AppUi())->IsFaded(), RWindowTreeNode::EFadeIncludeChildren);
|
|
1653 |
ProvideDataWithoutThumbnailsL(aMediaArray);
|
|
1654 |
}
|
|
1655 |
else
|
|
1656 |
{
|
|
1657 |
iListWidget->Reset();
|
|
1658 |
iListWidget->ResizeL( aCount );
|
|
1659 |
iListWidget->SetFocus(ETrue);
|
|
1660 |
if( iContext == EContextItemPlaylist )
|
|
1661 |
{
|
|
1662 |
iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar);
|
|
1663 |
}
|
|
1664 |
else
|
|
1665 |
{
|
|
1666 |
iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerLetterStripLite );
|
|
1667 |
}
|
|
1668 |
ProvideDataWithoutThumbnailsL(aMediaArray);
|
|
1669 |
iListWidget->MakeVisible(ETrue);
|
|
1670 |
iListWidget->InitScreenL(clientRect);
|
|
1671 |
}
|
|
1672 |
|
|
1673 |
if ( (iAlbumIndex >= 0) && (iAlbumIndex < aCount) )
|
|
1674 |
{
|
|
1675 |
iListWidget->SetSelectedIndex( iAlbumIndex + iShuffleItem );
|
|
1676 |
}
|
|
1677 |
else if ( KErrNotFound == iAlbumIndex )
|
|
1678 |
{
|
|
1679 |
if ( iSelectedAlbumIndex >= 0 && iSelectedAlbumIndex < aCount)
|
|
1680 |
{
|
|
1681 |
iListWidget->SetSelectedIndex( iSelectedAlbumIndex + iShuffleItem );
|
|
1682 |
}
|
|
1683 |
else
|
|
1684 |
{
|
|
1685 |
iListWidget->SetSelectedIndex( iListWidget->FirstIndexOnScreen() + iShuffleItem );
|
|
1686 |
}
|
|
1687 |
}
|
|
1688 |
|
|
1689 |
// TODO. Define here in which views we need to have buffering enabled in the list
|
|
1690 |
if( ( ( iContext == EContextGroupAlbum ) ||
|
|
1691 |
( iContext == EContextGroupArtist ) ||
|
|
1692 |
( iContext == EContextGroupSong ) ||
|
|
1693 |
( iContext == EContextItemGenre ) ||
|
|
1694 |
( iContext == EContextItemPlaylist ) ) &&
|
|
1695 |
// Check if the list is empty, Enable scroll buffer won't call requst if list is empty
|
|
1696 |
( iListWidget->ItemCount() != 0 ) )
|
|
1697 |
{
|
|
1698 |
MPX_DEBUG1("CMPXCollectionViewHgContainer::PrepareListL - EnableScrollBufferL");
|
|
1699 |
iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
|
|
1700 |
iDefaultIconSet = EFalse;
|
|
1701 |
// Setting an empty icon to the list as default icon.
|
|
1702 |
iListWidget->SetDefaultIconL(CGulIcon::NewL(new CFbsBitmap()));
|
|
1703 |
CleanPrevView();
|
|
1704 |
}
|
|
1705 |
else
|
|
1706 |
{
|
|
1707 |
// Note: Special case
|
|
1708 |
// We need to clean previous view prior to setting default icon otherwise the
|
|
1709 |
// icon will be set to the wrong scroller.
|
|
1710 |
CleanPrevView();
|
|
1711 |
SetDefaultIconL();
|
|
1712 |
EndFullScreenAnimation();
|
|
1713 |
iListWidget->RefreshScreen(0);
|
|
1714 |
iDefaultIconSet = ETrue;
|
|
1715 |
}
|
|
1716 |
}
|
|
1717 |
|
|
1718 |
// ----------------------------------------------------------------------------
|
|
1719 |
// Prepare view for displaying data in media wall with list
|
|
1720 |
// ----------------------------------------------------------------------------
|
|
1721 |
void CMPXCollectionViewHgContainer::PrepareMediaWallWithListL(const CMPXMediaArray& aMediaArray, TInt aCount)
|
|
1722 |
{
|
|
1723 |
MPX_FUNC("CMPXCollectionViewHgContainer::PrepareMediaWallWithListL");
|
|
1724 |
|
|
1725 |
// Now create the media wall & the list
|
|
1726 |
|
|
1727 |
((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(EFalse);
|
|
1728 |
iThumbnailManager->SetSizeL( EAudioGridThumbnailSize );
|
|
1729 |
|
|
1730 |
TRect clientRect = ((CAknView*)iView)->ClientRect();
|
|
1731 |
|
|
1732 |
TAknLayoutRect mediawallLayout;
|
|
1733 |
mediawallLayout.LayoutRect( clientRect, AknLayoutScalable_Apps::cf0_flow_pane(0) );
|
|
1734 |
|
|
1735 |
TAknLayoutRect listLayout;
|
|
1736 |
listLayout.LayoutRect( clientRect, AknLayoutScalable_Apps::listscroll_cf0_pane(0) );
|
|
1737 |
|
|
1738 |
TRect mediaWallRect = mediawallLayout.Rect();
|
|
1739 |
TRect mwListRect = listLayout.Rect();
|
|
1740 |
|
|
1741 |
// get front rectange from layout
|
|
1742 |
TAknLayoutRect frontRect;
|
|
1743 |
frontRect.LayoutRect( mediaWallRect, AknLayoutScalable_Apps::cf0_flow_pane_g1(0) );
|
|
1744 |
iImageSize = frontRect.Rect().Size();
|
|
1745 |
|
|
1746 |
if( iMediaWall )
|
|
1747 |
{
|
|
1748 |
delete iMediaWall;
|
|
1749 |
iMediaWall = 0;
|
|
1750 |
delete iMwListWidget;
|
|
1751 |
iMwListWidget = 0;
|
|
1752 |
}
|
|
1753 |
|
|
1754 |
if ( !iMediaWall )
|
|
1755 |
{
|
|
1756 |
iMediaWall = CHgVgMediaWall::NewL (
|
|
1757 |
mediaWallRect,
|
|
1758 |
aCount,
|
|
1759 |
CHgVgMediaWall::EHgVgMediaWallStyleCoverflowTBonePortrait,
|
|
1760 |
EFalse,
|
|
1761 |
this,
|
|
1762 |
CGulIcon::NewL( new CFbsBitmap()) );
|
|
1763 |
|
|
1764 |
if( !iIsForeground )
|
|
1765 |
iMediaWall->HandleLosingForeground();
|
|
1766 |
|
|
1767 |
iMediaWall->SetMopParent(this);
|
|
1768 |
iMediaWall->EnableScrollBufferL(*this, KMPXListBufferSizeWithMediaWall, KMPXListBufferSizeWithMediaWall/4);
|
|
1769 |
iMediaWall->SetSelectionObserver(*this);
|
|
1770 |
ProvideDataWithoutThumbnailsMwL(aMediaArray);
|
|
1771 |
|
|
1772 |
// Create the list to be used with Media wall view
|
|
1773 |
iMwListWidget = CHgSingleTextListWithIcon::NewL(mwListRect, 0, NULL, NULL);
|
|
1774 |
iMwListWidget->SetMenuProviderL(this);
|
|
1775 |
iMwListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
|
|
1776 |
iMwListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar );
|
|
1777 |
iMwListWidget->SetSelectionObserver(*this);
|
|
1778 |
}
|
|
1779 |
else
|
|
1780 |
{
|
|
1781 |
// Lets just reuse the mediawall item and resize it.
|
|
1782 |
if( iMediaWall->Style() != CHgVgMediaWall::EHgVgMediaWallStyleCoverflowTBonePortrait )
|
|
1783 |
iMediaWall->ChangeStyleL( CHgVgMediaWall::EHgVgMediaWallStyleCoverflowTBonePortrait, mediaWallRect, ETrue );
|
|
1784 |
|
|
1785 |
iMediaWall->EnableScrollBufferL(*this, KMPXListBufferSizeWithMediaWall, KMPXListBufferSizeWithMediaWall/4);
|
|
1786 |
iMediaWall->MakeVisible( ETrue );
|
|
1787 |
if ( !iMwListWidget )
|
|
1788 |
{
|
|
1789 |
iMwListWidget = CHgSingleTextListWithIcon::NewL(mwListRect, 0, NULL, NULL);
|
|
1790 |
iMwListWidget->SetMenuProviderL(this);
|
|
1791 |
iMwListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
|
|
1792 |
iMwListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar );
|
|
1793 |
iMwListWidget->SetSelectionObserver(*this);
|
|
1794 |
}
|
|
1795 |
else
|
|
1796 |
{
|
|
1797 |
iMwListWidget->MakeVisible( ETrue );
|
|
1798 |
iMwListWidget->SetFocus( ETrue );
|
|
1799 |
iMwListWidget->SetRect( mwListRect );
|
|
1800 |
iMwListWidget->DrawNow();
|
|
1801 |
}
|
|
1802 |
}
|
|
1803 |
|
|
1804 |
if( iTranstionType != EMPXTranstionNotDefined )
|
|
1805 |
{
|
|
1806 |
iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallDrawToWindowGC );
|
|
1807 |
}
|
|
1808 |
|
|
1809 |
iMediaWall->SetOpeningAnimationType( CHgVgMediaWall::EHgVgOpeningAnimationNone );
|
|
1810 |
|
|
1811 |
if ( iAlbumIndex == KErrNotFound )
|
|
1812 |
{
|
|
1813 |
iMediaWall->SetSelectedIndex( iRestoredAlbumIndex );
|
|
1814 |
// If we are about to start a transition animation we should draw only
|
|
1815 |
// when we have received first screen of thumbs in Refresh function.
|
|
1816 |
if( iTranstionType == EMPXTranstionNotDefined )
|
|
1817 |
iMediaWall->RefreshScreen(iRestoredAlbumIndex);
|
|
1818 |
OpenAlbumL(iRestoredAlbumIndex);
|
|
1819 |
}
|
|
1820 |
else
|
|
1821 |
{
|
|
1822 |
iMediaWall->SetSelectedIndex( iAlbumIndex );
|
|
1823 |
// If we are about to start a transition animation we should draw only
|
|
1824 |
// when we have received first screen of thumbs in Refresh function.
|
|
1825 |
if( iTranstionType == EMPXTranstionNotDefined )
|
|
1826 |
iMediaWall->RefreshScreen(iAlbumIndex);
|
|
1827 |
OpenAlbumL(iAlbumIndex);
|
|
1828 |
}
|
|
1829 |
iMwListWidget->RefreshScreen(0);
|
|
1830 |
|
|
1831 |
CleanPrevView();
|
|
1832 |
}
|
|
1833 |
|
|
1834 |
// ----------------------------------------------------------------------------
|
|
1835 |
// Prepare view for displaying data in Media wall format.
|
|
1836 |
// ----------------------------------------------------------------------------
|
|
1837 |
void CMPXCollectionViewHgContainer::PrepareMediaWallL(const CMPXMediaArray& aMediaArray, TInt aCount)
|
|
1838 |
{
|
|
1839 |
MPX_FUNC("CMPXCollectionViewHgContainer::PrepareMediaWallL");
|
|
1840 |
TRect appRect = ((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect();
|
|
1841 |
((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(EFalse);
|
|
1842 |
iThumbnailManager->SetSizeL( EAudioFullScreenThumbnailSize );
|
|
1843 |
if( iCbaHandler )
|
|
1844 |
iCbaHandler->UpdateCba();
|
|
1845 |
// get front rectange from layout
|
|
1846 |
TAknLayoutRect frontRect;
|
|
1847 |
frontRect.LayoutRect( appRect, AknLayoutScalable_Apps::cf0_flow_pane_g1(0) );
|
|
1848 |
iImageSize = frontRect.Rect().Size();
|
|
1849 |
|
|
1850 |
CMPXCollectionViewHgSwitchBuffer* switchBuffer(NULL);
|
|
1851 |
|
|
1852 |
if( iListWidget && (iPrevContext == EContextGroupAlbum || iPrevContext == EContextItemAlbum ) )
|
|
1853 |
{
|
|
1854 |
switchBuffer = CMPXCollectionViewHgSwitchBuffer::CreateBufferLC( *iListWidget );
|
|
1855 |
}
|
|
1856 |
else if ( iMediaWall && iPrevViewType == EMPXViewTBone )
|
|
1857 |
{
|
|
1858 |
switchBuffer = CMPXCollectionViewHgSwitchBuffer::CreateBufferLC( *iMediaWall );
|
|
1859 |
if (aMediaArray.Count()>1)
|
|
1860 |
{
|
|
1861 |
switchBuffer->SetIndexOffset(1);
|
|
1862 |
}
|
|
1863 |
}
|
|
1864 |
if( iMediaWall )
|
|
1865 |
{
|
|
1866 |
delete iMediaWall;
|
|
1867 |
iMediaWall = 0;
|
|
1868 |
delete iMwListWidget;
|
|
1869 |
iMwListWidget = 0;
|
|
1870 |
}
|
|
1871 |
|
|
1872 |
if (!iMediaWall)
|
|
1873 |
{
|
|
1874 |
if ( iIsNowPlayingView )
|
|
1875 |
{
|
|
1876 |
// back from now playing view, create mediawall with empty albumart icon to avoid flickering
|
|
1877 |
iMediaWall = CHgVgMediaWall::NewL(
|
|
1878 |
appRect,
|
|
1879 |
aCount,
|
|
1880 |
CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen,
|
|
1881 |
ETrue,
|
|
1882 |
this,
|
|
1883 |
CGulIcon::NewL( new CFbsBitmap()) );
|
|
1884 |
}
|
|
1885 |
else
|
|
1886 |
{
|
|
1887 |
iMediaWall = CHgVgMediaWall::NewL(
|
|
1888 |
appRect,
|
|
1889 |
aCount,
|
|
1890 |
CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen,
|
|
1891 |
ETrue,
|
|
1892 |
this,
|
|
1893 |
DefaultIconL() );
|
|
1894 |
}
|
|
1895 |
|
|
1896 |
if( !iIsForeground )
|
|
1897 |
iMediaWall->HandleLosingForeground();
|
|
1898 |
|
|
1899 |
iMediaWall->SetMopParent(this);
|
|
1900 |
iMediaWall->SetSelectionObserver(*this);
|
|
1901 |
iMediaWall->SetObserver( this ); // softkey visibility event observer
|
|
1902 |
// Check if the list is empty, Enable scroll buffer won't call requst if list is empty
|
|
1903 |
if( iMediaWall->ItemCount() != 0 )
|
|
1904 |
{
|
|
1905 |
iMediaWall->EnableScrollBufferL(
|
|
1906 |
*this,
|
|
1907 |
KMPXListBufferSizeWithMediaWall,
|
|
1908 |
KMPXListBufferSizeWithMediaWall / 4);
|
|
1909 |
}
|
|
1910 |
else
|
|
1911 |
{
|
|
1912 |
EndFullScreenAnimation();
|
|
1913 |
iMediaWall->RefreshScreen( 0 );
|
|
1914 |
}
|
|
1915 |
// We want softkeys to be drawn on top of mediawall, thats we need to manipulate window pos
|
|
1916 |
iMediaWall->DrawableWindow()->SetOrdinalPosition( -1 );
|
|
1917 |
if(((CAknAppUi*)iCoeEnv->AppUi())->IsFaded())
|
|
1918 |
{
|
|
1919 |
iMediaWall->DrawableWindow()->SetFaded(ETrue, RWindowTreeNode::EFadeIncludeChildren);
|
|
1920 |
iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallFaded );
|
|
1921 |
}
|
|
1922 |
ProvideDataWithoutThumbnailsMwL(aMediaArray);
|
|
1923 |
if( iAlbumIndex == KErrNotFound )
|
|
1924 |
iMediaWall->SetSelectedIndex( iRestoredAlbumIndex + iShuffleItem );
|
|
1925 |
else
|
|
1926 |
iMediaWall->SetSelectedIndex( iAlbumIndex + iShuffleItem );
|
|
1927 |
}
|
|
1928 |
else
|
|
1929 |
{
|
|
1930 |
if( iMediaWall->Style() != CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen )
|
|
1931 |
iMediaWall->ChangeStyleL( CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen, appRect, ETrue );
|
|
1932 |
|
|
1933 |
iMediaWall->MakeVisible( ETrue );
|
|
1934 |
iMediaWall->SetFocus( ETrue );
|
|
1935 |
// Check if the list is empty, Enable scroll buffer won't call requst if list is empty
|
|
1936 |
if( iMediaWall->ItemCount() != 0 )
|
|
1937 |
{
|
|
1938 |
iMediaWall->EnableScrollBufferL(
|
|
1939 |
*this,
|
|
1940 |
KMPXListBufferSizeWithMediaWall,
|
|
1941 |
KMPXListBufferSizeWithMediaWall / 4);
|
|
1942 |
}
|
|
1943 |
else
|
|
1944 |
{
|
|
1945 |
EndFullScreenAnimation();
|
|
1946 |
iMediaWall->RefreshScreen( 0 );
|
|
1947 |
}
|
|
1948 |
if( iAlbumIndex == KErrNotFound )
|
|
1949 |
iMediaWall->SetSelectedIndex( iRestoredAlbumIndex + iShuffleItem );
|
|
1950 |
else
|
|
1951 |
iMediaWall->SetSelectedIndex( iAlbumIndex + iShuffleItem );
|
|
1952 |
}
|
|
1953 |
|
|
1954 |
if( iTranstionType != EMPXTranstionNotDefined )
|
|
1955 |
{
|
|
1956 |
iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallDrawToWindowGC );
|
|
1957 |
}
|
|
1958 |
|
|
1959 |
if( iPopupListRect == TRect(0,0,0,0) )
|
|
1960 |
{
|
|
1961 |
ResolvePopupListSizeL();
|
|
1962 |
}
|
|
1963 |
|
|
1964 |
iMediaWall->SetOpenedItemRect( iPopupListRect );
|
|
1965 |
iMediaWall->SetOpeningAnimationType( CHgVgMediaWall::EHgVgOpeningAnimationZoomToFront );
|
|
1966 |
|
|
1967 |
if( switchBuffer )
|
|
1968 |
{
|
|
1969 |
switchBuffer->FillFromBufferL( *iMediaWall );
|
|
1970 |
CleanupStack::PopAndDestroy( switchBuffer );
|
|
1971 |
switchBuffer = NULL;
|
|
1972 |
}
|
|
1973 |
|
|
1974 |
if ( iIsNowPlayingView )
|
|
1975 |
{
|
|
1976 |
iDefaultIconSet = EFalse;
|
|
1977 |
iIsNowPlayingView = EFalse;
|
|
1978 |
}
|
|
1979 |
else
|
|
1980 |
{
|
|
1981 |
iDefaultIconSet = ETrue;
|
|
1982 |
}
|
|
1983 |
CleanPrevView();
|
|
1984 |
}
|
|
1985 |
|
|
1986 |
// ----------------------------------------------------------------------------
|
|
1987 |
// Add shuffle list item to the top of the list.
|
|
1988 |
// ----------------------------------------------------------------------------
|
|
1989 |
void CMPXCollectionViewHgContainer::SetShuffleItemToListL(CHgScroller* aScroller )
|
|
1990 |
{
|
|
1991 |
CHgItem* item = CHgItem::NewL();
|
|
1992 |
HBufC* shuffleText = StringLoader::LoadLC(
|
|
1993 |
R_MPX_TBONE_SHUFFLE );
|
|
1994 |
item->SetTitleL( *shuffleText );
|
|
1995 |
CleanupStack::PopAndDestroy( shuffleText );
|
|
1996 |
|
|
1997 |
CGulIcon* icon = (*iIconArray)[EMPXClvIconShuffle];
|
|
1998 |
CFbsBitmap* bitmap = icon->Bitmap();
|
|
1999 |
CFbsBitmap* mask = icon->Mask();
|
|
2000 |
|
|
2001 |
// Icon needs to be bigger!
|
|
2002 |
TSize size(35, 35);
|
|
2003 |
AknIconUtils::SetSize( bitmap, size );
|
|
2004 |
AknIconUtils::SetSize( mask, size );
|
|
2005 |
|
|
2006 |
CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
|
|
2007 |
iconCopy->SetBitmapsOwnedExternally(ETrue);
|
|
2008 |
item->SetIcon( iconCopy );
|
|
2009 |
aScroller->SetItem( item, 0 );
|
|
2010 |
}
|
|
2011 |
|
|
2012 |
// ----------------------------------------------------------------------------
|
|
2013 |
// Retreive the current list widget
|
|
2014 |
// ----------------------------------------------------------------------------
|
|
2015 |
CHgScroller* CMPXCollectionViewHgContainer::CurrentListWidget()
|
|
2016 |
{
|
|
2017 |
CHgScroller* current = NULL;
|
|
2018 |
switch (iCurrentViewType)
|
|
2019 |
{
|
|
2020 |
case EMPXViewTBone:
|
|
2021 |
{
|
|
2022 |
current = iMwListWidget;
|
|
2023 |
break;
|
|
2024 |
}
|
|
2025 |
case EMPXViewList:
|
|
2026 |
{
|
|
2027 |
current = iListWidget;
|
|
2028 |
break;
|
|
2029 |
}
|
|
2030 |
default:
|
|
2031 |
break;
|
|
2032 |
}
|
|
2033 |
|
|
2034 |
return current;
|
|
2035 |
}
|
|
2036 |
|
|
2037 |
// ----------------------------------------------------------------------------
|
|
2038 |
// Check if the current view is TBoneView.
|
|
2039 |
// ----------------------------------------------------------------------------
|
|
2040 |
TBool CMPXCollectionViewHgContainer::IsTBoneView()
|
|
2041 |
{
|
|
2042 |
TBool tBoneView = EFalse;
|
|
2043 |
|
|
2044 |
if( EMPXViewTBone == iCurrentViewType || iOpenAlbumTracks )
|
|
2045 |
tBoneView = ETrue;
|
|
2046 |
|
|
2047 |
return tBoneView;
|
|
2048 |
}
|
|
2049 |
|
|
2050 |
// ----------------------------------------------------------------------------
|
|
2051 |
// Resolve the current view type based on the browsing context
|
|
2052 |
// ----------------------------------------------------------------------------
|
|
2053 |
void CMPXCollectionViewHgContainer::ResolveCurrentViewType( TInt aCount )
|
|
2054 |
{
|
|
2055 |
iCurrentViewType = EMPXViewUnknown;
|
|
2056 |
TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
|
|
2057 |
switch (iContext)
|
|
2058 |
{
|
|
2059 |
case EContextGroupAlbum:
|
|
2060 |
{
|
|
2061 |
if( landscapeOrientation )
|
|
2062 |
iCurrentViewType = EMPXViewMediawall;
|
|
2063 |
else
|
|
2064 |
{
|
|
2065 |
// In case we want to display the albums in T-Bone view
|
|
2066 |
// we change the view type and context appropriately.
|
|
2067 |
if ( iOpenAlbumTracks )
|
|
2068 |
{
|
|
2069 |
iCurrentViewType = EMPXViewTBone;
|
|
2070 |
iContext = EContextItemAlbum;
|
|
2071 |
}
|
|
2072 |
else
|
|
2073 |
{
|
|
2074 |
iCurrentViewType = EMPXViewList;
|
|
2075 |
}
|
|
2076 |
}
|
|
2077 |
break;
|
|
2078 |
}
|
|
2079 |
case EContextItemAlbum:
|
|
2080 |
case EContextItemArtist:
|
|
2081 |
{
|
|
2082 |
if( landscapeOrientation )
|
|
2083 |
iCurrentViewType = EMPXViewMediawall;
|
|
2084 |
else
|
|
2085 |
iCurrentViewType = EMPXViewTBone;
|
|
2086 |
break;
|
|
2087 |
}
|
|
2088 |
default:
|
|
2089 |
iCurrentViewType = EMPXViewList;
|
|
2090 |
break;
|
|
2091 |
}
|
|
2092 |
|
|
2093 |
// if tbone view is empty, switch back to Albums list or meidawall view
|
|
2094 |
if( ( iCurrentViewType == EMPXViewTBone ) && ( aCount < 1 ) )
|
|
2095 |
{
|
|
2096 |
if( landscapeOrientation )
|
|
2097 |
iCurrentViewType = EMPXViewMediawall;
|
|
2098 |
else
|
|
2099 |
iCurrentViewType = EMPXViewList;
|
|
2100 |
}
|
|
2101 |
|
|
2102 |
}
|
|
2103 |
|
|
2104 |
// ----------------------------------------------------------------------------
|
|
2105 |
// Clears the previous view content.
|
|
2106 |
// ----------------------------------------------------------------------------
|
|
2107 |
void CMPXCollectionViewHgContainer::CleanPrevView()
|
|
2108 |
{
|
|
2109 |
if( iCurrentViewType == iPrevViewType )
|
|
2110 |
return;
|
|
2111 |
|
|
2112 |
switch (iPrevViewType)
|
|
2113 |
{
|
|
2114 |
case EMPXViewMediawall:
|
|
2115 |
{
|
|
2116 |
if( iCurrentViewType != EMPXViewTBone )
|
|
2117 |
{
|
|
2118 |
delete iMediaWall;
|
|
2119 |
iMediaWall = 0;
|
|
2120 |
}
|
|
2121 |
break;
|
|
2122 |
}
|
|
2123 |
case EMPXViewTBone:
|
|
2124 |
{
|
|
2125 |
if( iCurrentViewType != EMPXViewMediawall )
|
|
2126 |
{
|
|
2127 |
delete iMediaWall;
|
|
2128 |
iMediaWall = 0;
|
|
2129 |
}
|
|
2130 |
delete iMwListWidget;
|
|
2131 |
iMwListWidget = 0;
|
|
2132 |
break;
|
|
2133 |
}
|
|
2134 |
case EMPXViewList:
|
|
2135 |
{
|
|
2136 |
delete iListWidget;
|
|
2137 |
iListWidget = 0;
|
|
2138 |
break;
|
|
2139 |
}
|
|
2140 |
default:
|
|
2141 |
break;
|
|
2142 |
}
|
|
2143 |
}
|
|
2144 |
|
|
2145 |
// ---------------------------------------------------------------------------
|
|
2146 |
// Check if the selected item is a song.
|
|
2147 |
// ---------------------------------------------------------------------------
|
|
2148 |
//
|
|
2149 |
TBool CMPXCollectionViewHgContainer::IsSelectedItemASong()
|
|
2150 |
{
|
|
2151 |
MPX_FUNC( "CMPXCollectionViewHgContainer::IsSelectedItemASong" );
|
|
2152 |
|
|
2153 |
TBool res(EFalse);
|
|
2154 |
if ( iContext == EContextItemAlbum ||
|
|
2155 |
iContext == EContextGroupSong ||
|
|
2156 |
iContext == EContextItemGenre )
|
|
2157 |
{
|
|
2158 |
CHgScroller* listWidget = CurrentListWidget();
|
|
2159 |
if ( !listWidget )
|
|
2160 |
{
|
|
2161 |
return EFalse;
|
|
2162 |
}
|
|
2163 |
if ( listWidget->SelectedIndex() == 0 &&
|
|
2164 |
listWidget->ItemCount() > 1 )
|
|
2165 |
{
|
|
2166 |
res = EFalse;
|
|
2167 |
}
|
|
2168 |
else
|
|
2169 |
{
|
|
2170 |
res = ETrue;
|
|
2171 |
}
|
|
2172 |
}
|
|
2173 |
return res;
|
|
2174 |
}
|
|
2175 |
|
|
2176 |
|
|
2177 |
// -----------------------------------------------------------------------------
|
|
2178 |
// Retreives the selected item's media.
|
|
2179 |
// -----------------------------------------------------------------------------
|
|
2180 |
//
|
|
2181 |
CMPXMedia* CMPXCollectionViewHgContainer::SelectedItemMediaL()
|
|
2182 |
{
|
|
2183 |
MPX_FUNC( "CMPXCollectionViewHgImp::SelectedItemMediaL" );
|
|
2184 |
CMPXMedia* song = NULL;
|
|
2185 |
const CMPXMediaArray& albums = iListBoxArray->MediaArray();
|
|
2186 |
CMPXMedia* album( albums.AtL( iSelectedAlbumIndex ) );
|
|
2187 |
const CMPXMediaArray* songs = album->Value<CMPXMediaArray>(KMPXMediaArrayContents);
|
|
2188 |
CHgScroller* listWidget = CurrentListWidget();
|
|
2189 |
if (listWidget && songs)
|
|
2190 |
{
|
|
2191 |
// Tracks list may have a shuffle item inserted so account for that.
|
|
2192 |
if (listWidget->ItemCount() > 1)
|
|
2193 |
{
|
|
2194 |
song = songs->AtL(listWidget->SelectedIndex()-1);
|
|
2195 |
}
|
|
2196 |
else
|
|
2197 |
{
|
|
2198 |
song = songs->AtL(listWidget->SelectedIndex());
|
|
2199 |
}
|
|
2200 |
}
|
|
2201 |
return song;
|
|
2202 |
}
|
|
2203 |
|
|
2204 |
|
|
2205 |
// ---------------------------------------------------------------------------
|
|
2206 |
// Handle item command
|
|
2207 |
// ---------------------------------------------------------------------------
|
|
2208 |
//
|
|
2209 |
void CMPXCollectionViewHgContainer::HandleItemCommandL( TInt aCommand )
|
|
2210 |
{
|
|
2211 |
MPX_FUNC( "CMPXCollectionViewHgContainer::HandleItemCommandL" );
|
|
2212 |
MPX_DEBUG3("CMPXCollectionViewHgContainer::HandleItemCommandL iCurrentViewType = %d, iContext = %d", iCurrentViewType, iContext);
|
|
2213 |
if( aCommand == EMPXCmdPlay )
|
|
2214 |
{
|
|
2215 |
TInt index = CurrentLbxItemIndex();
|
|
2216 |
if (!ShufflePlayAllL(index))
|
|
2217 |
{
|
|
2218 |
switch( iContext )
|
|
2219 |
{
|
|
2220 |
case EContextGroupAlbum:
|
|
2221 |
case EContextItemAlbum:
|
|
2222 |
{
|
|
2223 |
iSelectedAlbumIndex = index;
|
|
2224 |
SaveSelectedAlbumItemL(index);
|
|
2225 |
// Open first song of album & playlist for entire album is created.
|
|
2226 |
PlayAlbumL(index);
|
|
2227 |
break;
|
|
2228 |
}
|
|
2229 |
case EContextGroupPlaylist:
|
|
2230 |
{
|
|
2231 |
PlayPlaylistL(index);
|
|
2232 |
break;
|
|
2233 |
}
|
|
2234 |
case EContextGroupGenre:
|
|
2235 |
{
|
|
2236 |
PlayGenreL(index);
|
|
2237 |
break;
|
|
2238 |
}
|
|
2239 |
default:
|
|
2240 |
break;
|
|
2241 |
}
|
|
2242 |
}
|
|
2243 |
// Start animation now as next view activated is
|
|
2244 |
// now playing view. We will end animation in now playing view.
|
|
2245 |
SetupTransitionType(KMPXInterviewTransition);
|
|
2246 |
BeginFullScreenAnimation();
|
|
2247 |
}
|
|
2248 |
}
|
|
2249 |
|
|
2250 |
// ---------------------------------------------------------------------------
|
|
2251 |
// From MHgSelectionObserver
|
|
2252 |
// Handle Item Selection
|
|
2253 |
// ---------------------------------------------------------------------------
|
|
2254 |
//
|
|
2255 |
void CMPXCollectionViewHgContainer::HandleSelectL( TInt /*aIndex*/ )
|
|
2256 |
{
|
|
2257 |
MPX_FUNC( "CMPXCollectionViewHgContainer::HandleSelect" );
|
|
2258 |
|
|
2259 |
}
|
|
2260 |
|
|
2261 |
// ---------------------------------------------------------------------------
|
|
2262 |
// From MHgSelectionObserver
|
|
2263 |
// Handle Item Selection
|
|
2264 |
// ---------------------------------------------------------------------------
|
|
2265 |
//
|
|
2266 |
void CMPXCollectionViewHgContainer::HandleSelectL( TInt aIndex, CCoeControl* aControl )
|
|
2267 |
{
|
|
2268 |
MPX_FUNC( "CMPXCollectionViewHgContainer::HandleSelect" );
|
|
2269 |
|
|
2270 |
TInt index(MediaIndex(aIndex));
|
|
2271 |
|
|
2272 |
if( iCurrentViewType == EMPXViewTBone && iSelectedAlbumIndex != index )
|
|
2273 |
{
|
|
2274 |
if ( aControl == iMediaWall )
|
|
2275 |
{
|
|
2276 |
iSelectedAlbumIndex = index;
|
|
2277 |
iAlbumIndex = index;
|
|
2278 |
OpenAlbumL(index);
|
|
2279 |
}
|
|
2280 |
}
|
|
2281 |
else if( iCurrentViewType == EMPXViewMediawall )
|
|
2282 |
{
|
|
2283 |
iSelectedAlbumIndex = index;
|
|
2284 |
iAlbumIndex = index;
|
|
2285 |
}
|
|
2286 |
}
|
|
2287 |
|
|
2288 |
|
|
2289 |
// ---------------------------------------------------------------------------
|
|
2290 |
// From MHgSelectionObserver
|
|
2291 |
// Handle Item opened
|
|
2292 |
// ---------------------------------------------------------------------------
|
|
2293 |
//
|
|
2294 |
void CMPXCollectionViewHgContainer::HandleOpenL( TInt aIndex )
|
|
2295 |
{
|
|
2296 |
MPX_FUNC( "CMPXCollectionViewHgContainer::HandleOpenL" );
|
|
2297 |
|
|
2298 |
TInt index(MediaIndex(aIndex));
|
|
2299 |
|
|
2300 |
// ganes list components still uses this version of the HandleOpen
|
|
2301 |
if ( iContext == EContextItemAlbum )
|
|
2302 |
{
|
|
2303 |
if( iCurrentViewType == EMPXViewTBone )
|
|
2304 |
{
|
|
2305 |
iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallDrawToWindowGC );
|
|
2306 |
iMediaWall->DrawNow();
|
|
2307 |
}
|
|
2308 |
SaveSelectedAlbumItemL(iSelectedAlbumIndex);
|
|
2309 |
UpdatePathAndOpenL(index);
|
|
2310 |
// Start animation now as next view activated is
|
|
2311 |
// now playing view. We will end animation in now playing view.
|
|
2312 |
SetupTransitionType(KMPXInterviewTransition);
|
|
2313 |
BeginFullScreenAnimation();
|
|
2314 |
}
|
|
2315 |
else if ( iContext == EContextGroupAlbum )
|
|
2316 |
{
|
|
2317 |
SaveSelectedAlbumItemL(index);
|
|
2318 |
iAlbumIndex = index;
|
|
2319 |
// Check if shuffle play all was selected.
|
|
2320 |
if (!ShufflePlayAllL(index))
|
|
2321 |
{
|
|
2322 |
// To open the selected album.
|
|
2323 |
PrepareTboneViewL();
|
|
2324 |
}
|
|
2325 |
}
|
|
2326 |
else if ( iContext == EContextGroupSong || iContext == EContextItemPlaylist || iContext == EContextItemGenre )
|
|
2327 |
{
|
|
2328 |
// Check if shuffle play all was selected.
|
|
2329 |
TBool inReorderMode ( IsInReorderMode() );
|
|
2330 |
if ( inReorderMode && index == KErrNotFound )
|
|
2331 |
{
|
|
2332 |
// If Shuffle is selected in reorder mode than Grabbed item should move
|
|
2333 |
// to first position in the playlist, just after shuffle item.
|
|
2334 |
SetLbxCurrentItemIndex(1);
|
|
2335 |
iView->ProcessCommandL( EMPXCmdCommonEnterKey );
|
|
2336 |
}
|
|
2337 |
else if ( !ShufflePlayAllL(index) )
|
|
2338 |
{
|
|
2339 |
// To open the selected album.
|
|
2340 |
iView->ProcessCommandL( EMPXCmdCommonEnterKey );
|
|
2341 |
}
|
|
2342 |
|
|
2343 |
// Disable transition in reorder mode
|
|
2344 |
if( !inReorderMode )
|
|
2345 |
{
|
|
2346 |
// Start animation now as next view activated is
|
|
2347 |
// now playing view. We will end animation in now playing view.
|
|
2348 |
SetupTransitionType(KMPXInterviewTransition);
|
|
2349 |
BeginFullScreenAnimation();
|
|
2350 |
}
|
|
2351 |
}
|
|
2352 |
else
|
|
2353 |
{
|
|
2354 |
iView->ProcessCommandL( EMPXCmdCommonEnterKey );
|
|
2355 |
}
|
|
2356 |
}
|
|
2357 |
|
|
2358 |
// ---------------------------------------------------------------------------
|
|
2359 |
// From MHgSelectionObserver
|
|
2360 |
// Handle Item opened
|
|
2361 |
// ---------------------------------------------------------------------------
|
|
2362 |
//
|
|
2363 |
void CMPXCollectionViewHgContainer::HandleOpenL( TInt aIndex, CCoeControl* aControl )
|
|
2364 |
{
|
|
2365 |
MPX_FUNC( "CMPXCollectionViewHgContainer::HandleOpenL" );
|
|
2366 |
|
|
2367 |
TInt index(MediaIndex(aIndex));
|
|
2368 |
|
|
2369 |
if( iContext == EContextGroupAlbum && index >= 0 )
|
|
2370 |
{
|
|
2371 |
iAlbumIndex = index;
|
|
2372 |
iSelectedAlbumIndex = index;
|
|
2373 |
SaveSelectedAlbumItemL(index);
|
|
2374 |
}
|
|
2375 |
|
|
2376 |
if ( iContext == EContextItemAlbum )
|
|
2377 |
{
|
|
2378 |
if( iCurrentViewType == EMPXViewTBone )
|
|
2379 |
{
|
|
2380 |
iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallDrawToWindowGC );
|
|
2381 |
iMediaWall->DrawNow();
|
|
2382 |
}
|
|
2383 |
if ( aControl == iMediaWall )
|
|
2384 |
{
|
|
2385 |
// If album was opened, we will play all tracks in the album.
|
|
2386 |
SaveSelectedAlbumItemL(index);
|
|
2387 |
// Open first song of album & playlist for entire album is created.
|
|
2388 |
UpdatePathAndOpenL(0, ETrue);
|
|
2389 |
}
|
|
2390 |
else if ( aControl == iMwListWidget )
|
|
2391 |
{
|
|
2392 |
// If item in list was opened, we only play the selected one.
|
|
2393 |
SaveSelectedAlbumItemL(iSelectedAlbumIndex);
|
|
2394 |
// Open the selected song of album
|
|
2395 |
UpdatePathAndOpenL(index);
|
|
2396 |
}
|
|
2397 |
// Start animation now as next view activated is
|
|
2398 |
// now playing view. We will end animation in now playing view.
|
|
2399 |
SetupTransitionType(KMPXInterviewTransition);
|
|
2400 |
BeginFullScreenAnimation();
|
|
2401 |
}
|
|
2402 |
else if ( iContext == EContextGroupAlbum )
|
|
2403 |
{
|
|
2404 |
if ( aControl == iMediaWall )
|
|
2405 |
{
|
|
2406 |
// Check if shuffle play all was selected.
|
|
2407 |
if (!ShufflePlayAllL(index))
|
|
2408 |
{
|
|
2409 |
OpenAlbumL(index);
|
|
2410 |
}
|
|
2411 |
else
|
|
2412 |
{
|
|
2413 |
// Start animation now as next view activated is
|
|
2414 |
// now playing view. We will end animation in now playing view.
|
|
2415 |
SetupTransitionType(KMPXInterviewTransition);
|
|
2416 |
BeginFullScreenAnimation();
|
|
2417 |
}
|
|
2418 |
}
|
|
2419 |
}
|
|
2420 |
else
|
|
2421 |
{
|
|
2422 |
iView->ProcessCommandL( EMPXCmdCommonEnterKey );
|
|
2423 |
}
|
|
2424 |
}
|
|
2425 |
|
|
2426 |
// -----------------------------------------------------------------------------
|
|
2427 |
// Handle media wall event
|
|
2428 |
// -----------------------------------------------------------------------------
|
|
2429 |
//
|
|
2430 |
void CMPXCollectionViewHgContainer::HandleMediaWallEvent(
|
|
2431 |
TInt aEvent,
|
|
2432 |
CHgVgMediaWall* /*aSender*/)
|
|
2433 |
{
|
|
2434 |
switch( aEvent )
|
|
2435 |
{
|
|
2436 |
case CHgVgMediaWall::EHgVgMediaWallEventRequestShowSoftkeys:
|
|
2437 |
{
|
|
2438 |
if( iCbaHandler )
|
|
2439 |
iCbaHandler->ChangeCbaVisibility( ETrue );
|
|
2440 |
break;
|
|
2441 |
}
|
|
2442 |
case CHgVgMediaWall::EHgVgMediaWallEventRequestHideSoftkeys:
|
|
2443 |
{
|
|
2444 |
if( iCbaHandler )
|
|
2445 |
iCbaHandler->ChangeCbaVisibility( EFalse );
|
|
2446 |
break;
|
|
2447 |
}
|
|
2448 |
default:
|
|
2449 |
break;
|
|
2450 |
}
|
|
2451 |
}
|
|
2452 |
// -----------------------------------------------------------------------------
|
|
2453 |
// Provides the data to the model
|
|
2454 |
// -----------------------------------------------------------------------------
|
|
2455 |
//
|
|
2456 |
void CMPXCollectionViewHgContainer::Request(
|
|
2457 |
TInt aBufferStart,
|
|
2458 |
TInt aBufferEnd,
|
|
2459 |
THgScrollDirection aDirection )
|
|
2460 |
{
|
|
2461 |
MPX_FUNC( "CMPXCollectionViewHgContainer::Request" );
|
|
2462 |
MPX_DEBUG3( "CMPXCollectionViewHgContainer::Request aBufferStart = %d, aBufferEnd = %d",
|
|
2463 |
aBufferStart, aBufferEnd );
|
|
2464 |
|
|
2465 |
// This should not happen but if not handled, bad things will happen.
|
|
2466 |
if ( aBufferStart < 0 || aBufferEnd < 0 )
|
|
2467 |
return;
|
|
2468 |
|
|
2469 |
if ( aBufferStart - iShuffleItem > iLastValidMediaItemIndex ||
|
|
2470 |
aBufferEnd - iShuffleItem > iLastValidMediaItemIndex )
|
|
2471 |
{
|
|
2472 |
// We cannot provide data for the requested range at this time.
|
|
2473 |
// Remember the request so we can handle it when there's enough data.
|
|
2474 |
iRequestStart = aBufferStart;
|
|
2475 |
iRequestEnd = aBufferEnd;
|
|
2476 |
return;
|
|
2477 |
}
|
|
2478 |
|
|
2479 |
iDirection = aDirection;
|
|
2480 |
|
|
2481 |
for ( TInt i = aBufferStart; i <= aBufferEnd; i++ )
|
|
2482 |
{
|
|
2483 |
iThumbnailReqMap[ i ] = EFalse;
|
|
2484 |
}
|
|
2485 |
|
|
2486 |
|
|
2487 |
if ( aDirection == EHgBufferReset || aDirection == EHgBufferScrollDown || aDirection == EHgBufferScrollUp)
|
|
2488 |
{
|
|
2489 |
// For index range in visible-area
|
|
2490 |
TRAP_IGNORE(ProvideDataIntersectL(aBufferStart, aBufferEnd));
|
|
2491 |
// For index range elsewhere
|
|
2492 |
TRAP_IGNORE(ProvideDataDifferenceL(aBufferStart, aBufferEnd));
|
|
2493 |
}
|
|
2494 |
else
|
|
2495 |
{
|
|
2496 |
TRAP_IGNORE(ProvideDataL(aBufferStart, aBufferEnd));
|
|
2497 |
}
|
|
2498 |
|
|
2499 |
// When in main collection view, list can be refresh
|
|
2500 |
// without waiting on thumbnails since this list doesn't
|
|
2501 |
// require thumbnails.
|
|
2502 |
if ( iCurrentViewType == EMPXViewList && (
|
|
2503 |
iContext == EContextGroupCollection ||
|
|
2504 |
iContext == EContextGroupPlaylist ||
|
|
2505 |
iContext == EContextGroupGenre ||
|
|
2506 |
iContext == EContextGroupComposer ) ||
|
|
2507 |
iContext == EContextGroupArtist )
|
|
2508 |
{
|
|
2509 |
iListWidget->RefreshScreen( aBufferStart );
|
|
2510 |
}
|
|
2511 |
iTopIndex = aBufferStart;
|
|
2512 |
iBottomIndex = aBufferEnd;
|
|
2513 |
}
|
|
2514 |
|
|
2515 |
// -----------------------------------------------------------------------------
|
|
2516 |
// Check if request range also covers the visible area and provide data
|
|
2517 |
// to it first.
|
|
2518 |
// -----------------------------------------------------------------------------
|
|
2519 |
//
|
|
2520 |
void CMPXCollectionViewHgContainer::ProvideDataIntersectL(
|
|
2521 |
TInt aBufferStart,
|
|
2522 |
TInt aBufferEnd )
|
|
2523 |
{
|
|
2524 |
TInt firstOnScreen = 0;
|
|
2525 |
TInt lastOnScreen = 0;
|
|
2526 |
if( iMediaWall )
|
|
2527 |
{
|
|
2528 |
firstOnScreen = iMediaWall->FirstIndexOnScreen();
|
|
2529 |
lastOnScreen = firstOnScreen + iMediaWall->ItemsOnScreen();
|
|
2530 |
}
|
|
2531 |
else
|
|
2532 |
{
|
|
2533 |
firstOnScreen = iListWidget->FirstIndexOnScreen();
|
|
2534 |
lastOnScreen = firstOnScreen + iListWidget->ItemsOnScreen();
|
|
2535 |
}
|
|
2536 |
|
|
2537 |
TInt startIndex = Max( firstOnScreen, aBufferStart );
|
|
2538 |
TInt endIndex = Min( lastOnScreen, aBufferEnd );
|
|
2539 |
|
|
2540 |
ProvideDataForRangeL( startIndex, endIndex );
|
|
2541 |
}
|
|
2542 |
|
|
2543 |
// -----------------------------------------------------------------------------
|
|
2544 |
// Handles request range outside of visible area.
|
|
2545 |
// -----------------------------------------------------------------------------
|
|
2546 |
//
|
|
2547 |
void CMPXCollectionViewHgContainer::ProvideDataDifferenceL(
|
|
2548 |
TInt aBufferStart,
|
|
2549 |
TInt aBufferEnd)
|
|
2550 |
{
|
|
2551 |
TInt firstOnScreen = 0;
|
|
2552 |
TInt lastOnScreen = 0;
|
|
2553 |
if( iMediaWall )
|
|
2554 |
{
|
|
2555 |
firstOnScreen = iMediaWall->FirstIndexOnScreen();
|
|
2556 |
lastOnScreen = firstOnScreen + iMediaWall->ItemsOnScreen();
|
|
2557 |
}
|
|
2558 |
else
|
|
2559 |
{
|
|
2560 |
firstOnScreen = iListWidget->FirstIndexOnScreen();
|
|
2561 |
lastOnScreen = firstOnScreen + iListWidget->ItemsOnScreen();
|
|
2562 |
}
|
|
2563 |
if (aBufferStart == firstOnScreen && aBufferEnd == lastOnScreen)
|
|
2564 |
return;
|
|
2565 |
|
|
2566 |
// Start block
|
|
2567 |
ProvideDataForRangeL( aBufferStart, firstOnScreen-1 );
|
|
2568 |
|
|
2569 |
// End block
|
|
2570 |
ProvideDataForRangeL( lastOnScreen+1, aBufferEnd );
|
|
2571 |
|
|
2572 |
}
|
|
2573 |
|
|
2574 |
|
|
2575 |
// -----------------------------------------------------------------------------
|
|
2576 |
// Generic data provider for the requested range.
|
|
2577 |
// -----------------------------------------------------------------------------
|
|
2578 |
//
|
|
2579 |
void CMPXCollectionViewHgContainer::ProvideDataForRangeL( TInt aBufferStart, TInt aBufferEnd )
|
|
2580 |
{
|
|
2581 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
2582 |
TInt index(0);
|
|
2583 |
|
|
2584 |
if(iDirection == MHgScrollBufferObserver::EHgBufferScrollUp )
|
|
2585 |
{
|
|
2586 |
for( TInt i = aBufferEnd; i >= aBufferStart; i-- )
|
|
2587 |
{
|
|
2588 |
// Just get the exiting item and update the fields + icon.
|
|
2589 |
CHgItem* item = NULL;
|
|
2590 |
if( iMediaWall )
|
|
2591 |
item = &iMediaWall->ItemL(i);
|
|
2592 |
else
|
|
2593 |
item = &iListWidget->ItemL(i);
|
|
2594 |
|
|
2595 |
index = MediaIndex(i);
|
|
2596 |
if ( index >= 0 )
|
|
2597 |
{
|
|
2598 |
CMPXMedia* currentMedia( mediaArray.AtL( index ) );
|
|
2599 |
AddThumbnailToDisplayedItemL( item, currentMedia, index );
|
|
2600 |
}
|
|
2601 |
else
|
|
2602 |
{
|
|
2603 |
if ( iCurrentViewType == EMPXViewMediawall ||
|
|
2604 |
iCurrentViewType == EMPXViewList && (i-iShuffleItem) == -1 )
|
|
2605 |
SetDetailIconShuffleL();
|
|
2606 |
iThumbnailReqMap[i] = ETrue;
|
|
2607 |
RefreshNoThumbnailL(i);
|
|
2608 |
}
|
|
2609 |
}
|
|
2610 |
}
|
|
2611 |
else
|
|
2612 |
{
|
|
2613 |
for( TInt i = aBufferStart; i <= aBufferEnd; i++ )
|
|
2614 |
{
|
|
2615 |
// Just get the exiting item and update the fields + icon.
|
|
2616 |
CHgItem* item = NULL;
|
|
2617 |
if( iMediaWall )
|
|
2618 |
item = &iMediaWall->ItemL(i);
|
|
2619 |
else
|
|
2620 |
item = &iListWidget->ItemL(i);
|
|
2621 |
|
|
2622 |
index = MediaIndex(i);
|
|
2623 |
if ( index >= 0 )
|
|
2624 |
{
|
|
2625 |
CMPXMedia* currentMedia( mediaArray.AtL( index ) );
|
|
2626 |
AddThumbnailToDisplayedItemL( item, currentMedia, index );
|
|
2627 |
}
|
|
2628 |
else
|
|
2629 |
{
|
|
2630 |
if ( iCurrentViewType == EMPXViewMediawall ||
|
|
2631 |
iCurrentViewType == EMPXViewList && (i-iShuffleItem) == -1 )
|
|
2632 |
SetDetailIconShuffleL();
|
|
2633 |
iThumbnailReqMap[i] = ETrue;
|
|
2634 |
RefreshNoThumbnailL(i);
|
|
2635 |
}
|
|
2636 |
}
|
|
2637 |
}
|
|
2638 |
}
|
|
2639 |
|
|
2640 |
// -----------------------------------------------------------------------------
|
|
2641 |
// CMPXCollectionViewHgContainer::ProvideDataWithouThumbnailsL
|
|
2642 |
// -----------------------------------------------------------------------------
|
|
2643 |
//
|
|
2644 |
void CMPXCollectionViewHgContainer::ProvideDataWithoutThumbnailsL(
|
|
2645 |
const CMPXMediaArray& aMediaArray,
|
|
2646 |
TInt aStartIndex )
|
|
2647 |
{
|
|
2648 |
MPX_FUNC( "CMPXCollectionViewHgContainer::ProvideDataWithoutThumbnailsL" );
|
|
2649 |
|
|
2650 |
if ( ShuffleItemPresent() )
|
|
2651 |
{
|
|
2652 |
CHgItem* item = &iListWidget->ItemL(0);
|
|
2653 |
SetShuffleItemTextL(item, NULL);
|
|
2654 |
}
|
|
2655 |
|
|
2656 |
TInt mediaCount = aMediaArray.Count();
|
|
2657 |
|
|
2658 |
for ( TInt i = aStartIndex; i < mediaCount ; i++ )
|
|
2659 |
{
|
|
2660 |
CMPXMedia* currentMedia( aMediaArray.AtL( i ) );
|
|
2661 |
|
|
2662 |
if ( currentMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
|
|
2663 |
KMPXInvalidItemId )
|
|
2664 |
{
|
|
2665 |
break;
|
|
2666 |
}
|
|
2667 |
// Just get the exiting item and update the fields + icon.
|
|
2668 |
CHgItem* item = &iListWidget->ItemL(i+iShuffleItem);
|
|
2669 |
SetTitleL( item, currentMedia );
|
|
2670 |
AddDetailToDisplayedItemL( item, currentMedia, i );
|
|
2671 |
iLastValidMediaItemIndex = i;
|
|
2672 |
}
|
|
2673 |
}
|
|
2674 |
|
|
2675 |
// -----------------------------------------------------------------------------
|
|
2676 |
// CMPXCollectionViewHgContainer::ProvideDataWithoutThumbnailsMwL
|
|
2677 |
// -----------------------------------------------------------------------------
|
|
2678 |
//
|
|
2679 |
void CMPXCollectionViewHgContainer::ProvideDataWithoutThumbnailsMwL(
|
|
2680 |
const CMPXMediaArray& aMediaArray,
|
|
2681 |
TInt aStartIndex )
|
|
2682 |
{
|
|
2683 |
MPX_FUNC( "CMPXCollectionViewHgContainer::ProvideDataWithoutThumbnailsMwL" );
|
|
2684 |
|
|
2685 |
if ( ShuffleItemPresent() )
|
|
2686 |
{
|
|
2687 |
CHgVgItem* item = &iMediaWall->ItemL(0);
|
|
2688 |
SetShuffleItemTextL(item, NULL);
|
|
2689 |
}
|
|
2690 |
|
|
2691 |
TInt mediaCount = aMediaArray.Count();
|
|
2692 |
|
|
2693 |
for ( TInt i = aStartIndex; i < mediaCount ; i++ )
|
|
2694 |
{
|
|
2695 |
CMPXMedia* currentMedia( aMediaArray.AtL( i ) );
|
|
2696 |
|
|
2697 |
if ( currentMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
|
|
2698 |
KMPXInvalidItemId )
|
|
2699 |
{
|
|
2700 |
break;
|
|
2701 |
}
|
|
2702 |
// Just get the exiting item and update the fields + icon.
|
|
2703 |
CHgVgItem* item = &iMediaWall->ItemL(i+iShuffleItem);
|
|
2704 |
|
|
2705 |
SetTitleL( item, currentMedia );
|
|
2706 |
AddDetailToDisplayedItemL( item, currentMedia, i );
|
|
2707 |
iLastValidMediaItemIndex = i;
|
|
2708 |
}
|
|
2709 |
}
|
|
2710 |
// -----------------------------------------------------------------------------
|
|
2711 |
// CMPXCollectionViewHgContainer::ProvideDataL
|
|
2712 |
// -----------------------------------------------------------------------------
|
|
2713 |
//
|
|
2714 |
void CMPXCollectionViewHgContainer::ProvideDataL( TInt aStart, TInt aEnd )
|
|
2715 |
{
|
|
2716 |
MPX_FUNC( "CMPXCollectionViewHgContainer::ProvideDataL" );
|
|
2717 |
MPX_DEBUG3( "CMPXCollectionViewHgContainer::ProvideDataL aStart = %d, aEnd = %d",
|
|
2718 |
aStart, aEnd );
|
|
2719 |
if ( aStart < 0 ) aStart = 0;
|
|
2720 |
if ( aEnd < 0 ) aEnd = 0;
|
|
2721 |
|
|
2722 |
TInt index(0);
|
|
2723 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
2724 |
for ( TInt i = aStart; i <= aEnd ; i++ )
|
|
2725 |
{
|
|
2726 |
// Just get the exiting item and update the fields + icon.
|
|
2727 |
CHgItem* item = NULL;
|
|
2728 |
if( iCurrentViewType == EMPXViewMediawall || iCurrentViewType == EMPXViewTBone )
|
|
2729 |
item = &iMediaWall->ItemL(i);
|
|
2730 |
else
|
|
2731 |
item = &iListWidget->ItemL(i);
|
|
2732 |
|
|
2733 |
index = MediaIndex(i);
|
|
2734 |
if ( index >= 0 )
|
|
2735 |
{
|
|
2736 |
CMPXMedia* currentMedia( mediaArray.AtL( index ) );
|
|
2737 |
AddThumbnailToDisplayedItemL( item, currentMedia, index );
|
|
2738 |
}
|
|
2739 |
}
|
|
2740 |
}
|
|
2741 |
|
|
2742 |
|
|
2743 |
// -----------------------------------------------------------------------------
|
|
2744 |
// CMPXCollectionViewHgContainer::Release
|
|
2745 |
// -----------------------------------------------------------------------------
|
|
2746 |
//
|
|
2747 |
void CMPXCollectionViewHgContainer::Release(TInt aReleaseStart, TInt aReleaseEnd)
|
|
2748 |
{
|
|
2749 |
MPX_FUNC( "CMPXCollectionViewHgContainer::Release" );
|
|
2750 |
|
|
2751 |
TInt temp = aReleaseStart - iShuffleItem;
|
|
2752 |
TInt start = temp >=0 ? temp : 0 ;
|
|
2753 |
TInt end = aReleaseEnd - iShuffleItem;
|
|
2754 |
|
|
2755 |
for(; start <= end; ++start)
|
|
2756 |
{
|
|
2757 |
MPX_DEBUG2( "-->CMPXCollectionViewHgContainer::Release aReleaseStart = %d", start );
|
|
2758 |
iThumbnailManager->CancelThumb( start );
|
|
2759 |
}
|
|
2760 |
}
|
|
2761 |
|
|
2762 |
// ---------------------------------------------------------------------------
|
|
2763 |
// Refresh for item without thumbnail
|
|
2764 |
// ---------------------------------------------------------------------------
|
|
2765 |
//
|
|
2766 |
void CMPXCollectionViewHgContainer::RefreshNoThumbnailL(TInt aDisplayIndex)
|
|
2767 |
{
|
|
2768 |
MPX_FUNC( "CMPXCollectionViewHgContainer::RefreshNoThumbnail" );
|
|
2769 |
|
|
2770 |
RefreshL(aDisplayIndex);
|
|
2771 |
}
|
|
2772 |
// ---------------------------------------------------------------------------
|
|
2773 |
// Refresh list as needed.
|
|
2774 |
// This function tries to determine the best time to refresh the screen as to
|
|
2775 |
// avoid too many redraws. In some cases, multiple refresh is unavoidable.
|
|
2776 |
// ---------------------------------------------------------------------------
|
|
2777 |
//
|
|
2778 |
void CMPXCollectionViewHgContainer::RefreshL(TInt aDisplayIndex)
|
|
2779 |
{
|
|
2780 |
MPX_FUNC( "CMPXCollectionViewHgContainer::Refresh" );
|
|
2781 |
|
|
2782 |
TInt mediaCount = iListBoxArray->MediaArray().Count();
|
|
2783 |
TInt displayCount = mediaCount + iShuffleItem;
|
|
2784 |
|
|
2785 |
TInt firstOnScreen = 0;
|
|
2786 |
TInt lastOnScreen = 0;
|
|
2787 |
|
|
2788 |
TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
|
|
2789 |
CHgScroller* listWidget = CurrentListWidget();
|
|
2790 |
|
|
2791 |
if( iCurrentViewType == EMPXViewTBone || iCurrentViewType == EMPXViewMediawall )
|
|
2792 |
{
|
|
2793 |
firstOnScreen = iMediaWall->FirstIndexOnScreen();
|
|
2794 |
lastOnScreen = firstOnScreen + iMediaWall->ItemsOnScreen();
|
|
2795 |
}
|
|
2796 |
else
|
|
2797 |
{
|
|
2798 |
firstOnScreen = listWidget->FirstIndexOnScreen();
|
|
2799 |
lastOnScreen = firstOnScreen + listWidget->ItemsOnScreen();
|
|
2800 |
}
|
|
2801 |
|
|
2802 |
if( firstOnScreen < 0 )
|
|
2803 |
firstOnScreen = 0;
|
|
2804 |
if (lastOnScreen > (displayCount - 1))
|
|
2805 |
lastOnScreen = displayCount - 1;
|
|
2806 |
|
|
2807 |
// Refresh screen if the item is within view and no more thumbnails expected.
|
|
2808 |
if ( aDisplayIndex >= firstOnScreen && aDisplayIndex <= lastOnScreen )
|
|
2809 |
{
|
|
2810 |
TBool canRefresh(ETrue);
|
|
2811 |
for (TInt i= firstOnScreen; i <= lastOnScreen; i++)
|
|
2812 |
{
|
|
2813 |
if ( !iThumbnailReqMap[i] )
|
|
2814 |
{
|
|
2815 |
canRefresh = EFalse;
|
|
2816 |
break;
|
|
2817 |
}
|
|
2818 |
}
|
|
2819 |
if ( canRefresh )
|
|
2820 |
{
|
|
2821 |
if( !iDefaultIconSet )
|
|
2822 |
{
|
|
2823 |
SetDefaultIconL();
|
|
2824 |
iDefaultIconSet = ETrue;
|
|
2825 |
}
|
|
2826 |
if( iCurrentViewType == EMPXViewTBone || iCurrentViewType == EMPXViewMediawall )
|
|
2827 |
{
|
|
2828 |
if( iTranstionType != EMPXTranstionNotDefined )
|
|
2829 |
{
|
|
2830 |
// This will trigger the transtition animation
|
|
2831 |
EndFullScreenAnimation();
|
|
2832 |
iMediaWall->DrawNow();
|
|
2833 |
}
|
|
2834 |
else
|
|
2835 |
{
|
|
2836 |
iMediaWall->RefreshScreen( firstOnScreen );
|
|
2837 |
}
|
|
2838 |
}
|
|
2839 |
else
|
|
2840 |
{
|
|
2841 |
if( iTranstionType != EMPXTranstionNotDefined )
|
|
2842 |
{
|
|
2843 |
// This will trigger the transtition animation
|
|
2844 |
// Use DrawNow since RefreshScreen uses DrawDeferred and we want to start
|
|
2845 |
// the animation immediately.
|
|
2846 |
EndFullScreenAnimation();
|
|
2847 |
listWidget->DrawNow();
|
|
2848 |
}
|
|
2849 |
else
|
|
2850 |
{
|
|
2851 |
listWidget->RefreshScreen( firstOnScreen );
|
|
2852 |
}
|
|
2853 |
}
|
|
2854 |
}
|
|
2855 |
}
|
|
2856 |
}
|
|
2857 |
|
|
2858 |
// ----------------------------------------------------------------------------
|
|
2859 |
// Get the default icon for the current browsing context.
|
|
2860 |
// ----------------------------------------------------------------------------
|
|
2861 |
CGulIcon* CMPXCollectionViewHgContainer::DefaultIconL()
|
|
2862 |
{
|
|
2863 |
|
|
2864 |
TInt iconIndex( EMPXClvIconEmpty );
|
|
2865 |
|
|
2866 |
switch( iContext )
|
|
2867 |
{
|
|
2868 |
case EContextGroupArtist:
|
|
2869 |
case EContextItemArtist:
|
|
2870 |
{
|
|
2871 |
iconIndex = EMPXClvIconArtist;
|
|
2872 |
break;
|
|
2873 |
}
|
|
2874 |
case EContextGroupAlbum:
|
|
2875 |
case EContextItemAlbum:
|
|
2876 |
{
|
|
2877 |
iconIndex = 27; // default album art in mediawall
|
|
2878 |
break;
|
|
2879 |
}
|
|
2880 |
case EContextGroupPodcast:
|
|
2881 |
case EContextItemPodcast:
|
|
2882 |
{
|
|
2883 |
iconIndex = EMPXPodClvIconTitle; // Podcast default icon
|
|
2884 |
break;
|
|
2885 |
}
|
|
2886 |
case EContextGroupPlaylist:
|
|
2887 |
{
|
|
2888 |
iconIndex = EMPXClvIconPlaylist;
|
|
2889 |
break;
|
|
2890 |
}
|
|
2891 |
case EContextGroupGenre:
|
|
2892 |
{
|
|
2893 |
iconIndex = EMPXClvIconGenre;
|
|
2894 |
break;
|
|
2895 |
}
|
|
2896 |
case EContextGroupComposer:
|
|
2897 |
{
|
|
2898 |
iconIndex = EMPXClvIconComposer;
|
|
2899 |
break;
|
|
2900 |
}
|
|
2901 |
case EContextItemComposer:
|
|
2902 |
case EContextGroupSong:
|
|
2903 |
case EContextItemSong:
|
|
2904 |
case EContextItemPlaylist:
|
|
2905 |
case EContextItemGenre:
|
|
2906 |
case EContextGroupCollection:
|
|
2907 |
case EContextUnknown:
|
|
2908 |
default:
|
|
2909 |
{
|
|
2910 |
// no default icon for main menu items
|
|
2911 |
break;
|
|
2912 |
}
|
|
2913 |
}
|
|
2914 |
|
|
2915 |
CGulIcon* icon = (*iIconArray)[iconIndex];
|
|
2916 |
CFbsBitmap* bitmap = icon->Bitmap();
|
|
2917 |
CFbsBitmap* mask = icon->Mask();
|
|
2918 |
|
|
2919 |
TSize size(iImageSize.iWidth, iImageSize.iHeight);
|
|
2920 |
AknIconUtils::SetSize( bitmap, size );
|
|
2921 |
AknIconUtils::SetSize( mask, size );
|
|
2922 |
|
|
2923 |
CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
|
|
2924 |
iconCopy->SetBitmapsOwnedExternally(ETrue);
|
|
2925 |
return iconCopy;
|
|
2926 |
}
|
|
2927 |
|
|
2928 |
// -----------------------------------------------------------------------------
|
|
2929 |
// Sets default icon to the HgList
|
|
2930 |
// -----------------------------------------------------------------------------
|
|
2931 |
//
|
|
2932 |
void CMPXCollectionViewHgContainer::SetDefaultIconL()
|
|
2933 |
{
|
|
2934 |
|
|
2935 |
TDefaultIcon defaultIcon( EMPXDefaultIconEmpty );
|
|
2936 |
TInt iconIndex( EMPXClvIconEmpty );
|
|
2937 |
|
|
2938 |
switch( iContext )
|
|
2939 |
{
|
|
2940 |
case EContextGroupArtist:
|
|
2941 |
case EContextItemArtist:
|
|
2942 |
{
|
|
2943 |
defaultIcon = EMPXDefaultIconArtist;
|
|
2944 |
iconIndex = EMPXClvIconArtist;
|
|
2945 |
break;
|
|
2946 |
}
|
|
2947 |
case EContextGroupAlbum:
|
|
2948 |
case EContextItemAlbum:
|
|
2949 |
{
|
|
2950 |
defaultIcon = EMPXDefaultIconAlbum;
|
|
2951 |
iconIndex = 27; // default album art in mediawall and list view
|
|
2952 |
break;
|
|
2953 |
}
|
|
2954 |
case EContextGroupPodcast:
|
|
2955 |
case EContextItemPodcast:
|
|
2956 |
{
|
|
2957 |
defaultIcon = EMPXDefaultTitleIconPodcasts;
|
|
2958 |
iconIndex = EMPXPodClvIconTitle; // Podcast default icon
|
|
2959 |
break;
|
|
2960 |
}
|
|
2961 |
case EContextGroupPlaylist:
|
|
2962 |
{
|
|
2963 |
defaultIcon = EMPXDefaultIconPlaylist;
|
|
2964 |
iconIndex = EMPXClvIconPlaylist;
|
|
2965 |
break;
|
|
2966 |
}
|
|
2967 |
case EContextGroupGenre:
|
|
2968 |
{
|
|
2969 |
defaultIcon = EMPXDefaultIconGenre;
|
|
2970 |
iconIndex = EMPXClvIconGenre;
|
|
2971 |
break;
|
|
2972 |
}
|
|
2973 |
case EContextGroupComposer:
|
|
2974 |
{
|
|
2975 |
defaultIcon = EMPXDefaultIconComposer;
|
|
2976 |
iconIndex = EMPXClvIconComposer;
|
|
2977 |
break;
|
|
2978 |
}
|
|
2979 |
case EContextGroupSong:
|
|
2980 |
case EContextItemPlaylist:
|
|
2981 |
case EContextItemGenre:
|
|
2982 |
{
|
|
2983 |
defaultIcon = EMPXDefaultIconSongs;
|
|
2984 |
iconIndex = EMPXClvIconSongs;
|
|
2985 |
break;
|
|
2986 |
}
|
|
2987 |
case EContextItemComposer:
|
|
2988 |
case EContextItemSong:
|
|
2989 |
case EContextGroupCollection:
|
|
2990 |
case EContextUnknown:
|
|
2991 |
default:
|
|
2992 |
{
|
|
2993 |
// no default icon for main menu items
|
|
2994 |
break;
|
|
2995 |
}
|
|
2996 |
}
|
|
2997 |
|
|
2998 |
CGulIcon* icon = (*iIconArray)[iconIndex];
|
|
2999 |
CFbsBitmap* bitmap = icon->Bitmap();
|
|
3000 |
CFbsBitmap* mask = icon->Mask();
|
|
3001 |
|
|
3002 |
TSize size(iImageSize.iWidth, iImageSize.iHeight);
|
|
3003 |
AknIconUtils::SetSize( bitmap, size );
|
|
3004 |
AknIconUtils::SetSize( mask, size );
|
|
3005 |
|
|
3006 |
CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
|
|
3007 |
iconCopy->SetBitmapsOwnedExternally(ETrue);
|
|
3008 |
CleanupStack::PushL( iconCopy );
|
|
3009 |
if ( iMediaWall )
|
|
3010 |
{
|
|
3011 |
iMediaWall->SetDefaultIconL(iconCopy);
|
|
3012 |
}
|
|
3013 |
else if ( iListWidget )
|
|
3014 |
{
|
|
3015 |
iListWidget->SetDefaultIconL(iconCopy);
|
|
3016 |
}
|
|
3017 |
else
|
|
3018 |
{
|
|
3019 |
delete iconCopy;
|
|
3020 |
}
|
|
3021 |
CleanupStack::Pop( iconCopy );
|
|
3022 |
iCurrentDefaultIcon = defaultIcon;
|
|
3023 |
}
|
|
3024 |
|
|
3025 |
// -----------------------------------------------------------------------------
|
|
3026 |
// Sets default icon to list item
|
|
3027 |
// -----------------------------------------------------------------------------
|
|
3028 |
//
|
|
3029 |
void CMPXCollectionViewHgContainer::SetDefaultIconL(TInt aIndex)
|
|
3030 |
{
|
|
3031 |
|
|
3032 |
TDefaultIcon defaultIcon( EMPXDefaultIconNotSet );
|
|
3033 |
TInt iconIndex( EMPXClvIconNone );
|
|
3034 |
|
|
3035 |
switch( iContext )
|
|
3036 |
{
|
|
3037 |
|
|
3038 |
case EContextGroupAlbum:
|
|
3039 |
{
|
|
3040 |
defaultIcon = EMPXDefaultIconAlbum;
|
|
3041 |
iconIndex = EMPXClvIconAlbum;
|
|
3042 |
break;
|
|
3043 |
}
|
|
3044 |
case EContextGroupPodcast:
|
|
3045 |
case EContextItemPodcast:
|
|
3046 |
{
|
|
3047 |
defaultIcon = EMPXDefaultTitleIconPodcasts;
|
|
3048 |
iconIndex = EMPXPodClvIconTitle; // Podcast default icon
|
|
3049 |
break;
|
|
3050 |
}
|
|
3051 |
case EContextItemComposer:
|
|
3052 |
case EContextGroupSong:
|
|
3053 |
case EContextItemSong:
|
|
3054 |
case EContextItemPlaylist:
|
|
3055 |
case EContextItemGenre:
|
|
3056 |
case EContextItemAlbum:
|
|
3057 |
{
|
|
3058 |
defaultIcon = EMPXDefaultIconSongs;
|
|
3059 |
iconIndex = EMPXClvIconSongs;
|
|
3060 |
break;
|
|
3061 |
}
|
|
3062 |
default:
|
|
3063 |
{
|
|
3064 |
break;
|
|
3065 |
}
|
|
3066 |
}
|
|
3067 |
|
|
3068 |
CGulIcon* icon = (*iIconArray)[iconIndex];
|
|
3069 |
CFbsBitmap* bitmap = icon->Bitmap();
|
|
3070 |
CFbsBitmap* mask = icon->Mask();
|
|
3071 |
|
|
3072 |
TSize size(iImageSize.iWidth, iImageSize.iHeight);
|
|
3073 |
AknIconUtils::SetSize( bitmap, size );
|
|
3074 |
AknIconUtils::SetSize( mask, size );
|
|
3075 |
|
|
3076 |
CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
|
|
3077 |
iconCopy->SetBitmapsOwnedExternally(ETrue);
|
|
3078 |
CleanupStack::PushL( iconCopy );
|
|
3079 |
|
|
3080 |
// TODO, fix this to use currentviewtype
|
|
3081 |
if ( iMediaWall && defaultIcon != EMPXDefaultIconNotSet )
|
|
3082 |
{
|
|
3083 |
iMediaWall->ItemL(aIndex).SetIcon(iconCopy);
|
|
3084 |
}
|
|
3085 |
else if ( iListWidget && defaultIcon != EMPXDefaultIconNotSet )
|
|
3086 |
{
|
|
3087 |
iListWidget->ItemL(aIndex).SetIcon(iconCopy);
|
|
3088 |
}
|
|
3089 |
else
|
|
3090 |
{
|
|
3091 |
delete iconCopy;
|
|
3092 |
}
|
|
3093 |
CleanupStack::Pop( iconCopy );
|
|
3094 |
}
|
|
3095 |
|
|
3096 |
|
|
3097 |
// -----------------------------------------------------------------------------
|
|
3098 |
// Adds detail to the list item at the specified index
|
|
3099 |
// -----------------------------------------------------------------------------
|
|
3100 |
//
|
|
3101 |
void CMPXCollectionViewHgContainer::AddDetailToDisplayedItemL(
|
|
3102 |
CHgItem* aVisualItem,
|
|
3103 |
CMPXMedia* aMedia,
|
|
3104 |
TInt aIndex )
|
|
3105 |
{
|
|
3106 |
MPX_FUNC( "CMPXCollectionViewHgContainer::AddDetailToDisplayedItemL" );
|
|
3107 |
|
|
3108 |
switch ( iContext )
|
|
3109 |
{
|
|
3110 |
case EContextGroupCollection:
|
|
3111 |
{
|
|
3112 |
SetDetailIconL( aVisualItem, aIndex );
|
|
3113 |
SetDetailCountL( aVisualItem, aMedia );
|
|
3114 |
break;
|
|
3115 |
}
|
|
3116 |
case EContextGroupArtist:
|
|
3117 |
{
|
|
3118 |
SetDetailCountL( aVisualItem, aMedia );
|
|
3119 |
break;
|
|
3120 |
}
|
|
3121 |
case EContextGroupAlbum:
|
|
3122 |
{
|
|
3123 |
SetDetailAlbumL( aVisualItem, aMedia );
|
|
3124 |
//SetDetailArtistL( aVisualItem, aMedia );
|
|
3125 |
break;
|
|
3126 |
}
|
|
3127 |
case EContextGroupPlaylist:
|
|
3128 |
{
|
|
3129 |
SetDetailDurationL( aVisualItem, aMedia );
|
|
3130 |
SetDetailIndicatorL( aVisualItem, aIndex );
|
|
3131 |
// SetDetailIconL( aVisualItem, EMPXDefaultIconPlaylist ); // playlist icon
|
|
3132 |
break;
|
|
3133 |
}
|
|
3134 |
case EContextItemAlbum:
|
|
3135 |
{
|
|
3136 |
SetDetailAlbumL( aVisualItem, aMedia );
|
|
3137 |
//SetDetailArtistL( aVisualItem, aMedia );
|
|
3138 |
SetDetailIndicatorL( aVisualItem, aIndex );
|
|
3139 |
break;
|
|
3140 |
}
|
|
3141 |
case EContextGroupSong:
|
|
3142 |
case EContextItemPlaylist:
|
|
3143 |
case EContextItemGenre:
|
|
3144 |
case EContextItemComposer:
|
|
3145 |
{
|
|
3146 |
SetDetailArtistL( aVisualItem, aMedia );
|
|
3147 |
SetDetailIndicatorL( aVisualItem, aIndex );
|
|
3148 |
break;
|
|
3149 |
}
|
|
3150 |
case EContextGroupPodcast:
|
|
3151 |
{
|
|
3152 |
SetDetailCountL( aVisualItem, aMedia );
|
|
3153 |
// SetDetailIconL( aVisualItem, EMPXDefaultTitleIconPodcasts );
|
|
3154 |
break;
|
|
3155 |
}
|
|
3156 |
case EContextGroupGenre:
|
|
3157 |
{
|
|
3158 |
// SetDetailIconL( aVisualItem, EMPXDefaultIconGenre ); //genre icon
|
|
3159 |
SetDetailCountL( aVisualItem, aMedia );
|
|
3160 |
break;
|
|
3161 |
}
|
|
3162 |
case EContextGroupComposer:
|
|
3163 |
{
|
|
3164 |
// SetDetailIconL( aVisualItem, EMPXDefaultIconComposer ); //composer icon
|
|
3165 |
SetDetailCountL( aVisualItem, aMedia );
|
|
3166 |
break;
|
|
3167 |
}
|
|
3168 |
case EContextItemArtist:
|
|
3169 |
{
|
|
3170 |
SetDetailCountL(aVisualItem, aMedia);
|
|
3171 |
break;
|
|
3172 |
}
|
|
3173 |
case EContextItemSong:
|
|
3174 |
{
|
|
3175 |
SetDetailAlbumL( aVisualItem, aMedia );
|
|
3176 |
SetDetailIndicatorL( aVisualItem, aIndex );
|
|
3177 |
break;
|
|
3178 |
}
|
|
3179 |
case EContextItemPodcast:
|
|
3180 |
{
|
|
3181 |
SetDetailIndicatorL( aVisualItem, aIndex );
|
|
3182 |
break;
|
|
3183 |
}
|
|
3184 |
}
|
|
3185 |
}
|
|
3186 |
|
|
3187 |
// -----------------------------------------------------------------------------
|
|
3188 |
// Adds thumbnail to the list item at the specified index
|
|
3189 |
// -----------------------------------------------------------------------------
|
|
3190 |
//
|
|
3191 |
void CMPXCollectionViewHgContainer::AddThumbnailToDisplayedItemL(
|
|
3192 |
CHgItem* aVisualItem,
|
|
3193 |
CMPXMedia* aMedia,
|
|
3194 |
TInt aIndex )
|
|
3195 |
{
|
|
3196 |
MPX_FUNC( "CMPXCollectionViewHgContainer::AddThumbnailToDisplayedItemL" );
|
|
3197 |
|
|
3198 |
|
|
3199 |
switch ( iContext )
|
|
3200 |
{
|
|
3201 |
case EContextGroupCollection:
|
|
3202 |
{
|
|
3203 |
|
|
3204 |
SetDetailIconL( aVisualItem, aIndex );
|
|
3205 |
break;
|
|
3206 |
}
|
|
3207 |
case EContextGroupAlbum:
|
|
3208 |
case EContextGroupSong:
|
|
3209 |
case EContextItemPlaylist:
|
|
3210 |
case EContextItemGenre:
|
|
3211 |
case EContextItemComposer:
|
|
3212 |
case EContextItemArtist:
|
|
3213 |
case EContextItemSong:
|
|
3214 |
case EContextItemPodcast:
|
|
3215 |
case EContextItemAlbum:
|
|
3216 |
{
|
|
3217 |
SetDetailThumbnailL( aMedia, aIndex );
|
|
3218 |
break;
|
|
3219 |
}
|
|
3220 |
|
|
3221 |
}
|
|
3222 |
}
|
|
3223 |
|
|
3224 |
// -----------------------------------------------------------------------------
|
|
3225 |
// Set title to the visual item
|
|
3226 |
// -----------------------------------------------------------------------------
|
|
3227 |
//
|
|
3228 |
void CMPXCollectionViewHgContainer::SetTitleL(
|
|
3229 |
CHgItem* aVisualItem,
|
|
3230 |
CMPXMedia* aMedia )
|
|
3231 |
{
|
|
3232 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetTitleL" );
|
|
3233 |
|
|
3234 |
|
|
3235 |
if ( iContext == EContextGroupAlbum || iContext == EContextItemAlbum )
|
|
3236 |
{
|
|
3237 |
if ( aMedia->IsSupported( KMPXMediaMusicArtist ) )
|
|
3238 |
{
|
|
3239 |
const TDesC& title = aMedia->ValueText( KMPXMediaMusicArtist );
|
|
3240 |
if ( title.Compare( KNullDesC ) != 0 )
|
|
3241 |
{
|
|
3242 |
aVisualItem->SetTitleL( title );
|
|
3243 |
}
|
|
3244 |
else
|
|
3245 |
{
|
|
3246 |
HBufC* unknownText = NULL;
|
|
3247 |
if ( iContext == EContextGroupAlbum )
|
|
3248 |
{
|
|
3249 |
TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
|
|
3250 |
if ( landscapeOrientation )
|
|
3251 |
{
|
|
3252 |
unknownText =
|
|
3253 |
StringLoader::LoadLC( R_MPX_MEDIAWALL_ARTIST_UNKNOWN );
|
|
3254 |
}
|
|
3255 |
else
|
|
3256 |
{
|
|
3257 |
unknownText =
|
|
3258 |
StringLoader::LoadLC( R_MPX_MP_LIST_ARTIST_UNKNOWN );
|
|
3259 |
}
|
|
3260 |
}
|
|
3261 |
else
|
|
3262 |
{
|
|
3263 |
unknownText =
|
|
3264 |
StringLoader::LoadLC( R_MPX_MEDIAWALL_ARTIST_UNKNOWN );
|
|
3265 |
}
|
|
3266 |
aVisualItem->SetTitleL( *unknownText );
|
|
3267 |
CleanupStack::PopAndDestroy( unknownText );
|
|
3268 |
}
|
|
3269 |
}
|
|
3270 |
}
|
|
3271 |
else
|
|
3272 |
{
|
|
3273 |
if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) )
|
|
3274 |
{
|
|
3275 |
const TDesC& title = aMedia->ValueText( KMPXMediaGeneralTitle );
|
|
3276 |
if ( title.Compare( KNullDesC ) != 0 )
|
|
3277 |
{
|
|
3278 |
aVisualItem->SetTitleL( title );
|
|
3279 |
}
|
|
3280 |
else
|
|
3281 |
{
|
|
3282 |
if ( iContext == EContextGroupGenre )
|
|
3283 |
{
|
|
3284 |
HBufC* unknownText =
|
|
3285 |
StringLoader::LoadLC( R_MPX_GENRE_UNKNOWN );
|
|
3286 |
aVisualItem->SetTitleL( *unknownText );
|
|
3287 |
CleanupStack::PopAndDestroy( unknownText );
|
|
3288 |
}
|
|
3289 |
}
|
|
3290 |
}
|
|
3291 |
}
|
|
3292 |
}
|
|
3293 |
|
|
3294 |
// -----------------------------------------------------------------------------
|
|
3295 |
// Set song title to the visual item
|
|
3296 |
// -----------------------------------------------------------------------------
|
|
3297 |
//
|
|
3298 |
void CMPXCollectionViewHgContainer::SetSongTitleL(
|
|
3299 |
CHgItem* aVisualItem,
|
|
3300 |
CMPXMedia* aMedia )
|
|
3301 |
{
|
|
3302 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetSongTitleL" );
|
|
3303 |
|
|
3304 |
if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) )
|
|
3305 |
{
|
|
3306 |
const TDesC& title = aMedia->ValueText( KMPXMediaGeneralTitle );
|
|
3307 |
if ( title.Compare( KNullDesC ) != 0 )
|
|
3308 |
{
|
|
3309 |
aVisualItem->SetTitleL( title );
|
|
3310 |
}
|
|
3311 |
else
|
|
3312 |
{
|
|
3313 |
HBufC* unknownText =
|
|
3314 |
StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN );
|
|
3315 |
aVisualItem->SetTitleL( *unknownText );
|
|
3316 |
CleanupStack::PopAndDestroy( unknownText );
|
|
3317 |
}
|
|
3318 |
}
|
|
3319 |
}
|
|
3320 |
|
|
3321 |
// -----------------------------------------------------------------------------
|
|
3322 |
// Set Detail - Count to the visual item
|
|
3323 |
// -----------------------------------------------------------------------------
|
|
3324 |
//
|
|
3325 |
void CMPXCollectionViewHgContainer::SetDetailCountL(
|
|
3326 |
CHgItem* aVisualItem,
|
|
3327 |
CMPXMedia* aMedia )
|
|
3328 |
{
|
|
3329 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailCountL" );
|
|
3330 |
if ( aMedia->IsSupported( KMPXMediaGeneralCount ) )
|
|
3331 |
{
|
|
3332 |
TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) );
|
|
3333 |
|
|
3334 |
if ( iContext == EContextGroupGenre )
|
|
3335 |
{
|
|
3336 |
HBufC* numSongsText = NULL;
|
|
3337 |
if ( count > 1 || count == 0 )
|
|
3338 |
{
|
|
3339 |
numSongsText = StringLoader::LoadLC( R_MPX_MUSIC_NUM_SONGS, count );
|
|
3340 |
}
|
|
3341 |
else
|
|
3342 |
{
|
|
3343 |
numSongsText = StringLoader::LoadLC( R_MPX_MUSIC_ONE_SONG );
|
|
3344 |
}
|
|
3345 |
TPtr ptr = numSongsText->Des();
|
|
3346 |
AknTextUtils::LanguageSpecificNumberConversion( ptr );
|
|
3347 |
aVisualItem->SetTextL( ptr );
|
|
3348 |
CleanupStack::PopAndDestroy( numSongsText );
|
|
3349 |
}
|
|
3350 |
}
|
|
3351 |
}
|
|
3352 |
|
|
3353 |
// -----------------------------------------------------------------------------
|
|
3354 |
// Set Detail - Artist to the visual item
|
|
3355 |
// -----------------------------------------------------------------------------
|
|
3356 |
//
|
|
3357 |
void CMPXCollectionViewHgContainer::SetDetailArtistL(
|
|
3358 |
CHgItem* aVisualItem,
|
|
3359 |
CMPXMedia* aMedia )
|
|
3360 |
{
|
|
3361 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailArtistL" );
|
|
3362 |
|
|
3363 |
if ( aMedia->IsSupported( KMPXMediaMusicArtist ) )
|
|
3364 |
{
|
|
3365 |
// AK - Needs to be localized
|
|
3366 |
TBuf<KMPXMaxFileLength> detailText;
|
|
3367 |
const TDesC& artist = aMedia->ValueText( KMPXMediaMusicArtist );
|
|
3368 |
if ( artist.Compare( KNullDesC ) != 0 )
|
|
3369 |
{
|
|
3370 |
detailText.Copy(artist.Left(detailText.MaxLength()));
|
|
3371 |
aVisualItem->SetTextL( detailText );
|
|
3372 |
}
|
|
3373 |
else
|
|
3374 |
{
|
|
3375 |
HBufC* unknownText =
|
|
3376 |
StringLoader::LoadLC( R_MPX_SONGS_ARTIST_UNKNOWN );
|
|
3377 |
aVisualItem->SetTextL( *unknownText );
|
|
3378 |
CleanupStack::PopAndDestroy( unknownText );
|
|
3379 |
}
|
|
3380 |
}
|
|
3381 |
}
|
|
3382 |
|
|
3383 |
// -----------------------------------------------------------------------------
|
|
3384 |
// Set Detail - Album to the visual item
|
|
3385 |
// -----------------------------------------------------------------------------
|
|
3386 |
//
|
|
3387 |
void CMPXCollectionViewHgContainer::SetDetailAlbumL(
|
|
3388 |
CHgItem* aVisualItem,
|
|
3389 |
CMPXMedia* aMedia )
|
|
3390 |
{
|
|
3391 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailAlbumL" );
|
|
3392 |
|
|
3393 |
TMPXGeneralCategory category( EMPXNoCategory );
|
|
3394 |
if ( aMedia->IsSupported( KMPXMediaGeneralCategory ) )
|
|
3395 |
{
|
|
3396 |
category = aMedia->ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
|
|
3397 |
}
|
|
3398 |
|
|
3399 |
if ( aMedia->IsSupported( KMPXMediaMusicAlbum ) && category != EMPXCommand )
|
|
3400 |
{
|
|
3401 |
TBuf<KMPXMaxFileLength> detailText;
|
|
3402 |
const TDesC& album = aMedia->ValueText( KMPXMediaMusicAlbum );
|
|
3403 |
if ( album.Compare( KNullDesC ) != 0 )
|
|
3404 |
{
|
|
3405 |
detailText.Copy( album.Left(detailText.MaxLength()));
|
|
3406 |
aVisualItem->SetTextL( detailText );
|
|
3407 |
}
|
|
3408 |
else
|
|
3409 |
{
|
|
3410 |
HBufC* unknownText = NULL;
|
|
3411 |
if ( iContext == EContextGroupAlbum )
|
|
3412 |
{
|
|
3413 |
TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
|
|
3414 |
if ( landscapeOrientation )
|
|
3415 |
{
|
|
3416 |
unknownText =
|
|
3417 |
StringLoader::LoadLC( R_MPX_MEDIAWALL_ALBUM_UNKNOWN );
|
|
3418 |
}
|
|
3419 |
else
|
|
3420 |
{
|
|
3421 |
unknownText =
|
|
3422 |
StringLoader::LoadLC( R_MPX_MP_LIST_ALBUM_UNKNOWN );
|
|
3423 |
}
|
|
3424 |
}
|
|
3425 |
else
|
|
3426 |
{
|
|
3427 |
unknownText =
|
|
3428 |
StringLoader::LoadLC( R_MPX_MEDIAWALL_ALBUM_UNKNOWN );
|
|
3429 |
}
|
|
3430 |
aVisualItem->SetTextL( *unknownText );
|
|
3431 |
CleanupStack::PopAndDestroy( unknownText );
|
|
3432 |
}
|
|
3433 |
}
|
|
3434 |
}
|
|
3435 |
|
|
3436 |
|
|
3437 |
// -----------------------------------------------------------------------------
|
|
3438 |
// Set Detail - Count + Duration to the visual item
|
|
3439 |
// -----------------------------------------------------------------------------
|
|
3440 |
//
|
|
3441 |
void CMPXCollectionViewHgContainer::SetDetailDurationL(
|
|
3442 |
CHgItem* aVisualItem,
|
|
3443 |
CMPXMedia* aMedia )
|
|
3444 |
{
|
|
3445 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailDurationL" );
|
|
3446 |
if ( iContext == EContextGroupPlaylist &&
|
|
3447 |
aMedia->IsSupported( KMPXMediaGeneralDuration ) &&
|
|
3448 |
aMedia->IsSupported( KMPXMediaGeneralCount ) )
|
|
3449 |
{
|
|
3450 |
TBuf<KMPXMaxFileLength> detailText;
|
|
3451 |
TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) );
|
|
3452 |
TInt duration = aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
|
|
3453 |
|
|
3454 |
UpdateTimeIndicatorsL(detailText, duration);
|
|
3455 |
HBufC* numSongsDurationText = NULL;
|
|
3456 |
if ( count > 1 || count == 0 )
|
|
3457 |
{
|
|
3458 |
numSongsDurationText = StringLoader::LoadLC( R_MPX_MUSIC_NUM_SONGS_DURATION, detailText, count );
|
|
3459 |
}
|
|
3460 |
else
|
|
3461 |
{
|
|
3462 |
numSongsDurationText = StringLoader::LoadLC( R_MPX_MUSIC_ONE_SONG_DURATION, detailText );
|
|
3463 |
}
|
|
3464 |
TPtr ptr = numSongsDurationText->Des();
|
|
3465 |
AknTextUtils::LanguageSpecificNumberConversion( ptr );
|
|
3466 |
aVisualItem->SetTextL( ptr );
|
|
3467 |
CleanupStack::PopAndDestroy( numSongsDurationText );
|
|
3468 |
}
|
|
3469 |
else if ( iContext == EContextItemPodcast &&
|
|
3470 |
aMedia->IsSupported( KMPXMediaGeneralDuration ) &&
|
|
3471 |
aMedia->IsSupported( KMPXMediaGeneralSize ) )
|
|
3472 |
{
|
|
3473 |
TBuf<KMPXMaxFileLength> detailText;
|
|
3474 |
TInt duration = aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
|
|
3475 |
UpdateTimeIndicatorsL(detailText, duration);
|
|
3476 |
detailText.Append( KMPXDash() );
|
|
3477 |
|
|
3478 |
TInt size( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralSize ) );
|
|
3479 |
HBufC* sizeBuf = iCommonUiHelper->UnitConversionL( size, ETrue );
|
|
3480 |
TPtr sizePtr( sizeBuf->Des() );
|
|
3481 |
detailText.Append( sizePtr );
|
|
3482 |
delete sizeBuf;
|
|
3483 |
|
|
3484 |
aVisualItem->SetTextL( detailText );
|
|
3485 |
}
|
|
3486 |
}
|
|
3487 |
|
|
3488 |
|
|
3489 |
// -----------------------------------------------------------------------------
|
|
3490 |
// Format the duration to the visual item
|
|
3491 |
// -----------------------------------------------------------------------------
|
|
3492 |
//
|
|
3493 |
void CMPXCollectionViewHgContainer::UpdateTimeIndicatorsL(
|
|
3494 |
TDes& aBuf,
|
|
3495 |
TInt aDuration )
|
|
3496 |
{
|
|
3497 |
MPX_FUNC( "CMPXCollectionViewHgContainer::UpdateTimeIndicatorsL" );
|
|
3498 |
TInt durationInSeconds = aDuration;
|
|
3499 |
if ( durationInSeconds > 0 )
|
|
3500 |
{
|
|
3501 |
durationInSeconds /= 1000; // MilliSeconds to second conversion
|
|
3502 |
}
|
|
3503 |
else if ( durationInSeconds < 0 )
|
|
3504 |
{
|
|
3505 |
durationInSeconds = 0;
|
|
3506 |
}
|
|
3507 |
if ( durationInSeconds == 0 )
|
|
3508 |
{
|
|
3509 |
TLocale locale;
|
|
3510 |
TBuf<KMPXTimeIndicatorLength> pos;
|
|
3511 |
TChar separator = locale.TimeSeparator( KMPXMinSecSeparatorIndex );
|
|
3512 |
aBuf.Append(KMPXZeroDurationMark);
|
|
3513 |
aBuf.Append( separator );
|
|
3514 |
aBuf.Append(KMPXZeroDurationMark);
|
|
3515 |
}
|
|
3516 |
else
|
|
3517 |
{
|
|
3518 |
CMPXCommonUiHelper::TMPXDuratDisplayMode durationMode = CMPXCommonUiHelper::EMPXDuratAuto;
|
|
3519 |
if ( durationInSeconds > KOneHourInSeconds )
|
|
3520 |
{
|
|
3521 |
durationMode = CMPXCommonUiHelper::EMPXDuratHMS;
|
|
3522 |
}
|
|
3523 |
// Convert ellapsed time to texts
|
|
3524 |
HBufC* position = iCommonUiHelper->DisplayableDurationL( durationInSeconds, durationMode );
|
|
3525 |
aBuf.Append(position->Des());
|
|
3526 |
delete position;
|
|
3527 |
}
|
|
3528 |
}
|
|
3529 |
|
|
3530 |
|
|
3531 |
// -----------------------------------------------------------------------------
|
|
3532 |
// Set Detail - Indicator to the visual item
|
|
3533 |
// -----------------------------------------------------------------------------
|
|
3534 |
//
|
|
3535 |
void CMPXCollectionViewHgContainer::SetDetailIndicatorL(
|
|
3536 |
CHgItem* aVisualItem,
|
|
3537 |
TInt aIndex )
|
|
3538 |
{
|
|
3539 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailIndicatorL" );
|
|
3540 |
// Get icon indices
|
|
3541 |
RArray<TInt> iconIndices = iListBoxArray->IndicatorIconIndicesL( aIndex );
|
|
3542 |
CleanupClosePushL( iconIndices );
|
|
3543 |
|
|
3544 |
const TInt iconCount = iconIndices.Count();
|
|
3545 |
TInt flags = aVisualItem->Flags() & CHgItem::EHgItemFlagMarked;
|
|
3546 |
aVisualItem->ClearFlags(aVisualItem->Flags());
|
|
3547 |
if ( iconCount > 0 )
|
|
3548 |
{
|
|
3549 |
TInt iconId = 0;
|
|
3550 |
for ( TInt iconIndex = 0; iconIndex < iconCount; iconIndex++ )
|
|
3551 |
{
|
|
3552 |
iconId = iconIndices[iconIndex];
|
|
3553 |
if ( !iPodcastContext )
|
|
3554 |
{
|
|
3555 |
switch (iconId)
|
|
3556 |
{
|
|
3557 |
case EMPXClvIconMMC:
|
|
3558 |
{
|
|
3559 |
flags |= CHgItem::EHgItemFlagsMmc;
|
|
3560 |
break;
|
|
3561 |
}
|
|
3562 |
case EMPXClvIconPlay:
|
|
3563 |
{
|
|
3564 |
flags |= CHgItem::EHgItemFlagsPlaybackIndicator;
|
|
3565 |
break;
|
|
3566 |
}
|
|
3567 |
case EMPXClvIconPause:
|
|
3568 |
{
|
|
3569 |
flags |= CHgItem::EHgItemFlagsPauseIndicator;
|
|
3570 |
break;
|
|
3571 |
}
|
|
3572 |
case EMPXClvIconBrokenTrack:
|
|
3573 |
{
|
|
3574 |
flags |= CHgItem::EHgItemFlagsBrokenTrackIndicator;
|
|
3575 |
break;
|
|
3576 |
}
|
|
3577 |
case EMPXClvIconCorruptTrack:
|
|
3578 |
{
|
|
3579 |
flags |= CHgItem::EHgItemFlagsCorruptedTrackIndicator;
|
|
3580 |
break;
|
|
3581 |
}
|
|
3582 |
case EMPXClvIconDrmExpired:
|
|
3583 |
{
|
|
3584 |
flags |= CHgItem::EHgItemFlagsDrmRightsExpired;
|
|
3585 |
break;
|
|
3586 |
}
|
|
3587 |
case EMPXClvIconBrokenPlaylist:
|
|
3588 |
{
|
|
3589 |
flags |= CHgItem::EHgItemFlagsBrokenPlaylistIndicator;
|
|
3590 |
break;
|
|
3591 |
}
|
|
3592 |
}
|
|
3593 |
}
|
|
3594 |
else // podcast icons
|
|
3595 |
{
|
|
3596 |
switch (iconId)
|
|
3597 |
{
|
|
3598 |
case EMPXPodClvIconMMC:
|
|
3599 |
{
|
|
3600 |
flags |= CHgItem::EHgItemFlagsMmc;
|
|
3601 |
break;
|
|
3602 |
}
|
|
3603 |
case EMPXPodClvIconPlay:
|
|
3604 |
{
|
|
3605 |
flags |= CHgItem::EHgItemFlagsPlaybackIndicator;
|
|
3606 |
break;
|
|
3607 |
}
|
|
3608 |
case EMPXPodClvIconPause:
|
|
3609 |
{
|
|
3610 |
flags |= CHgItem::EHgItemFlagsPauseIndicator;
|
|
3611 |
break;
|
|
3612 |
}
|
|
3613 |
case EMPXPodClvIconBroken:
|
|
3614 |
{
|
|
3615 |
flags |= CHgItem::EHgItemFlagsBrokenTrackIndicator;
|
|
3616 |
break;
|
|
3617 |
}
|
|
3618 |
case EMPXPodClvIconCorrupt:
|
|
3619 |
{
|
|
3620 |
flags |= CHgItem::EHgItemFlagsCorruptedTrackIndicator;
|
|
3621 |
break;
|
|
3622 |
}
|
|
3623 |
case EMPXPodClvIconNew:
|
|
3624 |
{
|
|
3625 |
flags |= CHgItem::EHgItemFlagsNewPodcastIndicator;
|
|
3626 |
break;
|
|
3627 |
}
|
|
3628 |
case EMPXPodClvIconCompplay:
|
|
3629 |
{
|
|
3630 |
flags |= CHgItem::EHgItemFlagsCompletelyPlayedPodcastIndicator;
|
|
3631 |
break;
|
|
3632 |
}
|
|
3633 |
case EMPXPodClvIconPartplay:
|
|
3634 |
{
|
|
3635 |
flags |= CHgItem::EHgItemFlagsPlayedPodcastIndicator;
|
|
3636 |
break;
|
|
3637 |
}
|
|
3638 |
}
|
|
3639 |
}
|
|
3640 |
}
|
|
3641 |
}
|
|
3642 |
aVisualItem->SetFlags( flags );
|
|
3643 |
CleanupStack::PopAndDestroy(&iconIndices);
|
|
3644 |
}
|
|
3645 |
|
|
3646 |
|
|
3647 |
// -----------------------------------------------------------------------------
|
|
3648 |
// Set Detail - Icon to the visual item
|
|
3649 |
// -----------------------------------------------------------------------------
|
|
3650 |
//
|
|
3651 |
void CMPXCollectionViewHgContainer::SetDetailIconL(
|
|
3652 |
CHgItem* aVisualItem,
|
|
3653 |
TInt aIndex )
|
|
3654 |
{
|
|
3655 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailIconL" );
|
|
3656 |
|
|
3657 |
TInt iconIndex = aIndex;
|
|
3658 |
switch ( aIndex )
|
|
3659 |
{
|
|
3660 |
case 0:
|
|
3661 |
iconIndex = EMPXClvIconArtist;
|
|
3662 |
break;
|
|
3663 |
case 1:
|
|
3664 |
iconIndex = EMPXClvIconAlbum;
|
|
3665 |
break;
|
|
3666 |
case 2:
|
|
3667 |
iconIndex = EMPXClvIconPlaylist;
|
|
3668 |
break;
|
|
3669 |
case 3:
|
|
3670 |
iconIndex = EMPXClvIconSongs;
|
|
3671 |
break;
|
|
3672 |
case 4:
|
|
3673 |
iconIndex = EMPXClvIconPodcasts;
|
|
3674 |
break;
|
|
3675 |
case 5:
|
|
3676 |
iconIndex = EMPXClvIconGenre;
|
|
3677 |
break;
|
|
3678 |
case 6:
|
|
3679 |
iconIndex = EMPXClvIconComposer;
|
|
3680 |
break;
|
|
3681 |
case 7: //EMPXDefaultTitleIconPodcasts
|
|
3682 |
iconIndex = 10;
|
|
3683 |
break;
|
|
3684 |
}
|
|
3685 |
|
|
3686 |
CGulIcon* icon = (*iIconArray)[iconIndex];
|
|
3687 |
|
|
3688 |
CFbsBitmap* bitmap = icon->Bitmap();
|
|
3689 |
CFbsBitmap* mask = icon->Mask();
|
|
3690 |
|
|
3691 |
TSize size(iImageSize.iWidth, iImageSize.iHeight);
|
|
3692 |
if ( iContext == EContextGroupCollection )
|
|
3693 |
{ // shrink smaller to look same as in Antriksh
|
|
3694 |
size.iWidth = iImageSize.iWidth * KIconFactor;
|
|
3695 |
size.iHeight = iImageSize.iHeight * KIconFactor;
|
|
3696 |
}
|
|
3697 |
|
|
3698 |
AknIconUtils::SetSize( bitmap, size );
|
|
3699 |
AknIconUtils::SetSize( mask, size );
|
|
3700 |
|
|
3701 |
CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
|
|
3702 |
iconCopy->SetBitmapsOwnedExternally(ETrue);
|
|
3703 |
aVisualItem->SetIcon( iconCopy );
|
|
3704 |
}
|
|
3705 |
|
|
3706 |
// -----------------------------------------------------------------------------
|
|
3707 |
// Set Detail - Thumbnail to the visual item
|
|
3708 |
// -----------------------------------------------------------------------------
|
|
3709 |
//
|
|
3710 |
void CMPXCollectionViewHgContainer::SetDetailThumbnailL(
|
|
3711 |
CMPXMedia* aMedia,
|
|
3712 |
TInt aIndex )
|
|
3713 |
{
|
|
3714 |
MPX_FUNC("CMPXCollectionViewHgContainer::SetDetailThumbnailL(CMPXMedia* aMedia,TInt aIndex)");
|
|
3715 |
TMPXItemId currentId( aMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
|
|
3716 |
|
|
3717 |
if ( currentId == KMPXInvalidItemId )
|
|
3718 |
{
|
|
3719 |
return;
|
|
3720 |
}
|
|
3721 |
|
|
3722 |
if ( aMedia->IsSupported( KMPXMediaMusicAlbumArtFileName ) )
|
|
3723 |
{
|
|
3724 |
const TDesC& album = aMedia->ValueText( KMPXMediaMusicAlbumArtFileName );
|
|
3725 |
#ifdef _DEBUG
|
|
3726 |
RDebug::RawPrint(album);
|
|
3727 |
#endif
|
|
3728 |
if ( album.Compare( KNullDesC ) != 0 )
|
|
3729 |
{
|
|
3730 |
iThumbnailManager->LoadThumbL( aIndex , album);
|
|
3731 |
}
|
|
3732 |
else
|
|
3733 |
{
|
|
3734 |
//no albumart
|
|
3735 |
// Default album art has already been set earlier.
|
|
3736 |
iThumbnailReqMap[aIndex+iShuffleItem] = ETrue;
|
|
3737 |
RefreshNoThumbnailL(aIndex);
|
|
3738 |
}
|
|
3739 |
}
|
|
3740 |
else
|
|
3741 |
{
|
|
3742 |
// no album art supported
|
|
3743 |
// Default album art has already been set earlier.
|
|
3744 |
if ( iCurrentViewType == EMPXViewMediawall ||
|
|
3745 |
iCurrentViewType == EMPXViewList && (aIndex-iShuffleItem) == -1 )
|
|
3746 |
SetDetailIconShuffleL(); // BUG: temporarily called here because default icon is shown if SetDefaultIconL is called after.
|
|
3747 |
iThumbnailReqMap[aIndex+iShuffleItem] = ETrue;
|
|
3748 |
RefreshNoThumbnailL(aIndex);
|
|
3749 |
}
|
|
3750 |
}
|
|
3751 |
|
|
3752 |
// ----------------------------------------------------------------------------
|
|
3753 |
// Set the shuffle item icon
|
|
3754 |
// ----------------------------------------------------------------------------
|
|
3755 |
|
|
3756 |
void CMPXCollectionViewHgContainer::SetDetailIconShuffleL()
|
|
3757 |
{
|
|
3758 |
|
|
3759 |
if (iShuffleItem)
|
|
3760 |
{
|
|
3761 |
CGulIcon* icon = (*iIconArray)[EMPXClvIconShuffle];
|
|
3762 |
CFbsBitmap* bitmap = icon->Bitmap();
|
|
3763 |
CFbsBitmap* mask = icon->Mask();
|
|
3764 |
|
|
3765 |
TSize size(CHgDoubleGraphicListFlat::PreferredImageSize());
|
|
3766 |
CHgItem* item = NULL;
|
|
3767 |
if( iCurrentViewType == EMPXViewMediawall || iCurrentViewType == EMPXViewTBone )
|
|
3768 |
{
|
|
3769 |
item = &iMediaWall->ItemL(0);
|
|
3770 |
TRect appRect = ((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect();
|
|
3771 |
// get front rectange from layout
|
|
3772 |
TAknLayoutRect frontRect;
|
|
3773 |
frontRect.LayoutRect( appRect, AknLayoutScalable_Apps::cf0_flow_pane_g1(0) );
|
|
3774 |
size = frontRect.Rect().Size();
|
|
3775 |
}
|
|
3776 |
else if( iCurrentViewType == EMPXViewList )
|
|
3777 |
{
|
|
3778 |
item = &iListWidget->ItemL(0);
|
|
3779 |
}
|
|
3780 |
else
|
|
3781 |
{
|
|
3782 |
User::Leave( KErrNotSupported );
|
|
3783 |
}
|
|
3784 |
|
|
3785 |
if ( item )
|
|
3786 |
{
|
|
3787 |
AknIconUtils::SetSize( bitmap, size );
|
|
3788 |
AknIconUtils::SetSize( mask, size );
|
|
3789 |
|
|
3790 |
CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
|
|
3791 |
iconCopy->SetBitmapsOwnedExternally(ETrue);
|
|
3792 |
item->SetIcon( iconCopy );
|
|
3793 |
}
|
|
3794 |
}
|
|
3795 |
|
|
3796 |
|
|
3797 |
|
|
3798 |
}
|
|
3799 |
|
|
3800 |
// ----------------------------------------------------------------------------
|
|
3801 |
// Set the shuffle item text
|
|
3802 |
// ----------------------------------------------------------------------------
|
|
3803 |
|
|
3804 |
TBool CMPXCollectionViewHgContainer::SetShuffleItemTextL(CHgItem* aItem, CMPXMedia* aMedia)
|
|
3805 |
{
|
|
3806 |
|
|
3807 |
TBool res(EFalse);
|
|
3808 |
|
|
3809 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
3810 |
const TInt count( mediaArray.Count() );
|
|
3811 |
|
|
3812 |
if ( count > 1 && iContext == EContextGroupAlbum )
|
|
3813 |
{
|
|
3814 |
TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
|
|
3815 |
if ( landscapeOrientation )
|
|
3816 |
{
|
|
3817 |
HBufC* shuffleText = StringLoader::LoadLC(
|
|
3818 |
R_MPX_MEDIAWALL_TITLE_SHUFFLE_ALL );
|
|
3819 |
aItem->SetTitleL( *shuffleText );
|
|
3820 |
CleanupStack::PopAndDestroy( shuffleText );
|
|
3821 |
}
|
|
3822 |
else
|
|
3823 |
{
|
|
3824 |
HBufC* shuffleText = StringLoader::LoadLC(
|
|
3825 |
R_MPX_SHUFFLE );
|
|
3826 |
aItem->SetTitleL( *shuffleText );
|
|
3827 |
CleanupStack::PopAndDestroy( shuffleText );
|
|
3828 |
}
|
|
3829 |
|
|
3830 |
// We can try to set icon too.
|
|
3831 |
SetDetailIconShuffleL();
|
|
3832 |
res = ETrue;
|
|
3833 |
}
|
|
3834 |
|
|
3835 |
if ( count > 1 &&
|
|
3836 |
iContext == EContextGroupSong ||
|
|
3837 |
iContext == EContextGroupGenre ||
|
|
3838 |
iContext == EContextItemPlaylist ||
|
|
3839 |
iContext == EContextItemGenre ||
|
|
3840 |
iContext == EContextItemSong )
|
|
3841 |
{
|
|
3842 |
HBufC* shuffleText = StringLoader::LoadLC(
|
|
3843 |
R_MPX_SHUFFLE );
|
|
3844 |
aItem->SetTitleL( *shuffleText );
|
|
3845 |
CleanupStack::PopAndDestroy( shuffleText );
|
|
3846 |
|
|
3847 |
// We can try to set icon too.
|
|
3848 |
SetDetailIconShuffleL();
|
|
3849 |
res = ETrue;
|
|
3850 |
}
|
|
3851 |
|
|
3852 |
return res;
|
|
3853 |
}
|
|
3854 |
|
|
3855 |
// -----------------------------------------------------------------------------
|
|
3856 |
// Sets the current category.
|
|
3857 |
// -----------------------------------------------------------------------------
|
|
3858 |
//
|
|
3859 |
void CMPXCollectionViewHgContainer::SetCollectionContextL()
|
|
3860 |
{
|
|
3861 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetCollectionContextL" );
|
|
3862 |
|
|
3863 |
const CMPXMedia& media = iListBoxArray->ContainerMedia();
|
|
3864 |
|
|
3865 |
if ( NULL == &media )
|
|
3866 |
{
|
|
3867 |
MPX_DEBUG1( "CMPXCollectionViewHgContainer::SetCollectionContextL NO media");
|
|
3868 |
User::Leave(KErrNotFound);
|
|
3869 |
}
|
|
3870 |
|
|
3871 |
TMPXGeneralType containerType( EMPXNoType );
|
|
3872 |
if ( media.IsSupported( KMPXMediaGeneralType ) )
|
|
3873 |
{
|
|
3874 |
containerType = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
|
|
3875 |
}
|
|
3876 |
|
|
3877 |
TMPXGeneralCategory containerCategory( EMPXNoCategory );
|
|
3878 |
if ( media.IsSupported( KMPXMediaGeneralCategory ) )
|
|
3879 |
{
|
|
3880 |
containerCategory = media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
|
|
3881 |
}
|
|
3882 |
MPX_DEBUG3( "CMPXCollectionViewHgContainer::SetCollectionContextL container type = %d, category = %d",
|
|
3883 |
containerType, containerCategory );
|
|
3884 |
|
|
3885 |
iPodcastContext = EFalse;
|
|
3886 |
TMPXPodcastCategory podcastCategory( EMPXUnknown );
|
|
3887 |
if ( media.IsSupported( KMPXMediaPodcastType ) )
|
|
3888 |
{
|
|
3889 |
iPodcastContext = ETrue;
|
|
3890 |
if ( media.IsSupported( KMPXMediaPodcastCategoryGroup ) )
|
|
3891 |
{
|
|
3892 |
podcastCategory = media.ValueTObjectL<TMPXPodcastCategory>( KMPXMediaPodcastCategoryGroup );
|
|
3893 |
}
|
|
3894 |
}
|
|
3895 |
MPX_DEBUG3( "CMPXCommonContainerHitchcockImp::SetCollectionContextL container podcast = %d, category = %d",
|
|
3896 |
iPodcastContext, podcastCategory );
|
|
3897 |
|
|
3898 |
iPrevContext = iContext;
|
|
3899 |
|
|
3900 |
if( iListWidget )
|
|
3901 |
{
|
|
3902 |
iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
|
|
3903 |
}
|
|
3904 |
if ( !iPodcastContext )
|
|
3905 |
{
|
|
3906 |
if ( containerType == EMPXGroup )
|
|
3907 |
{
|
|
3908 |
switch (containerCategory)
|
|
3909 |
{
|
|
3910 |
case EMPXCollection:
|
|
3911 |
iContext = EContextGroupCollection;
|
|
3912 |
if( iListWidget )
|
|
3913 |
{
|
|
3914 |
iListWidget->SetFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
|
|
3915 |
}
|
|
3916 |
break;
|
|
3917 |
case EMPXArtist:
|
|
3918 |
iContext = EContextGroupArtist;
|
|
3919 |
break;
|
|
3920 |
case EMPXAlbum:
|
|
3921 |
iContext = EContextGroupAlbum;
|
|
3922 |
break;
|
|
3923 |
case EMPXPlaylist:
|
|
3924 |
iContext = EContextGroupPlaylist;
|
|
3925 |
break;
|
|
3926 |
case EMPXSong:
|
|
3927 |
iContext = EContextGroupSong;
|
|
3928 |
break;
|
|
3929 |
case EMPXGenre:
|
|
3930 |
iContext = EContextGroupGenre;
|
|
3931 |
break;
|
|
3932 |
case EMPXComposer:
|
|
3933 |
iContext = EContextGroupComposer;
|
|
3934 |
break;
|
|
3935 |
default:
|
|
3936 |
User::Leave(KErrNotSupported);
|
|
3937 |
break;
|
|
3938 |
}
|
|
3939 |
}
|
|
3940 |
else if ( containerType == EMPXItem )
|
|
3941 |
{
|
|
3942 |
switch (containerCategory)
|
|
3943 |
{
|
|
3944 |
case EMPXArtist:
|
|
3945 |
iContext = EContextItemArtist;
|
|
3946 |
break;
|
|
3947 |
case EMPXAlbum:
|
|
3948 |
iContext = EContextItemAlbum;
|
|
3949 |
break;
|
|
3950 |
case EMPXPlaylist:
|
|
3951 |
iContext = EContextItemPlaylist;
|
|
3952 |
break;
|
|
3953 |
case EMPXSong:
|
|
3954 |
iContext = EContextItemSong;
|
|
3955 |
break;
|
|
3956 |
case EMPXGenre:
|
|
3957 |
iContext = EContextItemGenre;
|
|
3958 |
break;
|
|
3959 |
case EMPXComposer:
|
|
3960 |
iContext = EContextItemComposer;
|
|
3961 |
break;
|
|
3962 |
default:
|
|
3963 |
User::Leave(KErrNotSupported);
|
|
3964 |
break;
|
|
3965 |
}
|
|
3966 |
}
|
|
3967 |
else if ( containerType == EMPXOtherType )
|
|
3968 |
{
|
|
3969 |
|
|
3970 |
if (containerCategory == EMPXAlbum)
|
|
3971 |
{
|
|
3972 |
//iContext = EContextItemAlbum2;
|
|
3973 |
}
|
|
3974 |
|
|
3975 |
}
|
|
3976 |
}
|
|
3977 |
else
|
|
3978 |
{
|
|
3979 |
if ( (containerType == EMPXGroup) && (podcastCategory == EMPXTitle) )
|
|
3980 |
{
|
|
3981 |
iContext = EContextGroupPodcast;
|
|
3982 |
if( iListWidget )
|
|
3983 |
{
|
|
3984 |
iListWidget->SetFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
|
|
3985 |
}
|
|
3986 |
}
|
|
3987 |
else if ( (containerType == EMPXItem) && (podcastCategory == EMPXEpisode) )
|
|
3988 |
{
|
|
3989 |
iContext = EContextItemPodcast;
|
|
3990 |
}
|
|
3991 |
else
|
|
3992 |
{
|
|
3993 |
User::Leave(KErrNotSupported);
|
|
3994 |
}
|
|
3995 |
}
|
|
3996 |
}
|
|
3997 |
|
|
3998 |
|
|
3999 |
|
|
4000 |
void CMPXCollectionViewHgContainer::TNReadyL(TInt aError, CFbsBitmap* aBitmap, CFbsBitmap* /*aMask*/, TInt aIndex)
|
|
4001 |
{
|
|
4002 |
TInt displayIndex = aIndex+iShuffleItem;
|
|
4003 |
if ( aError == KErrNone )
|
|
4004 |
{
|
|
4005 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
4006 |
CMPXMedia* currentMedia( mediaArray.AtL( aIndex ) );
|
|
4007 |
if ( currentMedia->IsSupported( KMPXMediaGeneralId ) )
|
|
4008 |
{
|
|
4009 |
if ( aBitmap )
|
|
4010 |
{
|
|
4011 |
CGulIcon* icon = CGulIcon::NewL(aBitmap, NULL);
|
|
4012 |
|
|
4013 |
switch (iCurrentViewType)
|
|
4014 |
{
|
|
4015 |
case EMPXViewMediawall:
|
|
4016 |
case EMPXViewTBone:
|
|
4017 |
{
|
|
4018 |
iMediaWall->ItemL(displayIndex).SetIcon(icon);
|
|
4019 |
break;
|
|
4020 |
}
|
|
4021 |
case EMPXViewList:
|
|
4022 |
{
|
|
4023 |
iListWidget->ItemL(displayIndex).SetIcon(icon);
|
|
4024 |
break;
|
|
4025 |
}
|
|
4026 |
default:
|
|
4027 |
break;
|
|
4028 |
}
|
|
4029 |
|
|
4030 |
|
|
4031 |
}
|
|
4032 |
}
|
|
4033 |
}
|
|
4034 |
else
|
|
4035 |
{
|
|
4036 |
//no albumart supported
|
|
4037 |
//iThumbnailReqMap[displayIndex] = ETrue;
|
|
4038 |
//RefreshL(displayIndex);
|
|
4039 |
}
|
|
4040 |
|
|
4041 |
iThumbnailReqMap[displayIndex] = ETrue;
|
|
4042 |
RefreshL(displayIndex);
|
|
4043 |
|
|
4044 |
|
|
4045 |
}
|
|
4046 |
|
|
4047 |
// ----------------------------------------------------------------------------
|
|
4048 |
// Clears the TN request if any
|
|
4049 |
// ----------------------------------------------------------------------------
|
|
4050 |
void CMPXCollectionViewHgContainer::CancelTNRequest()
|
|
4051 |
{
|
|
4052 |
MPX_FUNC("CMPXCollectionViewHgContainer::CancelTNRequest");
|
|
4053 |
|
|
4054 |
}
|
|
4055 |
|
|
4056 |
|
|
4057 |
// ----------------------------------------------------------------------------
|
|
4058 |
// Construct a collection path with the current selection and open the
|
|
4059 |
// path to start playback.
|
|
4060 |
// ----------------------------------------------------------------------------
|
|
4061 |
void CMPXCollectionViewHgContainer::UpdatePathAndOpenL(TInt aIndex, TBool aSelectAll)
|
|
4062 |
{
|
|
4063 |
MPX_FUNC("CMPXCollectionViewHgContainer::UpdatePathAndOpenL");
|
|
4064 |
|
|
4065 |
RArray<TMPXItemId> ids;
|
|
4066 |
CleanupClosePushL(ids);
|
|
4067 |
const CMPXMediaArray& albums = iListBoxArray->MediaArray();
|
|
4068 |
CMPXMedia* album( albums.AtL( iSelectedAlbumIndex ) );
|
|
4069 |
|
|
4070 |
if( album->IsSupported(KMPXMediaArrayContents) )
|
|
4071 |
{
|
|
4072 |
|
|
4073 |
// Get the current path
|
|
4074 |
CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
|
|
4075 |
CleanupStack::PushL( cpath );
|
|
4076 |
|
|
4077 |
MPX_DEBUG_PATH(*cpath);
|
|
4078 |
|
|
4079 |
if ( 2 == cpath->Levels())
|
|
4080 |
{
|
|
4081 |
cpath->Back();
|
|
4082 |
cpath->AppendL(3);
|
|
4083 |
}
|
|
4084 |
else if (cpath->Levels() == 3)
|
|
4085 |
{
|
|
4086 |
// go back one level before amending path with new levels
|
|
4087 |
cpath->Back();
|
|
4088 |
}
|
|
4089 |
|
|
4090 |
else if (cpath->Levels() == 4)
|
|
4091 |
{
|
|
4092 |
// go back 2 levels before appending new level
|
|
4093 |
cpath->Back();
|
|
4094 |
cpath->Back();
|
|
4095 |
}
|
|
4096 |
|
|
4097 |
|
|
4098 |
TInt albumCount = albums.Count();
|
|
4099 |
for (TInt i=0; i<albumCount; ++i)
|
|
4100 |
{
|
|
4101 |
CMPXMedia* album = albums.AtL(i);
|
|
4102 |
const TMPXItemId id = album->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
|
|
4103 |
ids.AppendL(id);
|
|
4104 |
}
|
|
4105 |
cpath->AppendL(ids.Array()); // top level items
|
|
4106 |
cpath->Set(iSelectedAlbumIndex);
|
|
4107 |
ids.Reset();
|
|
4108 |
|
|
4109 |
const CMPXMediaArray* songs = album->Value<CMPXMediaArray>(KMPXMediaArrayContents);
|
|
4110 |
User::LeaveIfNull(const_cast<CMPXMediaArray*>(songs));
|
|
4111 |
TInt count = songs->Count();
|
|
4112 |
for (TInt i=0; i<count; ++i)
|
|
4113 |
{
|
|
4114 |
CMPXMedia* song = songs->AtL(i);
|
|
4115 |
const TMPXItemId id = song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
|
|
4116 |
ids.AppendL(id);
|
|
4117 |
}
|
|
4118 |
|
|
4119 |
cpath->AppendL(ids.Array()); // top level items
|
|
4120 |
|
|
4121 |
if ( aSelectAll ) // Plays all songs without shuffle
|
|
4122 |
{
|
|
4123 |
cpath->Set(0);
|
|
4124 |
}
|
|
4125 |
else
|
|
4126 |
{
|
|
4127 |
if ( count > 1 ) // We need to adjust in case aIndex is the shuffle item
|
|
4128 |
{
|
|
4129 |
if ( aIndex == 0 ) // Plays all songs shuffled
|
|
4130 |
{
|
|
4131 |
TTime time;
|
|
4132 |
time.UniversalTime();
|
|
4133 |
TInt64 seed = time.Int64();
|
|
4134 |
TInt randIndex = Math::Rand(seed) % count;
|
|
4135 |
cpath->Set(randIndex);
|
|
4136 |
iPlaybackUtility->SetL( EPbPropertyRandomMode, ETrue );
|
|
4137 |
}
|
|
4138 |
else
|
|
4139 |
{
|
|
4140 |
cpath->Set(aIndex-1); // actual selection
|
|
4141 |
}
|
|
4142 |
}
|
|
4143 |
else
|
|
4144 |
{
|
|
4145 |
cpath->Set(aIndex);
|
|
4146 |
}
|
|
4147 |
}
|
|
4148 |
|
|
4149 |
MPX_DEBUG_PATH(*cpath);
|
|
4150 |
|
|
4151 |
TMPXPlaybackState pbState( iPlaybackUtility->StateL() );
|
|
4152 |
if ( pbState == EPbStatePlaying || pbState == EPbStatePaused )
|
|
4153 |
{
|
|
4154 |
if ( IsPlayingCurrentIndexL(cpath) )
|
|
4155 |
{
|
|
4156 |
if ( pbState == EPbStatePaused )
|
|
4157 |
{
|
|
4158 |
iPlaybackUtility->CommandL( EPbCmdPlay );
|
|
4159 |
}
|
|
4160 |
iView->ProcessCommandL( EMPXCmdGoToNowPlaying );
|
|
4161 |
}
|
|
4162 |
else
|
|
4163 |
{
|
|
4164 |
iCollectionUtility->Collection().OpenL(*cpath);
|
|
4165 |
}
|
|
4166 |
}
|
|
4167 |
else
|
|
4168 |
{
|
|
4169 |
iCollectionUtility->Collection().OpenL(*cpath);
|
|
4170 |
}
|
|
4171 |
|
|
4172 |
CleanupStack::PopAndDestroy( cpath );
|
|
4173 |
|
|
4174 |
|
|
4175 |
}
|
|
4176 |
CleanupStack::PopAndDestroy(&ids);
|
|
4177 |
}
|
|
4178 |
|
|
4179 |
|
|
4180 |
// ----------------------------------------------------------------------------
|
|
4181 |
// Construct a collection path with the current selection and construct a
|
|
4182 |
// playlist from path to start playback.
|
|
4183 |
// ----------------------------------------------------------------------------
|
|
4184 |
void CMPXCollectionViewHgContainer::UpdatePathAndOpenPlaylistL(
|
|
4185 |
const CMPXMedia& aFindResult )
|
|
4186 |
{
|
|
4187 |
MPX_FUNC("CMPXCollectionViewHgContainer::UpdatePathAndOpenPlaylistL");
|
|
4188 |
|
|
4189 |
TInt selectedIndex(0);
|
|
4190 |
CHgScroller* listWidget = CurrentListWidget();
|
|
4191 |
if ( iContext == EContextGroupPlaylist ||
|
|
4192 |
iContext == EContextGroupGenre && listWidget )
|
|
4193 |
{
|
|
4194 |
selectedIndex = MediaIndex(listWidget->SelectedIndex());
|
|
4195 |
}
|
|
4196 |
else
|
|
4197 |
{
|
|
4198 |
return;
|
|
4199 |
}
|
|
4200 |
|
|
4201 |
RArray<TMPXItemId> ids;
|
|
4202 |
CleanupClosePushL(ids);
|
|
4203 |
|
|
4204 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
4205 |
|
|
4206 |
// Get the current path
|
|
4207 |
CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
|
|
4208 |
CleanupStack::PushL( cpath );
|
|
4209 |
|
|
4210 |
MPX_DEBUG_PATH(*cpath);
|
|
4211 |
|
|
4212 |
if ( 2 == cpath->Levels())
|
|
4213 |
{
|
|
4214 |
cpath->Back();
|
|
4215 |
cpath->AppendL(3);
|
|
4216 |
}
|
|
4217 |
else if (cpath->Levels() == 3)
|
|
4218 |
{
|
|
4219 |
// go back one level before amending path with new levels
|
|
4220 |
cpath->Back();
|
|
4221 |
}
|
|
4222 |
|
|
4223 |
TInt mediaCount = mediaArray.Count();
|
|
4224 |
for (TInt i=0; i<mediaCount; ++i)
|
|
4225 |
{
|
|
4226 |
CMPXMedia* mediaItem = mediaArray.AtL(i);
|
|
4227 |
const TMPXItemId id = mediaItem->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
|
|
4228 |
ids.AppendL(id);
|
|
4229 |
}
|
|
4230 |
cpath->AppendL(ids.Array()); // top level items
|
|
4231 |
cpath->Set(selectedIndex); // set the selected item
|
|
4232 |
ids.Reset();
|
|
4233 |
|
|
4234 |
CMPXMediaArray* songArray(const_cast<CMPXMediaArray*>( aFindResult.Value<CMPXMediaArray>(
|
|
4235 |
KMPXMediaArrayContents ) ) );
|
|
4236 |
User::LeaveIfNull( songArray );
|
|
4237 |
|
|
4238 |
TInt count = songArray->Count();
|
|
4239 |
for (TInt i=0; i<count; ++i)
|
|
4240 |
{
|
|
4241 |
CMPXMedia* song = songArray->AtL(i);
|
|
4242 |
const TMPXItemId id = song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
|
|
4243 |
ids.AppendL(id);
|
|
4244 |
}
|
|
4245 |
|
|
4246 |
cpath->AppendL(ids.Array()); // top level items of songs
|
|
4247 |
cpath->Set(0); // select 1st song
|
|
4248 |
|
|
4249 |
MPX_DEBUG_PATH(*cpath);
|
|
4250 |
|
|
4251 |
TMPXPlaybackState pbState( iPlaybackUtility->StateL() );
|
|
4252 |
if ( pbState == EPbStatePlaying || pbState == EPbStatePaused )
|
|
4253 |
{
|
|
4254 |
if ( IsPlayingCurrentIndexL(cpath) )
|
|
4255 |
{
|
|
4256 |
if ( pbState == EPbStatePaused )
|
|
4257 |
{
|
|
4258 |
iPlaybackUtility->CommandL( EPbCmdPlay );
|
|
4259 |
}
|
|
4260 |
iView->ProcessCommandL( EMPXCmdGoToNowPlaying );
|
|
4261 |
}
|
|
4262 |
else
|
|
4263 |
{
|
|
4264 |
iPlaylistHelper->InitPlaylistL(*cpath, EFalse);
|
|
4265 |
}
|
|
4266 |
}
|
|
4267 |
else
|
|
4268 |
{
|
|
4269 |
iPlaylistHelper->InitPlaylistL(*cpath, EFalse);
|
|
4270 |
}
|
|
4271 |
|
|
4272 |
CleanupStack::PopAndDestroy( cpath );
|
|
4273 |
|
|
4274 |
// We need to restore the status pane before switching to playback view.
|
|
4275 |
if (!((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->IsVisible())
|
|
4276 |
((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(ETrue);
|
|
4277 |
|
|
4278 |
CleanupStack::PopAndDestroy(&ids);
|
|
4279 |
}
|
|
4280 |
|
|
4281 |
|
|
4282 |
// ----------------------------------------------------------------------------
|
|
4283 |
// Handle opening the album to show songs
|
|
4284 |
// ----------------------------------------------------------------------------
|
|
4285 |
void CMPXCollectionViewHgContainer::OpenAlbumL(TInt aIndex)
|
|
4286 |
{
|
|
4287 |
MPX_FUNC("CMPXCollectionViewHgContainer::OpenAlbumL");
|
|
4288 |
|
|
4289 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
4290 |
CMPXMedia* album( mediaArray.AtL( aIndex ) );
|
|
4291 |
if( album->IsSupported(KMPXMediaArrayContents) )
|
|
4292 |
{
|
|
4293 |
// We've previously fetched the songs for this album so
|
|
4294 |
// all we do now is populate the list with the song titles.
|
|
4295 |
if( iCurrentViewType == EMPXViewMediawall )
|
|
4296 |
{
|
|
4297 |
ShowAlbumSongsDialogL(*album);
|
|
4298 |
}
|
|
4299 |
else
|
|
4300 |
{
|
|
4301 |
ShowAlbumSongsL(*album);
|
|
4302 |
}
|
|
4303 |
}
|
|
4304 |
else
|
|
4305 |
{
|
|
4306 |
// We'll find the songs for the selected album
|
|
4307 |
iFindOp = EMPXOpenAlbum;
|
|
4308 |
FindAlbumSongsL(aIndex);
|
|
4309 |
}
|
|
4310 |
|
|
4311 |
}
|
|
4312 |
|
|
4313 |
// ----------------------------------------------------------------------------
|
|
4314 |
// Handle preparing playback of the selected album
|
|
4315 |
// ----------------------------------------------------------------------------
|
|
4316 |
void CMPXCollectionViewHgContainer::PlayAlbumL(TInt aIndex)
|
|
4317 |
{
|
|
4318 |
MPX_FUNC("CMPXCollectionViewHgContainer::PlayAlbumL");
|
|
4319 |
|
|
4320 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
4321 |
CMPXMedia* album( mediaArray.AtL( aIndex ) );
|
|
4322 |
if( album->IsSupported(KMPXMediaArrayContents) )
|
|
4323 |
{
|
|
4324 |
// We've previously fetched the songs for this album so
|
|
4325 |
// all we do now is construct a playlist for the album
|
|
4326 |
UpdatePathAndOpenL(0, ETrue);
|
|
4327 |
}
|
|
4328 |
else
|
|
4329 |
{
|
|
4330 |
// We'll find the songs for the selected album
|
|
4331 |
iFindOp = EMPXPlayAlbum;
|
|
4332 |
FindAlbumSongsL(aIndex);
|
|
4333 |
}
|
|
4334 |
}
|
|
4335 |
|
|
4336 |
// ----------------------------------------------------------------------------
|
|
4337 |
// Handle preparing playback of the selected playlist
|
|
4338 |
// ----------------------------------------------------------------------------
|
|
4339 |
void CMPXCollectionViewHgContainer::PlayPlaylistL(TInt aIndex)
|
|
4340 |
{
|
|
4341 |
MPX_FUNC("CMPXCollectionViewHgContainer::PlayPlaylistL");
|
|
4342 |
|
|
4343 |
// We'll find the songs for the selected playlist
|
|
4344 |
iFindOp = EMPXPlayPlaylist;
|
|
4345 |
FindPlaylistSongsL(aIndex);
|
|
4346 |
}
|
|
4347 |
|
|
4348 |
// ----------------------------------------------------------------------------
|
|
4349 |
// Handle preparing playback of the selected genre
|
|
4350 |
// ----------------------------------------------------------------------------
|
|
4351 |
void CMPXCollectionViewHgContainer::PlayGenreL(TInt aIndex)
|
|
4352 |
{
|
|
4353 |
MPX_FUNC("CMPXCollectionViewHgContainer::PlayGenreL");
|
|
4354 |
|
|
4355 |
// We'll find the songs for the selected genre
|
|
4356 |
iFindOp = EMPXPlayGenre;
|
|
4357 |
FindGenreSongsL(aIndex);
|
|
4358 |
}
|
|
4359 |
|
|
4360 |
// ----------------------------------------------------------------------------
|
|
4361 |
// Check if shuffle item is selected and if so, initialize shuffle playback.
|
|
4362 |
// ----------------------------------------------------------------------------
|
|
4363 |
TBool CMPXCollectionViewHgContainer::ShufflePlayAllL(TInt aIndex)
|
|
4364 |
{
|
|
4365 |
MPX_FUNC("CMPXCollectionViewHgContainer::ShufflePlayAllL");
|
|
4366 |
|
|
4367 |
TBool shuffle(EFalse);
|
|
4368 |
|
|
4369 |
if ( aIndex == -1 )
|
|
4370 |
{
|
|
4371 |
shuffle = ETrue;
|
|
4372 |
if ( iContext == EContextItemPlaylist || iContext == EContextItemGenre )
|
|
4373 |
{
|
|
4374 |
CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
|
|
4375 |
CleanupStack::PushL( cpath );
|
|
4376 |
iPlaylistHelper->InitPlaylistL(*cpath, shuffle);
|
|
4377 |
CleanupStack::PopAndDestroy( cpath );
|
|
4378 |
}
|
|
4379 |
else
|
|
4380 |
{
|
|
4381 |
iPlaylistHelper->InitPlaylistL(shuffle);
|
|
4382 |
}
|
|
4383 |
}
|
|
4384 |
|
|
4385 |
return shuffle;
|
|
4386 |
}
|
|
4387 |
|
|
4388 |
// -----------------------------------------------------------------------------
|
|
4389 |
// CMPXCollectionViewHgContainer::FindAlbumSongsL
|
|
4390 |
// Find all the songs for the selected album index.
|
|
4391 |
// If songs are already in the media array, we don't need to fetch them again.
|
|
4392 |
// -----------------------------------------------------------------------------
|
|
4393 |
//
|
|
4394 |
void CMPXCollectionViewHgContainer::FindAlbumSongsL(
|
|
4395 |
TInt aIndex )
|
|
4396 |
{
|
|
4397 |
MPX_FUNC( "CMPXCollectionViewHgContainer::FindAlbumSongsL" );
|
|
4398 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
4399 |
CMPXMedia* album( mediaArray.AtL( aIndex ) );
|
|
4400 |
|
|
4401 |
// Fetch the songs for the selected album
|
|
4402 |
TMPXItemId albumId = album->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
|
|
4403 |
CMPXMedia* findCriteria = CMPXMedia::NewL();
|
|
4404 |
CleanupStack::PushL( findCriteria );
|
|
4405 |
findCriteria->SetTObjectValueL<TMPXGeneralType>( KMPXMediaGeneralType, EMPXGroup );
|
|
4406 |
findCriteria->SetTObjectValueL<TMPXGeneralCategory>( KMPXMediaGeneralCategory, EMPXSong );
|
|
4407 |
findCriteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, albumId );
|
|
4408 |
RArray<TMPXAttribute> attrs;
|
|
4409 |
CleanupClosePushL( attrs );
|
|
4410 |
attrs.Append( TMPXAttribute( KMPXMediaIdGeneral,
|
|
4411 |
EMPXMediaGeneralTitle |
|
|
4412 |
EMPXMediaGeneralId |
|
|
4413 |
EMPXMediaGeneralType |
|
|
4414 |
EMPXMediaGeneralCategory |
|
|
4415 |
EMPXMediaGeneralFlags ) );
|
|
4416 |
attrs.Append( KMPXMediaMusicAlbumTrack );
|
|
4417 |
|
|
4418 |
|
|
4419 |
iCollectionUtility->Collection().FindAllL( *findCriteria, attrs.Array(), *this );
|
|
4420 |
CleanupStack::PopAndDestroy( &attrs );
|
|
4421 |
CleanupStack::PopAndDestroy( findCriteria );
|
|
4422 |
|
|
4423 |
}
|
|
4424 |
|
|
4425 |
// -----------------------------------------------------------------------------
|
|
4426 |
// CMPXCollectionViewHgContainer::FindPlaylistSongsL
|
|
4427 |
// Find all the songs for the selected playlist index.
|
|
4428 |
// -----------------------------------------------------------------------------
|
|
4429 |
//
|
|
4430 |
void CMPXCollectionViewHgContainer::FindPlaylistSongsL(
|
|
4431 |
TInt aIndex )
|
|
4432 |
{
|
|
4433 |
MPX_FUNC( "CMPXCollectionViewHgContainer::FindPlaylistSongsL" );
|
|
4434 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
4435 |
CMPXMedia* playlist( mediaArray.AtL( aIndex ) );
|
|
4436 |
|
|
4437 |
// Fetch the songs for the selected album
|
|
4438 |
TMPXItemId playlistId = playlist->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
|
|
4439 |
CMPXMedia* findCriteria = CMPXMedia::NewL();
|
|
4440 |
CleanupStack::PushL( findCriteria );
|
|
4441 |
findCriteria->SetTObjectValueL<TMPXGeneralType>( KMPXMediaGeneralType, EMPXGroup );
|
|
4442 |
findCriteria->SetTObjectValueL<TMPXGeneralCategory>( KMPXMediaGeneralCategory, EMPXSong );
|
|
4443 |
findCriteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, playlistId );
|
|
4444 |
RArray<TMPXAttribute> attrs;
|
|
4445 |
CleanupClosePushL( attrs );
|
|
4446 |
attrs.Append( TMPXAttribute( KMPXMediaIdGeneral,
|
|
4447 |
EMPXMediaGeneralTitle |
|
|
4448 |
EMPXMediaGeneralId |
|
|
4449 |
EMPXMediaGeneralType |
|
|
4450 |
EMPXMediaGeneralCategory |
|
|
4451 |
EMPXMediaGeneralFlags ) );
|
|
4452 |
|
|
4453 |
iCollectionUtility->Collection().FindAllL( *findCriteria, attrs.Array(), *this );
|
|
4454 |
CleanupStack::PopAndDestroy( &attrs );
|
|
4455 |
CleanupStack::PopAndDestroy( findCriteria );
|
|
4456 |
|
|
4457 |
}
|
|
4458 |
|
|
4459 |
// -----------------------------------------------------------------------------
|
|
4460 |
// CMPXCollectionViewHgContainer::FindGenreSongsL
|
|
4461 |
// Find all the songs for the selected genre index.
|
|
4462 |
// -----------------------------------------------------------------------------
|
|
4463 |
//
|
|
4464 |
void CMPXCollectionViewHgContainer::FindGenreSongsL(
|
|
4465 |
TInt aIndex )
|
|
4466 |
{
|
|
4467 |
MPX_FUNC( "CMPXCollectionViewHgContainer::FindPlaylistSongsL" );
|
|
4468 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
4469 |
CMPXMedia* genre( mediaArray.AtL( aIndex ) );
|
|
4470 |
|
|
4471 |
// Fetch the songs for the selected genre
|
|
4472 |
TMPXItemId genreId = genre->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
|
|
4473 |
CMPXMedia* findCriteria = CMPXMedia::NewL();
|
|
4474 |
CleanupStack::PushL( findCriteria );
|
|
4475 |
findCriteria->SetTObjectValueL<TMPXGeneralType>( KMPXMediaGeneralType, EMPXGroup );
|
|
4476 |
findCriteria->SetTObjectValueL<TMPXGeneralCategory>( KMPXMediaGeneralCategory, EMPXSong );
|
|
4477 |
findCriteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, genreId );
|
|
4478 |
RArray<TMPXAttribute> attrs;
|
|
4479 |
CleanupClosePushL( attrs );
|
|
4480 |
attrs.Append( TMPXAttribute( KMPXMediaIdGeneral,
|
|
4481 |
EMPXMediaGeneralTitle |
|
|
4482 |
EMPXMediaGeneralId |
|
|
4483 |
EMPXMediaGeneralType |
|
|
4484 |
EMPXMediaGeneralCategory |
|
|
4485 |
EMPXMediaGeneralFlags ) );
|
|
4486 |
|
|
4487 |
iCollectionUtility->Collection().FindAllL( *findCriteria, attrs.Array(), *this );
|
|
4488 |
CleanupStack::PopAndDestroy( &attrs );
|
|
4489 |
CleanupStack::PopAndDestroy( findCriteria );
|
|
4490 |
|
|
4491 |
}
|
|
4492 |
|
|
4493 |
|
|
4494 |
// ---------------------------------------------------------------------------
|
|
4495 |
// From MMPXCollectionFindObserver
|
|
4496 |
// Handle callback for "find" operation
|
|
4497 |
// Songs are saved back into the media array for subsequent use.
|
|
4498 |
// ---------------------------------------------------------------------------
|
|
4499 |
//
|
|
4500 |
void CMPXCollectionViewHgContainer::HandleFindAllL(
|
|
4501 |
const CMPXMedia& aResults,
|
|
4502 |
TBool /*aComplete*/,
|
|
4503 |
TInt aError )
|
|
4504 |
{
|
|
4505 |
MPX_DEBUG2( "-->CMPXCollectionViewHgContainer::HandleFindAllL aError = %d", aError );
|
|
4506 |
|
|
4507 |
if ( aError == KErrNone )
|
|
4508 |
{
|
|
4509 |
if ( iFindOp == EMPXOpenAlbum || iFindOp == EMPXPlayAlbum )
|
|
4510 |
{
|
|
4511 |
CMPXMediaArray* songArray(const_cast<CMPXMediaArray*>( aResults.Value<CMPXMediaArray>(
|
|
4512 |
KMPXMediaArrayContents ) ) );
|
|
4513 |
User::LeaveIfNull( songArray );
|
|
4514 |
|
|
4515 |
// save the songs to the album so that we don't need to find them again
|
|
4516 |
// if the same album is selected again.
|
|
4517 |
if ( songArray->Count() )
|
|
4518 |
{
|
|
4519 |
const CMPXMediaArray& albumsArray = iListBoxArray->MediaArray();
|
|
4520 |
CMPXMedia* albumMedia( albumsArray.AtL( iSelectedAlbumIndex ) );
|
|
4521 |
albumMedia->SetCObjectValueL(KMPXMediaArrayContents, songArray);
|
|
4522 |
albumMedia->SetTObjectValueL<TInt>(KMPXMediaArrayCount, songArray->Count());
|
|
4523 |
}
|
|
4524 |
|
|
4525 |
if ( iFindOp == EMPXOpenAlbum )
|
|
4526 |
{
|
|
4527 |
if( iCurrentViewType == EMPXViewMediawall )
|
|
4528 |
{
|
|
4529 |
// do not call ShowAlbumSongsDialogL if song count = 0
|
|
4530 |
// otherwise panic occurs
|
|
4531 |
if( songArray->Count() )
|
|
4532 |
{
|
|
4533 |
ShowAlbumSongsDialogL( aResults );
|
|
4534 |
}
|
|
4535 |
else
|
|
4536 |
{
|
|
4537 |
iMediaWall->StartOpeningAnimationL( EFalse );
|
|
4538 |
}
|
|
4539 |
}
|
|
4540 |
else
|
|
4541 |
{
|
|
4542 |
ShowAlbumSongsL( aResults );
|
|
4543 |
}
|
|
4544 |
}
|
|
4545 |
else if ( iFindOp == EMPXPlayAlbum )
|
|
4546 |
{
|
|
4547 |
PlayAlbumL(iSelectedAlbumIndex);
|
|
4548 |
}
|
|
4549 |
iFindOp = EMPXNoOp;
|
|
4550 |
}
|
|
4551 |
else if ( iFindOp == EMPXPlayPlaylist || iFindOp == EMPXPlayGenre )
|
|
4552 |
{
|
|
4553 |
iFindOp = EMPXNoOp;
|
|
4554 |
UpdatePathAndOpenPlaylistL(aResults);
|
|
4555 |
}
|
|
4556 |
}
|
|
4557 |
else
|
|
4558 |
{
|
|
4559 |
// We don't do anything if there's error
|
|
4560 |
return;
|
|
4561 |
}
|
|
4562 |
}
|
|
4563 |
|
|
4564 |
// ---------------------------------------------------------------------------
|
|
4565 |
// Check if the current playing song is the same as the selected song.
|
|
4566 |
// ---------------------------------------------------------------------------
|
|
4567 |
//
|
|
4568 |
TBool CMPXCollectionViewHgContainer::IsPlayingCurrentIndexL(CMPXCollectionPath* aPath)
|
|
4569 |
{
|
|
4570 |
MPX_FUNC( "CMPXCollectionViewHgContainer::CurrentPlaybackIndexL" );
|
|
4571 |
TBool ret( EFalse );
|
|
4572 |
|
|
4573 |
MMPXSource* source( iPlaybackUtility->Source() );
|
|
4574 |
if ( source )
|
|
4575 |
{
|
|
4576 |
CMPXCollectionPlaylist* playlist( source->PlaylistL() );
|
|
4577 |
if ( playlist )
|
|
4578 |
{
|
|
4579 |
CleanupStack::PushL( playlist );
|
|
4580 |
CMPXCollectionPath* pbPath(
|
|
4581 |
CMPXCollectionPath::NewL( playlist->Path() ) );
|
|
4582 |
CleanupStack::PushL( pbPath );
|
|
4583 |
MPX_DEBUG_PATH(*aPath);
|
|
4584 |
MPX_DEBUG_PATH(*pbPath);
|
|
4585 |
|
|
4586 |
TInt playbackPathCount( pbPath->Levels() );
|
|
4587 |
if ( aPath->Levels() == playbackPathCount )
|
|
4588 |
{
|
|
4589 |
TBool isEqual( ETrue );
|
|
4590 |
for ( TInt i = 0; i < playbackPathCount - 1; i++ )
|
|
4591 |
{
|
|
4592 |
if ( aPath->Id( i ) != pbPath->Id( i ) )
|
|
4593 |
{
|
|
4594 |
isEqual = EFalse;
|
|
4595 |
break;
|
|
4596 |
}
|
|
4597 |
}
|
|
4598 |
if ( isEqual )
|
|
4599 |
{
|
|
4600 |
if (pbPath->Index() == aPath->Index() )
|
|
4601 |
ret = ETrue;
|
|
4602 |
}
|
|
4603 |
}
|
|
4604 |
CleanupStack::PopAndDestroy( pbPath );
|
|
4605 |
CleanupStack::PopAndDestroy( playlist );
|
|
4606 |
}
|
|
4607 |
}
|
|
4608 |
|
|
4609 |
return ret;
|
|
4610 |
}
|
|
4611 |
|
|
4612 |
// -----------------------------------------------------------------------------
|
|
4613 |
// Shows the album songs in songs dialog.
|
|
4614 |
// -----------------------------------------------------------------------------
|
|
4615 |
//
|
|
4616 |
void CMPXCollectionViewHgContainer::ShowAlbumSongsDialogL( const CMPXMedia& aResults )
|
|
4617 |
{
|
|
4618 |
CAknSingleGraphicPopupMenuStyleListBox* listBox = new ( ELeave ) CAknSingleGraphicPopupMenuStyleListBox;
|
|
4619 |
CleanupStack::PushL( listBox );
|
|
4620 |
|
|
4621 |
CAknPopupList* dialog = CAknPopupList::NewL(listBox, R_MPX_COLLECTION_ALBUMSONGS_LIST_CBA,
|
|
4622 |
AknPopupLayouts::EDynMenuWindow );
|
|
4623 |
|
|
4624 |
CleanupStack::PushL( dialog );
|
|
4625 |
|
|
4626 |
listBox->ConstructL( dialog,
|
|
4627 |
EAknListBoxSelectionList | EAknListBoxScrollBarSizeExcluded );
|
|
4628 |
|
|
4629 |
|
|
4630 |
listBox->CreateScrollBarFrameL( ETrue );
|
|
4631 |
listBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
|
|
4632 |
CEikScrollBarFrame::EAuto );
|
|
4633 |
|
|
4634 |
// Set title
|
|
4635 |
if ( iSelectedMediaInAlbumView && iSelectedMediaInAlbumView->IsSupported( KMPXMediaMusicAlbum ) )
|
|
4636 |
{
|
|
4637 |
const TDesC& album = iSelectedMediaInAlbumView->ValueText( KMPXMediaMusicAlbum );
|
|
4638 |
if ( album.Compare( KNullDesC ) != 0 )
|
|
4639 |
{
|
|
4640 |
dialog->SetTitleL( album );
|
|
4641 |
}
|
|
4642 |
else
|
|
4643 |
{
|
|
4644 |
HBufC* unknownText =
|
|
4645 |
StringLoader::LoadLC( R_MPX_MEDIAWALL_POPUP_TITLE_UNKNOWN );
|
|
4646 |
dialog->SetTitleL( *unknownText );
|
|
4647 |
CleanupStack::PopAndDestroy( unknownText );
|
|
4648 |
}
|
|
4649 |
}
|
|
4650 |
|
|
4651 |
CMPXMediaArray* songArray(const_cast<CMPXMediaArray*>( aResults.Value<CMPXMediaArray>(
|
|
4652 |
KMPXMediaArrayContents ) ) );
|
|
4653 |
User::LeaveIfNull( songArray );
|
|
4654 |
TInt songCount = songArray->Count();
|
|
4655 |
|
|
4656 |
CDesC16ArrayFlat* songList = new (ELeave) CDesC16ArrayFlat(songCount);
|
|
4657 |
CleanupStack::PushL(songList);
|
|
4658 |
|
|
4659 |
if ( songCount > 1 )
|
|
4660 |
{
|
|
4661 |
HBufC* shuffleText = StringLoader::LoadLC(
|
|
4662 |
R_MPX_MEDIAWALL_DIALOG_SHUFFLE );
|
|
4663 |
// Make room for 3 more formatting characters.
|
|
4664 |
HBufC* finalText = HBufC::NewLC(shuffleText->Length() + 3);
|
|
4665 |
TPtr ptr = finalText->Des();
|
|
4666 |
// This tells the list to use icon at index 0 of array index.
|
|
4667 |
ptr.Append(_L("0\t"));
|
|
4668 |
ptr.Append(shuffleText->Des());
|
|
4669 |
songList->AppendL( *finalText );
|
|
4670 |
CleanupStack::PopAndDestroy( finalText );
|
|
4671 |
CleanupStack::PopAndDestroy( shuffleText );
|
|
4672 |
CAknIconArray* iconArray = new( ELeave ) CAknIconArray( 1 );
|
|
4673 |
CleanupStack::PushL( iconArray );
|
|
4674 |
// Prepare icon array.
|
|
4675 |
CGulIcon* icon = (*iIconArray)[EMPXClvIconShuffle];
|
|
4676 |
CGulIcon* iconCopy = CGulIcon::NewL(icon->Bitmap(), icon->Mask());
|
|
4677 |
iconCopy->SetBitmapsOwnedExternally(ETrue);
|
|
4678 |
iconArray->AppendL(iconCopy);
|
|
4679 |
|
|
4680 |
listBox->ItemDrawer()->ColumnData()->SetIconArrayL( iconArray );
|
|
4681 |
CleanupStack::Pop(); // iconArray
|
|
4682 |
}
|
|
4683 |
|
|
4684 |
for ( TInt i = 0; i < songCount; i++ )
|
|
4685 |
{
|
|
4686 |
// Just get the exiting item and update the fields + icon.
|
|
4687 |
CMPXMedia* currentMedia( songArray->AtL( i ) );
|
|
4688 |
|
|
4689 |
if ( currentMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
|
|
4690 |
KMPXInvalidItemId )
|
|
4691 |
{
|
|
4692 |
break;
|
|
4693 |
}
|
|
4694 |
if ( currentMedia->IsSupported( KMPXMediaGeneralTitle ) )
|
|
4695 |
{
|
|
4696 |
const TDesC& title = currentMedia->ValueText( KMPXMediaGeneralTitle );
|
|
4697 |
HBufC* finalText = HBufC::NewLC(title.Length() + 2);
|
|
4698 |
TPtr ptr = finalText->Des();
|
|
4699 |
ptr.Append(_L("\t"));
|
|
4700 |
ptr.Append(title);
|
|
4701 |
songList->AppendL( *finalText );
|
|
4702 |
CleanupStack::PopAndDestroy( finalText );
|
|
4703 |
}
|
|
4704 |
}
|
|
4705 |
|
|
4706 |
CTextListBoxModel* model = listBox->Model();
|
|
4707 |
model->SetItemTextArray( songList );
|
|
4708 |
CleanupStack::Pop(); // songList
|
|
4709 |
model->SetOwnershipType( ELbmOwnsItemArray );
|
|
4710 |
CleanupStack::Pop( dialog );
|
|
4711 |
iDialog = dialog;
|
|
4712 |
TBool play( EFalse );
|
|
4713 |
GfxTransEffect::Deregister( iDialog );
|
|
4714 |
GfxTransEffect::Register( iDialog, KAppUidMusicPlayerX, EFalse );
|
|
4715 |
// Trap ExecuteLD to make sure iDialog always get reset.
|
|
4716 |
TRAP_IGNORE( play = iDialog->ExecuteLD() );
|
|
4717 |
iDialog = NULL;
|
|
4718 |
if( play && iMediaWall )
|
|
4719 |
{
|
|
4720 |
iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallDrawToWindowGC );
|
|
4721 |
iMediaWall->DrawNow();
|
|
4722 |
TInt index = listBox->CurrentItemIndex();
|
|
4723 |
// If item in list was opened, we only play the selected one.
|
|
4724 |
SaveSelectedAlbumItemL(iSelectedAlbumIndex);
|
|
4725 |
// Open the selected song of album
|
|
4726 |
UpdatePathAndOpenL(index);
|
|
4727 |
// Start animation now as next view activated is
|
|
4728 |
// now playing view. We will end animation in now playing view.
|
|
4729 |
SetupTransitionType(KMPXInterviewTransition);
|
|
4730 |
BeginFullScreenAnimation();
|
|
4731 |
}
|
|
4732 |
else if( !iLayoutSwitch && iMediaWall )
|
|
4733 |
{
|
|
4734 |
// Close mediawall "flip animation"
|
|
4735 |
iMediaWall->StartOpeningAnimationL( EFalse );
|
|
4736 |
}
|
|
4737 |
|
|
4738 |
CleanupStack::PopAndDestroy( listBox );
|
|
4739 |
}
|
|
4740 |
|
|
4741 |
|
|
4742 |
// -----------------------------------------------------------------------------
|
|
4743 |
// Shows the album songs in the tbone list.
|
|
4744 |
// -----------------------------------------------------------------------------
|
|
4745 |
//
|
|
4746 |
void CMPXCollectionViewHgContainer::ShowAlbumSongsL( const CMPXMedia& aAlbum )
|
|
4747 |
{
|
|
4748 |
|
|
4749 |
CMPXMediaArray* albumSongs =
|
|
4750 |
const_cast<CMPXMediaArray*>(aAlbum.Value<CMPXMediaArray>( KMPXMediaArrayContents ) );
|
|
4751 |
TInt songCount = albumSongs->Count();
|
|
4752 |
TInt listSize = songCount;
|
|
4753 |
TInt indexAddition = 0;
|
|
4754 |
|
|
4755 |
CHgScroller* currentList = CurrentListWidget();
|
|
4756 |
User::LeaveIfNull( currentList );
|
|
4757 |
|
|
4758 |
if( currentList->ItemCount() > 1 )
|
|
4759 |
{
|
|
4760 |
// There might be shuffle icon in the first item so lets reset it.
|
|
4761 |
currentList->ItemL(0).SetIcon( NULL );
|
|
4762 |
}
|
|
4763 |
if( songCount > 1 )
|
|
4764 |
{
|
|
4765 |
listSize++;
|
|
4766 |
indexAddition = 1;
|
|
4767 |
}
|
|
4768 |
// Add space for shuffle item if list contains more than one item.
|
|
4769 |
currentList->ResizeL( listSize );
|
|
4770 |
|
|
4771 |
for ( TInt i = 0; i < songCount ; i++ )
|
|
4772 |
{
|
|
4773 |
// Just get the exiting item and update the fields + icon.
|
|
4774 |
CMPXMedia* song( albumSongs->AtL( i ) );
|
|
4775 |
|
|
4776 |
if ( song->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
|
|
4777 |
KMPXInvalidItemId )
|
|
4778 |
{
|
|
4779 |
break;
|
|
4780 |
}
|
|
4781 |
CHgItem* item = ¤tList->ItemL(i+indexAddition);
|
|
4782 |
|
|
4783 |
// Just get the exiting item and update the fields + icon.
|
|
4784 |
SetSongTitleL( item, song );
|
|
4785 |
// TODO, david has removed this line????
|
|
4786 |
// AddDetailToDisplayedItemL( item, song, i );
|
|
4787 |
//David: AddDetailToDisplayedItemL( item, currentMedia, i ); is broken
|
|
4788 |
// will need to be fixed.
|
|
4789 |
}
|
|
4790 |
|
|
4791 |
if( songCount > 1 )
|
|
4792 |
{
|
|
4793 |
SetShuffleItemToListL( currentList );
|
|
4794 |
}
|
|
4795 |
currentList->SetSelectedIndex( 0 );
|
|
4796 |
currentList->SetFocus(ETrue, EDrawNow);
|
|
4797 |
currentList->DrawNow();
|
|
4798 |
|
|
4799 |
}
|
|
4800 |
|
|
4801 |
// ----------------------------------------------------------------------------
|
|
4802 |
// Save the selected album item
|
|
4803 |
// ----------------------------------------------------------------------------
|
|
4804 |
void CMPXCollectionViewHgContainer::SaveSelectedAlbumItemL(TInt aIndex)
|
|
4805 |
{
|
|
4806 |
if ( iContext == EContextGroupAlbum ||
|
|
4807 |
iContext == EContextItemArtist ||
|
|
4808 |
iContext == EContextItemAlbum )
|
|
4809 |
{
|
|
4810 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
4811 |
|
|
4812 |
if ( iSelectedMediaInAlbumView )
|
|
4813 |
{
|
|
4814 |
delete iSelectedMediaInAlbumView;
|
|
4815 |
iSelectedMediaInAlbumView = NULL;
|
|
4816 |
}
|
|
4817 |
|
|
4818 |
if ( aIndex < 0 ) // We try to save a valid album otherwise restore will not work.
|
|
4819 |
{
|
|
4820 |
aIndex = 0;
|
|
4821 |
}
|
|
4822 |
|
|
4823 |
iSelectedMediaInAlbumView = CMPXMedia::NewL( *mediaArray.AtL( aIndex ) );
|
|
4824 |
|
|
4825 |
if ( iSelectedMediaInAlbumView->IsSupported( KMPXMediaGeneralTitle ) )
|
|
4826 |
{
|
|
4827 |
const TDesC& title = iSelectedMediaInAlbumView->ValueText( KMPXMediaGeneralTitle );
|
|
4828 |
if ( title == KNullDesC )
|
|
4829 |
{
|
|
4830 |
// Cannot use reference to KNullDesC, must
|
|
4831 |
// use the literal directly.
|
|
4832 |
iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicAlbum, KNullDesC );
|
|
4833 |
}
|
|
4834 |
else
|
|
4835 |
{
|
|
4836 |
iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicAlbum, title );
|
|
4837 |
}
|
|
4838 |
}
|
|
4839 |
|
|
4840 |
if ( iContext == EContextItemArtist )
|
|
4841 |
{
|
|
4842 |
const CMPXMedia& containerMedia = iListBoxArray->ContainerMedia();
|
|
4843 |
const TDesC& artist = containerMedia.ValueText( KMPXMediaGeneralTitle );
|
|
4844 |
|
|
4845 |
HBufC* unknownArtistText =
|
|
4846 |
StringLoader::LoadLC( R_MPX_QTN_NMP_UNKNOWN_ARTIST );
|
|
4847 |
|
|
4848 |
if ( artist != unknownArtistText->Des() )
|
|
4849 |
{
|
|
4850 |
iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicArtist, artist );
|
|
4851 |
}
|
|
4852 |
else
|
|
4853 |
{
|
|
4854 |
iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicArtist, KNullDesC );
|
|
4855 |
}
|
|
4856 |
|
|
4857 |
CleanupStack::PopAndDestroy( unknownArtistText );
|
|
4858 |
}
|
|
4859 |
|
|
4860 |
iSelectedAlbumHandler->SaveSelectedAlbumL(*iSelectedMediaInAlbumView);
|
|
4861 |
}
|
|
4862 |
}
|
|
4863 |
|
|
4864 |
// -----------------------------------------------------------------------------
|
|
4865 |
// CMPXCollectionViewHgContainer::RestoreSelectedAlbumItemL
|
|
4866 |
// When view is deactivated, all the current information about album selection
|
|
4867 |
// were lost. So we restore the selected album.
|
|
4868 |
// -----------------------------------------------------------------------------
|
|
4869 |
//
|
|
4870 |
void CMPXCollectionViewHgContainer::RestoreSelectedAlbumItemL(
|
|
4871 |
const CMPXMediaArray& aMediaArray )
|
|
4872 |
{
|
|
4873 |
MPX_FUNC( "CMPXCollectionViewHgContainer::RestoreSelectedAlbumItemL" );
|
|
4874 |
|
|
4875 |
const CMPXMedia* restoredAlbum = iSelectedAlbumHandler->RestoreSelectedAlbum();
|
|
4876 |
iRestoredAlbumIndex = 0;
|
|
4877 |
iSelectedAlbumIndex = 0;
|
|
4878 |
TMPXItemId id(0);
|
|
4879 |
if (!restoredAlbum)
|
|
4880 |
{
|
|
4881 |
CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
|
|
4882 |
CleanupStack::PushL( cpath );
|
|
4883 |
id = (cpath->Id());
|
|
4884 |
CleanupStack::PopAndDestroy( cpath );
|
|
4885 |
}
|
|
4886 |
else
|
|
4887 |
{
|
|
4888 |
id=restoredAlbum->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
|
|
4889 |
}
|
|
4890 |
for ( TInt i = 0; i < aMediaArray.Count() ; i++ )
|
|
4891 |
{
|
|
4892 |
CMPXMedia* currentMedia( aMediaArray.AtL( i ) );
|
|
4893 |
|
|
4894 |
if ( (currentMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == id) ||
|
|
4895 |
(id.iId1 == 0 && currentMedia->ValueText(KMPXMediaGeneralTitle).Compare( restoredAlbum->ValueText(KMPXMediaGeneralTitle) ) == 0 ) )
|
|
4896 |
{
|
|
4897 |
iRestoredAlbumIndex = i;
|
|
4898 |
iSelectedAlbumIndex = i;
|
|
4899 |
break;
|
|
4900 |
}
|
|
4901 |
}
|
|
4902 |
}
|
|
4903 |
|
|
4904 |
// ----------------------------------------------------------------------------
|
|
4905 |
// Write the album name, artist name and album art in media data to file
|
|
4906 |
// ----------------------------------------------------------------------------
|
|
4907 |
void CMPXCollectionViewHgContainer::WriteToStreamFileL( const CMPXMedia* aMedia )
|
|
4908 |
{
|
|
4909 |
MPX_FUNC( "CMPXCollectionViewHgContainer::WriteToStreamFileL" );
|
|
4910 |
|
|
4911 |
CCoeEnv* coeEnv( iEikonEnv );
|
|
4912 |
RFs& fs = coeEnv->FsSession();
|
|
4913 |
fs.MkDirAll( iSelectedAlbumItemFileName );
|
|
4914 |
TParse parsedName;
|
|
4915 |
|
|
4916 |
fs.Parse( iSelectedAlbumItemFileName, parsedName );
|
|
4917 |
CFileStore* store( NULL );
|
|
4918 |
MPX_TRAPD( error, store = CDirectFileStore::ReplaceL(fs,
|
|
4919 |
parsedName.FullName(),
|
|
4920 |
EFileWrite); );
|
|
4921 |
|
|
4922 |
if ( error == KErrNone )
|
|
4923 |
{
|
|
4924 |
CleanupStack::PushL( store );
|
|
4925 |
store->SetTypeL( KDirectFileStoreLayoutUid );
|
|
4926 |
|
|
4927 |
RStoreWriteStream wstream;
|
|
4928 |
TStreamId stream = wstream.CreateLC( *store );
|
|
4929 |
store->SetRootL( stream );
|
|
4930 |
|
|
4931 |
aMedia->ExternalizeL(wstream);
|
|
4932 |
|
|
4933 |
wstream.CommitL();
|
|
4934 |
CleanupStack::PopAndDestroy( &wstream );
|
|
4935 |
CleanupStack::PopAndDestroy( store );
|
|
4936 |
}
|
|
4937 |
else
|
|
4938 |
{
|
|
4939 |
fs.Delete( iSelectedAlbumItemFileName );
|
|
4940 |
}
|
|
4941 |
}
|
|
4942 |
|
|
4943 |
// ----------------------------------------------------------------------------
|
|
4944 |
// Read the album name, artist name and album art from file
|
|
4945 |
// ----------------------------------------------------------------------------
|
|
4946 |
void CMPXCollectionViewHgContainer::ReadFromStreamFileL( CMPXMedia* aMedia )
|
|
4947 |
{
|
|
4948 |
MPX_FUNC("CMPXCollectionViewHgContainer::ReadFromStreamFileL");
|
|
4949 |
|
|
4950 |
CCoeEnv* coeEnv( iEikonEnv );
|
|
4951 |
RFs& fs = coeEnv->FsSession();
|
|
4952 |
fs.MkDirAll( iSelectedAlbumItemFileName );
|
|
4953 |
TParse parsedName;
|
|
4954 |
|
|
4955 |
fs.Parse( iSelectedAlbumItemFileName, parsedName );
|
|
4956 |
CFileStore* store( NULL );
|
|
4957 |
MPX_TRAPD( error, store = CDirectFileStore::OpenL(fs,
|
|
4958 |
parsedName.FullName(),
|
|
4959 |
EFileRead ); );
|
|
4960 |
|
|
4961 |
if ( error == KErrNone )
|
|
4962 |
{
|
|
4963 |
CleanupStack::PushL( store );
|
|
4964 |
|
|
4965 |
RStoreReadStream stream;
|
|
4966 |
stream.OpenLC( *store, store->Root() );
|
|
4967 |
aMedia->InternalizeL(stream);
|
|
4968 |
|
|
4969 |
CleanupStack::PopAndDestroy( &stream );
|
|
4970 |
CleanupStack::PopAndDestroy( store );
|
|
4971 |
}
|
|
4972 |
|
|
4973 |
}
|
|
4974 |
|
|
4975 |
void CMPXCollectionViewHgContainer::HandleGainingForeground()
|
|
4976 |
{
|
|
4977 |
iIsForeground = ETrue;
|
|
4978 |
if ( iCurrentViewType == EMPXViewMediawall )
|
|
4979 |
{
|
|
4980 |
if( iCbaHandler )
|
|
4981 |
iCbaHandler->ChangeCbaVisibility( EFalse );
|
|
4982 |
}
|
|
4983 |
}
|
|
4984 |
|
|
4985 |
void CMPXCollectionViewHgContainer::HandleLosingForeground()
|
|
4986 |
{
|
|
4987 |
iIsForeground = EFalse;
|
|
4988 |
}
|
|
4989 |
|
|
4990 |
TInt CMPXCollectionViewHgContainer::AsyncCallback( TAny* aPtr )
|
|
4991 |
{
|
|
4992 |
CMPXCollectionViewHgContainer* self = static_cast<CMPXCollectionViewHgContainer*>(aPtr);
|
|
4993 |
if( self )
|
|
4994 |
{
|
|
4995 |
//check if the pointer to ContainerMedia exists
|
|
4996 |
const CMPXMedia& media = self->iListBoxArray->ContainerMedia();
|
|
4997 |
if ( NULL == &media )
|
|
4998 |
{
|
|
4999 |
return KErrNone;
|
|
5000 |
}
|
|
5001 |
|
|
5002 |
|
|
5003 |
MPX_TRAPD( err, self->HandleLbxItemAdditionL() );
|
|
5004 |
if ( err != KErrNone )
|
|
5005 |
{
|
|
5006 |
MPX_DEBUG2("CMPXCollectionViewHgContainer::AsyncCallback() return err%d", err );
|
|
5007 |
return err;
|
|
5008 |
}
|
|
5009 |
|
|
5010 |
if( self->iCbaHandler )
|
|
5011 |
{
|
|
5012 |
self->iCbaHandler->UpdateCba();
|
|
5013 |
}
|
|
5014 |
}
|
|
5015 |
return KErrNone;
|
|
5016 |
}
|
|
5017 |
|
|
5018 |
// -----------------------------------------------------------------------------
|
|
5019 |
// Prepare T-bone view
|
|
5020 |
// -----------------------------------------------------------------------------
|
|
5021 |
//
|
|
5022 |
void CMPXCollectionViewHgContainer::PrepareTboneViewL()
|
|
5023 |
{
|
|
5024 |
MPX_FUNC( "CMPXCollectionViewHgContainer::PrepareTboneViewL" );
|
|
5025 |
|
|
5026 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
5027 |
TInt mediaCount( mediaArray.Count() );
|
|
5028 |
HandleLbxItemRemovalL();
|
|
5029 |
|
|
5030 |
iPrevContext = EContextGroupAlbum;
|
|
5031 |
iOpenAlbumTracks = ETrue;
|
|
5032 |
iContext = EContextItemAlbum;
|
|
5033 |
iCurrentViewType = EMPXViewTBone;
|
|
5034 |
|
|
5035 |
if (ShuffleItemPresent())
|
|
5036 |
iShuffleItem = 1;
|
|
5037 |
else
|
|
5038 |
iShuffleItem = 0;
|
|
5039 |
|
|
5040 |
TInt listCount = mediaCount + iShuffleItem;
|
|
5041 |
iThumbnailReqMap.Reset();
|
|
5042 |
iThumbnailReqMap.ReserveL(listCount);
|
|
5043 |
for ( TInt i = 0; i < listCount; i++ )
|
|
5044 |
{
|
|
5045 |
iThumbnailReqMap.Append( EFalse );
|
|
5046 |
}
|
|
5047 |
|
|
5048 |
iThumbnailManager->CancelAll();
|
|
5049 |
|
|
5050 |
// MediaWall sets the default icon in the construction phase.
|
|
5051 |
iDefaultIconSet = EFalse;
|
|
5052 |
|
|
5053 |
if( !iLayoutSwitch )
|
|
5054 |
{
|
|
5055 |
SetupTransitionType(KMPXIntraviewTransition);
|
|
5056 |
BeginFullScreenAnimation();
|
|
5057 |
}
|
|
5058 |
|
|
5059 |
RestoreSelectedAlbumItemL(mediaArray);
|
|
5060 |
PrepareMediaWallWithListL( mediaArray, mediaCount );
|
|
5061 |
|
|
5062 |
DrawableWindow()->SetOrdinalPosition( -1 );
|
|
5063 |
|
|
5064 |
iPrevViewType = iCurrentViewType;
|
|
5065 |
|
|
5066 |
// We need to adjust the CBA for this view.
|
|
5067 |
if( iCbaHandler )
|
|
5068 |
iCbaHandler->UpdateCba();
|
|
5069 |
|
|
5070 |
iLayoutSwitch = EFalse;
|
|
5071 |
}
|
|
5072 |
|
|
5073 |
// -----------------------------------------------------------------------------
|
|
5074 |
// Determine if adding shuffle command is needed
|
|
5075 |
// -----------------------------------------------------------------------------
|
|
5076 |
//
|
|
5077 |
TBool CMPXCollectionViewHgContainer::ShuffleItemPresent()
|
|
5078 |
{
|
|
5079 |
MPX_FUNC( "CMPXCollectionViewHgContainer::ShuffleItemNeeded" );
|
|
5080 |
|
|
5081 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
5082 |
|
|
5083 |
TBool res = EFalse;
|
|
5084 |
if ( mediaArray.Count() > 1 &&
|
|
5085 |
(iContext == EContextGroupAlbum ||
|
|
5086 |
iContext == EContextGroupSong ||
|
|
5087 |
iContext == EContextItemPlaylist ||
|
|
5088 |
iContext == EContextItemGenre ||
|
|
5089 |
iContext == EContextItemSong ))
|
|
5090 |
{
|
|
5091 |
res = ETrue;
|
|
5092 |
}
|
|
5093 |
|
|
5094 |
return res;
|
|
5095 |
}
|
|
5096 |
|
|
5097 |
// -----------------------------------------------------------------------------
|
|
5098 |
// Handles translation from list index to media array index
|
|
5099 |
// -----------------------------------------------------------------------------
|
|
5100 |
//
|
|
5101 |
TInt CMPXCollectionViewHgContainer::MediaIndex(TInt aIndex) const
|
|
5102 |
{
|
|
5103 |
MPX_FUNC( "CMPXCollectionViewHgContainer::MediaIndex" );
|
|
5104 |
|
|
5105 |
TInt index(aIndex);
|
|
5106 |
|
|
5107 |
if ( iShuffleItem && aIndex != KErrNotFound )
|
|
5108 |
{
|
|
5109 |
index = aIndex - 1;
|
|
5110 |
}
|
|
5111 |
|
|
5112 |
return index;
|
|
5113 |
}
|
|
5114 |
|
|
5115 |
|
|
5116 |
// ---------------------------------------------------------------------------
|
|
5117 |
// Offer command by view, if handled, return ETrue.
|
|
5118 |
// ---------------------------------------------------------------------------
|
|
5119 |
//
|
|
5120 |
TBool CMPXCollectionViewHgContainer::OfferCommandL( TInt aCommand )
|
|
5121 |
{
|
|
5122 |
MPX_FUNC( "CMPXCollectionViewHgContainer::OfferCommandL" );
|
|
5123 |
|
|
5124 |
if( aCommand == EAknSoftkeyBack && iContext == EContextItemAlbum )
|
|
5125 |
{
|
|
5126 |
iOpenAlbumTracks = EFalse;
|
|
5127 |
HandleLbxItemAdditionL();
|
|
5128 |
return ETrue;
|
|
5129 |
}
|
|
5130 |
else
|
|
5131 |
{
|
|
5132 |
return EFalse;
|
|
5133 |
}
|
|
5134 |
}
|
|
5135 |
|
|
5136 |
// ---------------------------------------------------------------------------
|
|
5137 |
// Load and set empty text
|
|
5138 |
// ---------------------------------------------------------------------------
|
|
5139 |
//
|
|
5140 |
void CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL()
|
|
5141 |
{
|
|
5142 |
MPX_FUNC( "CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL" );
|
|
5143 |
MPX_DEBUG2( "CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL - iContext %d", iContext );
|
|
5144 |
|
|
5145 |
TInt resId( 0 );
|
|
5146 |
|
|
5147 |
switch ( iContext )
|
|
5148 |
{
|
|
5149 |
case EContextGroupAlbum:
|
|
5150 |
{
|
|
5151 |
resId = R_MPX_VMP_NO_ALBUMS;
|
|
5152 |
break;
|
|
5153 |
}
|
|
5154 |
case EContextGroupGenre:
|
|
5155 |
case EContextItemGenre:
|
|
5156 |
{
|
|
5157 |
resId = R_MPX_VMP_NO_GENRES;
|
|
5158 |
break;
|
|
5159 |
}
|
|
5160 |
case EContextItemSong:
|
|
5161 |
case EContextGroupSong:
|
|
5162 |
case EContextItemPlaylist:
|
|
5163 |
{
|
|
5164 |
resId = R_MPX_VMP_NO_SONGS;
|
|
5165 |
break;
|
|
5166 |
}
|
|
5167 |
default:
|
|
5168 |
{
|
|
5169 |
MPX_DEBUG1( "CMPXCollectionViewHgContainer::LoadAndSetEmptyTextL - some empty text is missing" );
|
|
5170 |
return;
|
|
5171 |
}
|
|
5172 |
}
|
|
5173 |
HBufC* emptyText = StringLoader::LoadLC( resId );
|
|
5174 |
SetLbxEmptyTextL( *emptyText );
|
|
5175 |
CleanupStack::PopAndDestroy( emptyText );
|
|
5176 |
}
|
|
5177 |
|
|
5178 |
// ---------------------------------------------------------------------------
|
|
5179 |
// Set previous view Uid
|
|
5180 |
// ---------------------------------------------------------------------------
|
|
5181 |
//
|
|
5182 |
void CMPXCollectionViewHgContainer::SetPreviousViewId(TUid aViewUid)
|
|
5183 |
{
|
|
5184 |
MPX_FUNC( "CMPXCollectionViewHgContainer::SetPreviousViewId" );
|
|
5185 |
|
|
5186 |
iPreviousViewId = aViewUid;
|
|
5187 |
}
|
|
5188 |
|
|
5189 |
// ---------------------------------------------------------------------------
|
|
5190 |
// Hides container window controls
|
|
5191 |
// ---------------------------------------------------------------------------
|
|
5192 |
//
|
|
5193 |
void CMPXCollectionViewHgContainer::HideContainerWindow()
|
|
5194 |
{
|
|
5195 |
if( iMediaWall )
|
|
5196 |
iMediaWall->MakeVisible(EFalse);
|
|
5197 |
if( iListWidget )
|
|
5198 |
iListWidget->MakeVisible(EFalse);
|
|
5199 |
if( iMwListWidget )
|
|
5200 |
iMwListWidget->MakeVisible(EFalse);
|
|
5201 |
|
|
5202 |
// draw background application rectangle
|
|
5203 |
iDrawBackGround = ETrue;
|
|
5204 |
DrawNow();
|
|
5205 |
iDrawBackGround = EFalse;
|
|
5206 |
}
|
|
5207 |
|
|
5208 |
// ---------------------------------------------------------------------------
|
|
5209 |
// Prepare and begin fullscreen animation effects
|
|
5210 |
// ---------------------------------------------------------------------------
|
|
5211 |
//
|
|
5212 |
void CMPXCollectionViewHgContainer::BeginFullScreenAnimation()
|
|
5213 |
{
|
|
5214 |
if( iTranstionType == EMPXTranstionNotDefined )
|
|
5215 |
return;
|
|
5216 |
|
|
5217 |
const TInt flags = AknTransEffect::TParameter::EActivateExplicitCancel;
|
|
5218 |
TRect appRect = ((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect();
|
|
5219 |
GfxTransEffect::BeginFullScreen( iTranstionType, appRect,
|
|
5220 |
AknTransEffect::EParameterType,
|
|
5221 |
AknTransEffect::GfxTransParam(KAppUidMusicPlayerX, flags));
|
|
5222 |
}
|
|
5223 |
|
|
5224 |
// ---------------------------------------------------------------------------
|
|
5225 |
// End fullscreen animation effects
|
|
5226 |
// ---------------------------------------------------------------------------
|
|
5227 |
//
|
|
5228 |
void CMPXCollectionViewHgContainer::EndFullScreenAnimation()
|
|
5229 |
{
|
|
5230 |
if( iTranstionType != EMPXTranstionNotDefined )
|
|
5231 |
{
|
|
5232 |
GfxTransEffect::EndFullScreen();
|
|
5233 |
iTranstionType = EMPXTranstionNotDefined;
|
|
5234 |
// TODO: uncomment if really needed.
|
|
5235 |
//iThumbnailManager->Pause(TTimeIntervalMicroSeconds32(KThumbLoadingPauseForTransition));
|
|
5236 |
}
|
|
5237 |
}
|
|
5238 |
|
|
5239 |
// ---------------------------------------------------------------------------
|
|
5240 |
// Setup transition types for animation.
|
|
5241 |
// ---------------------------------------------------------------------------
|
|
5242 |
//
|
|
5243 |
void CMPXCollectionViewHgContainer::SetupTransitionType( TInt aType, TBool aPrevViewWasPlayback )
|
|
5244 |
{
|
|
5245 |
if ( aType == KMPXIntraviewTransition )
|
|
5246 |
{
|
|
5247 |
iTranstionType = EMPXTranstionToLeft;
|
|
5248 |
|
|
5249 |
if( iPrevContext == EContextUnknown )
|
|
5250 |
{
|
|
5251 |
// We aren't coming from playback view and prev context is unknown.
|
|
5252 |
// Musicplayer is propably started so we shouldn't use any animation.
|
|
5253 |
iTranstionType = EMPXTranstionNotDefined;
|
|
5254 |
return;
|
|
5255 |
}
|
|
5256 |
else if( iContext == EContextItemAlbum ||
|
|
5257 |
iContext == EContextItemGenre ||
|
|
5258 |
iContext == EContextItemPlaylist )
|
|
5259 |
{
|
|
5260 |
iTranstionType = EMPXTranstionToRight;
|
|
5261 |
}
|
|
5262 |
|
|
5263 |
if( iPrevViewType == EMPXViewMediawall || iPrevViewType == EMPXViewTBone )
|
|
5264 |
{
|
|
5265 |
iMediaWall->SetFlags( CHgVgMediaWall::EHgVgMediaWallDrawToWindowGC );
|
|
5266 |
iMediaWall->DrawNow();
|
|
5267 |
}
|
|
5268 |
}
|
|
5269 |
else if ( aType == KMPXNoTransition ) // No transition
|
|
5270 |
{
|
|
5271 |
iTranstionType = EMPXTranstionNotDefined;
|
|
5272 |
}
|
|
5273 |
else // interview transition
|
|
5274 |
{
|
|
5275 |
|
|
5276 |
iTranstionType = EMPXTranstionToRight;
|
|
5277 |
if ( (iPrevContext == EContextUnknown ||
|
|
5278 |
iPrevContext == EContextItemAlbum ) && aPrevViewWasPlayback )
|
|
5279 |
{
|
|
5280 |
iTranstionType = EMPXTranstionToLeft;
|
|
5281 |
}
|
|
5282 |
}
|
|
5283 |
}
|
|
5284 |
|
|
5285 |
// ---------------------------------------------------------------------------
|
|
5286 |
// Resolving the size of the popup list rectangle.
|
|
5287 |
// ---------------------------------------------------------------------------
|
|
5288 |
//
|
|
5289 |
void CMPXCollectionViewHgContainer::ResolvePopupListSizeL()
|
|
5290 |
{
|
|
5291 |
// Resolve popuplistbox rect that is used to show the album songs
|
|
5292 |
CAknSinglePopupMenuStyleListBox* listBox = new ( ELeave ) CAknSinglePopupMenuStyleListBox;
|
|
5293 |
CleanupStack::PushL( listBox );
|
|
5294 |
|
|
5295 |
CMpxPopupList* dialog = CMpxPopupList::NewL(listBox, R_MPX_COLLECTION_ALBUMSONGS_LIST_CBA,
|
|
5296 |
AknPopupLayouts::EDynMenuWindow );
|
|
5297 |
|
|
5298 |
CleanupStack::PushL( dialog );
|
|
5299 |
|
|
5300 |
listBox->ConstructL( dialog, EAknListBoxViewerFlags );
|
|
5301 |
|
|
5302 |
// title can be hardcoded because it is not shown to user. Just for the calculations.
|
|
5303 |
dialog->SetTitleL(_L("Foo"));
|
|
5304 |
iPopupListRect = dialog->LayoutRect();
|
|
5305 |
|
|
5306 |
CleanupStack::PopAndDestroy( dialog );
|
|
5307 |
CleanupStack::PopAndDestroy( listBox );
|
|
5308 |
}
|
|
5309 |
|
|
5310 |
// ---------------------------------------------------------------------------
|
|
5311 |
// Marked the grabbed item for reordering
|
|
5312 |
// ---------------------------------------------------------------------------
|
|
5313 |
//
|
|
5314 |
void CMPXCollectionViewHgContainer::MarkGrabedItemL(TInt aIndex)
|
|
5315 |
{
|
|
5316 |
MPX_DEBUG2( "CMPXCollectionViewHgContainer::MarkGrabedItemL item %d", aIndex + iShuffleItem );
|
|
5317 |
iListWidget->Mark( aIndex + iShuffleItem );
|
|
5318 |
}
|
|
5319 |
|
|
5320 |
// End of File
|