mpdata/src/mpcollectiontbonelistdatamodel.cpp
changeset 37 eb79a7c355bf
parent 36 a0afa279b8fe
child 45 612c4815aebe
equal deleted inserted replaced
36:a0afa279b8fe 37:eb79a7c355bf
    71 MpCollectionTBoneListDataModel::MpCollectionTBoneListDataModel( MpMpxCollectionData *collectionData, 
    71 MpCollectionTBoneListDataModel::MpCollectionTBoneListDataModel( MpMpxCollectionData *collectionData, 
    72         MpPlaybackData *playbackData, QObject *parent )
    72         MpPlaybackData *playbackData, QObject *parent )
    73     : QAbstractListModel( parent ),
    73     : QAbstractListModel( parent ),
    74       mCollectionData( collectionData ),
    74       mCollectionData( collectionData ),
    75       mPlaybackData( playbackData ),
    75       mPlaybackData( playbackData ),
    76       mRowCount(0),
    76       mRowCount( 0 ),
    77       mCurrentSongId(0)
    77       mCurrentSongId( 0 ),
       
    78       mPlaybackActive( false )
    78 {
    79 {
    79     TX_ENTRY
    80     TX_ENTRY
    80     connect( mCollectionData, SIGNAL(refreshAlbumSongs()),
    81     connect( mCollectionData, SIGNAL(refreshAlbumSongs()),
    81              this, SLOT(refreshModel()) );
    82              this, SLOT(refreshModel()) );
    82     connect( mCollectionData, SIGNAL(albumDataChanged()),
    83     connect( mCollectionData, SIGNAL(albumDataChanged()),
   138         else {
   139         else {
   139             returnValue = hbTrId("txt_mus_other_unknown4");
   140             returnValue = hbTrId("txt_mus_other_unknown4");
   140         }
   141         }
   141     }
   142     }
   142     else if ( role == Qt::DecorationRole ) {
   143     else if ( role == Qt::DecorationRole ) {
   143         if ( mPlaybackData 
   144         if ( mPlaybackActive
   144                 && mPlaybackActive
   145                 && mPlaybackData->id() == mCollectionData->albumSongId( row ) ) {
   145                 && mPlaybackData->id() == mCollectionData->albumSongId( index.row() ) ) {
       
   146             QList<QVariant> iconList;
   146             QList<QVariant> iconList;
   147             iconList << QVariant(); //primary icon is not used.
   147             iconList << QVariant(); //primary icon is not used.
   148             //TODO: Replace for qtg_small_speaker when available.
   148 
   149             iconList << HbIcon("qtg_graf_hspage_highlight");
   149             iconList << HbIcon("qtg_small_speaker");
   150             returnValue = iconList;
   150             returnValue = iconList;
   151         }
   151         }
   152     }
   152     }
   153     TX_EXIT
   153     TX_EXIT
   154     return returnValue;
   154     return returnValue;
   175     TX_ENTRY
   175     TX_ENTRY
   176     int newSongId = mPlaybackData->id();
   176     int newSongId = mPlaybackData->id();
   177     
   177     
   178     if ( mCurrentSongId && newSongId != mCurrentSongId) {
   178     if ( mCurrentSongId && newSongId != mCurrentSongId) {
   179         //Attempt to remove old song icon.
   179         //Attempt to remove old song icon.
   180         QModelIndex OldSongIndex;
   180         QModelIndex oldSongIndex;
   181         OldSongIndex = index( mCollectionData->albumSongIndex( mCurrentSongId ) );
   181         oldSongIndex = index( mCollectionData->albumSongIndex( mCurrentSongId ) );
   182         if ( OldSongIndex.isValid() ) {
   182         if ( oldSongIndex.isValid() ) {
   183             emit dataChanged( OldSongIndex, OldSongIndex );
   183             emit dataChanged( oldSongIndex, oldSongIndex );
   184         }       
   184         }       
   185     }
   185     }
   186 
   186 
   187     //Attempt to update current song data and state.
   187     //Attempt to update current song data and state.
   188     QModelIndex songIndex;
   188     QModelIndex songIndex;