161 TX_LOG_ARGS( "Error: invalid xml file." ); |
162 TX_LOG_ARGS( "Error: invalid xml file." ); |
162 Q_ASSERT_X( ok, "MpCollectionView::initializeView", "invalid xml file" ); |
163 Q_ASSERT_X( ok, "MpCollectionView::initializeView", "invalid xml file" ); |
163 } |
164 } |
164 |
165 |
165 mAlbumCover = new MpAlbumCoverWidget( this ); |
166 mAlbumCover = new MpAlbumCoverWidget( this ); |
|
167 mAlbumCover->setGraphicsEffect( new MpReflectionEffect(mAlbumCover) ); |
166 mAlbumCover->setDefaultIcon( HbIcon( "qtg_large_album_art" ) ); |
168 mAlbumCover->setDefaultIcon( HbIcon( "qtg_large_album_art" ) ); |
167 mAlbumCover->hide(); |
169 mAlbumCover->hide(); |
168 |
170 |
169 mTrackList = new MpTrackListWidget( this ); |
171 mTrackList = new MpTrackListWidget( this ); |
|
172 mTrackList->setGraphicsEffect( new MpReflectionEffect(mTrackList) ); |
170 mTrackList->list()->setModel( new MpCollectionTBoneListDataModel(mCollectionData, mPlaybackData, mTrackList ) ); |
173 mTrackList->list()->setModel( new MpCollectionTBoneListDataModel(mCollectionData, mPlaybackData, mTrackList ) ); |
171 mTrackList->hide(); |
174 mTrackList->hide(); |
172 |
175 |
173 connect(mAlbumCover,SIGNAL(clicked()),this, SLOT(hideTracksList())); |
176 connect(mAlbumCover,SIGNAL(clicked()),this, SLOT(hideTracksList())); |
174 connect(mTrackList->list(), SIGNAL(activated(QModelIndex)), this, SLOT(listItemActivated(QModelIndex))); |
177 connect(mTrackList->list(), SIGNAL(activated(QModelIndex)), this, SLOT(listItemActivated(QModelIndex))); |
175 connect(mTrackList,SIGNAL(closed()),this, SLOT(hideTracksList())); |
178 connect(mTrackList,SIGNAL(closed()),this, SLOT(hideTracksList())); |
176 |
179 |
177 HbStyleLoader::registerFilePath(":/css/mpcustommediawall.css"); |
180 HbStyleLoader::registerFilePath(":/css/mpcustommediawall.css"); |
|
181 HbStyleLoader::registerFilePath(":/css/mpcustommediawall_color.css"); |
178 HbStyleLoader::registerFilePath(":/css/mpcustommediawall.hgmediawall.widgetml"); |
182 HbStyleLoader::registerFilePath(":/css/mpcustommediawall.hgmediawall.widgetml"); |
179 |
183 |
180 TX_EXIT |
184 TX_EXIT |
181 } |
185 } |
182 |
186 |
410 HbIcon defaultIcon( "qtg_large_album_art" ); |
416 HbIcon defaultIcon( "qtg_large_album_art" ); |
411 defaultIcon.setSize(mMediaWallWidget->itemSize()); |
417 defaultIcon.setSize(mMediaWallWidget->itemSize()); |
412 mMediaWallWidget->setDefaultImage( defaultIcon.pixmap().toImage() ); |
418 mMediaWallWidget->setDefaultImage( defaultIcon.pixmap().toImage() ); |
413 mMediaWallWidget->enableReflections( true ); |
419 mMediaWallWidget->enableReflections( true ); |
414 mMediaWallWidget->setModel( mModel ); |
420 mMediaWallWidget->setModel( mModel ); |
|
421 scrollToDefault(); |
|
422 mMediaWallWidget->setTitleFontSpec( HbFontSpec( HbFontSpec::Primary ) ); |
|
423 mMediaWallWidget->setDescriptionFontSpec( HbFontSpec( HbFontSpec::Secondary ) ); |
|
424 mMediaWallWidget->setScrollBarPolicy( HgWidget::ScrollBarAlwaysOn ); //HgWidget::ScrollBarAutoHide |
|
425 mMediaWallWidget->scrollBar()->setInteractive( true ); |
|
426 mMediaWallWidget->setIndexFeedbackPolicy( HgWidget::IndexFeedbackSingleCharacter ); |
|
427 connect(mMediaWallWidget, SIGNAL(animationAboutToEnd(QModelIndex)), SLOT(fetchAlbumSongs(QModelIndex))); |
|
428 connect(mMediaWallWidget, SIGNAL(activated(QModelIndex)), SLOT(showTrackList())); |
|
429 connect(mMediaWallWidget, SIGNAL(scrollingStarted()), SLOT(dismissListClosingAnimation())); |
|
430 } |
|
431 /*! |
|
432 Scrolls the media wall to a default position. |
|
433 */ |
|
434 void MpMediaWallView::scrollToDefault() |
|
435 { |
|
436 //if something is playing go there, if not go to a balanced position. |
415 if ( mPlaybackData->playbackState() != MpPlaybackData::NotPlaying ) { |
437 if ( mPlaybackData->playbackState() != MpPlaybackData::NotPlaying ) { |
416 scrollToNowPlaying(); |
438 scrollToNowPlaying(); |
417 } |
439 } |
418 //The rest of the cases are attepting to balance the items on screen. |
440 else if ( mModel->rowCount() >= 5 ) { |
419 else if ( mModel->rowCount() >= 5 ) { |
|
420 /* 5 and more |
441 /* 5 and more |
421 [0] [1] [X] [3] [4]... |
442 [0] [1] [X] [3] [4]... |
422 */ |
443 */ |
423 QModelIndex index; |
444 QModelIndex index; |
424 index = mModel->index( 2 ); |
445 index = mModel->index( 2 ); |
425 mMediaWallWidget->scrollTo( index ); |
446 mMediaWallWidget->scrollTo( index ); |
|
447 fetchAlbumSongs( index ); |
|
448 |
426 } |
449 } |
427 else if ( mModel->rowCount() >=3 ) { |
450 else if ( mModel->rowCount() >=3 ) { |
428 /* 4 and 3 |
451 /* 4 and 3 |
429 __ [0] [X] [2] [3] |
452 __ [0] [X] [2] [3] |
430 __ [0] [X] [2] __ |
453 __ [0] [X] [2] __ |
431 */ |
454 */ |
432 QModelIndex index; |
455 QModelIndex index; |
433 index = mModel->index( 1 ); |
456 index = mModel->index( 1 ); |
434 mMediaWallWidget->scrollTo( index ); |
457 mMediaWallWidget->scrollTo( index ); |
|
458 fetchAlbumSongs( index ); |
435 } |
459 } |
436 else { |
460 else { |
437 /* 2 and 1 |
461 /* 2 and 1 |
438 __ __ [X] [1] __ |
462 __ __ [X] [1] __ |
439 __ __ [X] __ __ |
463 __ __ [X] __ __ |
440 */ |
464 */ |
441 QModelIndex index; |
465 QModelIndex index; |
442 index = mModel->index( 0 ); |
466 index = mModel->index( 0 ); |
443 mMediaWallWidget->scrollTo( index ); |
467 mMediaWallWidget->scrollTo( index ); |
444 } |
468 fetchAlbumSongs( index ); |
445 mMediaWallWidget->setTitleFontSpec( HbFontSpec( HbFontSpec::Primary ) ); |
469 } |
446 mMediaWallWidget->setDescriptionFontSpec( HbFontSpec( HbFontSpec::Secondary ) ); |
|
447 mMediaWallWidget->setScrollBarPolicy( HgWidget::ScrollBarAlwaysOn ); //HgWidget::ScrollBarAutoHide |
|
448 mMediaWallWidget->scrollBar()->setInteractive( true ); |
|
449 mMediaWallWidget->setIndexFeedbackPolicy( HgWidget::IndexFeedbackSingleCharacter ); |
|
450 connect(mMediaWallWidget, SIGNAL(animationAboutToEnd(QModelIndex)), SLOT(fetchAlbumSongs(QModelIndex))); |
|
451 connect(mMediaWallWidget, SIGNAL(activated(QModelIndex)), SLOT(showTrackList())); |
|
452 connect(mMediaWallWidget, SIGNAL(scrollingStarted()), SLOT(dismissListClosingAnimation())); |
|
453 } |
470 } |
454 |
471 |
455 /*! |
472 /*! |
456 Scrolls the media wall to now playing position. |
473 Scrolls the media wall to now playing position. |
457 */ |
474 */ |