radioapp/radiouiengine/src/radiostationmodel.cpp
changeset 51 bbebb0235466
parent 47 74b7c6e79031
child 54 a8ba0c289b44
equal deleted inserted replaced
47:74b7c6e79031 51:bbebb0235466
   115                     return list;
   115                     return list;
   116                 }
   116                 }
   117             } else {
   117             } else {
   118                 QStringList list;
   118                 QStringList list;
   119                 list.append( firstLine );
   119                 list.append( firstLine );
   120                 QString parsedFrequency = " "; // Empty space so that the listbox generates the second row
   120                 list.append( qtTrId( "txt_rad_dblist_l1_mhz2" ).arg( RadioStation::parseFrequency( station.frequency() ) ) );
   121                 parsedFrequency = qtTrId( "txt_rad_dblist_l1_mhz" ).arg( RadioStation::parseFrequency( station.frequency() ) );
       
   122                 list.append( parsedFrequency );
       
   123                 return list;
   121                 return list;
   124             }
   122             }
   125         } else {
   123         } else {
   126             if ( currentStation().frequency() != station.frequency() ) {
   124             if ( currentStation().frequency() != station.frequency() ) {
   127                 QStringList list;
   125                 QStringList list;
   128                 list.append( firstLine );
   126                 list.append( firstLine );
       
   127                 list.append( " " );
   129                 return list;
   128                 return list;
   130             } else {
   129             } else {
   131                 QStringList list;
   130                 QStringList list;
   132                 list.append( firstLine );
   131                 list.append( firstLine );
   133                 QString genre = " "; // Empty space so that the listbox generates the second row
   132                 QString genre = " "; // Empty space so that the listbox generates the second row
   148                 d->mDetailLevel.testFlag( RadioStationModel::ShowIcons ) ) {
   147                 d->mDetailLevel.testFlag( RadioStationModel::ShowIcons ) ) {
   149         RadioStation station = stationAt( index.row() );
   148         RadioStation station = stationAt( index.row() );
   150         QVariantList list;
   149         QVariantList list;
   151         if ( station.isFavorite() && !d->mFavoriteIcon.isNull() ) {
   150         if ( station.isFavorite() && !d->mFavoriteIcon.isNull() ) {
   152             list.append( d->mFavoriteIcon );
   151             list.append( d->mFavoriteIcon );
   153         } else {
   152         } else if ( !station.isFavorite() && !d->mNonFavoriteIcon.isNull() ) {
       
   153             list.append( d->mNonFavoriteIcon );
       
   154         }else {
   154             list.append( QIcon() );
   155             list.append( QIcon() );
   155         }
   156         }
   156         if ( currentStation().frequency() == station.frequency() && !d->mNowPlayingIcon.isNull() ) {
   157         if ( currentStation().frequency() == station.frequency() && !d->mNowPlayingIcon.isNull() ) {
   157             list.append( d->mNowPlayingIcon );
   158             list.append( d->mNowPlayingIcon );
   158         }
   159         }
   243 }
   244 }
   244 
   245 
   245 /*!
   246 /*!
   246  * Sets the icons to be used in the lists
   247  * Sets the icons to be used in the lists
   247  */
   248  */
   248 void RadioStationModel::setIcons( const QIcon& favoriteIcon, const QIcon& nowPlayingIcon )
   249 void RadioStationModel::setIcons( const QIcon& favoriteIcon, const QIcon& nonFavoriteIcon, const QIcon& nowPlayingIcon )
   249 {
   250 {
   250     Q_D( RadioStationModel );
   251     Q_D( RadioStationModel );
   251     d->mFavoriteIcon = favoriteIcon;
   252     d->mFavoriteIcon = favoriteIcon;
       
   253     d->mNonFavoriteIcon = nonFavoriteIcon;
   252     d->mNowPlayingIcon = nowPlayingIcon;
   254     d->mNowPlayingIcon = nowPlayingIcon;
   253 }
   255 }
   254 
   256 
   255 /*!
   257 /*!
   256  * Returns a reference to the station handler interface
   258  * Returns a reference to the station handler interface