qtinternetradio/ui/src/irhistoryview.cpp
changeset 8 3b03c28289e6
parent 5 0930554dc389
child 11 f683e24efca3
equal deleted inserted replaced
5:0930554dc389 8:3b03c28289e6
    70     this, SLOT(networkRequestNotified(IRQNetworkEvent)));
    70     this, SLOT(networkRequestNotified(IRQNetworkEvent)));
    71     connect(iModel, SIGNAL(modelChanged()), this, SLOT(modelChanged()));
    71     connect(iModel, SIGNAL(modelChanged()), this, SLOT(modelChanged()));
    72     connect(iConvertTimer, SIGNAL(timeout()), this, SLOT(convertAnother()));
    72     connect(iConvertTimer, SIGNAL(timeout()), this, SLOT(convertAnother()));
    73 }
    73 }
    74 
    74 
    75 void IRHistoryView::gotoSongHistory()
       
    76 {
       
    77     getViewManager()->activateView(EIRView_SongHistoryView);
       
    78 }
       
    79 
       
    80 /* 
    75 /* 
    81  * Description : destructor
    76  * Description : destructor
    82  */
    77  */
    83 IRHistoryView::~IRHistoryView()
    78 IRHistoryView::~IRHistoryView()
    84 {
    79 {
   106         showHistory();
   101         showHistory();
   107         ret = EIR_NoDefault;
   102         ret = EIR_NoDefault;
   108         break;
   103         break;
   109                 
   104                 
   110     case EIR_ViewCommand_ACTIVATED:
   105     case EIR_ViewCommand_ACTIVATED:
   111         connect(iIsdsClient, SIGNAL(presetResponse(IRQPreset *)),
       
   112                 this, SLOT(presetResponse(IRQPreset *)));
       
   113         connect(iIsdsClient, SIGNAL(operationException(IRQError)),
       
   114                 this, SLOT(operationException(IRQError)));
       
   115         connect(iIsdsClient, SIGNAL(presetLogoDownloaded(IRQPreset* )),
   106         connect(iIsdsClient, SIGNAL(presetLogoDownloaded(IRQPreset* )),
   116                 this, SLOT(presetLogoDownload(IRQPreset* )));
   107                 this, SLOT(presetLogoDownload(IRQPreset* )));
   117         connect(iIsdsClient, SIGNAL(presetLogoDownloadError()),
   108         connect(iIsdsClient, SIGNAL(presetLogoDownloadError()),
   118                 this, SLOT(presetLogoDownloadError()));
   109                 this, SLOT(presetLogoDownloadError()));
   119         
   110         
   132         iIsdsClient->isdsLogoDownCancelTransaction();     
   123         iIsdsClient->isdsLogoDownCancelTransaction();     
   133         
   124         
   134         //iIconIndexArray must be cleared, because timer call back convertAnother() might be
   125         //iIconIndexArray must be cleared, because timer call back convertAnother() might be
   135         //called after view is deactivated. In that case, iModel->getImgURL(aIndex); will crash
   126         //called after view is deactivated. In that case, iModel->getImgURL(aIndex); will crash
   136         iIconIndexArray.clear();
   127         iIconIndexArray.clear();
   137                 
   128 
   138         disconnect(iIsdsClient, SIGNAL(presetResponse(IRQPreset *)),
       
   139                    this, SLOT(presetResponse(IRQPreset *)));
       
   140         disconnect(iIsdsClient, SIGNAL(operationException(IRQError)),
       
   141                    this, SLOT(operationException(IRQError)));
       
   142         disconnect(iIsdsClient, SIGNAL(presetLogoDownloaded(IRQPreset*)),
   129         disconnect(iIsdsClient, SIGNAL(presetLogoDownloaded(IRQPreset*)),
   143                    this, SLOT(presetLogoDownload(IRQPreset* )));
   130                    this, SLOT(presetLogoDownload(IRQPreset* )));
   144         disconnect(iIsdsClient, SIGNAL(presetLogoDownloadError()),
   131         disconnect(iIsdsClient, SIGNAL(presetLogoDownloadError()),
   145                    this, SLOT(presetLogoDownloadError()));
   132                    this, SLOT(presetLogoDownloadError()));
   146         ret = EIR_NoDefault;
   133         ret = EIR_NoDefault;
   167     if (NULL == hisInfo)
   154     if (NULL == hisInfo)
   168     {
   155     {
   169         return;
   156         return;
   170     }
   157     }
   171 
   158 
       
   159     IRQPreset preset;
       
   160     convertStationHistory2Preset(*hisInfo, preset);
       
   161     
   172     if (hisInfo->getChannelType())
   162     if (hisInfo->getChannelType())
   173     {
   163     {
   174         // channel from isds server, get this preset
   164         // channel from isds server
   175         iApplication->createLoadingDialog(this, SLOT(cancelRequest()));
   165         iPlayController->connectToChannel(&preset, EIRQHistoryIsds);
   176         iIsdsClient->isdsListenRequest(hisInfo->getChannelId(), true);
       
   177     }
   166     }
   178     else
   167     else
   179     {
   168     {
   180         // user defined channel
   169         // user defined channel
   181         IRQChannelServerURL server;
       
   182         server.bitrate = hisInfo->getBitrate();
       
   183         server.url = hisInfo->getStreamUrl();
       
   184         server.serverName = hisInfo->getChannelName();
       
   185         IRQPreset preset;
       
   186         preset.insertChannelServer(server);
       
   187         preset.name = hisInfo->getChannelName();
       
   188         preset.description = hisInfo->getChannelDesc();
       
   189         preset.shortDesc = hisInfo->getChannelDesc();
       
   190         preset.genreName = hisInfo->getGenreName();
       
   191         preset.countryName = hisInfo->getCountryName();
       
   192         preset.languageName = hisInfo->getLanguageName();
       
   193         preset.type = 0;
       
   194         preset.uniqID = 0;
       
   195         preset.presetId = 0;
       
   196 
       
   197         iPlayController->connectToChannel(&preset,EIRQHistoryAdhoc);
   170         iPlayController->connectToChannel(&preset,EIRQHistoryAdhoc);
   198     }
   171     }
   199 }
       
   200 
       
   201 // ---------------------------------------------------------------------------
       
   202 // IRHistoryView::presetResponse()
       
   203 // gets the preset from isds client and play
       
   204 //---------------------------------------------------------------------------
       
   205 void IRHistoryView::presetResponse(IRQPreset *aPreset)
       
   206 {
       
   207     iPlayController->connectToChannel(aPreset,EIRQHistoryIsds);
       
   208 }
       
   209 
       
   210 void IRHistoryView::operationException(IRQError aError)
       
   211 {
       
   212     Q_UNUSED(aError);
       
   213     iApplication->closeLoadingDialog();
       
   214 
       
   215     popupNote(hbTrId("txt_irad_info_failed_to_connect"), HbMessageBox::MessageTypeWarning);
       
   216 }
   172 }
   217 
   173 
   218 void IRHistoryView::networkRequestNotified(IRQNetworkEvent aEvent)
   174 void IRHistoryView::networkRequestNotified(IRQNetworkEvent aEvent)
   219 {
   175 {
   220     if (getViewManager()->currentView() != this)
   176     if (getViewManager()->currentView() != this)
   235         setCheckedAction();
   191         setCheckedAction();
   236         break;
   192         break;
   237     }
   193     }
   238     
   194     
   239     setUseNetworkReason(EIR_UseNetwork_NoReason);
   195     setUseNetworkReason(EIR_UseNetwork_NoReason);
   240 }
       
   241 
       
   242 void IRHistoryView::cancelRequest()
       
   243 {
       
   244     iIsdsClient->isdsCancelRequest();
       
   245 }
   196 }
   246 
   197 
   247 // ---------------------------------------------------------------------------
   198 // ---------------------------------------------------------------------------
   248 // IRHistoryView::showHistory()
   199 // IRHistoryView::showHistory()
   249 // gets the List which was stored earlier
   200 // gets the List which was stored earlier
   477 }
   428 }
   478 
   429 
   479 void IRHistoryView::convertStationHistory2Preset(const IRQSongHistoryInfo& aHistoryInfo, IRQPreset& aPreset)
   430 void IRHistoryView::convertStationHistory2Preset(const IRQSongHistoryInfo& aHistoryInfo, IRQPreset& aPreset)
   480 {
   431 {
   481     IRQChannelServerURL url;
   432     IRQChannelServerURL url;
       
   433     url.serverName = aHistoryInfo.getChannelName();
   482     url.url = aHistoryInfo.getStreamUrl();
   434     url.url = aHistoryInfo.getStreamUrl();
   483     url.bitrate = aHistoryInfo.getBitrate();
   435     url.bitrate = aHistoryInfo.getBitrate();
   484     aPreset.name = aHistoryInfo.getChannelName();
   436     aPreset.name = aHistoryInfo.getChannelName();
   485     aPreset.insertChannelServer(url);
   437     aPreset.insertChannelServer(url);
   486     aPreset.type = aHistoryInfo.getChannelType();
   438     aPreset.type = aHistoryInfo.getChannelType();