28 #include "mpcollectioncontainerartists.h" |
28 #include "mpcollectioncontainerartists.h" |
29 #include "mpmpxcollectiondata.h" |
29 #include "mpmpxcollectiondata.h" |
30 #include "mpcollectiondatamodel.h" |
30 #include "mpcollectiondatamodel.h" |
31 #include "mpcollectiontbonelistdatamodel.h" |
31 #include "mpcollectiontbonelistdatamodel.h" |
32 #include "mptrace.h" |
32 #include "mptrace.h" |
|
33 #include "mpenginefactory.h" |
33 |
34 |
34 /*! |
35 /*! |
35 \class MpCollectionContainerArtists |
36 \class MpCollectionContainerArtists |
36 \brief Music Player collection container definition - Artists. |
37 \brief Music Player collection container definition - Artists. |
37 |
38 |
51 /*! |
52 /*! |
52 Constructs the collection container. |
53 Constructs the collection container. |
53 */ |
54 */ |
54 MpCollectionContainerArtists::MpCollectionContainerArtists( HbDocumentLoader *loader, QGraphicsItem *parent ) |
55 MpCollectionContainerArtists::MpCollectionContainerArtists( HbDocumentLoader *loader, QGraphicsItem *parent ) |
55 : MpCollectionListContainer(loader, parent), |
56 : MpCollectionListContainer(loader, parent), |
56 mInfoBar(0), |
|
57 mTBone(0), |
57 mTBone(0), |
58 mTBoneListModel(0), |
58 mTBoneListModel(0), |
59 mCurrentArtistIndex(0), |
59 mCurrentArtistIndex(0), |
60 mCurrentAlbumIndex(0) |
60 mCurrentAlbumIndex(0) |
61 { |
61 { |
133 mCurrentAlbumIndex = count - 1; |
132 mCurrentAlbumIndex = count - 1; |
134 } |
133 } |
135 mTBone->setModel(dataModel); |
134 mTBone->setModel(dataModel); |
136 mTBone->scrollTo( dataModel->index(mCurrentAlbumIndex - mAlbumIndexOffset, 0) ); |
135 mTBone->scrollTo( dataModel->index(mCurrentAlbumIndex - mAlbumIndexOffset, 0) ); |
137 if ( mTBoneListModel == 0 ) { |
136 if ( mTBoneListModel == 0 ) { |
138 mTBoneListModel = new MpCollectionTBoneListDataModel(mCollectionData); |
137 mTBoneListModel = new MpCollectionTBoneListDataModel(mCollectionData, MpEngineFactory::sharedEngine()->playbackData()); |
139 connect( mTBoneListModel, SIGNAL(albumDataChanged()), this, SLOT(albumDataChanged()) ); |
138 connect( mTBoneListModel, SIGNAL(albumDataChanged()), this, SLOT(albumDataChanged()) ); |
140 connect( mTBoneListModel, SIGNAL(albumDataAvailable()), this, SLOT(albumDataAvailable()) ); |
139 connect( mTBoneListModel, SIGNAL(albumDataAvailable()), this, SLOT(albumDataAvailable()) ); |
141 } |
140 } |
142 mList->setModel(mTBoneListModel); |
141 mList->setModel(mTBoneListModel); |
143 if ( mCollectionData->setCurrentAlbum(mCurrentAlbumIndex) ) { |
142 if ( mCollectionData->setCurrentAlbum(mCurrentAlbumIndex) ) { |
312 \reimp |
311 \reimp |
313 */ |
312 */ |
314 void MpCollectionContainerArtists::setupContainer() |
313 void MpCollectionContainerArtists::setupContainer() |
315 { |
314 { |
316 TX_ENTRY_ARGS("mCollectionContext=" << mCollectionContext); |
315 TX_ENTRY_ARGS("mCollectionContext=" << mCollectionContext); |
|
316 |
|
317 mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "showInfoBar"); |
|
318 |
317 if ( mCollectionData->count() ) { |
319 if ( mCollectionData->count() ) { |
318 bool ok = false; |
320 bool ok = false; |
319 QGraphicsWidget *widget; |
321 QGraphicsWidget *widget; |
320 QString artist; |
322 QString artist; |
321 switch ( mCollectionContext ) { |
323 switch ( mCollectionContext ) { |
329 widget = mDocumentLoader->findWidget(QString("artistsList")); |
331 widget = mDocumentLoader->findWidget(QString("artistsList")); |
330 mList = qobject_cast<HbListView*>(widget); |
332 mList = qobject_cast<HbListView*>(widget); |
331 mIndexFeedback->setItemView(mList); |
333 mIndexFeedback->setItemView(mList); |
332 initializeList(); |
334 initializeList(); |
333 } |
335 } |
334 if ( mInfoBar ) { |
|
335 delete mInfoBar; |
|
336 mInfoBar = 0; |
|
337 } |
|
338 if ( mTBone ) { |
336 if ( mTBone ) { |
339 delete mTBone; |
337 delete mTBone; |
340 mTBone = 0; |
338 mTBone = 0; |
341 } |
339 } |
|
340 |
|
341 mInfoBar->setHeading(hbTrId("txt_mus_subhead_artist_1l").arg(mCollectionData->count())); |
|
342 |
342 break; |
343 break; |
343 case ECollectionContextArtistAlbums: |
344 case ECollectionContextArtistAlbums: |
344 mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "artistAlbums", &ok); |
345 mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "artistAlbums", &ok); |
345 if ( !ok ) { |
346 if ( !ok ) { |
346 TX_LOG_ARGS("Error: invalid xml file."); |
347 TX_LOG_ARGS("Error: invalid xml file."); |
347 Q_ASSERT_X(ok, "MpCollectionContainerArtists::setupContainer", "invalid xml file"); |
348 Q_ASSERT_X(ok, "MpCollectionContainerArtists::setupContainer", "invalid xml file"); |
348 } |
349 } |
349 widget = mDocumentLoader->findWidget(QString("artistDetail")); |
|
350 mInfoBar = qobject_cast<HbGroupBox*>(widget); |
|
351 |
350 |
352 artist = mCollectionData->collectionTitle(); |
351 artist = mCollectionData->collectionTitle(); |
353 if ( artist.isEmpty() ) { |
352 if ( artist.isEmpty() ) { |
354 artist = hbTrId("txt_mus_subtitle_unknown"); |
353 artist = hbTrId("txt_mus_subtitle_unknown"); |
355 } |
354 } |
365 mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "artistAlbumTBoneFetcher", &ok); |
364 mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "artistAlbumTBoneFetcher", &ok); |
366 if ( !ok ) { |
365 if ( !ok ) { |
367 TX_LOG_ARGS("Error: invalid xml file."); |
366 TX_LOG_ARGS("Error: invalid xml file."); |
368 Q_ASSERT_X(ok, "MpCollectionContainerAlbums::setupContainer", "invalid xml file"); |
367 Q_ASSERT_X(ok, "MpCollectionContainerAlbums::setupContainer", "invalid xml file"); |
369 } |
368 } |
370 widget = mDocumentLoader->findWidget(QString("artistDetail")); |
369 |
371 mInfoBar = qobject_cast<HbGroupBox*>(widget); |
370 mInfoBar->setHeading( hbTrId("txt_mus_subtitle_select_song") ); |
372 mInfoBar->setHeading( hbTrId("txt_mus_subtitle_select_a_song") ); |
|
373 } |
371 } |
374 else { |
372 else { |
375 mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "artistAlbumTBone", &ok); |
373 mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "artistAlbumTBone", &ok); |
376 if ( !ok ) { |
374 if ( !ok ) { |
377 TX_LOG_ARGS("Error: invalid xml file."); |
375 TX_LOG_ARGS("Error: invalid xml file."); |
378 Q_ASSERT_X(ok, "MpCollectionContainerAlbums::setupContainer", "invalid xml file"); |
376 Q_ASSERT_X(ok, "MpCollectionContainerAlbums::setupContainer", "invalid xml file"); |
379 } |
377 } |
380 if ( mInfoBar ) { |
378 |
381 delete mInfoBar; |
379 mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "hideInfoBar"); |
382 mInfoBar = 0; |
380 |
383 } |
|
384 } |
381 } |
385 widget = mDocumentLoader->findWidget(QString("artistAlbumWall")); |
382 widget = mDocumentLoader->findWidget(QString("artistAlbumWall")); |
386 mTBone = qobject_cast<HgMediawall*>(widget); |
383 mTBone = qobject_cast<HgMediawall*>(widget); |
387 HbIcon defaultIcon( "qtg_large_album_art" ); |
384 HbIcon defaultIcon( "qtg_large_album_art" ); |
388 defaultIcon.setSize(mTBone->itemSize()); |
385 defaultIcon.setSize(mTBone->itemSize()); |
395 break; |
392 break; |
396 case ECollectionContextArtistAllSongs: |
393 case ECollectionContextArtistAllSongs: |
397 // No need to load anything. Just reuse the section "artistAlbums" loaded |
394 // No need to load anything. Just reuse the section "artistAlbums" loaded |
398 // in ECollectionContextArtistAlbums context. |
395 // in ECollectionContextArtistAlbums context. |
399 if ( mViewMode == MpCommon::FetchView ) { |
396 if ( mViewMode == MpCommon::FetchView ) { |
400 mInfoBar->setHeading( hbTrId("txt_mus_subtitle_select_a_song") ); |
397 mInfoBar->setHeading( hbTrId("txt_mus_subtitle_select_song") ); |
401 } |
398 } |
402 else { |
399 else { |
403 artist = mCollectionData->collectionTitle(); |
400 artist = mCollectionData->collectionTitle(); |
404 if ( artist.isEmpty() ) { |
401 if ( artist.isEmpty() ) { |
405 artist = hbTrId("txt_mus_subtitle_unknown_all"); |
402 artist = hbTrId("txt_mus_subtitle_unknown_all"); |