qtinternetradio/ui/src/irsonghistoryview.cpp
changeset 15 065198191975
parent 14 896e9dbc5f19
child 17 38bbf2dcd608
equal deleted inserted replaced
14:896e9dbc5f19 15:065198191975
    27 #include "irsonghistorymodel.h"
    27 #include "irsonghistorymodel.h"
    28 #include "irqsonghistoryinfo.h" 
    28 #include "irqsonghistoryinfo.h" 
    29 #include "irqenums.h"
    29 #include "irqenums.h"
    30 #include "irqstatisticsreporter.h"
    30 #include "irqstatisticsreporter.h"
    31 #include "irqsettings.h"
    31 #include "irqsettings.h"
       
    32 #include "irqutility.h"
    32 #include "iruidefines.h"
    33 #include "iruidefines.h"
    33 
    34 
    34 const QString KActionSearchInMusicStoreName("SearchInMusicStore");
    35 const QString KActionSearchInMusicStoreName("SearchInMusicStore");
    35 const QString KActionDeleteName("Delete");
    36 const QString KActionDeleteName("Delete");
       
    37 
       
    38 #ifdef STATISTIC_REPORT_TEST_ENABLED    
       
    39 static const int KDummyMusicStoreUid = 0xE609761B;
       
    40 #endif
    36 
    41 
    37 //                                         public functions
    42 //                                         public functions
    38 
    43 
    39 /*
    44 /*
    40  * Description : constructor
    45  * Description : constructor
    41  */
    46  */
    42 IRSongHistoryView::IRSongHistoryView(IRApplication *aApplication, TIRViewId aViewId) :
    47 IRSongHistoryView::IRSongHistoryView(IRApplication *aApplication, TIRViewId aViewId) :
    43     IrAbstractListViewBase(aApplication, aViewId), iClearSongHistoryAction(NULL),
    48     IrAbstractListViewBase(aApplication, aViewId), iClearSongHistoryAction(NULL),
    44     iShowPrompt(false)
    49     iShowPrompt(false)
    45 {         
    50 {         
    46     //this view won't be starting view, don't need lazy init
       
    47     IrAbstractListViewBase::lazyInit();
       
    48     setInitCompleted(true);
       
    49         
    51         
    50     iModel = new IRSongHistoryModel(this);
    52     iModel = new IRSongHistoryModel(this);
    51     iModel->setOrientation(getViewManager()->orientation());
    53     iModel->setOrientation(getViewManager()->orientation());
    52     iListView->setModel(iModel);
    54     iListView->setModel(iModel);
    53     iListView->setCurrentIndex(iModel->index(0));
    55     iListView->setCurrentIndex(iModel->index(0));
   129  *               issue a listen request to isds client
   131  *               issue a listen request to isds client
   130  * Parameters  : aItem : pointer to the clicked item.
   132  * Parameters  : aItem : pointer to the clicked item.
   131  */
   133  */
   132 void IRSongHistoryView::handleItemSelected()
   134 void IRSongHistoryView::handleItemSelected()
   133 {     
   135 {     
   134 #ifdef STATISTIC_REPORT_TEST_ENABLED
   136     // TODO : NEED preset id related to the song
   135     // TODO : have to save preset id related to the song
       
   136     iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsFind,0);  
       
   137     popupNote("Find in Music Store ...", HbMessageBox::MessageTypeInformation);
       
   138 #else
       
   139     int index = iListView->currentIndex().row();
   137     int index = iListView->currentIndex().row();
   140     IRQSongInfo *hisInfo = iModel->getSongHistoryInfo(index); 
   138     IRQSongInfo *hisInfo = iModel->getSongHistoryInfo(index); 
   141 
   139 
   142     if( hisInfo && ( 0 != hisInfo->getMusicshopStatus().compare("yes",Qt::CaseInsensitive) ) )
   140     if( hisInfo && ( 0 != hisInfo->getMusicshopStatus().compare("yes",Qt::CaseInsensitive) ) )
   143     {
   141     {
       
   142 #ifdef STATISTIC_REPORT_TEST_ENABLED
       
   143         if(IRQUtility::launchAppByUid(KDummyMusicStoreUid))
       
   144         {
       
   145             iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsLaunch,0);
       
   146         }    
       
   147 #else // STATISTIC_REPORT_TEST_ENABLED        
   144 #ifdef SUBTITLE_STR_BY_LOCID
   148 #ifdef SUBTITLE_STR_BY_LOCID
   145         popupNote(hbTrId("txt_irad_info_not_allowed_by_this_station"), HbMessageBox::MessageTypeInformation);
   149         popupNote(hbTrId("txt_irad_info_not_allowed_by_this_station"), HbMessageBox::MessageTypeInformation);
   146 #else
   150 #else  // SUBTITLE_STR_BY_LOCID
   147         popupNote(hbTrId("Not allowed by station"), HbMessageBox::MessageTypeInformation);        
   151         popupNote(hbTrId("Not allowed by station"), HbMessageBox::MessageTypeInformation);        
   148 #endif
   152 #endif // SUBTITLE_STR_BY_LOCID
       
   153 #endif // STATISTIC_REPORT_TEST_ENABLED 
   149         return;
   154         return;
   150     }
   155     }
   151     
   156     
   152     if( (NULL == hisInfo) ||    
   157     if( (NULL == hisInfo) ||    
   153         ( hisInfo->getSongName().isEmpty() &&  
   158         ( hisInfo->getSongName().isEmpty() &&  
   154           hisInfo->getArtistName().isEmpty()
   159           hisInfo->getArtistName().isEmpty()
   155         )
   160         )
   156       )
   161       )
   157     {
   162     {
       
   163 #ifdef STATISTIC_REPORT_TEST_ENABLED
       
   164         // TODO : have to save preset id related to the song
       
   165         if(IRQUtility::launchAppByUid(KDummyMusicStoreUid))
       
   166         {
       
   167             iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsLaunch,0);
       
   168         }    
       
   169 #else // STATISTIC_REPORT_TEST_ENABLED         
   158 #ifdef SUBTITLE_STR_BY_LOCID
   170 #ifdef SUBTITLE_STR_BY_LOCID
   159         popupNote(hbTrId("txt_irad_info_no_song_info"), HbMessageBox::MessageTypeInformation);
   171         popupNote(hbTrId("txt_irad_info_no_song_info"), HbMessageBox::MessageTypeInformation);
   160 #else
   172 #else  // SUBTITLE_STR_BY_LOCID
   161         popupNote(hbTrId("No song info"), HbMessageBox::MessageTypeInformation);        
   173         popupNote(hbTrId("No song info"), HbMessageBox::MessageTypeInformation);        
   162 #endif  
   174 #endif // SUBTITLE_STR_BY_LOCID
       
   175 #endif // STATISTIC_REPORT_TEST_ENABLED 
   163         return;
   176         return;
   164     }
   177     }
   165 
   178 
   166     // TODO : Add the report in future. Add the channel id in the song info db
   179 #ifdef STATISTIC_REPORT_TEST_ENABLED    
   167     // iStatisticsReporter->logNmsEvents(EIRQFind,channelId);
   180     if(IRQUtility::launchAppByUid(KDummyMusicStoreUid))
       
   181     {
       
   182         iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRNmsFind,0);
       
   183     }
       
   184 #else // STATISTIC_REPORT_TEST_ENABLED 
   168 #ifdef SUBTITLE_STR_BY_LOCID
   185 #ifdef SUBTITLE_STR_BY_LOCID
   169     popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation);
   186     popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation);
   170 #else
   187 #else  // SUBTITLE_STR_BY_LOCID
   171     popupNote(hbTrId("Music store not ready"), HbMessageBox::MessageTypeInformation);    
   188     popupNote(hbTrId("Music store not ready"), HbMessageBox::MessageTypeInformation);    
   172 #endif // SUBTITLE_STR_BY_LOCID
   189 #endif // SUBTITLE_STR_BY_LOCID
   173 #endif // STATISTIC_REPORT_TEST_ENABLED
   190 #endif // STATISTIC_REPORT_TEST_ENABLED
   174 }
   191 }
   175    
   192    
   277     action = contextMenu->addAction(hbTrId("txt_common_menu_delete"));
   294     action = contextMenu->addAction(hbTrId("txt_common_menu_delete"));
   278 #else
   295 #else
   279     action = contextMenu->addAction(hbTrId("Delete"));    
   296     action = contextMenu->addAction(hbTrId("Delete"));    
   280 #endif
   297 #endif
   281     action->setObjectName(KActionDeleteName);
   298     action->setObjectName(KActionDeleteName);
   282 
   299     contextMenu->setPreferredPos(aCoords);
   283     contextMenu->open();
   300     contextMenu->open();
   284 }
   301 }
   285 
   302 
   286 void IRSongHistoryView::searchInMusicStoreContextAction()
   303 void IRSongHistoryView::searchInMusicStoreContextAction()
   287 {
   304 {