mpdata/src/mpplaybackdata.cpp
changeset 61 3cd404d31176
parent 54 c5b304f4d89b
equal deleted inserted replaced
58:ed94e1e8390e 61:3cd404d31176
    73 
    73 
    74     This signal is emitted when a file is found corrupted.  Call by 
    74     This signal is emitted when a file is found corrupted.  Call by 
    75     PlayBackWrapper.  
    75     PlayBackWrapper.  
    76  */
    76  */
    77 
    77 
    78 
    78 /*!
       
    79     \fn void collectionPlaylistOpened()
       
    80 
       
    81     This signal is emitted when user selects an item from collection view.
       
    82  */
    79 
    83 
    80 /*!
    84 /*!
    81     Constructs a new MpPlaybackData.
    85     Constructs a new MpPlaybackData.
    82  */
    86  */
    83 MpPlaybackData::MpPlaybackData( QObject *parent )
    87 MpPlaybackData::MpPlaybackData( QObject *parent )
    88       mPosition(0),
    92       mPosition(0),
    89       mAlbumId(0),
    93       mAlbumId(0),
    90       mId(0),
    94       mId(0),
    91       mAlbumArt( "qtg_large_album_art" ),
    95       mAlbumArt( "qtg_large_album_art" ),
    92       mPlaybackState( NotPlaying ),
    96       mPlaybackState( NotPlaying ),
    93       mRealAudio( false )
    97       mRealAudio( false ),
       
    98 	  mCollectionPlaylistOpened( false )
    94 {
    99 {
    95     TX_ENTRY
   100     TX_ENTRY
    96     mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForQuality );
   101     mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForQuality );
    97     mThumbnailManager->setThumbnailSize( ThumbnailManager::ThumbnailLarge );
   102     mThumbnailManager->setThumbnailSize( ThumbnailManager::ThumbnailLarge );
    98     connect( mThumbnailManager, SIGNAL( thumbnailReady(QPixmap, void *, int, int ) ),
   103     connect( mThumbnailManager, SIGNAL( thumbnailReady(QPixmap, void *, int, int ) ),
   372     TX_LOG_ARGS( "mPlaybackState = " << mPlaybackState )
   377     TX_LOG_ARGS( "mPlaybackState = " << mPlaybackState )
   373     return mPlaybackState;
   378     return mPlaybackState;
   374 }
   379 }
   375 
   380 
   376 /*!
   381 /*!
   377 
   382  Indicates that all playback information is available and ready to be committed to the view. 
   378 */
   383  Signal is emitted only when any information has changed indicated by \a changed. A special
   379 void MpPlaybackData::commitPlaybackInfo()
   384  handling is covered, when the same song is re-selected by the user from the collection view, 
       
   385  in which case we force the reload even if the information hasn’t changed within this class.
       
   386 */
       
   387 void MpPlaybackData::commitPlaybackInfo( bool changed )
   380 {
   388 {
   381     TX_ENTRY
   389     TX_ENTRY
   382     emit playbackInfoChanged();
   390 	if ( changed || mCollectionPlaylistOpened ) {
       
   391         emit playbackInfoChanged();
       
   392 		mCollectionPlaylistOpened = false;
       
   393 	}
   383     TX_EXIT
   394     TX_EXIT
   384 }
   395 }
   385 
   396 
   386 /*!
   397 /*!
   387  Resets the data, currently called when source is removed.
   398  Resets the data, currently called when source is removed.
   430     }
   441     }
   431     emit albumArtReady();
   442     emit albumArtReady();
   432     TX_EXIT
   443     TX_EXIT
   433 }
   444 }
   434 
   445 
       
   446 /*!
       
   447  Emit collectionPlaylistOpened signal when user selects an item from collection view.
       
   448 */
       
   449 void MpPlaybackData::handleCollectionPlaylistOpened()
       
   450 {
       
   451     mCollectionPlaylistOpened = true;
       
   452     emit collectionPlaylistOpened();
       
   453 }