qtinternetradio/ui/src/irsonghistoryview.cpp
changeset 17 38bbf2dcd608
parent 15 065198191975
equal deleted inserted replaced
16:5723da102db1 17:38bbf2dcd608
    17 #include <hblistview.h>
    17 #include <hblistview.h>
    18 #include <hbmenu.h>
    18 #include <hbmenu.h>
    19 #include <hbaction.h>
    19 #include <hbaction.h>
    20 #include <hbicon.h>
    20 #include <hbicon.h>
    21 #include <QTimer> 
    21 #include <QTimer> 
       
    22 #include <QVariant>
    22 
    23 
    23 #include "irviewmanager.h"
    24 #include "irviewmanager.h"
    24 #include "irapplication.h" 
    25 #include "irapplication.h" 
    25 #include "irplaycontroller.h"
    26 #include "irplaycontroller.h"
    26 #include "irsonghistoryview.h" 
    27 #include "irsonghistoryview.h" 
    29 #include "irqenums.h"
    30 #include "irqenums.h"
    30 #include "irqstatisticsreporter.h"
    31 #include "irqstatisticsreporter.h"
    31 #include "irqsettings.h"
    32 #include "irqsettings.h"
    32 #include "irqutility.h"
    33 #include "irqutility.h"
    33 #include "iruidefines.h"
    34 #include "iruidefines.h"
       
    35 #include "irdbwrapper.h"
       
    36 #include "irqisdsdatastructure.h"
    34 
    37 
    35 const QString KActionSearchInMusicStoreName("SearchInMusicStore");
    38 const QString KActionSearchInMusicStoreName("SearchInMusicStore");
    36 const QString KActionDeleteName("Delete");
    39 const QString KActionDeleteName("Delete");
    37 
    40 
    38 #ifdef STATISTIC_REPORT_TEST_ENABLED    
    41 #ifdef STATISTIC_REPORT_TEST_ENABLED
    39 static const int KDummyMusicStoreUid = 0xE609761B;
    42 static const int KIRMusicStoreUid           = 0xE609761B;
       
    43 #else
       
    44 static const int KIRMusicStoreUid           = 0;
    40 #endif
    45 #endif
    41 
    46 
    42 //                                         public functions
    47 //                                         public functions
    43 
    48 
    44 /*
    49 /*
   131  *               issue a listen request to isds client
   136  *               issue a listen request to isds client
   132  * Parameters  : aItem : pointer to the clicked item.
   137  * Parameters  : aItem : pointer to the clicked item.
   133  */
   138  */
   134 void IRSongHistoryView::handleItemSelected()
   139 void IRSongHistoryView::handleItemSelected()
   135 {     
   140 {     
   136     // TODO : NEED preset id related to the song
   141     if (!IRQUtility::findAppByUid(KIRMusicStoreUid))  // if no music store, coming soon is shown.
   137     int index = iListView->currentIndex().row();
   142     {
   138     IRQSongInfo *hisInfo = iModel->getSongHistoryInfo(index); 
   143 #ifdef SUBTITLE_STR_BY_LOCID
   139 
   144         popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation);
       
   145 #else
       
   146         popupNote(hbTrId("Service Coming Soon"), HbMessageBox::MessageTypeInformation);    
       
   147 #endif        
       
   148         return;
       
   149     }
       
   150     
       
   151     IRQSongInfo *hisInfo = iModel->getSongHistoryInfo(iListView->currentIndex().row()); 
       
   152     int presetType = 0; // user defined
       
   153     
       
   154     IRDBWrapper irDb;
       
   155     columnMap selectCriteriaSet;
       
   156     selectCriteriaSet.insert(channelId,hisInfo->getChannelID());
       
   157     
       
   158     QList<QVariant*>* dataSet = NULL;
       
   159     dataSet = irDb.getIRDB(&selectCriteriaSet);
       
   160     
       
   161     if (dataSet && (dataSet->size()>0))
       
   162     {
       
   163         presetType = (*(dataSet->at(0) + channelType)).toInt(); 
       
   164     }    
       
   165     
       
   166     if (dataSet)
       
   167     {
       
   168         while(false == dataSet->isEmpty())
       
   169         {
       
   170             delete []dataSet->takeFirst();
       
   171         }
       
   172         dataSet->clear();
       
   173         
       
   174         delete dataSet;
       
   175         dataSet = NULL;        
       
   176     }
       
   177     
       
   178     bool launchResult = false;
   140     if( hisInfo && ( 0 != hisInfo->getMusicshopStatus().compare("yes",Qt::CaseInsensitive) ) )
   179     if( hisInfo && ( 0 != hisInfo->getMusicshopStatus().compare("yes",Qt::CaseInsensitive) ) )
   141     {
   180     {
   142 #ifdef STATISTIC_REPORT_TEST_ENABLED
   181         // TODO : launch music store with search result page
   143         if(IRQUtility::launchAppByUid(KDummyMusicStoreUid))
   182         launchResult = IRQUtility::launchAppByUid(KIRMusicStoreUid);
   144         {
   183         if (launchResult)        
   145             iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsLaunch,0);
   184         {
   146         }    
   185             if (presetType)
   147 #else // STATISTIC_REPORT_TEST_ENABLED        
   186             {
   148 #ifdef SUBTITLE_STR_BY_LOCID
   187                 iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsFind,iPlayController->getNowPlayingPreset()->presetId);
   149         popupNote(hbTrId("txt_irad_info_not_allowed_by_this_station"), HbMessageBox::MessageTypeInformation);
   188             }
   150 #else  // SUBTITLE_STR_BY_LOCID
   189             else
   151         popupNote(hbTrId("Not allowed by station"), HbMessageBox::MessageTypeInformation);        
   190             {            
   152 #endif // SUBTITLE_STR_BY_LOCID
   191                 iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsFind,0);
   153 #endif // STATISTIC_REPORT_TEST_ENABLED 
   192             }
   154         return;
   193         }
   155     }
   194     }
   156     
   195     else
   157     if( (NULL == hisInfo) ||    
   196     {
   158         ( hisInfo->getSongName().isEmpty() &&  
   197         // TODO : lunch music store with homepage  
   159           hisInfo->getArtistName().isEmpty()
   198         launchResult = IRQUtility::launchAppByUid(KIRMusicStoreUid);
   160         )
   199         if (launchResult)        
   161       )
   200         {
   162     {
   201             if (presetType)
   163 #ifdef STATISTIC_REPORT_TEST_ENABLED
   202             {
   164         // TODO : have to save preset id related to the song
   203                 iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsLaunch,iPlayController->getNowPlayingPreset()->presetId);
   165         if(IRQUtility::launchAppByUid(KDummyMusicStoreUid))
   204             }
   166         {
   205             else
   167             iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsLaunch,0);
   206             {            
   168         }    
   207                 iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsLaunch,0);
   169 #else // STATISTIC_REPORT_TEST_ENABLED         
   208             }
   170 #ifdef SUBTITLE_STR_BY_LOCID
   209         }          
   171         popupNote(hbTrId("txt_irad_info_no_song_info"), HbMessageBox::MessageTypeInformation);
   210     }
   172 #else  // SUBTITLE_STR_BY_LOCID
   211     
   173         popupNote(hbTrId("No song info"), HbMessageBox::MessageTypeInformation);        
   212     if (!launchResult)
   174 #endif // SUBTITLE_STR_BY_LOCID
   213     {        
   175 #endif // STATISTIC_REPORT_TEST_ENABLED 
   214 #ifdef SUBTITLE_STR_BY_LOCID
   176         return;
   215         popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation);
   177     }
   216 #else
   178 
   217         popupNote(hbTrId("Music store not ready"), HbMessageBox::MessageTypeInformation);    
   179 #ifdef STATISTIC_REPORT_TEST_ENABLED    
   218 #endif
   180     if(IRQUtility::launchAppByUid(KDummyMusicStoreUid))
   219     }    
   181     {
       
   182         iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsFind,0);
       
   183     }
       
   184 #else // STATISTIC_REPORT_TEST_ENABLED 
       
   185 #ifdef SUBTITLE_STR_BY_LOCID
       
   186     popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation);
       
   187 #else  // SUBTITLE_STR_BY_LOCID
       
   188     popupNote(hbTrId("Music store not ready"), HbMessageBox::MessageTypeInformation);    
       
   189 #endif // SUBTITLE_STR_BY_LOCID
       
   190 #endif // STATISTIC_REPORT_TEST_ENABLED
       
   191 }
   220 }
   192    
   221    
   193 
   222 
   194 // ---------------------------------------------------------------------------
   223 // ---------------------------------------------------------------------------
   195 // IRSongHistoryView::showSongHistory()
   224 // IRSongHistoryView::showSongHistory()