mpviewplugins/mpmediawallviewplugin/src/mpmediawallview.cpp
changeset 51 560ce2306a17
parent 43 0f32e550d9d8
child 55 f3930dda3342
equal deleted inserted replaced
47:4cc1412daed0 51:560ce2306a17
    24 #include <hbscrollbar.h>
    24 #include <hbscrollbar.h>
    25 #include <hblabel.h>
    25 #include <hblabel.h>
    26 #include <hbtoolbutton.h>
    26 #include <hbtoolbutton.h>
    27 #include <hblistview.h>
    27 #include <hblistview.h>
    28 #include <hbstyleloader.h>
    28 #include <hbstyleloader.h>
       
    29 #include <hbmessagebox.h>
       
    30 
    29 
    31 
    30 #include <hgmediawall.h>
    32 #include <hgmediawall.h>
    31 
    33 
    32 #include "mpmediawallview.h"
    34 #include "mpmediawallview.h"
    33 #include "mpmediawalldocumentloader.h"
    35 #include "mpmediawalldocumentloader.h"
   146         widget = mDocumentLoader->findWidget( QString( "container" ) );
   148         widget = mDocumentLoader->findWidget( QString( "container" ) );
   147         setWidget( widget );
   149         setWidget( widget );
   148         
   150         
   149         mEngine = MpEngineFactory::createIsolatedEngine( MpEngine::MediaBrowsing );
   151         mEngine = MpEngineFactory::createIsolatedEngine( MpEngine::MediaBrowsing );
   150         mCollectionData = mEngine->collectionData();
   152         mCollectionData = mEngine->collectionData();
   151         mModel = new MpCollectionDataModel( mCollectionData, this );
   153         mModel = new MpCollectionDataModel( mCollectionData, mPlaybackData, this );
   152         
   154         
   153         connect( mCollectionData, SIGNAL( contextChanged( TCollectionContext ) ), 
   155         connect( mCollectionData, SIGNAL( contextChanged( TCollectionContext ) ), 
   154                  this, SLOT( contextOpened( TCollectionContext ) ) );
   156                  this, SLOT( contextOpened( TCollectionContext ) ) );
   155         connect( mEngine, SIGNAL( containerContentsChanged() ),
   157         connect( mEngine, SIGNAL( containerContentsChanged() ),
   156                 this, SLOT( containerContentsChanged() ) );
   158                 this, SLOT( containerContentsChanged() ) );
   168     mAlbumCover->setDefaultIcon( HbIcon( "qtg_large_album_art" ) );
   170     mAlbumCover->setDefaultIcon( HbIcon( "qtg_large_album_art" ) );
   169     mAlbumCover->hide();
   171     mAlbumCover->hide();
   170     
   172     
   171     mTrackList = new MpTrackListWidget( this );
   173     mTrackList = new MpTrackListWidget( this );
   172     mTrackList->setGraphicsEffect( new MpReflectionEffect(mTrackList) );
   174     mTrackList->setGraphicsEffect( new MpReflectionEffect(mTrackList) );
   173     mTrackList->list()->setModel( new MpCollectionTBoneListDataModel(mCollectionData, mPlaybackData, mTrackList ) );
   175     MpCollectionTBoneListDataModel *model = new MpCollectionTBoneListDataModel(mCollectionData, mPlaybackData, mTrackList );
       
   176     model->enablePlaybackIndicatorEnable(true);
       
   177     mTrackList->list()->setModel( model );
   174     mTrackList->hide();
   178     mTrackList->hide();
   175     
   179     
   176     connect(mAlbumCover,SIGNAL(clicked()),this, SLOT(hideTracksList()));
   180     connect(mAlbumCover,SIGNAL(clicked()),this, SLOT(hideTracksList()));
   177     connect(mTrackList->list(), SIGNAL(activated(QModelIndex)), this, SLOT(listItemActivated(QModelIndex)));
   181     connect(mTrackList->list(), SIGNAL(activated(QModelIndex)), this, SLOT(listItemActivated(QModelIndex)));
   178     connect(mTrackList,SIGNAL(closed()),this, SLOT(hideTracksList()));
   182     connect(mTrackList,SIGNAL(closed()),this, SLOT(hideTracksList()));
   390 /*!
   394 /*!
   391  Slot to be called when a list item is selected by the user.
   395  Slot to be called when a list item is selected by the user.
   392  */
   396  */
   393 void MpMediaWallView::listItemActivated( const QModelIndex &index )
   397 void MpMediaWallView::listItemActivated( const QModelIndex &index )
   394 {
   398 {
   395     int albumIndex = mMediaWallWidget->currentIndex().row();
   399     if (!mCollectionData->hasAlbumSongProperty(index.row(), MpMpxCollectionData::Corrupted)) {
   396     //We are playing on the shared engine, but we pass the collection data that
   400         int albumIndex = mMediaWallWidget->currentIndex().row();
   397     //points to albums on media wall, this is used to construct the playlist.
   401         //We are playing on the shared engine, but we pass the collection data that
   398     MpEngineFactory::sharedEngine()->playAlbumSongs( albumIndex, index.row(), mCollectionData );
   402         //points to albums on media wall, this is used to construct the playlist.
       
   403         MpEngineFactory::sharedEngine()->playAlbumSongs( albumIndex, index.row(), mCollectionData );
       
   404     }
       
   405     else{
       
   406         //pop up corrupted note
       
   407         HbMessageBox *messageBox = new HbMessageBox( hbTrId( "txt_mus_info_file_is_corrupt" ), HbMessageBox::MessageTypeInformation );
       
   408         messageBox->setAttribute( Qt::WA_DeleteOnClose );
       
   409         messageBox->setIcon( HbIcon( QString("qtg_small_fail") ) ); 
       
   410         messageBox->show();   
       
   411     }
   399 }
   412 }
   400 
   413 
   401 /*!
   414 /*!
   402  Slot to be called to fetch the songs for an album.
   415  Slot to be called to fetch the songs for an album.
   403  */
   416  */