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: Application UI class required by AVKON application architecture.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
#include <barsread.h>
|
|
20 |
#include <StringLoader.h>
|
|
21 |
#include <AknIconArray.h>
|
|
22 |
#include <gulicon.h>
|
|
23 |
#include <featmgr.h>
|
|
24 |
#include <aknsfld.h>
|
|
25 |
#include <AknUtils.h>
|
|
26 |
#include <aknlists.h>
|
|
27 |
#include <aknconsts.h>
|
|
28 |
#include <avkon.mbg>
|
|
29 |
#include <eikclbd.h>
|
|
30 |
#include <eikcmobs.h>
|
|
31 |
#include <bautils.h>
|
|
32 |
#include <AknsBasicBackgroundControlContext.h>
|
|
33 |
#include <s32file.h>
|
|
34 |
|
|
35 |
#include <ganes/HgDoubleGraphicList.h>
|
|
36 |
#include <ganes/HgSingleGraphicList.h>
|
|
37 |
#include <ganes/HgItem.h>
|
|
38 |
#include <ganes/HgScrollerWithTitle.h>
|
|
39 |
|
|
40 |
#include <data_caging_path_literals.hrh>
|
|
41 |
#include <mpxlog.h>
|
|
42 |
#include <mpxuser.h>
|
|
43 |
#include <mpxmedia.h>
|
|
44 |
#include <mpxmediaarray.h>
|
|
45 |
#include <mpxmediageneraldefs.h>
|
|
46 |
#include <mpxmediamusicdefs.h>
|
|
47 |
#include <mpxcommonuihelper.h>
|
|
48 |
#include <mpxpodcastdefs.h>
|
|
49 |
|
|
50 |
#include <mpxcommoncontainer.rsg>
|
|
51 |
#include <mpxcollectionview.rsg>
|
|
52 |
|
|
53 |
#include "mpxcommonlistboxarraybase.h"
|
|
54 |
#include "mpxcommoncontainermediahelper.h"
|
|
55 |
#include "mpxcommoncontainertexturemanager2.h"
|
|
56 |
#include "mpxcommoncontainerhgimp.h"
|
|
57 |
#include "mpxcommoncontainer.hrh"
|
|
58 |
|
|
59 |
#include <thumbnaildata.h>
|
|
60 |
#include <thumbnailobjectsource.h>
|
|
61 |
#include <aknview.h>
|
|
62 |
|
|
63 |
|
|
64 |
// CONSTANTS
|
|
65 |
_LIT( KMPXCommonContainerRscPath, "mpxcommoncontainer.rsc" );
|
|
66 |
|
|
67 |
const TInt KMPXListSelectionCount = 5;
|
|
68 |
const TInt KMPXMinSecSeparatorIndex = 2;
|
|
69 |
const TInt KOneHourInSeconds = 3600;
|
|
70 |
const TInt KMPXTimeIndicatorLength = 16;
|
|
71 |
const TInt KMPXListBufferSize = 400;
|
|
72 |
const TInt KMPXMaxFileLength = 256;
|
|
73 |
const TReal KIconFactor = 0.7;
|
|
74 |
const int KMaxThumbnailReq = 100;
|
|
75 |
|
|
76 |
_LIT( KMPXDash, " - " );
|
|
77 |
#ifdef HG_MP_LOC_AVAILABLE
|
|
78 |
_LIT( KMPXSpace, " ");
|
|
79 |
#endif //HG_MP_LOC_AVAILABLE
|
|
80 |
_LIT( KMPXZeroDurationMark, "--");
|
|
81 |
//_LIT( KMPXAlbumMimeType, "image/jpeg" );
|
|
82 |
_LIT( KMPXAlbumMimeType, "audio/mpeg3" );
|
|
83 |
|
|
84 |
//#ifndef HG_MP_LOC_AVAILABLE
|
|
85 |
_LIT( KUnknown, "Unknown" );
|
|
86 |
_LIT( KSong, " song" );
|
|
87 |
_LIT( KSongs, " songs" );
|
|
88 |
_LIT( KEpisode, " episode" );
|
|
89 |
_LIT( KEpisodes, " episodes" );
|
|
90 |
_LIT( KAlbum, " album" );
|
|
91 |
_LIT( KAlbums, " albums" );
|
|
92 |
_LIT( KSongDash, " song - " );
|
|
93 |
_LIT( KSongsDash, " songs - " );
|
|
94 |
//#endif //HG_MP_LOC_AVAILABLE
|
|
95 |
|
|
96 |
_LIT( KMPXDriveC, "c:" );
|
|
97 |
_LIT( KMPXSelectedAlbumItemFileName, "mpxalbumitem.dat");
|
|
98 |
|
|
99 |
#define DSA_PARAM NULL
|
|
100 |
//#define DSA_PARAM &iEikonEnv->WsSession()
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
// ======== MEMBER FUNCTIONS ========
|
|
105 |
|
|
106 |
// ---------------------------------------------------------------------------
|
|
107 |
// C++ constructor can NOT contain any code that might leave.
|
|
108 |
// ---------------------------------------------------------------------------
|
|
109 |
//
|
|
110 |
CMPXCommonContainerHgImp::CMPXCommonContainerHgImp() :
|
|
111 |
iContext( EContextUnknown ),
|
|
112 |
iTopIndex( 0 ),
|
|
113 |
iBottomIndex( KErrNotFound ),
|
|
114 |
iCurrentDefaultIcon( EMPXDefaultIconNotSet ),
|
|
115 |
iRequestCount( 0 ),
|
|
116 |
iAlbumArtRequest(NULL),
|
|
117 |
iRequestQueue(_FOFF( TAlbumArtRequest, iLink )),
|
|
118 |
iQueueCounter(0)
|
|
119 |
{
|
|
120 |
}
|
|
121 |
|
|
122 |
|
|
123 |
// ---------------------------------------------------------------------------
|
|
124 |
// Destructor
|
|
125 |
// ---------------------------------------------------------------------------
|
|
126 |
//
|
|
127 |
CMPXCommonContainerHgImp::~CMPXCommonContainerHgImp()
|
|
128 |
{
|
|
129 |
MPX_FUNC( "CMPXCommonContainerHgImp::~CMPXCommonContainerHgImp" );
|
|
130 |
|
|
131 |
delete iEpisodeTitle;
|
|
132 |
delete iSongTitle;
|
|
133 |
delete iAlbumTitle;
|
|
134 |
|
|
135 |
if ( iResourceOffset )
|
|
136 |
{
|
|
137 |
iEikonEnv->DeleteResourceFile( iResourceOffset );
|
|
138 |
}
|
|
139 |
delete iListSelections;
|
|
140 |
delete iListBoxArray;
|
|
141 |
delete iIconArray;
|
|
142 |
if ( iScrollerWithTitle )
|
|
143 |
{
|
|
144 |
// delete iListWidget;
|
|
145 |
delete iScrollerWithTitle;
|
|
146 |
if ( iPrevListWidget )
|
|
147 |
{
|
|
148 |
delete iPrevListWidget;
|
|
149 |
}
|
|
150 |
}
|
|
151 |
else
|
|
152 |
{
|
|
153 |
delete iListWidget;
|
|
154 |
}
|
|
155 |
/// delete iTextureManager;
|
|
156 |
delete iCommonUiHelper;
|
|
157 |
CancelTNRequest();
|
|
158 |
iThumbnailReqHashMap.Close();
|
|
159 |
iThumbnailReqMap.Close();
|
|
160 |
delete iThumbnailManager;
|
|
161 |
delete iBgContext;
|
|
162 |
delete iSelectedMediaInAlbumView;
|
|
163 |
CleanAlbumArtReqQueue();
|
|
164 |
}
|
|
165 |
|
|
166 |
|
|
167 |
// ---------------------------------------------------------------------------
|
|
168 |
// Return Coe Control
|
|
169 |
// ---------------------------------------------------------------------------
|
|
170 |
//
|
|
171 |
CCoeControl* CMPXCommonContainerHgImp::CoeControl()
|
|
172 |
{
|
|
173 |
MPX_FUNC( "CMPXCommonContainerHgImp::CoeControl" );
|
|
174 |
return this;
|
|
175 |
}
|
|
176 |
|
|
177 |
|
|
178 |
// ---------------------------------------------------------------------------
|
|
179 |
// Set View Container
|
|
180 |
// ---------------------------------------------------------------------------
|
|
181 |
//
|
|
182 |
void CMPXCommonContainerHgImp::SetViewContainer(
|
|
183 |
MMPXViewContainer* aViewContainer )
|
|
184 |
{
|
|
185 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetViewContainer" );
|
|
186 |
iViewContainer = aViewContainer;
|
|
187 |
}
|
|
188 |
|
|
189 |
|
|
190 |
// ---------------------------------------------------------------------------
|
|
191 |
// Set command observer for the container
|
|
192 |
// ---------------------------------------------------------------------------
|
|
193 |
//
|
|
194 |
void CMPXCommonContainerHgImp::SetCommandObserver(
|
|
195 |
MEikCommandObserver* aCommandObserver )
|
|
196 |
{
|
|
197 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetCommandObserver" );
|
|
198 |
iView = aCommandObserver;
|
|
199 |
}
|
|
200 |
|
|
201 |
|
|
202 |
// ---------------------------------------------------------------------------
|
|
203 |
// C++ constructor can NOT contain any code that might leave.
|
|
204 |
// ---------------------------------------------------------------------------
|
|
205 |
//
|
|
206 |
void CMPXCommonContainerHgImp::SetListBoxObserver(
|
|
207 |
MEikListBoxObserver* aListBoxObserver )
|
|
208 |
{
|
|
209 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetListBoxObserver" );
|
|
210 |
iListBoxObserver = aListBoxObserver;
|
|
211 |
}
|
|
212 |
|
|
213 |
|
|
214 |
// ---------------------------------------------------------------------------
|
|
215 |
// Set layout for all elements and set sizes for icons.
|
|
216 |
// ---------------------------------------------------------------------------
|
|
217 |
//
|
|
218 |
void CMPXCommonContainerHgImp::UpdateLayout()
|
|
219 |
{
|
|
220 |
MPX_FUNC( "CMPXCommonContainerHgImp::UpdateLayout" );
|
|
221 |
}
|
|
222 |
|
|
223 |
|
|
224 |
// -----------------------------------------------------------------------------
|
|
225 |
// Returns a pointer to the listboxarray
|
|
226 |
// -----------------------------------------------------------------------------
|
|
227 |
//
|
|
228 |
CMPXCommonListBoxArrayBase* CMPXCommonContainerHgImp::ListBoxArray() const
|
|
229 |
{
|
|
230 |
return iListBoxArray;
|
|
231 |
}
|
|
232 |
|
|
233 |
|
|
234 |
// -----------------------------------------------------------------------------
|
|
235 |
// Sets listbox array
|
|
236 |
// -----------------------------------------------------------------------------
|
|
237 |
//
|
|
238 |
void CMPXCommonContainerHgImp::SetListBoxArrayL(
|
|
239 |
CMPXCommonListBoxArrayBase* aListBoxArray )
|
|
240 |
{
|
|
241 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetListBoxArrayL" );
|
|
242 |
iListBoxArray = aListBoxArray;
|
|
243 |
}
|
|
244 |
|
|
245 |
|
|
246 |
// -----------------------------------------------------------------------------
|
|
247 |
// Return number of listbox items shown in the current listbox.
|
|
248 |
// -----------------------------------------------------------------------------
|
|
249 |
//
|
|
250 |
TInt CMPXCommonContainerHgImp::CurrentListItemCount() const
|
|
251 |
{
|
|
252 |
MPX_FUNC( "CMPXCommonContainerHgImp::CurrentListItemCount" );
|
|
253 |
TInt count = 0;
|
|
254 |
if ( iListWidget )
|
|
255 |
{
|
|
256 |
count = iListWidget->ItemCount();
|
|
257 |
}
|
|
258 |
return count;
|
|
259 |
}
|
|
260 |
|
|
261 |
|
|
262 |
// -----------------------------------------------------------------------------
|
|
263 |
// Return total number of listbox items in the listbox.
|
|
264 |
// -----------------------------------------------------------------------------
|
|
265 |
//
|
|
266 |
TInt CMPXCommonContainerHgImp::TotalListItemCount() const
|
|
267 |
{
|
|
268 |
MPX_FUNC( "CMPXCommonContainerHgImp::TotalListItemCount" );
|
|
269 |
TInt count = 0;
|
|
270 |
if ( iListBoxArray )
|
|
271 |
{
|
|
272 |
count = iListBoxArray->MediaArray().Count();
|
|
273 |
}
|
|
274 |
return count;
|
|
275 |
}
|
|
276 |
|
|
277 |
|
|
278 |
// -----------------------------------------------------------------------------
|
|
279 |
// Gets top listbox item index (relative to the original listbox).
|
|
280 |
// -----------------------------------------------------------------------------
|
|
281 |
//
|
|
282 |
TInt CMPXCommonContainerHgImp::TopLbxItemIndex() const
|
|
283 |
{
|
|
284 |
MPX_FUNC( "CMPXCommonContainerHgImp::TopLbxItemIndex" );
|
|
285 |
return iTopIndex;
|
|
286 |
}
|
|
287 |
|
|
288 |
|
|
289 |
// -----------------------------------------------------------------------------
|
|
290 |
// Gets bottom listbox item index (relative to the original listbox).
|
|
291 |
// -----------------------------------------------------------------------------
|
|
292 |
//
|
|
293 |
TInt CMPXCommonContainerHgImp::BottomLbxItemIndex() const
|
|
294 |
{
|
|
295 |
MPX_FUNC( "CMPXCommonContainerHgImp::BottomLbxItemIndex" );
|
|
296 |
return iBottomIndex;
|
|
297 |
}
|
|
298 |
|
|
299 |
// -----------------------------------------------------------------------------
|
|
300 |
// Hides listbox
|
|
301 |
// -----------------------------------------------------------------------------
|
|
302 |
//
|
|
303 |
void CMPXCommonContainerHgImp::HideListView()
|
|
304 |
{
|
|
305 |
if ( iListWidget )
|
|
306 |
{
|
|
307 |
iListWidget->MakeVisible(EFalse);
|
|
308 |
}
|
|
309 |
}
|
|
310 |
|
|
311 |
// -----------------------------------------------------------------------------
|
|
312 |
// Gets current listbox item index (relative to the original listbox).
|
|
313 |
// -----------------------------------------------------------------------------
|
|
314 |
//
|
|
315 |
TInt CMPXCommonContainerHgImp::CurrentLbxItemIndex() const
|
|
316 |
{
|
|
317 |
MPX_FUNC( "CMPXCommonContainerHgImp::CurrentLbxItemIndex" );
|
|
318 |
TInt index( KErrNotFound );
|
|
319 |
if ( iListWidget )
|
|
320 |
{
|
|
321 |
const TInt count = CurrentListItemCount();
|
|
322 |
if ( count > 0 )
|
|
323 |
{
|
|
324 |
index = iListWidget->SelectedIndex();
|
|
325 |
}
|
|
326 |
}
|
|
327 |
return index;
|
|
328 |
}
|
|
329 |
|
|
330 |
|
|
331 |
// -----------------------------------------------------------------------------
|
|
332 |
// Get current selected listbox items indices (relative to the original listbox)
|
|
333 |
// -----------------------------------------------------------------------------
|
|
334 |
//
|
|
335 |
const CArrayFix<TInt>* CMPXCommonContainerHgImp::CurrentSelectionIndicesL() const
|
|
336 |
{
|
|
337 |
MPX_FUNC( "CMPXCommonContainerHgImp::CurrentSelectionIndicesL" );
|
|
338 |
if ( iListWidget )
|
|
339 |
{
|
|
340 |
iListSelections->Reset();
|
|
341 |
RArray<TInt> selectionArray;
|
|
342 |
CleanupClosePushL( selectionArray );
|
|
343 |
iListWidget->GetMarkedItemsL(selectionArray);
|
|
344 |
int count = selectionArray.Count();
|
|
345 |
for( int i = 0; i < count; i++ )
|
|
346 |
{
|
|
347 |
iListSelections->AppendL( selectionArray[i] );
|
|
348 |
}
|
|
349 |
CleanupStack::PopAndDestroy( &selectionArray );
|
|
350 |
}
|
|
351 |
return iListSelections;
|
|
352 |
}
|
|
353 |
|
|
354 |
|
|
355 |
// -----------------------------------------------------------------------------
|
|
356 |
// Set current selected listbox items indices (relative to the original listbox)
|
|
357 |
// -----------------------------------------------------------------------------
|
|
358 |
//
|
|
359 |
void CMPXCommonContainerHgImp::SetCurrentSelectionIndicesL(
|
|
360 |
CArrayFix<TInt>* aIndices ) const
|
|
361 |
{
|
|
362 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetCurrentSelectionIndicesL" );
|
|
363 |
TInt count = aIndices->Count();
|
|
364 |
if ( count > 0 && iListWidget )
|
|
365 |
{
|
|
366 |
for( TInt i = 0; i < count; i++ )
|
|
367 |
{
|
|
368 |
iListWidget->Mark( (*aIndices)[i] );
|
|
369 |
}
|
|
370 |
iListWidget->RefreshScreen( (*aIndices)[0] );
|
|
371 |
}
|
|
372 |
}
|
|
373 |
|
|
374 |
|
|
375 |
// -----------------------------------------------------------------------------
|
|
376 |
// Set top listbox item index.
|
|
377 |
// -----------------------------------------------------------------------------
|
|
378 |
//
|
|
379 |
void CMPXCommonContainerHgImp::SetLbxTopItemIndex( TInt /*aIndex*/ )
|
|
380 |
{
|
|
381 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetLbxTopItemIndex" );
|
|
382 |
}
|
|
383 |
|
|
384 |
|
|
385 |
// -----------------------------------------------------------------------------
|
|
386 |
// Set current listbox item index.
|
|
387 |
// -----------------------------------------------------------------------------
|
|
388 |
//
|
|
389 |
void CMPXCommonContainerHgImp::SetLbxCurrentItemIndex( TInt aIndex )
|
|
390 |
{
|
|
391 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetLbxCurrentItemIndex" );
|
|
392 |
if ( iListWidget )
|
|
393 |
{
|
|
394 |
iListWidget->SetSelectedIndex( aIndex );
|
|
395 |
}
|
|
396 |
}
|
|
397 |
|
|
398 |
|
|
399 |
// -----------------------------------------------------------------------------
|
|
400 |
// Set current listbox item index and highlight it.
|
|
401 |
// -----------------------------------------------------------------------------
|
|
402 |
//
|
|
403 |
void CMPXCommonContainerHgImp::SetLbxCurrentItemIndexAndDraw(
|
|
404 |
TInt aIndex )
|
|
405 |
{
|
|
406 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetLbxCurrentItemIndexAndDraw" );
|
|
407 |
SetLbxCurrentItemIndex(aIndex);
|
|
408 |
}
|
|
409 |
|
|
410 |
|
|
411 |
// -----------------------------------------------------------------------------
|
|
412 |
// Clear listbox selection.
|
|
413 |
// -----------------------------------------------------------------------------
|
|
414 |
//
|
|
415 |
void CMPXCommonContainerHgImp::ClearLbxSelection()
|
|
416 |
{
|
|
417 |
MPX_FUNC( "CMPXCommonContainerHgImp::ClearLbxSelection" );
|
|
418 |
if ( iListWidget )
|
|
419 |
{
|
|
420 |
iListWidget->UnMarkAll();
|
|
421 |
}
|
|
422 |
}
|
|
423 |
|
|
424 |
|
|
425 |
// -----------------------------------------------------------------------------
|
|
426 |
// Sets the text for an empty list box
|
|
427 |
// -----------------------------------------------------------------------------
|
|
428 |
//
|
|
429 |
void CMPXCommonContainerHgImp::SetLbxEmptyTextL( const TDesC& aText )
|
|
430 |
{
|
|
431 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetLbxEmptyTextL" );
|
|
432 |
|
|
433 |
if ( iListWidget && aText != KNullDesC )
|
|
434 |
{
|
|
435 |
iListWidget->SetEmptyTextL( aText );
|
|
436 |
}
|
|
437 |
}
|
|
438 |
|
|
439 |
// -----------------------------------------------------------------------------
|
|
440 |
// Draws a list box item
|
|
441 |
// -----------------------------------------------------------------------------
|
|
442 |
//
|
|
443 |
void CMPXCommonContainerHgImp::DrawLbxItemL( TInt aIndex )
|
|
444 |
{
|
|
445 |
MPX_DEBUG2( "CMPXCommonContainerHgImp::DrawLbxItemL (aIndex=%d)", aIndex );
|
|
446 |
if ( iListWidget && iBottomIndex > 0 )
|
|
447 |
{
|
|
448 |
CHgItem* item = &iListWidget->ItemL(aIndex);
|
|
449 |
SetDetailIndicatorL(item, aIndex);
|
|
450 |
iListWidget->RefreshScreen(aIndex);
|
|
451 |
}
|
|
452 |
}
|
|
453 |
|
|
454 |
|
|
455 |
// -----------------------------------------------------------------------------
|
|
456 |
// Set Find box's focus.
|
|
457 |
// -----------------------------------------------------------------------------
|
|
458 |
//
|
|
459 |
void CMPXCommonContainerHgImp::SetFindBoxFocus( TBool /*aFocus*/ )
|
|
460 |
{
|
|
461 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetFindBoxFocus" );
|
|
462 |
}
|
|
463 |
|
|
464 |
|
|
465 |
// -----------------------------------------------------------------------------
|
|
466 |
// Handle listbox item addition.
|
|
467 |
// -----------------------------------------------------------------------------
|
|
468 |
//
|
|
469 |
void CMPXCommonContainerHgImp::HandleLbxItemAdditionL()
|
|
470 |
{
|
|
471 |
MPX_FUNC( "CMPXCommonContainerHgImp::HandleLbxItemAdditionL" );
|
|
472 |
SetCollectionContextL();
|
|
473 |
iLastValidMediaItemIndex = 0;
|
|
474 |
if ( iListWidget )
|
|
475 |
{
|
|
476 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
477 |
const TInt count( mediaArray.Count() );
|
|
478 |
MPX_DEBUG2( "CMPXCommonContainerHgImp::HandleLbxItemAdditionL count=%d", count);
|
|
479 |
HandleLbxItemRemovalL();
|
|
480 |
|
|
481 |
iThumbnailReqMap.Reset();
|
|
482 |
for ( TInt i = 0; i < count; i++ )
|
|
483 |
{
|
|
484 |
iThumbnailReqMap.Append( EFalse );
|
|
485 |
}
|
|
486 |
|
|
487 |
if ( iContext == EContextItemAlbum && iContext != iPrevContext )
|
|
488 |
{
|
|
489 |
// Save previous list so won't cause flickering when back.
|
|
490 |
// If album view comes back again, we don't want to delete
|
|
491 |
// title_list so skip this block for the same album track view.
|
|
492 |
//iListWidget->SetFlags( CHgScroller::EHgScrollerScreenFreeze );
|
|
493 |
iListWidget->Reset();
|
|
494 |
iListWidget->SetFocus(EFalse);
|
|
495 |
// this is needed to make list passive when we switch to list with title
|
|
496 |
iListWidget->DisableScrollBuffer();
|
|
497 |
iPrevListWidget = iListWidget;
|
|
498 |
iListWidget = NULL;
|
|
499 |
CreateListBoxWithTitleL( count );
|
|
500 |
ProvideDataWithoutThumbnailsL(mediaArray);
|
|
501 |
iListWidget->SetFocus(ETrue);
|
|
502 |
}
|
|
503 |
else
|
|
504 |
{
|
|
505 |
if ( iScrollerWithTitle && iContext != EContextItemAlbum )
|
|
506 |
{
|
|
507 |
// Delete title_list when you are not in album_track view
|
|
508 |
delete iScrollerWithTitle;
|
|
509 |
iScrollerWithTitle = NULL;
|
|
510 |
iListWidget = iPrevListWidget;
|
|
511 |
// this is needed to make list active when we switch from list with title
|
|
512 |
iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
|
|
513 |
iListWidget->Reset();
|
|
514 |
iListWidget->SetFocus(ETrue);
|
|
515 |
iListWidget->ResizeL( count );
|
|
516 |
ProvideDataWithoutThumbnailsL(mediaArray);
|
|
517 |
}
|
|
518 |
else
|
|
519 |
{
|
|
520 |
TInt index = iListWidget->SelectedIndex();
|
|
521 |
iListWidget->Reset();
|
|
522 |
if ( count )
|
|
523 |
{
|
|
524 |
iListWidget->ResizeL( count );
|
|
525 |
ProvideDataWithoutThumbnailsL(mediaArray);
|
|
526 |
iListWidget->SetSelectedIndex( index );
|
|
527 |
}
|
|
528 |
else
|
|
529 |
{
|
|
530 |
iListWidget->RefreshScreen(0);
|
|
531 |
}
|
|
532 |
}
|
|
533 |
}
|
|
534 |
SetDefaultIconL();
|
|
535 |
SetScrollbarTypeL();
|
|
536 |
}
|
|
537 |
}
|
|
538 |
|
|
539 |
|
|
540 |
// -----------------------------------------------------------------------------
|
|
541 |
// Handle listbox item addition, preserving the current display index
|
|
542 |
// -----------------------------------------------------------------------------
|
|
543 |
//
|
|
544 |
void CMPXCommonContainerHgImp::HandleLbxItemAdditionPreserveIndexL()
|
|
545 |
{
|
|
546 |
MPX_FUNC( "CMPXCommonContainerHgImp::HandleLbxItemAdditionPreserveIndexL" );
|
|
547 |
HandleLbxItemAdditionL();
|
|
548 |
}
|
|
549 |
|
|
550 |
|
|
551 |
// -----------------------------------------------------------------------------
|
|
552 |
// Handle listbox item removal.
|
|
553 |
// -----------------------------------------------------------------------------
|
|
554 |
//
|
|
555 |
void CMPXCommonContainerHgImp::HandleLbxItemRemovalL()
|
|
556 |
{
|
|
557 |
MPX_FUNC( "CMPXCommonContainerHgImp::HandleLbxItemRemovalL" );
|
|
558 |
iTopIndex = 0;
|
|
559 |
iBottomIndex = KErrNotFound;
|
|
560 |
if ( iContext != iPrevContext )
|
|
561 |
{
|
|
562 |
CancelTNRequest();
|
|
563 |
iThumbnailReqHashMap.Close();
|
|
564 |
iThumbnailReqMap.Close();
|
|
565 |
CleanAlbumArtReqQueue();
|
|
566 |
iRequestCount = 0;
|
|
567 |
|
|
568 |
}
|
|
569 |
}
|
|
570 |
|
|
571 |
|
|
572 |
// -----------------------------------------------------------------------------
|
|
573 |
// Show/hide find box.
|
|
574 |
// -----------------------------------------------------------------------------
|
|
575 |
//
|
|
576 |
void CMPXCommonContainerHgImp::SetFindBoxVisibilityL( TBool /*aIsVisible*/ )
|
|
577 |
{
|
|
578 |
}
|
|
579 |
|
|
580 |
|
|
581 |
// -----------------------------------------------------------------------------
|
|
582 |
// Determine find box visibility
|
|
583 |
// -----------------------------------------------------------------------------
|
|
584 |
//
|
|
585 |
TBool CMPXCommonContainerHgImp::FindBoxVisibility()
|
|
586 |
{
|
|
587 |
return EFalse;
|
|
588 |
}
|
|
589 |
|
|
590 |
|
|
591 |
// -----------------------------------------------------------------------------
|
|
592 |
// Restore the PopupCBA of find box
|
|
593 |
// -----------------------------------------------------------------------------
|
|
594 |
//
|
|
595 |
void CMPXCommonContainerHgImp::RestoreFindBoxPopupCBA()
|
|
596 |
{
|
|
597 |
}
|
|
598 |
|
|
599 |
|
|
600 |
// -----------------------------------------------------------------------------
|
|
601 |
// Calculate the top index of the visible items
|
|
602 |
// -----------------------------------------------------------------------------
|
|
603 |
//
|
|
604 |
TInt CMPXCommonContainerHgImp::CalculateTopIndex( TInt /*aBottomIndex*/ )
|
|
605 |
{
|
|
606 |
MPX_FUNC( "CMPXCommonContainerHgImp::CalculateTopIndex" );
|
|
607 |
return 0;
|
|
608 |
}
|
|
609 |
|
|
610 |
|
|
611 |
// ---------------------------------------------------------------------------
|
|
612 |
// Symbian 2nd phase constructor can leave.
|
|
613 |
// ---------------------------------------------------------------------------
|
|
614 |
//
|
|
615 |
void CMPXCommonContainerHgImp::ConstructContainerL( TMPXCommonContainerCollectionType /*aCollectionType*/ )
|
|
616 |
{
|
|
617 |
MPX_FUNC( "CMPXCommonContainerHgImp::ConstructContainerL" );
|
|
618 |
|
|
619 |
|
|
620 |
CCoeEnv* coeEnv( iEikonEnv );
|
|
621 |
TParse parse;
|
|
622 |
parse.Set( KMPXCommonContainerRscPath, &KDC_APP_RESOURCE_DIR, NULL );
|
|
623 |
TFileName resourceFile( parse.FullName() );
|
|
624 |
User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
|
|
625 |
BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
|
|
626 |
iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
|
|
627 |
|
|
628 |
#ifdef HG_MP_LOC_AVAILABLE
|
|
629 |
iAlbumTitle = StringLoader::LoadL( R_MPX_COMMONCONTAINER_DETAILS_ONE_ALBUM );
|
|
630 |
iEpisodeTitle = StringLoader::LoadL( R_MPX_COMMONCONTAINER_DETAILS_ONE_EPISODE );
|
|
631 |
iSongTitle = StringLoader::LoadL( R_MPX_COMMONCONTAINER_DETAILS_ONE_SONG );
|
|
632 |
#endif //HG_MP_LOC_AVAILABLE
|
|
633 |
|
|
634 |
|
|
635 |
CreateWindowL();
|
|
636 |
TRect mainPane( 0,0,0,0 );
|
|
637 |
iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgScreen, mainPane, ETrue);
|
|
638 |
iBgContext->SetRect(CEikonEnv::Static()->EikAppUi()->ApplicationRect());
|
|
639 |
|
|
640 |
// Common methods used for 2-line list support
|
|
641 |
iCommonUiHelper = CMPXCommonUiHelper::NewL();
|
|
642 |
iListSelections = new (ELeave) CArrayFixFlat<TInt>( KMPXListSelectionCount );
|
|
643 |
//// iTextureManager = new (ELeave) CMPXCommonContainerTextureManager2();
|
|
644 |
|
|
645 |
//Album art request queue
|
|
646 |
//iRequestQueue = new TSglQue<TAlbumArtRequest>(_FOFF(TAlbumArtRequest, iLink));
|
|
647 |
iThumbnailManager = CThumbnailManager::NewL( *this );
|
|
648 |
iThumbnailManager->SetFlagsL( CThumbnailManager::EDefaultFlags );
|
|
649 |
iThumbnailManager->SetQualityPreferenceL( CThumbnailManager::EOptimizeForQuality );
|
|
650 |
iThumbnailManager->SetThumbnailSizeL( EAudioListThumbnailSize );
|
|
651 |
|
|
652 |
iImageSize = CHgDoubleGraphicList::PreferredImageSize();
|
|
653 |
|
|
654 |
TFileName pathWithoutDrive;
|
|
655 |
iEikonEnv->FsSession().PrivatePath( pathWithoutDrive );
|
|
656 |
iSelectedAlbumItemFileName.Copy( KMPXDriveC );
|
|
657 |
iSelectedAlbumItemFileName.Append( pathWithoutDrive );
|
|
658 |
iSelectedAlbumItemFileName.Append( KMPXSelectedAlbumItemFileName );
|
|
659 |
|
|
660 |
|
|
661 |
CreateListBoxL( 0 );
|
|
662 |
}
|
|
663 |
|
|
664 |
|
|
665 |
// ---------------------------------------------------------------------------
|
|
666 |
// Enable/disable find box
|
|
667 |
// ---------------------------------------------------------------------------
|
|
668 |
//
|
|
669 |
void CMPXCommonContainerHgImp::EnableFindBox( TBool /*aEnable*/ )
|
|
670 |
{
|
|
671 |
MPX_FUNC( "CMPXCommonContainerHgImp::EnableFindBox" );
|
|
672 |
}
|
|
673 |
|
|
674 |
|
|
675 |
// ---------------------------------------------------------------------------
|
|
676 |
// Enable/disable marking
|
|
677 |
// ---------------------------------------------------------------------------
|
|
678 |
//
|
|
679 |
void CMPXCommonContainerHgImp::EnableMarking( TBool /*aEnable*/ )
|
|
680 |
{
|
|
681 |
MPX_FUNC( "CMPXCommonContainerHgImp::EnableMarking" );
|
|
682 |
}
|
|
683 |
|
|
684 |
|
|
685 |
// ---------------------------------------------------------------------------
|
|
686 |
// Custom handling of commands for markable lists.
|
|
687 |
// ---------------------------------------------------------------------------
|
|
688 |
//
|
|
689 |
void CMPXCommonContainerHgImp::HandleMarkableListProcessCommandL(
|
|
690 |
TInt aCommand )
|
|
691 |
{
|
|
692 |
MPX_FUNC( "CMPXCommonContainerHgImp::HandleMarkableListProcessCommandL" );
|
|
693 |
|
|
694 |
if ( iListWidget )
|
|
695 |
{
|
|
696 |
switch ( aCommand )
|
|
697 |
{
|
|
698 |
case EAknCmdMark:
|
|
699 |
iListWidget->Mark(iListWidget->SelectedIndex());
|
|
700 |
break;
|
|
701 |
case EAknCmdUnmark:
|
|
702 |
iListWidget->UnMark(iListWidget->SelectedIndex());
|
|
703 |
break;
|
|
704 |
case EAknMarkAll:
|
|
705 |
iListWidget->MarkAll();
|
|
706 |
break;
|
|
707 |
case EAknUnmarkAll:
|
|
708 |
iListWidget->UnMarkAll();
|
|
709 |
break;
|
|
710 |
}
|
|
711 |
iListWidget->RefreshScreen(iListWidget->SelectedIndex());
|
|
712 |
}
|
|
713 |
}
|
|
714 |
|
|
715 |
|
|
716 |
// ---------------------------------------------------------------------------
|
|
717 |
// Custom handling of menu pane for markable lists
|
|
718 |
// ---------------------------------------------------------------------------
|
|
719 |
//
|
|
720 |
void CMPXCommonContainerHgImp::HandleMarkableListDynInitMenuPaneL(
|
|
721 |
TInt aResourceId,
|
|
722 |
CEikMenuPane* aMenuPane )
|
|
723 |
{
|
|
724 |
MPX_FUNC( "CMPXCommonContainerHgImp::HandleMarkableListDynInitMenuPane" );
|
|
725 |
|
|
726 |
if ( aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST )
|
|
727 |
{
|
|
728 |
TInt currentItem = CurrentLbxItemIndex();
|
|
729 |
if ( currentItem == KErrNotFound )
|
|
730 |
{
|
|
731 |
aMenuPane->SetItemDimmed( EAknCmdEditListMenu, ETrue );
|
|
732 |
}
|
|
733 |
else
|
|
734 |
{
|
|
735 |
aMenuPane->SetItemDimmed( EAknCmdEditListMenu, EFalse );
|
|
736 |
}
|
|
737 |
}
|
|
738 |
else if ( aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST_IMPLEMENTATION )
|
|
739 |
{
|
|
740 |
CurrentSelectionIndicesL();
|
|
741 |
TInt currentItem = CurrentLbxItemIndex();
|
|
742 |
if ( currentItem != KErrNotFound )
|
|
743 |
{
|
|
744 |
TBool currentItemMarked = EFalse;
|
|
745 |
for( int i = 0; i < iListSelections->Count(); i++ )
|
|
746 |
{
|
|
747 |
if ( currentItem == iListSelections->At(i) )
|
|
748 |
{
|
|
749 |
currentItemMarked = ETrue;
|
|
750 |
break;
|
|
751 |
}
|
|
752 |
}
|
|
753 |
|
|
754 |
aMenuPane->SetItemDimmed( EAknCmdMark, currentItemMarked );
|
|
755 |
aMenuPane->SetItemDimmed( EAknCmdUnmark, !currentItemMarked );
|
|
756 |
aMenuPane->SetItemDimmed( EAknMarkAll, iListSelections->Count() == iListWidget->ItemCount() );
|
|
757 |
aMenuPane->SetItemDimmed( EAknUnmarkAll, iListSelections->Count() == 0 );
|
|
758 |
}
|
|
759 |
}
|
|
760 |
}
|
|
761 |
|
|
762 |
|
|
763 |
// ---------------------------------------------------------------------------
|
|
764 |
// Handles key events.
|
|
765 |
// ---------------------------------------------------------------------------
|
|
766 |
//
|
|
767 |
TKeyResponse CMPXCommonContainerHgImp::HandleKeyEventL(
|
|
768 |
const TKeyEvent& aKeyEvent,
|
|
769 |
TEventCode aType )
|
|
770 |
{
|
|
771 |
MPX_DEBUG5( "CMPXCommonContainerHgImp::HandleKeyEventL(iCode=%d, iScanCode=%d, iModifiers=0x%x, aType=%d)",
|
|
772 |
aKeyEvent.iCode, aKeyEvent.iScanCode, aKeyEvent.iModifiers, aType );
|
|
773 |
|
|
774 |
TKeyResponse response( EKeyWasNotConsumed );
|
|
775 |
if ( aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter )
|
|
776 |
{
|
|
777 |
if( CurrentLbxItemIndex() >= 0 )
|
|
778 |
{
|
|
779 |
SaveSelectedAlbumItemL();
|
|
780 |
}
|
|
781 |
// Handle enter key pressed
|
|
782 |
iView->ProcessCommandL( EMPXCmdCommonEnterKey );
|
|
783 |
}
|
|
784 |
if ( iListWidget )
|
|
785 |
{
|
|
786 |
iListWidget->OfferKeyEventL( aKeyEvent, aType );
|
|
787 |
}
|
|
788 |
|
|
789 |
if ( response == EKeyWasNotConsumed &&
|
|
790 |
aType == EEventKey &&
|
|
791 |
aKeyEvent.iCode == EKeyBackspace && iView )
|
|
792 |
{
|
|
793 |
iView->ProcessCommandL( EMPXCmdCommonDelete );
|
|
794 |
response = EKeyWasConsumed;
|
|
795 |
}
|
|
796 |
|
|
797 |
return response;
|
|
798 |
}
|
|
799 |
|
|
800 |
// ---------------------------------------------------------------------------
|
|
801 |
// Activate container
|
|
802 |
// ---------------------------------------------------------------------------
|
|
803 |
//
|
|
804 |
void CMPXCommonContainerHgImp::ActivateContainerL()
|
|
805 |
{
|
|
806 |
// Nothing to do
|
|
807 |
}
|
|
808 |
|
|
809 |
|
|
810 |
// ---------------------------------------------------------------------------
|
|
811 |
// From MMPXCommonListBoxArrayObserver
|
|
812 |
// Handle listbox array events.
|
|
813 |
// ---------------------------------------------------------------------------
|
|
814 |
//
|
|
815 |
void CMPXCommonContainerHgImp::HandleListBoxArrayEventL(
|
|
816 |
MMPXCommonListBoxArrayObserver::TMPXCommonListBoxArrayEvents aEvent )
|
|
817 |
{
|
|
818 |
MPX_FUNC( "CMPXCommonContainerHgImp::HandleListBoxArrayEventL" );
|
|
819 |
if ( aEvent == MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventIconArrayChange )
|
|
820 |
{
|
|
821 |
delete iIconArray;
|
|
822 |
iIconArray = NULL;
|
|
823 |
CreateIconArrayL();
|
|
824 |
}
|
|
825 |
else if ( aEvent == MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventMediaArrayChange )
|
|
826 |
{
|
|
827 |
|
|
828 |
// Update list widget with new items in the media array.
|
|
829 |
// We start the update from last valid media item index.
|
|
830 |
if ( iListWidget )
|
|
831 |
{
|
|
832 |
ProvideDataWithoutThumbnailsL(iListBoxArray->MediaArray(), iLastValidMediaItemIndex);
|
|
833 |
|
|
834 |
if ( ( iLastValidMediaItemIndex >= iRequestStart )
|
|
835 |
&& ( iLastValidMediaItemIndex >= iRequestEnd )
|
|
836 |
&& ( iRequestStart != iRequestEnd ) )
|
|
837 |
{
|
|
838 |
Request( iRequestStart, iRequestEnd, EHgBufferReset );
|
|
839 |
}
|
|
840 |
|
|
841 |
iListWidget->RefreshScreen(iListWidget->FirstIndexOnScreen());
|
|
842 |
}
|
|
843 |
}
|
|
844 |
}
|
|
845 |
|
|
846 |
|
|
847 |
// ---------------------------------------------------------------------------
|
|
848 |
// From CCoeControl
|
|
849 |
// Handles key events.
|
|
850 |
// ---------------------------------------------------------------------------
|
|
851 |
//
|
|
852 |
TKeyResponse CMPXCommonContainerHgImp::OfferKeyEventL(
|
|
853 |
const TKeyEvent& aKeyEvent,
|
|
854 |
TEventCode aType )
|
|
855 |
{
|
|
856 |
ASSERT( iViewContainer );
|
|
857 |
MPX_DEBUG5( "CMPXCommonContainerHgImp::OfferKeyEventL(iCode=%d, iScanCode=%d, iModifiers=0x%x, aType=%d)",
|
|
858 |
aKeyEvent.iCode, aKeyEvent.iScanCode, aKeyEvent.iModifiers, aType );
|
|
859 |
|
|
860 |
// Let the view container handle the key event.
|
|
861 |
return iViewContainer->HandleKeyEventL( aKeyEvent, aType );
|
|
862 |
}
|
|
863 |
|
|
864 |
|
|
865 |
// ---------------------------------------------------------------------------
|
|
866 |
// Gets the control's help context.
|
|
867 |
// ---------------------------------------------------------------------------
|
|
868 |
//
|
|
869 |
void CMPXCommonContainerHgImp::GetHelpContext(
|
|
870 |
TCoeHelpContext& aContext ) const
|
|
871 |
{
|
|
872 |
ASSERT( iViewContainer );
|
|
873 |
MPX_FUNC( "CMPXCommonContainerHgImp::GetHelpContext" );
|
|
874 |
// Let the view container handle the help context retrieval
|
|
875 |
if ( iViewContainer )
|
|
876 |
{
|
|
877 |
iViewContainer->HandleHelpContext( aContext );
|
|
878 |
}
|
|
879 |
}
|
|
880 |
|
|
881 |
// ---------------------------------------------------------------------------
|
|
882 |
// From CCoeControl
|
|
883 |
// Handles a change to the control's resources.
|
|
884 |
// ---------------------------------------------------------------------------
|
|
885 |
//
|
|
886 |
void CMPXCommonContainerHgImp::HandleResourceChange( TInt aType )
|
|
887 |
{
|
|
888 |
MPX_FUNC( "CMPXCommonContainerHgImp::HandleResourceChange" );
|
|
889 |
CCoeControl::HandleResourceChange( aType );
|
|
890 |
|
|
891 |
TRAP_IGNORE(
|
|
892 |
if ( aType == KAknsMessageSkinChange )
|
|
893 |
{
|
|
894 |
iListWidget->SetDefaultIconL(NULL);
|
|
895 |
delete iIconArray;
|
|
896 |
iIconArray = NULL;
|
|
897 |
CreateIconArrayL();
|
|
898 |
iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
|
|
899 |
}
|
|
900 |
else if ( aType == KEikDynamicLayoutVariantSwitch )
|
|
901 |
{
|
|
902 |
TRect clientRect = ((CAknView*)iView)->ClientRect();
|
|
903 |
iBgContext->SetRect(CEikonEnv::Static()->EikAppUi()->ApplicationRect());
|
|
904 |
if ( iScrollerWithTitle )
|
|
905 |
{
|
|
906 |
iScrollerWithTitle->InitScreenL(clientRect);
|
|
907 |
iPrevListWidget->InitScreenL(clientRect);
|
|
908 |
}
|
|
909 |
else
|
|
910 |
{
|
|
911 |
iListWidget->InitScreenL(clientRect);
|
|
912 |
}
|
|
913 |
SetScrollbarTypeL();
|
|
914 |
}
|
|
915 |
);
|
|
916 |
}
|
|
917 |
|
|
918 |
|
|
919 |
// ---------------------------------------------------------------------------
|
|
920 |
// Draw this application's view to the screen
|
|
921 |
// ---------------------------------------------------------------------------
|
|
922 |
//
|
|
923 |
void CMPXCommonContainerHgImp::Draw(const TRect& /*aRect*/) const
|
|
924 |
{
|
|
925 |
// Do nothing so that list model will be drawn by hg list
|
|
926 |
}
|
|
927 |
|
|
928 |
|
|
929 |
// ---------------------------------------------------------------------------
|
|
930 |
// From MCoeControlObserver
|
|
931 |
// Handle control event
|
|
932 |
// ---------------------------------------------------------------------------
|
|
933 |
//
|
|
934 |
void CMPXCommonContainerHgImp::HandleControlEventL(
|
|
935 |
CCoeControl* /*aControl*/,
|
|
936 |
TCoeEvent /*aEventType*/ )
|
|
937 |
{
|
|
938 |
}
|
|
939 |
|
|
940 |
|
|
941 |
// ---------------------------------------------------------------------------
|
|
942 |
// From CCoeControl
|
|
943 |
// Provide control input capabilities
|
|
944 |
// ---------------------------------------------------------------------------
|
|
945 |
//
|
|
946 |
TCoeInputCapabilities CMPXCommonContainerHgImp::InputCapabilities() const
|
|
947 |
{
|
|
948 |
if( iListWidget )
|
|
949 |
{
|
|
950 |
return iListWidget->InputCapabilities();
|
|
951 |
}
|
|
952 |
return CCoeControl::InputCapabilities();
|
|
953 |
}
|
|
954 |
|
|
955 |
|
|
956 |
// ---------------------------------------------------------------------------
|
|
957 |
// From MHgSelectionObserver
|
|
958 |
// Handle Item Selection
|
|
959 |
// ---------------------------------------------------------------------------
|
|
960 |
//
|
|
961 |
void CMPXCommonContainerHgImp::HandleSelectL( TInt /*aIndex*/ )
|
|
962 |
{
|
|
963 |
MPX_FUNC( "CMPXCommonContainerHgImp::HandleSelect" );
|
|
964 |
}
|
|
965 |
|
|
966 |
|
|
967 |
// ---------------------------------------------------------------------------
|
|
968 |
// From MHgSelectionObserver
|
|
969 |
// Handle Item opened
|
|
970 |
// ---------------------------------------------------------------------------
|
|
971 |
//
|
|
972 |
void CMPXCommonContainerHgImp::HandleOpenL( TInt /*aIndex*/ )
|
|
973 |
{
|
|
974 |
MPX_FUNC( "CMPXCommonContainerHgImp::HandleOpenL" );
|
|
975 |
|
|
976 |
SaveSelectedAlbumItemL();
|
|
977 |
iView->ProcessCommandL( EMPXCmdCommonEnterKey );
|
|
978 |
}
|
|
979 |
|
|
980 |
|
|
981 |
// -----------------------------------------------------------------------------
|
|
982 |
// Provides the data to the model
|
|
983 |
// -----------------------------------------------------------------------------
|
|
984 |
//
|
|
985 |
void CMPXCommonContainerHgImp::Request(
|
|
986 |
TInt aBufferStart,
|
|
987 |
TInt aBufferEnd,
|
|
988 |
THgScrollDirection aDirection )
|
|
989 |
{
|
|
990 |
MPX_FUNC( "CMPXCommonContainerHgImp::Request" );
|
|
991 |
MPX_DEBUG3( "CMPXCommonContainerHgImp::Request aBufferStart = %d, aBufferEnd = %d",
|
|
992 |
aBufferStart, aBufferEnd );
|
|
993 |
|
|
994 |
// This should not happen but if not handled, bad things will happen.
|
|
995 |
if ( aBufferStart < 0 || aBufferEnd < 0 )
|
|
996 |
return;
|
|
997 |
|
|
998 |
|
|
999 |
|
|
1000 |
//iBottomIndex = aBufferEnd;
|
|
1001 |
|
|
1002 |
if ( aBufferStart > iLastValidMediaItemIndex || aBufferEnd > iLastValidMediaItemIndex )
|
|
1003 |
{
|
|
1004 |
// We cannot provide data for the requested range at this time.
|
|
1005 |
// Remember the request so we can handle it when there's enough data.
|
|
1006 |
iRequestStart = aBufferStart;
|
|
1007 |
iRequestEnd = aBufferEnd;
|
|
1008 |
return;
|
|
1009 |
}
|
|
1010 |
iDirection = aDirection;
|
|
1011 |
|
|
1012 |
for ( TInt i = aBufferStart; i <= aBufferEnd; i++ )
|
|
1013 |
{
|
|
1014 |
iThumbnailReqMap[ i ] = EFalse;
|
|
1015 |
}
|
|
1016 |
|
|
1017 |
MPX_TRAPD( err,
|
|
1018 |
if ( aDirection == EHgBufferReset || aDirection == EHgBufferScrollDown || aDirection == EHgBufferScrollUp)
|
|
1019 |
{
|
|
1020 |
// For index range in visible-area
|
|
1021 |
ProvideDataIntersectL(aBufferStart, aBufferEnd);
|
|
1022 |
// For index range elsewhere
|
|
1023 |
ProvideDataDifferenceL(aBufferStart, aBufferEnd);
|
|
1024 |
}
|
|
1025 |
else
|
|
1026 |
{
|
|
1027 |
ProvideDataL(aBufferStart, aBufferEnd);
|
|
1028 |
} );
|
|
1029 |
|
|
1030 |
if( err != KErrNone )
|
|
1031 |
{
|
|
1032 |
MPX_DEBUG2( "CMPXCommonContainerHgImp::Request leave err = %d", err );
|
|
1033 |
}
|
|
1034 |
//Refresh(aBufferStart);
|
|
1035 |
// When in main collection view, list can be refresh
|
|
1036 |
// without waiting on thumbnails since this list doesn't
|
|
1037 |
// require thumbnails.
|
|
1038 |
if ( iContext == EContextGroupCollection ||
|
|
1039 |
iContext == EContextGroupPlaylist ||
|
|
1040 |
iContext == EContextGroupGenre ||
|
|
1041 |
iContext == EContextGroupComposer )
|
|
1042 |
{
|
|
1043 |
iListWidget->RefreshScreen( aBufferStart );
|
|
1044 |
}
|
|
1045 |
iTopIndex = aBufferStart;
|
|
1046 |
iBottomIndex = aBufferEnd;
|
|
1047 |
}
|
|
1048 |
|
|
1049 |
// -----------------------------------------------------------------------------
|
|
1050 |
// Check if request range also covers the visible area and provide data
|
|
1051 |
// to it first.
|
|
1052 |
// -----------------------------------------------------------------------------
|
|
1053 |
//
|
|
1054 |
void CMPXCommonContainerHgImp::ProvideDataIntersectL(
|
|
1055 |
TInt aBufferStart,
|
|
1056 |
TInt aBufferEnd )
|
|
1057 |
{
|
|
1058 |
TInt firstOnScreen = iListWidget->FirstIndexOnScreen();
|
|
1059 |
TInt lastOnScreen = firstOnScreen + iListWidget->ItemsOnScreen();
|
|
1060 |
|
|
1061 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
1062 |
|
|
1063 |
for ( TInt i = firstOnScreen; i <= lastOnScreen; i++)
|
|
1064 |
{
|
|
1065 |
for ( TInt j = aBufferStart; j <= aBufferEnd; j++)
|
|
1066 |
{
|
|
1067 |
if ( i == j )
|
|
1068 |
{
|
|
1069 |
// Just get the exiting item and update the fields + icon.
|
|
1070 |
CHgItem* item = &iListWidget->ItemL(i);
|
|
1071 |
|
|
1072 |
CMPXMedia* currentMedia( mediaArray.AtL( i ) );
|
|
1073 |
|
|
1074 |
// Add detailed text to the list item, if available
|
|
1075 |
AddDetailToDisplayedItemL( item, currentMedia, i );
|
|
1076 |
AddThumbnailToDisplayedItemL( item, currentMedia, i );
|
|
1077 |
break;
|
|
1078 |
}
|
|
1079 |
}
|
|
1080 |
}
|
|
1081 |
}
|
|
1082 |
|
|
1083 |
// -----------------------------------------------------------------------------
|
|
1084 |
// Handles request range outside of visible area.
|
|
1085 |
// -----------------------------------------------------------------------------
|
|
1086 |
//
|
|
1087 |
void CMPXCommonContainerHgImp::ProvideDataDifferenceL(
|
|
1088 |
TInt aBufferStart,
|
|
1089 |
TInt aBufferEnd)
|
|
1090 |
{
|
|
1091 |
TBool found = EFalse;
|
|
1092 |
TInt firstOnScreen = iListWidget->FirstIndexOnScreen();
|
|
1093 |
TInt lastOnScreen = firstOnScreen + iListWidget->ItemsOnScreen();
|
|
1094 |
|
|
1095 |
if (aBufferStart == firstOnScreen && aBufferEnd == lastOnScreen)
|
|
1096 |
return;
|
|
1097 |
|
|
1098 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
1099 |
for ( TInt i = aBufferStart; i <= aBufferEnd; i++)
|
|
1100 |
{
|
|
1101 |
found = EFalse;
|
|
1102 |
// look for index in visible range
|
|
1103 |
for ( TInt j = firstOnScreen; j <= lastOnScreen; j++)
|
|
1104 |
{
|
|
1105 |
if ( i == j )
|
|
1106 |
{
|
|
1107 |
found = ETrue;
|
|
1108 |
break;
|
|
1109 |
}
|
|
1110 |
}
|
|
1111 |
if (!found)
|
|
1112 |
{
|
|
1113 |
// Just get the exiting item and update the fields + icon.
|
|
1114 |
CHgItem* item = &iListWidget->ItemL(i);
|
|
1115 |
|
|
1116 |
CMPXMedia* currentMedia( mediaArray.AtL( i ) );
|
|
1117 |
|
|
1118 |
// Add detailed text to the list item, if available
|
|
1119 |
AddDetailToDisplayedItemL( item, currentMedia, i );
|
|
1120 |
AddThumbnailToDisplayedItemL( item, currentMedia, i );
|
|
1121 |
}
|
|
1122 |
}
|
|
1123 |
}
|
|
1124 |
// -----------------------------------------------------------------------------
|
|
1125 |
// CMPXCommonContainerHgImp::ProvideDataWithouThumbnailsL
|
|
1126 |
// -----------------------------------------------------------------------------
|
|
1127 |
//
|
|
1128 |
void CMPXCommonContainerHgImp::ProvideDataWithoutThumbnailsL(
|
|
1129 |
const CMPXMediaArray& aMediaArray,
|
|
1130 |
TInt aStartIndex )
|
|
1131 |
{
|
|
1132 |
MPX_FUNC( "CMPXCommonContainerHgImp::ProvideDataWithouThumbnailsL" );
|
|
1133 |
|
|
1134 |
for ( TInt i = aStartIndex; i < aMediaArray.Count() ; i++ )
|
|
1135 |
{
|
|
1136 |
CMPXMedia* currentMedia( aMediaArray.AtL( i ) );
|
|
1137 |
|
|
1138 |
if ( currentMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
|
|
1139 |
KMPXInvalidItemId )
|
|
1140 |
{
|
|
1141 |
|
|
1142 |
break;
|
|
1143 |
}
|
|
1144 |
|
|
1145 |
// Just get the exiting item and update the fields + icon.
|
|
1146 |
CHgItem* item = &iListWidget->ItemL(i);
|
|
1147 |
SetTitleL( item, currentMedia );
|
|
1148 |
AddDetailToDisplayedItemL( item, currentMedia, i );
|
|
1149 |
iLastValidMediaItemIndex = i;
|
|
1150 |
|
|
1151 |
}
|
|
1152 |
}
|
|
1153 |
|
|
1154 |
// -----------------------------------------------------------------------------
|
|
1155 |
// CMPXCommonContainerHgImp::ProvideDataL
|
|
1156 |
// -----------------------------------------------------------------------------
|
|
1157 |
//
|
|
1158 |
void CMPXCommonContainerHgImp::ProvideDataL( TInt aStart, TInt aEnd )
|
|
1159 |
{
|
|
1160 |
MPX_FUNC( "CMPXCommonContainerHgImp::ProvideDataL" );
|
|
1161 |
MPX_DEBUG3( "CMPXCommonContainerHgImp::ProvideDataL aStart = %d, aEnd = %d",
|
|
1162 |
aStart, aEnd );
|
|
1163 |
if ( aStart < 0 ) aStart = 0;
|
|
1164 |
if ( aEnd < 0 ) aEnd = 0;
|
|
1165 |
|
|
1166 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
1167 |
for ( TInt i = aStart; i <= aEnd ; i++ )
|
|
1168 |
{
|
|
1169 |
// Just get the exiting item and update the fields + icon.
|
|
1170 |
CHgItem* item = &iListWidget->ItemL(i);
|
|
1171 |
|
|
1172 |
CMPXMedia* currentMedia( mediaArray.AtL( i ) );
|
|
1173 |
|
|
1174 |
// Add detailed text to the list item, if available
|
|
1175 |
AddDetailToDisplayedItemL( item, currentMedia, i );
|
|
1176 |
AddThumbnailToDisplayedItemL( item, currentMedia, i );
|
|
1177 |
}
|
|
1178 |
}
|
|
1179 |
|
|
1180 |
// -----------------------------------------------------------------------------
|
|
1181 |
// CMPXCommonContainerHgImp::Release
|
|
1182 |
// -----------------------------------------------------------------------------
|
|
1183 |
//
|
|
1184 |
void CMPXCommonContainerHgImp::Release(TInt aReleaseStart, TInt aReleaseEnd)
|
|
1185 |
{
|
|
1186 |
MPX_FUNC( "CMPXCommonContainerHgImp::Release" );
|
|
1187 |
|
|
1188 |
TInt queuecount=0;
|
|
1189 |
|
|
1190 |
if (iQueueCounter !=0)
|
|
1191 |
{
|
|
1192 |
for (TInt i=0; i<iQueueCounter; i++ )
|
|
1193 |
{
|
|
1194 |
iAlbumArtRequest = iRequestQueue.First();
|
|
1195 |
iRequestQueue.Remove(*iAlbumArtRequest);
|
|
1196 |
|
|
1197 |
if ( (iAlbumArtRequest->iIndex) >= aReleaseStart
|
|
1198 |
&& (iAlbumArtRequest->iIndex) <=aReleaseEnd )
|
|
1199 |
{
|
|
1200 |
delete iAlbumArtRequest->iAlbumArtUri; //not sure needed or not
|
|
1201 |
delete iAlbumArtRequest;
|
|
1202 |
}
|
|
1203 |
else
|
|
1204 |
{
|
|
1205 |
iRequestQueue.AddLast(*iAlbumArtRequest);
|
|
1206 |
++queuecount;
|
|
1207 |
}
|
|
1208 |
}
|
|
1209 |
iQueueCounter = queuecount;
|
|
1210 |
}
|
|
1211 |
}
|
|
1212 |
|
|
1213 |
|
|
1214 |
// -----------------------------------------------------------------------------
|
|
1215 |
// Preview thumbnail generation or loading is complete.
|
|
1216 |
// -----------------------------------------------------------------------------
|
|
1217 |
//
|
|
1218 |
void CMPXCommonContainerHgImp::ThumbnailPreviewReady(
|
|
1219 |
MThumbnailData& /*aThumbnail*/,
|
|
1220 |
TThumbnailRequestId /*aId*/ )
|
|
1221 |
{
|
|
1222 |
MPX_FUNC( "CMPXCommonContainerHgImp::ThumbnailPreviewReady" );
|
|
1223 |
// Not used
|
|
1224 |
}
|
|
1225 |
|
|
1226 |
|
|
1227 |
// -----------------------------------------------------------------------------
|
|
1228 |
// Final thumbnail bitmap generation or loading is complete.
|
|
1229 |
// -----------------------------------------------------------------------------
|
|
1230 |
//
|
|
1231 |
void CMPXCommonContainerHgImp::ThumbnailReady(
|
|
1232 |
TInt aError, MThumbnailData& aThumbnail,
|
|
1233 |
TThumbnailRequestId aId )
|
|
1234 |
{
|
|
1235 |
MPX_FUNC( "CMPXCommonContainerHgImp::ThumbnailReady" );
|
|
1236 |
MPX_DEBUG2( "CMPXCommonContainerHgImp::ThumbnailReady error = %d", aError);
|
|
1237 |
|
|
1238 |
TInt index = 0;
|
|
1239 |
// Find the index
|
|
1240 |
const TInt *ret = iThumbnailReqHashMap.Find( (TInt)aId);
|
|
1241 |
if ( ret )
|
|
1242 |
{
|
|
1243 |
index = *ret;
|
|
1244 |
}
|
|
1245 |
|
|
1246 |
if ( aError == KErrNone && ret )
|
|
1247 |
{
|
|
1248 |
CMPXMedia* currentMedia( NULL );
|
|
1249 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
1250 |
MPX_TRAPD( err, currentMedia = mediaArray.AtL( index ) );
|
|
1251 |
if( err != KErrNone )
|
|
1252 |
{
|
|
1253 |
__ASSERT_DEBUG( EFalse, User::Panic( _L( "CMPXCommonContainerHgImp::ThumbnailReady()" ), err ) );
|
|
1254 |
return;
|
|
1255 |
}
|
|
1256 |
|
|
1257 |
if ( currentMedia->IsSupported( KMPXMediaGeneralId ) )
|
|
1258 |
{
|
|
1259 |
CFbsBitmap* bmap = aThumbnail.DetachBitmap();
|
|
1260 |
if ( bmap )
|
|
1261 |
{
|
|
1262 |
CGulIcon* icon( NULL );
|
|
1263 |
MPX_TRAP( err, icon = CGulIcon::NewL( bmap, NULL ) );
|
|
1264 |
if( err != KErrNone )
|
|
1265 |
{
|
|
1266 |
__ASSERT_DEBUG( EFalse, User::Panic( _L( "CMPXCommonContainerHgImp::ThumbnailReady()" ), err ) );
|
|
1267 |
return;
|
|
1268 |
}
|
|
1269 |
|
|
1270 |
if ( iScrollerWithTitle && !iTitleSet )
|
|
1271 |
{
|
|
1272 |
iScrollerWithTitle->TitleItem().SetIcon(icon);
|
|
1273 |
iScrollerWithTitle->MakeVisible(ETrue);
|
|
1274 |
iListWidget->MakeVisible( ETrue );
|
|
1275 |
|
|
1276 |
iScrollerWithTitle->DrawNow();
|
|
1277 |
iTitleSet = ETrue;
|
|
1278 |
}
|
|
1279 |
else
|
|
1280 |
{
|
|
1281 |
MPX_TRAPD( err, iListWidget->ItemL(index).SetIcon(icon); )
|
|
1282 |
if( err != KErrNone )
|
|
1283 |
{
|
|
1284 |
MPX_DEBUG2( "CMPXCommonContainerHgImp::ThumbnailReady--iListWidget->ItemL(index).SetIcon(icon) leave err%d", err);
|
|
1285 |
}
|
|
1286 |
iThumbnailReqMap[index] = ETrue;
|
|
1287 |
Refresh( index );
|
|
1288 |
}
|
|
1289 |
}
|
|
1290 |
}
|
|
1291 |
iThumbnailReqHashMap.Remove( (TInt)aId);
|
|
1292 |
|
|
1293 |
// if request queue is not empty, we can send one or more requests
|
|
1294 |
if ( !iRequestQueue.IsEmpty() )
|
|
1295 |
{
|
|
1296 |
iAlbumArtRequest = iRequestQueue.First();
|
|
1297 |
iRequestQueue.Remove(*iAlbumArtRequest);
|
|
1298 |
--iQueueCounter;
|
|
1299 |
TInt index = iAlbumArtRequest->iIndex;
|
|
1300 |
|
|
1301 |
const TDesC& albumArtUri = *(iAlbumArtRequest->iAlbumArtUri);
|
|
1302 |
TRAP_IGNORE
|
|
1303 |
(
|
|
1304 |
CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( albumArtUri, KMPXAlbumMimeType );
|
|
1305 |
delete iAlbumArtRequest->iAlbumArtUri;
|
|
1306 |
delete iAlbumArtRequest;
|
|
1307 |
// Using negative index as priority will ensure that thumbnail requests
|
|
1308 |
// are processed in the order they were requested.
|
|
1309 |
TInt ret = NULL;
|
|
1310 |
TInt reqId;
|
|
1311 |
MPX_TRAP(err, reqId = (TInt) iThumbnailManager->GetThumbnailL( *source, (TAny*)ret, -index ));
|
|
1312 |
if ( err == KErrNone)
|
|
1313 |
{
|
|
1314 |
iThumbnailReqHashMap.InsertL( reqId, index );
|
|
1315 |
}
|
|
1316 |
CleanupStack::PopAndDestroy( source );
|
|
1317 |
);
|
|
1318 |
}
|
|
1319 |
else
|
|
1320 |
{
|
|
1321 |
//request queue is empty, decrease outstanding requests count
|
|
1322 |
iRequestCount--;
|
|
1323 |
}
|
|
1324 |
}
|
|
1325 |
|
|
1326 |
else
|
|
1327 |
{
|
|
1328 |
|
|
1329 |
if ( ret )
|
|
1330 |
{
|
|
1331 |
index = *ret;
|
|
1332 |
iThumbnailReqHashMap.Remove( (TInt)aId);
|
|
1333 |
}
|
|
1334 |
else
|
|
1335 |
{
|
|
1336 |
return;
|
|
1337 |
}
|
|
1338 |
TRAP_IGNORE
|
|
1339 |
(
|
|
1340 |
//no albumart supported
|
|
1341 |
SetDefaultIconL(index);
|
|
1342 |
if ( iScrollerWithTitle && !iTitleSet )
|
|
1343 |
{
|
|
1344 |
iScrollerWithTitle->MakeVisible(ETrue);
|
|
1345 |
iListWidget->MakeVisible( ETrue );
|
|
1346 |
iScrollerWithTitle->DrawNow();
|
|
1347 |
iTitleSet = ETrue;
|
|
1348 |
}
|
|
1349 |
else
|
|
1350 |
{
|
|
1351 |
iThumbnailReqMap[index] = ETrue;
|
|
1352 |
Refresh(index);
|
|
1353 |
}
|
|
1354 |
);
|
|
1355 |
}
|
|
1356 |
|
|
1357 |
}
|
|
1358 |
|
|
1359 |
// ---------------------------------------------------------------------------
|
|
1360 |
// Refresh for item without thumbnail
|
|
1361 |
// ---------------------------------------------------------------------------
|
|
1362 |
//
|
|
1363 |
void CMPXCommonContainerHgImp::RefreshNoThumbnailL(TInt aIndex)
|
|
1364 |
{
|
|
1365 |
MPX_FUNC( "CMPXCommonContainerHgImp::RefreshNoThumbnail" );
|
|
1366 |
|
|
1367 |
if ( iScrollerWithTitle && !iTitleSet )
|
|
1368 |
{
|
|
1369 |
iScrollerWithTitle->MakeVisible(ETrue);
|
|
1370 |
iListWidget->MakeVisible( ETrue );
|
|
1371 |
iScrollerWithTitle->DrawNow();
|
|
1372 |
iTitleSet = ETrue;
|
|
1373 |
}
|
|
1374 |
else
|
|
1375 |
{
|
|
1376 |
Refresh(aIndex);
|
|
1377 |
}
|
|
1378 |
}
|
|
1379 |
// ---------------------------------------------------------------------------
|
|
1380 |
// Refresh list as needed.
|
|
1381 |
// This function tries to determine the best time to refresh the screen as to
|
|
1382 |
// avoid too many redraws. In some cases, multiple refresh is unavoidable.
|
|
1383 |
// ---------------------------------------------------------------------------
|
|
1384 |
//
|
|
1385 |
void CMPXCommonContainerHgImp::Refresh(TInt aIndex)
|
|
1386 |
{
|
|
1387 |
MPX_FUNC( "CMPXCommonContainerHgImp::Refresh" );
|
|
1388 |
|
|
1389 |
TInt mediaCount = iListBoxArray->MediaArray().Count();
|
|
1390 |
|
|
1391 |
TInt firstOnScreen = iListWidget->FirstIndexOnScreen();
|
|
1392 |
TInt lastOnScreen = firstOnScreen + iListWidget->ItemsOnScreen();
|
|
1393 |
|
|
1394 |
if (lastOnScreen > (mediaCount - 1))
|
|
1395 |
lastOnScreen = mediaCount - 1;
|
|
1396 |
|
|
1397 |
// Refresh screen if the item is within view and no more thumbnails expected.
|
|
1398 |
if ( aIndex >= firstOnScreen && aIndex <= lastOnScreen )
|
|
1399 |
{
|
|
1400 |
TBool canRefresh(ETrue);
|
|
1401 |
for (TInt i= firstOnScreen; i <= lastOnScreen; i++)
|
|
1402 |
{
|
|
1403 |
if ( !iThumbnailReqMap[i] )
|
|
1404 |
{
|
|
1405 |
canRefresh = EFalse;
|
|
1406 |
break;
|
|
1407 |
}
|
|
1408 |
}
|
|
1409 |
if ( canRefresh )
|
|
1410 |
{
|
|
1411 |
iListWidget->RefreshScreen( firstOnScreen );
|
|
1412 |
}
|
|
1413 |
}
|
|
1414 |
}
|
|
1415 |
// ---------------------------------------------------------------------------
|
|
1416 |
// Create list box
|
|
1417 |
// ---------------------------------------------------------------------------
|
|
1418 |
//
|
|
1419 |
void CMPXCommonContainerHgImp::CreateListBoxL(TInt count)
|
|
1420 |
{
|
|
1421 |
MPX_FUNC( "CMPXCommonContainerHgImp::CreateListBox" );
|
|
1422 |
|
|
1423 |
TRect clientRect = ((CAknView*)iView)->ClientRect();
|
|
1424 |
iListWidget = CHgDoubleGraphicList::NewL (
|
|
1425 |
clientRect,
|
|
1426 |
count,
|
|
1427 |
NULL,
|
|
1428 |
DSA_PARAM );
|
|
1429 |
iListWidget->SetMopParent(this);
|
|
1430 |
iListWidget->SetSelectionObserver(*this);
|
|
1431 |
iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
|
|
1432 |
iListWidget->SetFocus(ETrue);
|
|
1433 |
iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
|
|
1434 |
iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar );
|
|
1435 |
}
|
|
1436 |
|
|
1437 |
|
|
1438 |
// ---------------------------------------------------------------------------
|
|
1439 |
// Create list box with Title
|
|
1440 |
// ---------------------------------------------------------------------------
|
|
1441 |
//
|
|
1442 |
void CMPXCommonContainerHgImp::CreateListBoxWithTitleL( TInt count )
|
|
1443 |
{
|
|
1444 |
MPX_FUNC( "CMPXCommonContainerHgImp::CreateListBoxWithTitleL" );
|
|
1445 |
|
|
1446 |
TRect clientRect = ((CAknView*)iView)->ClientRect();
|
|
1447 |
iScrollerWithTitle = CHgScrollerWithTitle::NewL (
|
|
1448 |
clientRect,
|
|
1449 |
count,
|
|
1450 |
CHgScrollerWithTitle::EHgScrollerDoubleTextList,
|
|
1451 |
NULL);
|
|
1452 |
|
|
1453 |
if ( iSelectedMediaInAlbumView )
|
|
1454 |
{
|
|
1455 |
delete iSelectedMediaInAlbumView;
|
|
1456 |
iSelectedMediaInAlbumView = NULL;
|
|
1457 |
}
|
|
1458 |
|
|
1459 |
iSelectedMediaInAlbumView = CMPXMedia::NewL();
|
|
1460 |
|
|
1461 |
ReadFromStreamFileL( iSelectedMediaInAlbumView );
|
|
1462 |
|
|
1463 |
CHgItem *item = &iScrollerWithTitle->TitleItem();
|
|
1464 |
SetDetailAlbumL( item, iSelectedMediaInAlbumView );
|
|
1465 |
SetDetailArtistL( item, iSelectedMediaInAlbumView );
|
|
1466 |
SetDetailIconL( item, 1 );
|
|
1467 |
|
|
1468 |
|
|
1469 |
iTitleSet = EFalse;
|
|
1470 |
|
|
1471 |
iScrollerWithTitle->SetMopParent(this);
|
|
1472 |
iScrollerWithTitle->SetFocus(ETrue);
|
|
1473 |
iScrollerWithTitle->InitScreenL( clientRect );
|
|
1474 |
iScrollerWithTitle->MakeVisible(EFalse);
|
|
1475 |
|
|
1476 |
iListWidget = &iScrollerWithTitle->Scroller();
|
|
1477 |
iListWidget->SetSelectionObserver(*this);
|
|
1478 |
iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
|
|
1479 |
iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar );
|
|
1480 |
iListWidget->MakeVisible(EFalse);
|
|
1481 |
}
|
|
1482 |
|
|
1483 |
|
|
1484 |
// -----------------------------------------------------------------------------
|
|
1485 |
// Creates icon array, populates iIconArray to be used by listbox
|
|
1486 |
// -----------------------------------------------------------------------------
|
|
1487 |
//
|
|
1488 |
void CMPXCommonContainerHgImp::CreateIconArrayL()
|
|
1489 |
{
|
|
1490 |
MPX_FUNC( "CMPXCommonContainerHgImp::CreateIconArrayL" );
|
|
1491 |
if ( iListBoxArray )
|
|
1492 |
{
|
|
1493 |
iIconArray = iListBoxArray->CreateIconArrayL();
|
|
1494 |
}
|
|
1495 |
SetDefaultIconL();
|
|
1496 |
}
|
|
1497 |
// -----------------------------------------------------------------------------
|
|
1498 |
// Sets default icon to the HgList
|
|
1499 |
// -----------------------------------------------------------------------------
|
|
1500 |
//
|
|
1501 |
void CMPXCommonContainerHgImp::SetDefaultIconL()
|
|
1502 |
{
|
|
1503 |
|
|
1504 |
TDefaultIcon defaultIcon( EMPXDefaultIconEmpty );
|
|
1505 |
TInt iconIndex( EMPXClvIconEmpty );
|
|
1506 |
|
|
1507 |
switch( iContext )
|
|
1508 |
{
|
|
1509 |
case EContextGroupArtist:
|
|
1510 |
case EContextItemArtist:
|
|
1511 |
case EContextGroupAlbum:
|
|
1512 |
{
|
|
1513 |
break;
|
|
1514 |
}
|
|
1515 |
case EContextGroupPodcast:
|
|
1516 |
case EContextItemPodcast:
|
|
1517 |
{
|
|
1518 |
defaultIcon = EMPXDefaultTitleIconPodcasts;
|
|
1519 |
iconIndex = EMPXPodClvIconTitle; // Podcast default icon
|
|
1520 |
break;
|
|
1521 |
}
|
|
1522 |
case EContextGroupPlaylist:
|
|
1523 |
{
|
|
1524 |
defaultIcon = EMPXDefaultIconPlaylist;
|
|
1525 |
iconIndex = EMPXClvIconPlaylist;
|
|
1526 |
break;
|
|
1527 |
}
|
|
1528 |
case EContextGroupGenre:
|
|
1529 |
{
|
|
1530 |
defaultIcon = EMPXDefaultIconGenre;
|
|
1531 |
iconIndex = EMPXClvIconGenre;
|
|
1532 |
break;
|
|
1533 |
}
|
|
1534 |
case EContextGroupComposer:
|
|
1535 |
{
|
|
1536 |
defaultIcon = EMPXDefaultIconComposer;
|
|
1537 |
iconIndex = EMPXClvIconComposer;
|
|
1538 |
break;
|
|
1539 |
}
|
|
1540 |
case EContextItemComposer:
|
|
1541 |
case EContextGroupSong:
|
|
1542 |
case EContextItemSong:
|
|
1543 |
case EContextItemPlaylist:
|
|
1544 |
case EContextItemGenre:
|
|
1545 |
case EContextItemAlbum:
|
|
1546 |
case EContextGroupCollection:
|
|
1547 |
case EContextUnknown:
|
|
1548 |
default:
|
|
1549 |
{
|
|
1550 |
// no default icon for main menu items
|
|
1551 |
break;
|
|
1552 |
}
|
|
1553 |
}
|
|
1554 |
|
|
1555 |
if ( iListWidget )
|
|
1556 |
{
|
|
1557 |
|
|
1558 |
CGulIcon* icon = (*iIconArray)[iconIndex];
|
|
1559 |
CFbsBitmap* bitmap = icon->Bitmap();
|
|
1560 |
CFbsBitmap* mask = icon->Mask();
|
|
1561 |
|
|
1562 |
TSize size(iImageSize.iWidth, iImageSize.iHeight);
|
|
1563 |
AknIconUtils::SetSize( bitmap, size );
|
|
1564 |
AknIconUtils::SetSize( mask, size );
|
|
1565 |
|
|
1566 |
CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
|
|
1567 |
iconCopy->SetBitmapsOwnedExternally(ETrue);
|
|
1568 |
|
|
1569 |
iListWidget->SetDefaultIconL(iconCopy);
|
|
1570 |
iCurrentDefaultIcon = defaultIcon;
|
|
1571 |
}
|
|
1572 |
}
|
|
1573 |
|
|
1574 |
// -----------------------------------------------------------------------------
|
|
1575 |
// Sets default icon to list item
|
|
1576 |
// -----------------------------------------------------------------------------
|
|
1577 |
//
|
|
1578 |
void CMPXCommonContainerHgImp::SetDefaultIconL(TInt aIndex)
|
|
1579 |
{
|
|
1580 |
|
|
1581 |
TDefaultIcon defaultIcon( EMPXDefaultIconNotSet );
|
|
1582 |
TInt iconIndex( EMPXClvIconNone );
|
|
1583 |
|
|
1584 |
switch( iContext )
|
|
1585 |
{
|
|
1586 |
case EContextGroupArtist:
|
|
1587 |
case EContextItemArtist:
|
|
1588 |
{
|
|
1589 |
defaultIcon = EMPXDefaultIconArtist;
|
|
1590 |
iconIndex = EMPXClvIconArtist;
|
|
1591 |
break;
|
|
1592 |
}
|
|
1593 |
case EContextGroupAlbum:
|
|
1594 |
{
|
|
1595 |
defaultIcon = EMPXDefaultIconAlbum;
|
|
1596 |
iconIndex = EMPXClvIconAlbum;
|
|
1597 |
break;
|
|
1598 |
}
|
|
1599 |
case EContextGroupPodcast:
|
|
1600 |
case EContextItemPodcast:
|
|
1601 |
{
|
|
1602 |
defaultIcon = EMPXDefaultTitleIconPodcasts;
|
|
1603 |
iconIndex = EMPXPodClvIconTitle; // Podcast default icon
|
|
1604 |
break;
|
|
1605 |
}
|
|
1606 |
case EContextItemComposer:
|
|
1607 |
case EContextGroupSong:
|
|
1608 |
case EContextItemSong:
|
|
1609 |
case EContextItemPlaylist:
|
|
1610 |
case EContextItemGenre:
|
|
1611 |
case EContextItemAlbum:
|
|
1612 |
{
|
|
1613 |
defaultIcon = EMPXDefaultIconSongs;
|
|
1614 |
iconIndex = EMPXClvIconSongs;
|
|
1615 |
break;
|
|
1616 |
}
|
|
1617 |
default:
|
|
1618 |
{
|
|
1619 |
break;
|
|
1620 |
}
|
|
1621 |
}
|
|
1622 |
|
|
1623 |
if ( iListWidget && defaultIcon != EMPXDefaultIconNotSet )
|
|
1624 |
{
|
|
1625 |
|
|
1626 |
|
|
1627 |
CGulIcon* icon = (*iIconArray)[iconIndex];
|
|
1628 |
CFbsBitmap* bitmap = icon->Bitmap();
|
|
1629 |
CFbsBitmap* mask = icon->Mask();
|
|
1630 |
|
|
1631 |
TSize size(iImageSize.iWidth, iImageSize.iHeight);
|
|
1632 |
AknIconUtils::SetSize( bitmap, size );
|
|
1633 |
AknIconUtils::SetSize( mask, size );
|
|
1634 |
|
|
1635 |
CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
|
|
1636 |
iconCopy->SetBitmapsOwnedExternally(ETrue);
|
|
1637 |
iListWidget->ItemL(aIndex).SetIcon(iconCopy);
|
|
1638 |
}
|
|
1639 |
}
|
|
1640 |
|
|
1641 |
|
|
1642 |
// -----------------------------------------------------------------------------
|
|
1643 |
// Adds detail to the list item at the specified index
|
|
1644 |
// -----------------------------------------------------------------------------
|
|
1645 |
//
|
|
1646 |
void CMPXCommonContainerHgImp::AddDetailToDisplayedItemL(
|
|
1647 |
CHgItem* aVisualItem,
|
|
1648 |
CMPXMedia* aMedia,
|
|
1649 |
TInt aIndex )
|
|
1650 |
{
|
|
1651 |
MPX_FUNC( "CMPXCommonContainerHgImp::AddDetailToDisplayedItemL" );
|
|
1652 |
|
|
1653 |
switch ( iContext )
|
|
1654 |
{
|
|
1655 |
case EContextGroupCollection:
|
|
1656 |
{
|
|
1657 |
SetDetailIconL( aVisualItem, aIndex );
|
|
1658 |
SetDetailCountL( aVisualItem, aMedia );
|
|
1659 |
break;
|
|
1660 |
}
|
|
1661 |
case EContextGroupArtist:
|
|
1662 |
{
|
|
1663 |
SetDetailCountL( aVisualItem, aMedia );
|
|
1664 |
break;
|
|
1665 |
}
|
|
1666 |
case EContextGroupAlbum:
|
|
1667 |
{
|
|
1668 |
SetDetailArtistL( aVisualItem, aMedia );
|
|
1669 |
break;
|
|
1670 |
}
|
|
1671 |
case EContextGroupPlaylist:
|
|
1672 |
{
|
|
1673 |
SetDetailDurationL( aVisualItem, aMedia );
|
|
1674 |
SetDetailIndicatorL( aVisualItem, aIndex );
|
|
1675 |
// SetDetailIconL( aVisualItem, EMPXDefaultIconPlaylist ); // playlist icon
|
|
1676 |
break;
|
|
1677 |
}
|
|
1678 |
case EContextItemAlbum:
|
|
1679 |
{
|
|
1680 |
SetDetailIndicatorL( aVisualItem, aIndex );
|
|
1681 |
break;
|
|
1682 |
}
|
|
1683 |
case EContextGroupSong:
|
|
1684 |
case EContextItemPlaylist:
|
|
1685 |
case EContextItemGenre:
|
|
1686 |
case EContextItemComposer:
|
|
1687 |
{
|
|
1688 |
SetDetailArtistL( aVisualItem, aMedia );
|
|
1689 |
SetDetailIndicatorL( aVisualItem, aIndex );
|
|
1690 |
break;
|
|
1691 |
}
|
|
1692 |
case EContextGroupPodcast:
|
|
1693 |
{
|
|
1694 |
SetDetailCountL( aVisualItem, aMedia );
|
|
1695 |
// SetDetailIconL( aVisualItem, EMPXDefaultTitleIconPodcasts );
|
|
1696 |
break;
|
|
1697 |
}
|
|
1698 |
case EContextGroupGenre:
|
|
1699 |
{
|
|
1700 |
// SetDetailIconL( aVisualItem, EMPXDefaultIconGenre ); //genre icon
|
|
1701 |
SetDetailCountL( aVisualItem, aMedia );
|
|
1702 |
break;
|
|
1703 |
}
|
|
1704 |
case EContextGroupComposer:
|
|
1705 |
{
|
|
1706 |
// SetDetailIconL( aVisualItem, EMPXDefaultIconComposer ); //composer icon
|
|
1707 |
SetDetailCountL( aVisualItem, aMedia );
|
|
1708 |
break;
|
|
1709 |
}
|
|
1710 |
case EContextItemArtist:
|
|
1711 |
{
|
|
1712 |
SetDetailCountL(aVisualItem, aMedia);
|
|
1713 |
break;
|
|
1714 |
}
|
|
1715 |
case EContextItemSong:
|
|
1716 |
{
|
|
1717 |
SetDetailAlbumL( aVisualItem, aMedia );
|
|
1718 |
SetDetailIndicatorL( aVisualItem, aIndex );
|
|
1719 |
break;
|
|
1720 |
}
|
|
1721 |
case EContextItemPodcast:
|
|
1722 |
{
|
|
1723 |
SetDetailIndicatorL( aVisualItem, aIndex );
|
|
1724 |
break;
|
|
1725 |
}
|
|
1726 |
}
|
|
1727 |
}
|
|
1728 |
|
|
1729 |
// -----------------------------------------------------------------------------
|
|
1730 |
// Adds thumbnail to the list item at the specified index
|
|
1731 |
// -----------------------------------------------------------------------------
|
|
1732 |
//
|
|
1733 |
void CMPXCommonContainerHgImp::AddThumbnailToDisplayedItemL(
|
|
1734 |
CHgItem* aVisualItem,
|
|
1735 |
CMPXMedia* aMedia,
|
|
1736 |
TInt aIndex )
|
|
1737 |
{
|
|
1738 |
MPX_FUNC( "CMPXCommonContainerHgImp::AddThumbnailToDisplayedItemL" );
|
|
1739 |
|
|
1740 |
|
|
1741 |
switch ( iContext )
|
|
1742 |
{
|
|
1743 |
case EContextGroupCollection:
|
|
1744 |
{
|
|
1745 |
|
|
1746 |
SetDetailIconL( aVisualItem, aIndex );
|
|
1747 |
break;
|
|
1748 |
}
|
|
1749 |
case EContextGroupAlbum:
|
|
1750 |
case EContextGroupArtist:
|
|
1751 |
case EContextGroupSong:
|
|
1752 |
case EContextItemPlaylist:
|
|
1753 |
case EContextItemGenre:
|
|
1754 |
case EContextItemComposer:
|
|
1755 |
case EContextItemArtist:
|
|
1756 |
case EContextItemSong:
|
|
1757 |
case EContextItemPodcast:
|
|
1758 |
{
|
|
1759 |
SetDetailThumbnailL( aMedia, aIndex );
|
|
1760 |
break;
|
|
1761 |
}
|
|
1762 |
case EContextItemAlbum:
|
|
1763 |
{
|
|
1764 |
// This is needed for this context because we want the album art
|
|
1765 |
// thumbnail to be in list title area.
|
|
1766 |
SetDetailThumbnailL( iSelectedMediaInAlbumView, aIndex );
|
|
1767 |
break;
|
|
1768 |
}
|
|
1769 |
}
|
|
1770 |
}
|
|
1771 |
|
|
1772 |
// -----------------------------------------------------------------------------
|
|
1773 |
// Set title to the visual item
|
|
1774 |
// -----------------------------------------------------------------------------
|
|
1775 |
//
|
|
1776 |
void CMPXCommonContainerHgImp::SetTitleL(
|
|
1777 |
CHgItem* aVisualItem,
|
|
1778 |
CMPXMedia* aMedia )
|
|
1779 |
{
|
|
1780 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetTitleL" );
|
|
1781 |
if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) )
|
|
1782 |
{
|
|
1783 |
const TDesC& title = aMedia->ValueText( KMPXMediaGeneralTitle );
|
|
1784 |
#ifdef HG_MP_LOC_AVAILABLE
|
|
1785 |
HBufC* unknownText =
|
|
1786 |
StringLoader::LoadLC( R_MPX_COMMONCONTAINER_UNKNOWN );
|
|
1787 |
if ( title.Compare( KNullDesC ) != 0 )
|
|
1788 |
{
|
|
1789 |
aVisualItem->SetTitleL( title );
|
|
1790 |
}
|
|
1791 |
else
|
|
1792 |
{
|
|
1793 |
aVisualItem->SetTitleL( *unknownText );
|
|
1794 |
}
|
|
1795 |
CleanupStack::PopAndDestroy( unknownText );
|
|
1796 |
#else //HG_MP_LOC_AVAILABLE
|
|
1797 |
TBuf<KMPXMaxFileLength> titleText( KUnknown );
|
|
1798 |
if ( title.Compare( KNullDesC ) != 0 )
|
|
1799 |
{
|
|
1800 |
titleText.Copy(title.Left(titleText.MaxLength()));
|
|
1801 |
}
|
|
1802 |
aVisualItem->SetTitleL( titleText );
|
|
1803 |
#endif //HG_MP_LOC_AVAILABLE
|
|
1804 |
}
|
|
1805 |
}
|
|
1806 |
|
|
1807 |
// -----------------------------------------------------------------------------
|
|
1808 |
// Set Detail - Count to the visual item
|
|
1809 |
// -----------------------------------------------------------------------------
|
|
1810 |
//
|
|
1811 |
void CMPXCommonContainerHgImp::SetDetailCountL(
|
|
1812 |
CHgItem* aVisualItem,
|
|
1813 |
CMPXMedia* aMedia )
|
|
1814 |
{
|
|
1815 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetDetailCountL" );
|
|
1816 |
if ( aMedia->IsSupported( KMPXMediaGeneralCount ) )
|
|
1817 |
{
|
|
1818 |
TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) );
|
|
1819 |
|
|
1820 |
#ifdef HG_MP_LOC_AVAILABLE
|
|
1821 |
if ( iContext == EContextGroupPodcast )
|
|
1822 |
{
|
|
1823 |
if ( count > 1 )
|
|
1824 |
{
|
|
1825 |
HBufC* episodesTitle = StringLoader::LoadLC( R_MPX_COMMONCONTAINER_DETAILS_NUMBER_OF_EPISODES, count );
|
|
1826 |
TPtr ptr = episodesTitle->Des();
|
|
1827 |
AknTextUtils::LanguageSpecificNumberConversion( ptr );
|
|
1828 |
aVisualItem->SetTextL( ptr );
|
|
1829 |
CleanupStack::PopAndDestroy( episodesTitle );
|
|
1830 |
}
|
|
1831 |
else
|
|
1832 |
{
|
|
1833 |
aVisualItem->SetTextL( *iEpisodeTitle );
|
|
1834 |
}
|
|
1835 |
}
|
|
1836 |
else if ( iContext == EContextGroupArtist )
|
|
1837 |
{
|
|
1838 |
if ( count > 1 )
|
|
1839 |
{
|
|
1840 |
HBufC* albumsTitle = StringLoader::LoadLC( R_MPX_COMMONCONTAINER_DETAILS_NUMBER_OF_SONGS, // mod by anjokela
|
|
1841 |
count );
|
|
1842 |
TPtr ptr = albumsTitle->Des();
|
|
1843 |
AknTextUtils::LanguageSpecificNumberConversion( ptr );
|
|
1844 |
aVisualItem->SetTextL( ptr );
|
|
1845 |
CleanupStack::PopAndDestroy( albumsTitle );
|
|
1846 |
}
|
|
1847 |
else
|
|
1848 |
{
|
|
1849 |
aVisualItem->SetTextL( *iSongTitle ); // mod by anjokela
|
|
1850 |
}
|
|
1851 |
}
|
|
1852 |
else
|
|
1853 |
{
|
|
1854 |
if ( count > 1 )
|
|
1855 |
{
|
|
1856 |
HBufC* songsTitle = StringLoader::LoadLC( R_MPX_COMMONCONTAINER_DETAILS_NUMBER_OF_SONGS, count );
|
|
1857 |
TPtr ptr = songsTitle->Des();
|
|
1858 |
AknTextUtils::LanguageSpecificNumberConversion( ptr );
|
|
1859 |
aVisualItem->SetTextL( ptr );
|
|
1860 |
CleanupStack::PopAndDestroy( songsTitle );
|
|
1861 |
}
|
|
1862 |
else
|
|
1863 |
{
|
|
1864 |
aVisualItem->SetTextL( *iSongTitle );
|
|
1865 |
}
|
|
1866 |
}
|
|
1867 |
#else //HG_MP_LOC_AVAILABLE
|
|
1868 |
|
|
1869 |
TBuf<10> temp;
|
|
1870 |
temp.AppendNum( count );
|
|
1871 |
AknTextUtils::LanguageSpecificNumberConversion( temp );
|
|
1872 |
|
|
1873 |
TBuf<KMPXMaxFileLength> detailText;
|
|
1874 |
detailText.Append( temp );
|
|
1875 |
if ( iContext == EContextGroupPodcast )
|
|
1876 |
{
|
|
1877 |
detailText.Append( (count > 1 ) ? KEpisodes() : KEpisode() );
|
|
1878 |
}
|
|
1879 |
else if ( iContext == EContextGroupArtist )
|
|
1880 |
{
|
|
1881 |
detailText.Append( (count > 1 ) ? KAlbums() : KAlbum() );
|
|
1882 |
}
|
|
1883 |
else
|
|
1884 |
{
|
|
1885 |
detailText.Append( (count > 1 ) ? KSongs() : KSong() );
|
|
1886 |
}
|
|
1887 |
aVisualItem->SetTextL( detailText );
|
|
1888 |
#endif //HG_MP_LOC_AVAILABLE
|
|
1889 |
|
|
1890 |
}
|
|
1891 |
}
|
|
1892 |
|
|
1893 |
// -----------------------------------------------------------------------------
|
|
1894 |
// Set Detail - Artist to the visual item
|
|
1895 |
// -----------------------------------------------------------------------------
|
|
1896 |
//
|
|
1897 |
void CMPXCommonContainerHgImp::SetDetailArtistL(
|
|
1898 |
CHgItem* aVisualItem,
|
|
1899 |
CMPXMedia* aMedia )
|
|
1900 |
{
|
|
1901 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetDetailArtistL" );
|
|
1902 |
if ( aMedia->IsSupported( KMPXMediaMusicArtist ) )
|
|
1903 |
{
|
|
1904 |
// AK - Needs to be localized
|
|
1905 |
TBuf<KMPXMaxFileLength> detailText;
|
|
1906 |
const TDesC& artist = aMedia->ValueText( KMPXMediaMusicArtist );
|
|
1907 |
if ( artist.Compare( KNullDesC ) != 0 )
|
|
1908 |
{
|
|
1909 |
detailText.Copy(artist.Left(detailText.MaxLength()));
|
|
1910 |
aVisualItem->SetTextL( detailText );
|
|
1911 |
}
|
|
1912 |
else
|
|
1913 |
{
|
|
1914 |
HBufC* unknownText =
|
|
1915 |
StringLoader::LoadLC( R_MPX_COMMONCONTAINER_UNKNOWN );
|
|
1916 |
aVisualItem->SetTextL( *unknownText );
|
|
1917 |
CleanupStack::PopAndDestroy( unknownText );
|
|
1918 |
}
|
|
1919 |
}
|
|
1920 |
}
|
|
1921 |
|
|
1922 |
// -----------------------------------------------------------------------------
|
|
1923 |
// Set Detail - Album to the visual item
|
|
1924 |
// -----------------------------------------------------------------------------
|
|
1925 |
//
|
|
1926 |
void CMPXCommonContainerHgImp::SetDetailAlbumL(
|
|
1927 |
CHgItem* aVisualItem,
|
|
1928 |
CMPXMedia* aMedia )
|
|
1929 |
{
|
|
1930 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetDetailAlbumL" );
|
|
1931 |
if ( aMedia->IsSupported( KMPXMediaMusicAlbum ) )
|
|
1932 |
{
|
|
1933 |
TBuf<KMPXMaxFileLength> detailText;
|
|
1934 |
const TDesC& album = aMedia->ValueText( KMPXMediaMusicAlbum );
|
|
1935 |
if ( album.Compare( KNullDesC ) != 0 )
|
|
1936 |
{
|
|
1937 |
detailText.Copy( album.Left(detailText.MaxLength()));
|
|
1938 |
if ( iScrollerWithTitle )
|
|
1939 |
{
|
|
1940 |
aVisualItem->SetTitleL( detailText );
|
|
1941 |
}
|
|
1942 |
else
|
|
1943 |
{
|
|
1944 |
aVisualItem->SetTextL( detailText );
|
|
1945 |
}
|
|
1946 |
}
|
|
1947 |
else
|
|
1948 |
{
|
|
1949 |
HBufC* unknownText =
|
|
1950 |
StringLoader::LoadLC( R_MPX_COMMONCONTAINER_UNKNOWN );
|
|
1951 |
aVisualItem->SetTextL( *unknownText );
|
|
1952 |
CleanupStack::PopAndDestroy( unknownText );
|
|
1953 |
}
|
|
1954 |
}
|
|
1955 |
}
|
|
1956 |
|
|
1957 |
|
|
1958 |
// -----------------------------------------------------------------------------
|
|
1959 |
// Set Detail - Count + Duration to the visual item
|
|
1960 |
// -----------------------------------------------------------------------------
|
|
1961 |
//
|
|
1962 |
void CMPXCommonContainerHgImp::SetDetailDurationL(
|
|
1963 |
CHgItem* aVisualItem,
|
|
1964 |
CMPXMedia* aMedia )
|
|
1965 |
{
|
|
1966 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetDetailDurationL" );
|
|
1967 |
if ( iContext == EContextGroupPlaylist &&
|
|
1968 |
aMedia->IsSupported( KMPXMediaGeneralDuration ) &&
|
|
1969 |
aMedia->IsSupported( KMPXMediaGeneralCount ) )
|
|
1970 |
{
|
|
1971 |
// AK - Needs to be localized
|
|
1972 |
TBuf<KMPXMaxFileLength> detailText;
|
|
1973 |
TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) );
|
|
1974 |
TInt duration = aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
|
|
1975 |
|
|
1976 |
#ifdef HG_MP_LOC_AVAILABLE
|
|
1977 |
if ( count > 1 || count == 0 )
|
|
1978 |
{
|
|
1979 |
HBufC* songsTitle = StringLoader::LoadLC( R_MPX_COMMONCONTAINER_DETAILS_NUMBER_OF_SONGS, count );
|
|
1980 |
detailText.Append(*songsTitle);
|
|
1981 |
detailText.Append(KMPXDash);
|
|
1982 |
UpdateTimeIndicatorsL(detailText, duration);
|
|
1983 |
aVisualItem->SetTextL( detailText );
|
|
1984 |
CleanupStack::PopAndDestroy( songsTitle );
|
|
1985 |
}
|
|
1986 |
else
|
|
1987 |
{
|
|
1988 |
detailText.Append(*iSongTitle);
|
|
1989 |
detailText.Append(KMPXDash);
|
|
1990 |
UpdateTimeIndicatorsL(detailText, duration);
|
|
1991 |
aVisualItem->SetTextL( detailText );
|
|
1992 |
}
|
|
1993 |
#else //HG_MP_LOC_AVAILABLE
|
|
1994 |
TBuf<10> temp;
|
|
1995 |
temp.AppendNum( count );
|
|
1996 |
AknTextUtils::LanguageSpecificNumberConversion( temp );
|
|
1997 |
detailText.Append( temp );
|
|
1998 |
detailText.Append( (count > 1 ) ? KSongsDash() : KSongDash() );
|
|
1999 |
UpdateTimeIndicatorsL(detailText, duration);
|
|
2000 |
aVisualItem->SetTextL( detailText );
|
|
2001 |
#endif //HG_MP_LOC_AVAILABLE
|
|
2002 |
}
|
|
2003 |
else if ( iContext == EContextItemPodcast &&
|
|
2004 |
aMedia->IsSupported( KMPXMediaGeneralDuration ) &&
|
|
2005 |
aMedia->IsSupported( KMPXMediaGeneralSize ) )
|
|
2006 |
{
|
|
2007 |
TBuf<KMPXMaxFileLength> detailText;
|
|
2008 |
TInt duration = aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
|
|
2009 |
UpdateTimeIndicatorsL(detailText, duration);
|
|
2010 |
detailText.Append( KMPXDash() );
|
|
2011 |
|
|
2012 |
TInt size( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralSize ) );
|
|
2013 |
HBufC* sizeBuf = iCommonUiHelper->UnitConversionL( size, ETrue );
|
|
2014 |
TPtr sizePtr( sizeBuf->Des() );
|
|
2015 |
detailText.Append( sizePtr );
|
|
2016 |
delete sizeBuf;
|
|
2017 |
|
|
2018 |
aVisualItem->SetTextL( detailText );
|
|
2019 |
}
|
|
2020 |
}
|
|
2021 |
|
|
2022 |
|
|
2023 |
// -----------------------------------------------------------------------------
|
|
2024 |
// Format the duration to the visual item
|
|
2025 |
// -----------------------------------------------------------------------------
|
|
2026 |
//
|
|
2027 |
void CMPXCommonContainerHgImp::UpdateTimeIndicatorsL(
|
|
2028 |
TDes& aBuf,
|
|
2029 |
TInt aDuration )
|
|
2030 |
{
|
|
2031 |
MPX_FUNC( "CMPXCommonContainerHgImp::UpdateTimeIndicatorsL" );
|
|
2032 |
TInt durationInSeconds = aDuration;
|
|
2033 |
if ( durationInSeconds > 0 )
|
|
2034 |
{
|
|
2035 |
durationInSeconds /= 1000; // MilliSeconds to second conversion
|
|
2036 |
}
|
|
2037 |
else if ( durationInSeconds < 0 )
|
|
2038 |
{
|
|
2039 |
durationInSeconds = 0;
|
|
2040 |
}
|
|
2041 |
if ( durationInSeconds == 0 )
|
|
2042 |
{
|
|
2043 |
TLocale locale;
|
|
2044 |
TBuf<KMPXTimeIndicatorLength> pos;
|
|
2045 |
TChar separator = locale.TimeSeparator( KMPXMinSecSeparatorIndex );
|
|
2046 |
aBuf.Append(KMPXZeroDurationMark);
|
|
2047 |
aBuf.Append( separator );
|
|
2048 |
aBuf.Append(KMPXZeroDurationMark);
|
|
2049 |
}
|
|
2050 |
else
|
|
2051 |
{
|
|
2052 |
CMPXCommonUiHelper::TMPXDuratDisplayMode durationMode = CMPXCommonUiHelper::EMPXDuratAuto;
|
|
2053 |
if ( durationInSeconds > KOneHourInSeconds )
|
|
2054 |
{
|
|
2055 |
durationMode = CMPXCommonUiHelper::EMPXDuratHMS;
|
|
2056 |
}
|
|
2057 |
// Convert ellapsed time to texts
|
|
2058 |
HBufC* position = iCommonUiHelper->DisplayableDurationL( durationInSeconds, durationMode );
|
|
2059 |
aBuf.Append(position->Des());
|
|
2060 |
delete position;
|
|
2061 |
}
|
|
2062 |
}
|
|
2063 |
|
|
2064 |
|
|
2065 |
// -----------------------------------------------------------------------------
|
|
2066 |
// Set Detail - Indicator to the visual item
|
|
2067 |
// -----------------------------------------------------------------------------
|
|
2068 |
//
|
|
2069 |
void CMPXCommonContainerHgImp::SetDetailIndicatorL(
|
|
2070 |
CHgItem* aVisualItem,
|
|
2071 |
TInt aIndex )
|
|
2072 |
{
|
|
2073 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetDetailIndicatorL" );
|
|
2074 |
// Get icon indices
|
|
2075 |
RArray<TInt> iconIndices = iViewContainer->IndicatorsL( aIndex );
|
|
2076 |
CleanupClosePushL( iconIndices );
|
|
2077 |
|
|
2078 |
const TInt iconCount = iconIndices.Count();
|
|
2079 |
TInt flags = aVisualItem->Flags() & CHgItem::EHgItemFlagMarked;
|
|
2080 |
aVisualItem->ClearFlags(aVisualItem->Flags());
|
|
2081 |
if ( iconCount > 0 )
|
|
2082 |
{
|
|
2083 |
TInt iconId = 0;
|
|
2084 |
for ( TInt iconIndex = 0; iconIndex < iconCount; iconIndex++ )
|
|
2085 |
{
|
|
2086 |
iconId = iconIndices[iconIndex];
|
|
2087 |
if ( !iPodcastContext )
|
|
2088 |
{
|
|
2089 |
switch (iconId)
|
|
2090 |
{
|
|
2091 |
case EMPXClvIconMMC:
|
|
2092 |
{
|
|
2093 |
flags |= CHgItem::EHgItemFlagsMmc;
|
|
2094 |
break;
|
|
2095 |
}
|
|
2096 |
case EMPXClvIconPlay:
|
|
2097 |
{
|
|
2098 |
flags |= CHgItem::EHgItemFlagsPlaybackIndicator;
|
|
2099 |
break;
|
|
2100 |
}
|
|
2101 |
case EMPXClvIconPause:
|
|
2102 |
{
|
|
2103 |
flags |= CHgItem::EHgItemFlagsPauseIndicator;
|
|
2104 |
break;
|
|
2105 |
}
|
|
2106 |
case EMPXClvIconBrokenTrack:
|
|
2107 |
{
|
|
2108 |
flags |= CHgItem::EHgItemFlagsBrokenTrackIndicator;
|
|
2109 |
break;
|
|
2110 |
}
|
|
2111 |
case EMPXClvIconCorruptTrack:
|
|
2112 |
{
|
|
2113 |
flags |= CHgItem::EHgItemFlagsCorruptedTrackIndicator;
|
|
2114 |
break;
|
|
2115 |
}
|
|
2116 |
case EMPXClvIconDrmExpired:
|
|
2117 |
{
|
|
2118 |
flags |= CHgItem::EHgItemFlagsDrmRightsExpired;
|
|
2119 |
break;
|
|
2120 |
}
|
|
2121 |
case EMPXClvIconBrokenPlaylist:
|
|
2122 |
{
|
|
2123 |
flags |= CHgItem::EHgItemFlagsBrokenPlaylistIndicator;
|
|
2124 |
break;
|
|
2125 |
}
|
|
2126 |
case EMPXClvIconReorderDown:
|
|
2127 |
{
|
|
2128 |
flags |= CHgItem::EHgItemFlagsMoveDownIndicator;
|
|
2129 |
break;
|
|
2130 |
}
|
|
2131 |
case EMPXClvIconReorderUp:
|
|
2132 |
{
|
|
2133 |
flags |= CHgItem::EHgItemFlagsMoveUpIndicator;
|
|
2134 |
break;
|
|
2135 |
}
|
|
2136 |
case EMPXClvIconReorderUpDown:
|
|
2137 |
{
|
|
2138 |
flags |= CHgItem::EHgItemFlagsMoveUpDownIndicator;
|
|
2139 |
break;
|
|
2140 |
}
|
|
2141 |
}
|
|
2142 |
}
|
|
2143 |
else // podcast icons
|
|
2144 |
{
|
|
2145 |
switch (iconId)
|
|
2146 |
{
|
|
2147 |
case EMPXPodClvIconMMC:
|
|
2148 |
{
|
|
2149 |
flags |= CHgItem::EHgItemFlagsMmc;
|
|
2150 |
break;
|
|
2151 |
}
|
|
2152 |
case EMPXPodClvIconPlay:
|
|
2153 |
{
|
|
2154 |
flags |= CHgItem::EHgItemFlagsPlaybackIndicator;
|
|
2155 |
break;
|
|
2156 |
}
|
|
2157 |
case EMPXPodClvIconPause:
|
|
2158 |
{
|
|
2159 |
flags |= CHgItem::EHgItemFlagsPauseIndicator;
|
|
2160 |
break;
|
|
2161 |
}
|
|
2162 |
case EMPXPodClvIconBroken:
|
|
2163 |
{
|
|
2164 |
flags |= CHgItem::EHgItemFlagsBrokenTrackIndicator;
|
|
2165 |
break;
|
|
2166 |
}
|
|
2167 |
case EMPXPodClvIconCorrupt:
|
|
2168 |
{
|
|
2169 |
flags |= CHgItem::EHgItemFlagsCorruptedTrackIndicator;
|
|
2170 |
break;
|
|
2171 |
}
|
|
2172 |
case EMPXPodClvIconNew:
|
|
2173 |
{
|
|
2174 |
flags |= CHgItem::EHgItemFlagsNewPodcastIndicator;
|
|
2175 |
break;
|
|
2176 |
}
|
|
2177 |
case EMPXPodClvIconCompplay:
|
|
2178 |
{
|
|
2179 |
flags |= CHgItem::EHgItemFlagsCompletelyPlayedPodcastIndicator;
|
|
2180 |
break;
|
|
2181 |
}
|
|
2182 |
case EMPXPodClvIconPartplay:
|
|
2183 |
{
|
|
2184 |
flags |= CHgItem::EHgItemFlagsPlayedPodcastIndicator;
|
|
2185 |
break;
|
|
2186 |
}
|
|
2187 |
}
|
|
2188 |
}
|
|
2189 |
}
|
|
2190 |
}
|
|
2191 |
aVisualItem->SetFlags( flags );
|
|
2192 |
CleanupStack::PopAndDestroy();
|
|
2193 |
}
|
|
2194 |
|
|
2195 |
|
|
2196 |
// -----------------------------------------------------------------------------
|
|
2197 |
// Set Detail - Icon to the visual item
|
|
2198 |
// -----------------------------------------------------------------------------
|
|
2199 |
//
|
|
2200 |
void CMPXCommonContainerHgImp::SetDetailIconL(
|
|
2201 |
CHgItem* aVisualItem,
|
|
2202 |
TInt aIndex )
|
|
2203 |
{
|
|
2204 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetDetailIconL" );
|
|
2205 |
|
|
2206 |
TInt iconIndex = aIndex;
|
|
2207 |
switch ( aIndex )
|
|
2208 |
{
|
|
2209 |
case 0:
|
|
2210 |
iconIndex = EMPXClvIconArtist;
|
|
2211 |
break;
|
|
2212 |
case 1:
|
|
2213 |
iconIndex = EMPXClvIconAlbum;
|
|
2214 |
break;
|
|
2215 |
case 2:
|
|
2216 |
iconIndex = EMPXClvIconPlaylist;
|
|
2217 |
break;
|
|
2218 |
case 3:
|
|
2219 |
iconIndex = EMPXClvIconSongs;
|
|
2220 |
break;
|
|
2221 |
case 4:
|
|
2222 |
iconIndex = EMPXClvIconPodcasts;
|
|
2223 |
break;
|
|
2224 |
case 5:
|
|
2225 |
iconIndex = EMPXClvIconGenre;
|
|
2226 |
break;
|
|
2227 |
case 6:
|
|
2228 |
iconIndex = EMPXClvIconComposer;
|
|
2229 |
break;
|
|
2230 |
case 7: //EMPXDefaultTitleIconPodcasts
|
|
2231 |
iconIndex = 10;
|
|
2232 |
break;
|
|
2233 |
}
|
|
2234 |
|
|
2235 |
CGulIcon* icon = (*iIconArray)[iconIndex];
|
|
2236 |
|
|
2237 |
CFbsBitmap* bitmap = icon->Bitmap();
|
|
2238 |
CFbsBitmap* mask = icon->Mask();
|
|
2239 |
|
|
2240 |
TSize size(iImageSize.iWidth, iImageSize.iHeight);
|
|
2241 |
if ( iContext == EContextGroupCollection )
|
|
2242 |
{ // shrink smaller to look same as in Antriksh
|
|
2243 |
size.iWidth = iImageSize.iWidth * KIconFactor;
|
|
2244 |
size.iHeight = iImageSize.iHeight * KIconFactor;
|
|
2245 |
}
|
|
2246 |
|
|
2247 |
AknIconUtils::SetSize( bitmap, size );
|
|
2248 |
AknIconUtils::SetSize( mask, size );
|
|
2249 |
|
|
2250 |
CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
|
|
2251 |
iconCopy->SetBitmapsOwnedExternally(ETrue);
|
|
2252 |
aVisualItem->SetIcon( iconCopy );
|
|
2253 |
}
|
|
2254 |
|
|
2255 |
// -----------------------------------------------------------------------------
|
|
2256 |
// Set Detail - Thumbnail to the visual item
|
|
2257 |
// -----------------------------------------------------------------------------
|
|
2258 |
//
|
|
2259 |
void CMPXCommonContainerHgImp::SetDetailThumbnailL(
|
|
2260 |
CMPXMedia* aMedia,
|
|
2261 |
TInt aIndex )
|
|
2262 |
{
|
|
2263 |
MPX_FUNC("CMPXCommonContainerHgImp::SetDetailThumbnailL(CMPXMedia* aMedia,TInt aIndex)");
|
|
2264 |
TMPXItemId currentId( aMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
|
|
2265 |
|
|
2266 |
if ( currentId == KMPXInvalidItemId )
|
|
2267 |
{
|
|
2268 |
return;
|
|
2269 |
}
|
|
2270 |
|
|
2271 |
if ( aMedia->IsSupported( KMPXMediaMusicAlbumArtFileName ) )
|
|
2272 |
{
|
|
2273 |
const TDesC& album = aMedia->ValueText( KMPXMediaMusicAlbumArtFileName );
|
|
2274 |
#ifdef _DEBUG
|
|
2275 |
RDebug::RawPrint(album);
|
|
2276 |
#endif
|
|
2277 |
if ( album.Compare( KNullDesC ) != 0 )
|
|
2278 |
{
|
|
2279 |
//send request only when under TNM max loads
|
|
2280 |
|
|
2281 |
if ( iRequestCount < KMaxThumbnailReq )
|
|
2282 |
{
|
|
2283 |
CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( album, KMPXAlbumMimeType );
|
|
2284 |
TInt reqId;
|
|
2285 |
TInt ret = NULL;
|
|
2286 |
// Set priority based on the index so that the smaller indexes are loaded first.
|
|
2287 |
TRAPD(err, reqId = (TInt) iThumbnailManager->GetThumbnailL( *source, (TAny*)ret, -aIndex));
|
|
2288 |
iRequestCount++;
|
|
2289 |
|
|
2290 |
if ( err == KErrNone)
|
|
2291 |
{
|
|
2292 |
iThumbnailReqHashMap.InsertL( reqId, aIndex );
|
|
2293 |
}
|
|
2294 |
CleanupStack::PopAndDestroy( source );
|
|
2295 |
}
|
|
2296 |
//can not send request since max TNM load, add album art requests to queue
|
|
2297 |
else
|
|
2298 |
{
|
|
2299 |
TAlbumArtRequest* albumArtRequest = NULL;
|
|
2300 |
|
|
2301 |
TRAPD(err, albumArtRequest = new (ELeave) TAlbumArtRequest;);
|
|
2302 |
if ( err != KErrNone )
|
|
2303 |
{
|
|
2304 |
return;
|
|
2305 |
}
|
|
2306 |
albumArtRequest->iIndex = aIndex;
|
|
2307 |
albumArtRequest->iAlbumArtUri = album.AllocL();
|
|
2308 |
|
|
2309 |
// Outstanding request exits; add it to the queue
|
|
2310 |
iRequestQueue.AddLast(*albumArtRequest);
|
|
2311 |
++iQueueCounter;
|
|
2312 |
|
|
2313 |
}
|
|
2314 |
}
|
|
2315 |
else
|
|
2316 |
{
|
|
2317 |
//no albumart
|
|
2318 |
SetDefaultIconL(aIndex);
|
|
2319 |
iThumbnailReqMap[aIndex] = ETrue;
|
|
2320 |
RefreshNoThumbnailL(aIndex);
|
|
2321 |
}
|
|
2322 |
}
|
|
2323 |
else
|
|
2324 |
{
|
|
2325 |
// no album art supported
|
|
2326 |
SetDefaultIconL(aIndex);
|
|
2327 |
iThumbnailReqMap[aIndex] = ETrue;
|
|
2328 |
RefreshNoThumbnailL(aIndex);
|
|
2329 |
}
|
|
2330 |
}
|
|
2331 |
|
|
2332 |
|
|
2333 |
// -----------------------------------------------------------------------------
|
|
2334 |
// Sets the current category.
|
|
2335 |
// -----------------------------------------------------------------------------
|
|
2336 |
//
|
|
2337 |
void CMPXCommonContainerHgImp::SetCollectionContextL()
|
|
2338 |
{
|
|
2339 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetCollectionContextL" );
|
|
2340 |
|
|
2341 |
const CMPXMedia& media = iListBoxArray->ContainerMedia();
|
|
2342 |
|
|
2343 |
TMPXGeneralType containerType( EMPXNoType );
|
|
2344 |
if ( media.IsSupported( KMPXMediaGeneralType ) )
|
|
2345 |
{
|
|
2346 |
containerType = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
|
|
2347 |
}
|
|
2348 |
|
|
2349 |
TMPXGeneralCategory containerCategory( EMPXNoCategory );
|
|
2350 |
if ( media.IsSupported( KMPXMediaGeneralCategory ) )
|
|
2351 |
{
|
|
2352 |
containerCategory = media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
|
|
2353 |
}
|
|
2354 |
MPX_DEBUG3( "CMPXCommonContainerHgImp::SetCollectionContextL container type = %d, category = %d",
|
|
2355 |
containerType, containerCategory );
|
|
2356 |
|
|
2357 |
iPodcastContext = EFalse;
|
|
2358 |
TMPXPodcastCategory podcastCategory( EMPXUnknown );
|
|
2359 |
if ( media.IsSupported( KMPXMediaPodcastType ) )
|
|
2360 |
{
|
|
2361 |
iPodcastContext = ETrue;
|
|
2362 |
if ( media.IsSupported( KMPXMediaPodcastCategoryGroup ) )
|
|
2363 |
{
|
|
2364 |
podcastCategory = media.ValueTObjectL<TMPXPodcastCategory>( KMPXMediaPodcastCategoryGroup );
|
|
2365 |
}
|
|
2366 |
}
|
|
2367 |
MPX_DEBUG3( "CMPXCommonContainerHitchcockImp::SetCollectionContextL container podcast = %d, category = %d",
|
|
2368 |
iPodcastContext, podcastCategory );
|
|
2369 |
|
|
2370 |
iPrevContext = iContext;
|
|
2371 |
|
|
2372 |
iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
|
|
2373 |
if ( !iPodcastContext )
|
|
2374 |
{
|
|
2375 |
if ( containerType == EMPXGroup )
|
|
2376 |
{
|
|
2377 |
switch (containerCategory)
|
|
2378 |
{
|
|
2379 |
case EMPXCollection:
|
|
2380 |
iContext = EContextGroupCollection;
|
|
2381 |
iListWidget->SetFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
|
|
2382 |
break;
|
|
2383 |
case EMPXArtist:
|
|
2384 |
iContext = EContextGroupArtist;
|
|
2385 |
break;
|
|
2386 |
case EMPXAlbum:
|
|
2387 |
iContext = EContextGroupAlbum;
|
|
2388 |
break;
|
|
2389 |
case EMPXPlaylist:
|
|
2390 |
iContext = EContextGroupPlaylist;
|
|
2391 |
break;
|
|
2392 |
case EMPXSong:
|
|
2393 |
iContext = EContextGroupSong;
|
|
2394 |
break;
|
|
2395 |
case EMPXGenre:
|
|
2396 |
iContext = EContextGroupGenre;
|
|
2397 |
break;
|
|
2398 |
case EMPXComposer:
|
|
2399 |
iContext = EContextGroupComposer;
|
|
2400 |
break;
|
|
2401 |
default:
|
|
2402 |
User::Leave(KErrNotSupported);
|
|
2403 |
break;
|
|
2404 |
}
|
|
2405 |
}
|
|
2406 |
else if ( containerType == EMPXItem )
|
|
2407 |
{
|
|
2408 |
switch (containerCategory)
|
|
2409 |
{
|
|
2410 |
case EMPXArtist:
|
|
2411 |
iContext = EContextItemArtist;
|
|
2412 |
break;
|
|
2413 |
case EMPXAlbum:
|
|
2414 |
iContext = EContextItemAlbum;
|
|
2415 |
break;
|
|
2416 |
case EMPXPlaylist:
|
|
2417 |
iContext = EContextItemPlaylist;
|
|
2418 |
break;
|
|
2419 |
case EMPXSong:
|
|
2420 |
iContext = EContextItemSong;
|
|
2421 |
break;
|
|
2422 |
case EMPXGenre:
|
|
2423 |
iContext = EContextItemGenre;
|
|
2424 |
break;
|
|
2425 |
case EMPXComposer:
|
|
2426 |
iContext = EContextItemComposer;
|
|
2427 |
break;
|
|
2428 |
default:
|
|
2429 |
User::Leave(KErrNotSupported);
|
|
2430 |
break;
|
|
2431 |
}
|
|
2432 |
}
|
|
2433 |
}
|
|
2434 |
else
|
|
2435 |
{
|
|
2436 |
if ( (containerType == EMPXGroup) && (podcastCategory == EMPXTitle) )
|
|
2437 |
{
|
|
2438 |
iContext = EContextGroupPodcast;
|
|
2439 |
iListWidget->SetFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
|
|
2440 |
}
|
|
2441 |
else if ( (containerType == EMPXItem) && (podcastCategory == EMPXEpisode) )
|
|
2442 |
{
|
|
2443 |
iContext = EContextItemPodcast;
|
|
2444 |
}
|
|
2445 |
else
|
|
2446 |
{
|
|
2447 |
User::Leave(KErrNotSupported);
|
|
2448 |
}
|
|
2449 |
}
|
|
2450 |
}
|
|
2451 |
|
|
2452 |
// -----------------------------------------------------------------------------
|
|
2453 |
// CMPXCommonContainerHgImp::MopSupplyObject
|
|
2454 |
// -----------------------------------------------------------------------------
|
|
2455 |
//
|
|
2456 |
TTypeUid::Ptr CMPXCommonContainerHgImp::MopSupplyObject( TTypeUid aId )
|
|
2457 |
{
|
|
2458 |
MPX_FUNC( "CMPXCommonContainerHgImp::MopSupplyObject" );
|
|
2459 |
return MAknsControlContext::SupplyMopObject(aId, iBgContext );
|
|
2460 |
}
|
|
2461 |
|
|
2462 |
// -----------------------------------------------------------------------------
|
|
2463 |
// CMPXCommonContainerHgImp::SetScrollbarType
|
|
2464 |
// -----------------------------------------------------------------------------
|
|
2465 |
//
|
|
2466 |
void CMPXCommonContainerHgImp::SetScrollbarTypeL()
|
|
2467 |
{
|
|
2468 |
MPX_FUNC( "CMPXCommonContainerHgImp::SetScrollbarType" );
|
|
2469 |
|
|
2470 |
if ( iContext == EContextGroupCollection ||
|
|
2471 |
iContext == EContextGroupPlaylist ||
|
|
2472 |
iContext == EContextItemAlbum ||
|
|
2473 |
iContext == EContextItemPlaylist )
|
|
2474 |
{
|
|
2475 |
iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar );
|
|
2476 |
}
|
|
2477 |
else
|
|
2478 |
{
|
|
2479 |
iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerLetterStripLite );
|
|
2480 |
}
|
|
2481 |
}
|
|
2482 |
|
|
2483 |
// ----------------------------------------------------------------------------
|
|
2484 |
// Clears the TN request if any
|
|
2485 |
// ----------------------------------------------------------------------------
|
|
2486 |
void CMPXCommonContainerHgImp::CancelTNRequest()
|
|
2487 |
{
|
|
2488 |
MPX_FUNC("CMPXCommonContainerHgImp::CancelTNRequest");
|
|
2489 |
|
|
2490 |
if ( iThumbnailReqHashMap.Count() == 0 )
|
|
2491 |
{
|
|
2492 |
return;
|
|
2493 |
}
|
|
2494 |
|
|
2495 |
THashMapIter<TInt, TInt> iter(iThumbnailReqHashMap);
|
|
2496 |
TInt* id = iter.CurrentValue();
|
|
2497 |
if (id && *id >= 0)
|
|
2498 |
{
|
|
2499 |
iThumbnailManager->CancelRequest((TThumbnailRequestId)id);
|
|
2500 |
}
|
|
2501 |
while ( TInt const* id = iter.NextValue() )
|
|
2502 |
{
|
|
2503 |
iThumbnailManager->CancelRequest((TThumbnailRequestId)*id);
|
|
2504 |
}
|
|
2505 |
}
|
|
2506 |
|
|
2507 |
// ----------------------------------------------------------------------------
|
|
2508 |
// Save the selected album item
|
|
2509 |
// ----------------------------------------------------------------------------
|
|
2510 |
void CMPXCommonContainerHgImp::SaveSelectedAlbumItemL()
|
|
2511 |
{
|
|
2512 |
if ( iContext == EContextGroupAlbum || iContext == EContextItemArtist )
|
|
2513 |
{
|
|
2514 |
const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
|
|
2515 |
|
|
2516 |
if ( iSelectedMediaInAlbumView )
|
|
2517 |
{
|
|
2518 |
delete iSelectedMediaInAlbumView;
|
|
2519 |
iSelectedMediaInAlbumView = NULL;
|
|
2520 |
}
|
|
2521 |
|
|
2522 |
iSelectedMediaInAlbumView = CMPXMedia::NewL( *mediaArray.AtL( CurrentLbxItemIndex() ) );
|
|
2523 |
|
|
2524 |
if ( iSelectedMediaInAlbumView->IsSupported( KMPXMediaGeneralTitle ) )
|
|
2525 |
{
|
|
2526 |
const TDesC& title = iSelectedMediaInAlbumView->ValueText( KMPXMediaGeneralTitle );
|
|
2527 |
if ( title == KNullDesC )
|
|
2528 |
{
|
|
2529 |
// Cannot use reference to KNullDesC, must
|
|
2530 |
// use the literal directly.
|
|
2531 |
iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicAlbum, KNullDesC );
|
|
2532 |
}
|
|
2533 |
else
|
|
2534 |
{
|
|
2535 |
iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicAlbum, title );
|
|
2536 |
}
|
|
2537 |
}
|
|
2538 |
|
|
2539 |
if ( iContext == EContextItemArtist )
|
|
2540 |
{
|
|
2541 |
const CMPXMedia& containerMedia = iListBoxArray->ContainerMedia();
|
|
2542 |
const TDesC& artist = containerMedia.ValueText( KMPXMediaGeneralTitle );
|
|
2543 |
|
|
2544 |
HBufC* unknownArtistText =
|
|
2545 |
StringLoader::LoadLC( R_MPX_QTN_NMP_UNKNOWN_ARTIST );
|
|
2546 |
|
|
2547 |
if ( artist != unknownArtistText->Des() )
|
|
2548 |
{
|
|
2549 |
iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicArtist, artist );
|
|
2550 |
}
|
|
2551 |
else
|
|
2552 |
{
|
|
2553 |
iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicArtist, KNullDesC );
|
|
2554 |
}
|
|
2555 |
|
|
2556 |
CleanupStack::PopAndDestroy( unknownArtistText );
|
|
2557 |
}
|
|
2558 |
|
|
2559 |
WriteToStreamFileL( iSelectedMediaInAlbumView );
|
|
2560 |
}
|
|
2561 |
}
|
|
2562 |
|
|
2563 |
// ----------------------------------------------------------------------------
|
|
2564 |
// Write the album name, artist name and album art in media data to file
|
|
2565 |
// ----------------------------------------------------------------------------
|
|
2566 |
void CMPXCommonContainerHgImp::WriteToStreamFileL( const CMPXMedia* aMedia )
|
|
2567 |
{
|
|
2568 |
MPX_FUNC( "CMPXCommonContainerHgImp::WriteToStreamFileL" );
|
|
2569 |
|
|
2570 |
CCoeEnv* coeEnv( iEikonEnv );
|
|
2571 |
RFs& fs = coeEnv->FsSession();
|
|
2572 |
fs.MkDirAll( iSelectedAlbumItemFileName );
|
|
2573 |
TParse parsedName;
|
|
2574 |
|
|
2575 |
fs.Parse( iSelectedAlbumItemFileName, parsedName );
|
|
2576 |
CFileStore* store( NULL );
|
|
2577 |
MPX_TRAPD( error, store = CDirectFileStore::ReplaceL(fs,
|
|
2578 |
parsedName.FullName(),
|
|
2579 |
EFileWrite); );
|
|
2580 |
|
|
2581 |
if ( error == KErrNone )
|
|
2582 |
{
|
|
2583 |
CleanupStack::PushL( store );
|
|
2584 |
store->SetTypeL( KDirectFileStoreLayoutUid );
|
|
2585 |
|
|
2586 |
RStoreWriteStream wstream;
|
|
2587 |
TStreamId stream = wstream.CreateLC( *store );
|
|
2588 |
store->SetRootL( stream );
|
|
2589 |
|
|
2590 |
if ( aMedia->IsSupported( KMPXMediaMusicAlbum ) )
|
|
2591 |
{
|
|
2592 |
const TDesC& album = aMedia->ValueText( KMPXMediaMusicAlbum );
|
|
2593 |
wstream << album;
|
|
2594 |
}
|
|
2595 |
else
|
|
2596 |
{
|
|
2597 |
wstream << KNullDesC;
|
|
2598 |
}
|
|
2599 |
|
|
2600 |
if ( aMedia->IsSupported( KMPXMediaMusicAlbumArtFileName ) )
|
|
2601 |
{
|
|
2602 |
const TDesC& art = aMedia->ValueText( KMPXMediaMusicAlbumArtFileName );
|
|
2603 |
wstream << art;
|
|
2604 |
}
|
|
2605 |
else
|
|
2606 |
{
|
|
2607 |
wstream << KNullDesC;
|
|
2608 |
}
|
|
2609 |
|
|
2610 |
if ( aMedia->IsSupported( KMPXMediaMusicArtist ) )
|
|
2611 |
{
|
|
2612 |
const TDesC& artist = aMedia->ValueText( KMPXMediaMusicArtist );
|
|
2613 |
wstream << artist;
|
|
2614 |
}
|
|
2615 |
else
|
|
2616 |
{
|
|
2617 |
wstream << KNullDesC;
|
|
2618 |
}
|
|
2619 |
|
|
2620 |
wstream.CommitL();
|
|
2621 |
CleanupStack::PopAndDestroy( &wstream );
|
|
2622 |
CleanupStack::PopAndDestroy( store );
|
|
2623 |
}
|
|
2624 |
else
|
|
2625 |
{
|
|
2626 |
fs.Delete( iSelectedAlbumItemFileName );
|
|
2627 |
}
|
|
2628 |
}
|
|
2629 |
|
|
2630 |
// ----------------------------------------------------------------------------
|
|
2631 |
// Read the album name, artist name and album art from file
|
|
2632 |
// ----------------------------------------------------------------------------
|
|
2633 |
void CMPXCommonContainerHgImp::ReadFromStreamFileL( CMPXMedia* aMedia )
|
|
2634 |
{
|
|
2635 |
MPX_FUNC("CMPXCommonContainerHgImp::ReadFromStreamFileL");
|
|
2636 |
|
|
2637 |
CCoeEnv* coeEnv( iEikonEnv );
|
|
2638 |
RFs& fs = coeEnv->FsSession();
|
|
2639 |
fs.MkDirAll( iSelectedAlbumItemFileName );
|
|
2640 |
TParse parsedName;
|
|
2641 |
|
|
2642 |
fs.Parse( iSelectedAlbumItemFileName, parsedName );
|
|
2643 |
CFileStore* store( NULL );
|
|
2644 |
MPX_TRAPD( error, store = CDirectFileStore::OpenL(fs,
|
|
2645 |
parsedName.FullName(),
|
|
2646 |
EFileRead ); );
|
|
2647 |
if ( error == KErrNone )
|
|
2648 |
{
|
|
2649 |
CleanupStack::PushL( store );
|
|
2650 |
|
|
2651 |
RStoreReadStream stream;
|
|
2652 |
stream.OpenLC( *store, store->Root() );
|
|
2653 |
|
|
2654 |
TBuf<KMPXMaxFileLength> album( KNullDesC );
|
|
2655 |
stream >> album;
|
|
2656 |
aMedia->SetTextValueL( KMPXMediaMusicAlbum, album );
|
|
2657 |
|
|
2658 |
TBuf<KMPXMaxFileLength> art( KNullDesC );
|
|
2659 |
stream >> art;
|
|
2660 |
aMedia->SetTextValueL( KMPXMediaMusicAlbumArtFileName, art );
|
|
2661 |
|
|
2662 |
TBuf<KMPXMaxFileLength> artist( KNullDesC );
|
|
2663 |
stream >> artist;
|
|
2664 |
aMedia->SetTextValueL( KMPXMediaMusicArtist, artist );
|
|
2665 |
|
|
2666 |
CleanupStack::PopAndDestroy( &stream );
|
|
2667 |
CleanupStack::PopAndDestroy( store );
|
|
2668 |
}
|
|
2669 |
else
|
|
2670 |
{
|
|
2671 |
aMedia->SetTextValueL( KMPXMediaMusicAlbum, KNullDesC );
|
|
2672 |
aMedia->SetTextValueL( KMPXMediaMusicAlbumArtFileName, KNullDesC );
|
|
2673 |
aMedia->SetTextValueL( KMPXMediaMusicArtist, KNullDesC );
|
|
2674 |
}
|
|
2675 |
}
|
|
2676 |
|
|
2677 |
// ----------------------------------------------------------------------------
|
|
2678 |
// Clean Albumart request queue
|
|
2679 |
// ----------------------------------------------------------------------------
|
|
2680 |
void CMPXCommonContainerHgImp::CleanAlbumArtReqQueue()
|
|
2681 |
{
|
|
2682 |
MPX_FUNC("CMPXCommonContainerHgImp::CleanAlbumArtReqQueue");
|
|
2683 |
while ( !iRequestQueue.IsEmpty() )
|
|
2684 |
{
|
|
2685 |
iAlbumArtRequest = iRequestQueue.First();
|
|
2686 |
iRequestQueue.Remove(*iAlbumArtRequest);
|
|
2687 |
delete iAlbumArtRequest->iAlbumArtUri; //not sure needed or not
|
|
2688 |
delete iAlbumArtRequest;
|
|
2689 |
}
|
|
2690 |
iQueueCounter = 0;
|
|
2691 |
}
|
|
2692 |
|
|
2693 |
// End of File
|
|
2694 |
|