qtinternetradio/ui/src/irnowplayingview.cpp
changeset 17 38bbf2dcd608
parent 16 5723da102db1
equal deleted inserted replaced
16:5723da102db1 17:38bbf2dcd608
    24 #include <QFontMetricsF>
    24 #include <QFontMetricsF>
    25 #include <QCoreApplication>
    25 #include <QCoreApplication>
    26 #include <HbColorScheme>
    26 #include <HbColorScheme>
    27 #include <HbEvent>
    27 #include <HbEvent>
    28 
    28 
    29 #ifdef NOWPLAYING_VIEW_OPTION_B
       
    30 #include <hbframedrawer.h>
       
    31 #include <hbframeitem.h>
       
    32 #endif
       
    33 
       
    34 #include "irviewmanager.h"
    29 #include "irviewmanager.h"
    35 #include "irapplication.h"
    30 #include "irapplication.h"
    36 #include "irplaycontroller.h"
    31 #include "irplaycontroller.h"
    37 #include "irqisdsdatastructure.h"
    32 #include "irqisdsdatastructure.h"
    38 #include "irqmetadata.h"
    33 #include "irqmetadata.h"
    68 
    63 
    69 static const QString KArtistColor("qtc_lcd_content_normal");
    64 static const QString KArtistColor("qtc_lcd_content_normal");
    70 static const QString KSongColor("qtc_lcd_content_normal");
    65 static const QString KSongColor("qtc_lcd_content_normal");
    71 static const QString KStationColor("qtc_lcd_content_normal");
    66 static const QString KStationColor("qtc_lcd_content_normal");
    72 
    67 
    73 #ifdef NOWPLAYING_VIEW_OPTION_B
       
    74 static const QString KLcdGraphics("qtg_fr_lcd");
       
    75 #endif
       
    76 
       
    77 #ifdef STATISTIC_REPORT_TEST_ENABLED    
    68 #ifdef STATISTIC_REPORT_TEST_ENABLED    
    78 static const int KDummySongRecognitionUid = 0xE4EF7D71;
    69 static const int KDummySongRecognitionUid   = 0xE4EF7D71;
    79 static const int KDummyMusicStoreUid = 0xE609761B;
    70 static const int KIRMusicStoreUid           = 0xE609761B;
       
    71 #else
       
    72 static const int KIRMusicStoreUid           = 0;
    80 #endif
    73 #endif
    81 
    74 
    82 static void saveStationLogo(const QPixmap &aStationLogo);
    75 static void saveStationLogo(const QPixmap &aStationLogo);
    83 
    76 
    84 /*
    77 /*
   253     
   246     
   254     iArtistName->setTextColor(HbColorScheme::color(KArtistColor));
   247     iArtistName->setTextColor(HbColorScheme::color(KArtistColor));
   255     iSongNameLabel->setTextColor(HbColorScheme::color(KSongColor));
   248     iSongNameLabel->setTextColor(HbColorScheme::color(KSongColor));
   256     iSongNameMarquee->setTextColor(HbColorScheme::color(KSongColor));
   249     iSongNameMarquee->setTextColor(HbColorScheme::color(KSongColor));
   257     iStationName->setTextColor(HbColorScheme::color(KStationColor));
   250     iStationName->setTextColor(HbColorScheme::color(KStationColor));
   258     
   251  
   259 #ifdef NOWPLAYING_VIEW_OPTION_B
       
   260 	HbWidget * viewContainer = qobject_cast<HbWidget *> (iLoader.findObject(VIEW_CONTAINER));
       
   261     HbFrameDrawer* drawer = new HbFrameDrawer(KLcdGraphics, HbFrameDrawer::NinePieces);
       
   262     HbFrameItem* backgroundItem = new HbFrameItem(drawer, viewContainer);
       
   263     if (backgroundItem)
       
   264     {
       
   265         viewContainer->setBackgroundItem(backgroundItem);
       
   266     }
       
   267 #endif
       
   268     
       
   269 #ifdef ADV_ENABLED
   252 #ifdef ADV_ENABLED
   270     iAdvImage = qobject_cast<HbLabel *> (iLoader.findObject( NOW_PLAYING_VIEW_OBJECT_ADVERTISEMENT_IMAGE));
   253     iAdvImage = qobject_cast<HbLabel *> (iLoader.findObject( NOW_PLAYING_VIEW_OBJECT_ADVERTISEMENT_IMAGE));
   271     iAdvImage->setIcon(HbIcon(KDefaultStationLogo));
   254     iAdvImage->setIcon(HbIcon(KDefaultStationLogo));
   272 #endif    
   255 #endif    
   273 }
   256 }
   283         return;
   266         return;
   284     }
   267     }
   285     
   268     
   286     if(iPlayController->getNowPlayingPreset())
   269     if(iPlayController->getNowPlayingPreset())
   287     {
   270     {
   288         iStationName->setPlainText(iPlayController->getNowPlayingPreset()->name);
   271         iStationName->setPlainText(iPlayController->getNowPlayingPreset()->nickName);
   289     }
   272     }
   290     loadStationLogo();
   273     loadStationLogo();
   291 }
   274 }
   292 
   275 
   293 void IRNowPlayingView::updateSongName(const QString &aSongName)
   276 void IRNowPlayingView::updateSongName(const QString &aSongName)
   479     //the only one item in play list file    
   462     //the only one item in play list file    
   480     IRPlayList *playList = iApplication->getPlayList();
   463     IRPlayList *playList = iApplication->getPlayList();
   481     if (playList && 1 == playList->getNumberOfEntries())
   464     if (playList && 1 == playList->getNumberOfEntries())
   482     {
   465     {
   483         IRQPreset *preset = playList->getPresetForEntry(0);
   466         IRQPreset *preset = playList->getPresetForEntry(0);
   484         iStationName->setPlainText(preset->name);
   467         iStationName->setPlainText(preset->nickName);
   485         iFindinNmsAllowed = (0 == preset->musicStoreStatus.compare("yes",Qt::CaseInsensitive));
   468         iFindinNmsAllowed = (0 == preset->musicStoreStatus.compare("yes",Qt::CaseInsensitive));
   486 #ifdef HS_WIDGET_ENABLED            
   469 #ifdef HS_WIDGET_ENABLED            
   487         iPlayController->reloadNowplayingPreset(preset,false,EIRQAdhocExternal);
   470         iPlayController->reloadNowplayingPreset(preset,false,EIRQAdhocExternal);
   488 #endif
   471 #endif
   489         iStationLogo->setIcon(HbIcon(KDefaultStationLogo));
   472         iStationLogo->setIcon(HbIcon(KDefaultStationLogo));
   501         if( lastPlayedStationInfo )
   484         if( lastPlayedStationInfo )
   502         {
   485         {
   503             IRQPreset *lastPreset = lastPlayedStationInfo->getLastPlayedStation();
   486             IRQPreset *lastPreset = lastPlayedStationInfo->getLastPlayedStation();
   504             if (lastPreset)
   487             if (lastPreset)
   505             {
   488             {
   506                 iStationName->setPlainText(lastPreset->name); 
   489                 iStationName->setPlainText(lastPreset->nickName); 
   507                 iFindinNmsAllowed = (0 == lastPreset->musicStoreStatus.compare("yes",Qt::CaseInsensitive));
   490                 iFindinNmsAllowed = (0 == lastPreset->musicStoreStatus.compare("yes",Qt::CaseInsensitive));
   508             }
   491             }
   509             else
   492             else
   510             {
   493             {
   511                 iStationName->setPlainText(QString("")); 
   494                 iStationName->setPlainText(QString("")); 
   746  *******************************************************************************************************
   729  *******************************************************************************************************
   747  */
   730  */
   748 void IRNowPlayingView::handleMusicStoreAction()
   731 void IRNowPlayingView::handleMusicStoreAction()
   749 {
   732 {
   750     LOG_METHOD;
   733     LOG_METHOD;
   751    
   734 
   752     if(!iFindinNmsAllowed)
   735     if (!IRQUtility::findAppByUid(KIRMusicStoreUid))  // if no music store, coming soon is shown.
   753     {
   736     {
   754 #ifdef STATISTIC_REPORT_TEST_ENABLED    
       
   755     if(IRQUtility::launchAppByUid(KDummyMusicStoreUid))
       
   756     {
       
   757         iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsLaunch,iPlayController->getNowPlayingPreset()->presetId);
       
   758     }
       
   759 #else // STATISTIC_REPORT_TEST_ENABLED
       
   760 #ifdef SUBTITLE_STR_BY_LOCID
   737 #ifdef SUBTITLE_STR_BY_LOCID
   761         popupNote(hbTrId("txt_irad_info_not_allowed_by_this_station"), HbMessageBox::MessageTypeInformation);
   738         popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation);
   762 #else  // SUBTITLE_STR_BY_LOCID
   739 #else
   763         popupNote(hbTrId("Not allowed by station"), HbMessageBox::MessageTypeInformation);        
   740         popupNote(hbTrId("Service Coming Soon"), HbMessageBox::MessageTypeInformation);    
   764 #endif // SUBTITLE_STR_BY_LOCID
   741 #endif        
   765 #endif // STATISTIC_REPORT_TEST_ENABLED        
   742         return;
   766         return;        
   743     }
   767     }
   744     
   768     
   745     bool launchResult = false;
   769     if(!iSongNameAvailable)
   746     if (iFindinNmsAllowed && iSongNameAvailable)
   770     {
   747     {       
   771 #ifdef STATISTIC_REPORT_TEST_ENABLED    
   748         // TODO : launch music store with search result page
   772     if(IRQUtility::launchAppByUid(KDummyMusicStoreUid))
   749         launchResult = IRQUtility::launchAppByUid(KIRMusicStoreUid);
   773     {
   750         if (launchResult)        
   774         iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsLaunch,iPlayController->getNowPlayingPreset()->presetId);
   751         {
   775     }
   752             if (iPlayController->getNowPlayingPreset()->type)
   776 #else // STATISTIC_REPORT_TEST_ENABLED        
   753             {
       
   754                 iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsFind,iPlayController->getNowPlayingPreset()->presetId);
       
   755             }
       
   756             else
       
   757             {            
       
   758                 iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsFind,0);
       
   759             }
       
   760         }
       
   761     }
       
   762     else
       
   763     {
       
   764         // TODO : lunch music store with homepage  
       
   765         launchResult = IRQUtility::launchAppByUid(KIRMusicStoreUid);
       
   766         if (launchResult)        
       
   767         {
       
   768             if (iPlayController->getNowPlayingPreset()->type)
       
   769             {
       
   770                 iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsLaunch,iPlayController->getNowPlayingPreset()->presetId);
       
   771             }
       
   772             else
       
   773             {            
       
   774                 iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsLaunch,0);
       
   775             }
       
   776         }        
       
   777     }
       
   778     
       
   779     if (!launchResult)
       
   780     {        
   777 #ifdef SUBTITLE_STR_BY_LOCID
   781 #ifdef SUBTITLE_STR_BY_LOCID
   778         popupNote(hbTrId("txt_irad_info_no_song_info"), HbMessageBox::MessageTypeInformation);
   782         popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation);
   779 #else // SUBTITLE_STR_BY_LOCID
   783 #else
   780         popupNote(hbTrId("No song info"), HbMessageBox::MessageTypeInformation);        
   784         popupNote(hbTrId("Music store not ready"), HbMessageBox::MessageTypeInformation);    
   781 #endif // SUBTITLE_STR_BY_LOCID
   785 #endif
   782 #endif // STATISTIC_REPORT_TEST_ENABLED        
   786     }
   783         return;        
       
   784     }
       
   785     
       
   786 #ifdef STATISTIC_REPORT_TEST_ENABLED    
       
   787     if(IRQUtility::launchAppByUid(KDummyMusicStoreUid))
       
   788     {
       
   789         iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsFind,iPlayController->getNowPlayingPreset()->presetId);
       
   790     }
       
   791 #else // STATISTIC_REPORT_TEST_ENABLED     
       
   792 #ifdef SUBTITLE_STR_BY_LOCID
       
   793     popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation);
       
   794 #else  // SUBTITLE_STR_BY_LOCID
       
   795     popupNote(hbTrId("Music store not ready"), HbMessageBox::MessageTypeInformation);    
       
   796 #endif // SUBTITLE_STR_BY_LOCID
       
   797 #endif // STATISTIC_REPORT_TEST_ENABLED 
       
   798 }
   787 }
   799 
   788 
   800 void IRNowPlayingView::handleIdentifySongAction()
   789 void IRNowPlayingView::handleIdentifySongAction()
   801 {
   790 {
   802     LOG_METHOD;
   791     LOG_METHOD;