radioapp/radiouiengine/src/radiostation.cpp
changeset 33 11b6825f0862
parent 32 189d20c34778
child 37 451b2e1545b2
child 41 3a6b55c6390c
equal deleted inserted replaced
32:189d20c34778 33:11b6825f0862
    23 #include "radiostation_p.h"
    23 #include "radiostation_p.h"
    24 #include "radiologger.h"
    24 #include "radiologger.h"
    25 #include "radio_global.h"
    25 #include "radio_global.h"
    26 
    26 
    27 // Constants
    27 // Constants
    28 const QString TAG_ARTIST = "artist";
    28 const QLatin1String HTML_TAG_START( "<font color='cyan'><u>" );
    29 const QString TAG_TITLE = "title";
    29 const QLatin1String HTML_TAG_END( "</u></font>" );
    30 const QString HTML_ARTIST = "<a href=\"" + TAG_ARTIST + "\">";
       
    31 const QString HTML_TITLE = "<a href=\"" + TAG_TITLE + "\">";
       
    32 const QString HTML_CLOSE = "</a>";
       
    33 
    30 
    34 const uint LAST_CALLSIGN_CHAR_CODE = 25;
    31 const uint LAST_CALLSIGN_CHAR_CODE = 25;
    35 const uint THREE_LETTER_CALLSIGN_COUNT = 72;
    32 const uint THREE_LETTER_CALLSIGN_COUNT = 72;
    36 const uint KXXX_CALLSIGN_PI_FIRST = 0x1000;
    33 const uint KXXX_CALLSIGN_PI_FIRST = 0x1000;
    37 const uint WXXX_CALLSIGN_PI_FIRST = 0x54A8;
    34 const uint WXXX_CALLSIGN_PI_FIRST = 0x54A8;
   203             mData->mCallSignCheckDone = false;
   200             mData->mCallSignCheckDone = false;
   204         }
   201         }
   205 
   202 
   206         //TODO: This is a temporary thing to see some URL. Remove this
   203         //TODO: This is a temporary thing to see some URL. Remove this
   207         if ( !mData->mName.isEmpty() ) {
   204         if ( !mData->mName.isEmpty() ) {
   208             mData->mUrl = "<a href=\"buu\">www." + mData->mName.toLower() + ".fi</a>";
   205             QString url = mData->mName.toLower().remove( " " );
       
   206             mData->mUrl = "www." + url + ".fi";
   209         } else {
   207         } else {
   210             mData->mUrl = "";
   208             mData->mUrl = "";
   211         }
   209         }
   212         mData->mChangeFlags |= RadioStation::UrlChanged;
   210         mData->mChangeFlags |= RadioStation::UrlChanged;
   213         ASSERT_SHARED_NULL_IS_INTACT
   211         ASSERT_SHARED_NULL_IS_INTACT
   315         if ( rtPlusClass == RtPlus::Homepage ) {
   313         if ( rtPlusClass == RtPlus::Homepage ) {
   316             setUrl( rtPlusItem );
   314             setUrl( rtPlusItem );
   317             return;
   315             return;
   318         }
   316         }
   319 
   317 
   320         QString replacement = "";
   318         const QString replacement = HTML_TAG_START + rtPlusItem + HTML_TAG_END;
   321         if ( rtPlusClass == RtPlus::Artist ) {
       
   322             replacement = HTML_ARTIST;
       
   323         } else if ( rtPlusClass == RtPlus::Title ) {
       
   324             replacement = HTML_TITLE;
       
   325         }
       
   326         replacement += rtPlusItem + HTML_CLOSE;
       
   327 
   319 
   328         mData->mRadioText.replace( rtPlusItem, replacement );
   320         mData->mRadioText.replace( rtPlusItem, replacement );
   329         mData->mChangeFlags |= RadioStation::RadioTextChanged;
   321         mData->mChangeFlags |= RadioStation::RadioTextChanged;
   330     }
   322     }
   331 }
   323 }
   441 }
   433 }
   442 
   434 
   443 /*!
   435 /*!
   444  *
   436  *
   445  */
   437  */
   446 bool RadioStation::hasPiCode() const
   438 int RadioStation::piCode() const
   447 {
   439 {
   448     return mData->mPiCode != -1;
   440     return mData->mPiCode;
   449 }
       
   450 
       
   451 /*!
       
   452  *
       
   453  */
       
   454 bool RadioStation::hasRds() const
       
   455 {
       
   456     return hasPiCode() ||
       
   457         mData->mGenre != -1 ||
       
   458         !mData->mDynamicPsText.isEmpty() ||
       
   459         !mData->mRadioText.isEmpty() ||
       
   460         ( !mData->mName.isEmpty() && !isRenamed() );
       
   461 }
   441 }
   462 
   442 
   463 /*!
   443 /*!
   464  *
   444  *
   465  */
   445  */