mpdata/src/mpcollectiontbonelistdatamodel.cpp
changeset 45 612c4815aebe
parent 37 eb79a7c355bf
child 51 560ce2306a17
equal deleted inserted replaced
43:0f32e550d9d8 45:612c4815aebe
   171  Slot to be called when playing song status has changed.
   171  Slot to be called when playing song status has changed.
   172  */
   172  */
   173 void MpCollectionTBoneListDataModel::updateSong()
   173 void MpCollectionTBoneListDataModel::updateSong()
   174 {
   174 {
   175     TX_ENTRY
   175     TX_ENTRY
   176     int newSongId = mPlaybackData->id();
   176     if( mPlaybackActive ) {
   177     
   177         int newSongId = mPlaybackData->id();
   178     if ( mCurrentSongId && newSongId != mCurrentSongId) {
   178 
   179         //Attempt to remove old song icon.
   179         if ( mCurrentSongId && newSongId != mCurrentSongId) {
   180         QModelIndex oldSongIndex;
   180             //Attempt to remove old song icon.
   181         oldSongIndex = index( mCollectionData->albumSongIndex( mCurrentSongId ) );
   181             QModelIndex oldSongIndex;
   182         if ( oldSongIndex.isValid() ) {
   182             oldSongIndex = index( mCollectionData->albumSongIndex( mCurrentSongId ) );
   183             emit dataChanged( oldSongIndex, oldSongIndex );
   183             if ( oldSongIndex.isValid() ) {
   184         }       
   184                emit dataChanged( oldSongIndex, oldSongIndex );
   185     }
   185             } 
   186 
   186         }
   187     //Attempt to update current song data and state.
   187 
   188     QModelIndex songIndex;
   188         //Attempt to update current song data and state.
   189     songIndex = index( mCollectionData->albumSongIndex( newSongId ) );
   189         QModelIndex songIndex;
   190     if ( songIndex.isValid() ) {
   190         songIndex = index( mCollectionData->albumSongIndex( newSongId ) );
   191         emit dataChanged( songIndex, songIndex );
   191         if ( songIndex.isValid() ) {
   192     }
   192             emit dataChanged( songIndex, songIndex );
   193     mCurrentSongId = newSongId;
   193         }
       
   194         mCurrentSongId = newSongId;
       
   195     }
   194     TX_EXIT
   196     TX_EXIT
   195 }
   197 }
   196 
   198 
   197 /*!
   199 /*!
   198  Slot to be called when playback state has changed.
   200  Slot to be called when playback state has changed.