radioapp/radiowidgets/src/radiocarouselitem.cpp
changeset 54 a8ba0c289b44
parent 51 bbebb0235466
child 57 21be958eb3ce
equal deleted inserted replaced
51:bbebb0235466 54:a8ba0c289b44
    37 const QLatin1String FAVORITE_TOUCH_AREA  ( "favorite_touch_area" );
    37 const QLatin1String FAVORITE_TOUCH_AREA  ( "favorite_touch_area" );
    38 const QLatin1String NAME_LABEL           ( "name_label" );
    38 const QLatin1String NAME_LABEL           ( "name_label" );
    39 const QLatin1String RT_LABEL             ( "rt_label" );
    39 const QLatin1String RT_LABEL             ( "rt_label" );
    40 const QLatin1String URL_LABEL            ( "url_label" );
    40 const QLatin1String URL_LABEL            ( "url_label" );
    41 
    41 
    42 const QLatin1String SEEKING_TEXT        ( "txt_rad_list_tuning" );
    42 const QLatin1String SEEKING_TEXT         ( "txt_rad_list_tuning" );
    43 const QLatin1String CONNECT_HEADSET_TEXT( "txt_rad_list_connect_wireless_antenna_headset_with" );
    43 const QLatin1String CONNECT_HEADSET_TEXT ( "txt_rad_list_connect_wireless_antenna_headset_with" );
    44 const uint CAROUSEL_LENGTH = 11;
    44 const int PS_NAME_MAX_VISIBILE_LENGTH    = 11;
    45 
    45 
    46 /*!
    46 /*!
    47  *
    47  *
    48  */
    48  */
    49 static void registerAndCheck( const QString& file ) {
    49 static void registerAndCheck( const QString& file ) {
   110     mNameItem = new HbTextItem( this );
   110     mNameItem = new HbTextItem( this );
   111     HbStyle::setItemName( mNameItem, NAME_LABEL );
   111     HbStyle::setItemName( mNameItem, NAME_LABEL );
   112 
   112 
   113     mRadiotextItem = new HbRichTextItem( this );
   113     mRadiotextItem = new HbRichTextItem( this );
   114     HbStyle::setItemName( mRadiotextItem, RT_LABEL );
   114     HbStyle::setItemName( mRadiotextItem, RT_LABEL );
   115 
   115 	
       
   116     // TODO: Proper text wrapping mode can be set in style sheet once 
       
   117     // TextWrapAtWordBoundaryOrAnywhere counterpart gets available
       
   118     mRadiotextItem->setTextWrapping( Hb::TextWrapAtWordBoundaryOrAnywhere );
       
   119     
   116     mUrlItem = new HbTextItem( this );
   120     mUrlItem = new HbTextItem( this );
   117     HbStyle::setItemName( mUrlItem, URL_LABEL );
   121     HbStyle::setItemName( mUrlItem, URL_LABEL );
   118 
   122 
   119     mFavoriteTouchArea = new HbTouchArea( this );
   123     mFavoriteTouchArea = new HbTouchArea( this );
   120     HbStyle::setItemName( mFavoriteTouchArea, FAVORITE_TOUCH_AREA );
   124     HbStyle::setItemName( mFavoriteTouchArea, FAVORITE_TOUCH_AREA );
   307     if ( mStation->isValid() ) {
   311     if ( mStation->isValid() ) {
   308         mGenreItem->setText( mObserver.localizeGenre( mStation->genre() ) );
   312         mGenreItem->setText( mObserver.localizeGenre( mStation->genre() ) );
   309 
   313 
   310         const bool hasName = mStation->hasName();
   314         const bool hasName = mStation->hasName();
   311         if ( hasName ) {
   315         if ( hasName ) {
   312             if ( mStation->name().length() > CAROUSEL_LENGTH ) {
   316             if ( mStation->name().length() > PS_NAME_MAX_VISIBILE_LENGTH ) {
   313                 mNameItem->setAlignment( Qt::AlignLeft );
   317                 mNameItem->setAlignment( Qt::AlignLeft );
   314             } else {
   318             } else {
   315                 mNameItem->setAlignment( Qt::AlignHCenter );
   319                 mNameItem->setAlignment( Qt::AlignHCenter );
   316             }
   320             }
   317             mNameItem->setText( mStation->name() );
   321             mNameItem->setText( mStation->name() );
   325             mRadiotextItem->setText( mStation->radioText() );
   329             mRadiotextItem->setText( mStation->radioText() );
   326         } else {
   330         } else {
   327             if ( mStation->hasDynamicPs() ) {
   331             if ( mStation->hasDynamicPs() ) {
   328                 mRadiotextItem->setText( mStation->dynamicPsText() );
   332                 mRadiotextItem->setText( mStation->dynamicPsText() );
   329             } else if ( hasName ) {
   333             } else if ( hasName ) {
   330                 const QString loc = "%L1 Mhz"; //hbTrId( "txt_rad_list_l1_mhz_small" );
   334                 const QString loc = hbTrId( "txt_rad_list_l1_mhz_small" );
   331                 mRadiotextItem->setText( loc.arg( mStation->frequencyString() ) );
   335                 mRadiotextItem->setText( loc.arg( mStation->frequencyString() ) );
   332             } else {
   336             } else {
   333                 mRadiotextItem->setText( "" );
   337                 mRadiotextItem->setText( "" );
   334             }
   338             }
   335         }
   339         }