qtinternetradio/ui/src/irplaycontroller.cpp
changeset 2 2e1adbfc62af
parent 0 09774dfdd46b
child 3 ee64f059b8e1
equal deleted inserted replaced
0:09774dfdd46b 2:2e1adbfc62af
    15 *
    15 *
    16 */
    16 */
    17 #include <hbprogressdialog.h>
    17 #include <hbprogressdialog.h>
    18 #include <hbmessagebox.h>
    18 #include <hbmessagebox.h>
    19 #include <QTimer>
    19 #include <QTimer>
       
    20 #ifdef Q_CC_NOKIAX86
       
    21 #include <QFile>
       
    22 #include <QTextStream>
       
    23 #endif
    20 
    24 
    21 #include "irplaycontroller.h"
    25 #include "irplaycontroller.h"
    22 #include "irapplication.h"
    26 #include "irapplication.h"
    23 #include "irqmediaplayer.h"
    27 #include "irqmediaplayer.h"
    24 #include "irabstractviewmanager.h"
    28 #include "irabstractviewmanager.h"
    28 #include "irqsonghistoryengine.h"
    32 #include "irqsonghistoryengine.h"
    29 #include "irqmetadata.h"
    33 #include "irqmetadata.h"
    30 #include "irqsettings.h"
    34 #include "irqsettings.h"
    31 #include "irqfavoritesdb.h"
    35 #include "irqfavoritesdb.h"
    32 #include "irqstatisticsreporter.h"
    36 #include "irqstatisticsreporter.h"
       
    37 
       
    38 #ifdef Q_CC_NOKIAX86
       
    39 void getRadioServerAddress(QString & aUrl);
       
    40 #endif
       
    41 
    33 //                                        public functions
    42 //                                        public functions
    34 
    43 
    35 /*
    44 /*
    36  * Description : constructor
    45  * Description : constructor
    37  */
    46  */
   133         iUrlArray = NULL;
   142         iUrlArray = NULL;
   134         iUrlArray = iNowPlayingPreset->getURLsForBitrate(selectedBitRate);
   143         iUrlArray = iNowPlayingPreset->getURLsForBitrate(selectedBitRate);
   135         if (iUrlArray)
   144         if (iUrlArray)
   136         {
   145         {
   137             QString url = iUrlArray->at(0);
   146             QString url = iUrlArray->at(0);
   138 #ifdef __WINS__
   147 #ifdef Q_CC_NOKIAX86
   139             if (iLastPlayedChannelName != aPreset->name)
   148             if (iLastPlayedChannelName != aPreset->name)
   140             {
   149             {
   141                 emit initializeLogo();
   150                 emit initializeLogo();
   142             }
   151             }
   143             url = tr("http://172.28.189.104:8000");
   152             url = "http://172.28.205.171:8000";
       
   153             getRadioServerAddress(url);
   144             iLastPlayedChannelName = aPreset->name;
   154             iLastPlayedChannelName = aPreset->name;
   145 #else
   155 #else
   146             if (iLastPlayedUrl != iUrlArray->at(0))
   156             if (iLastPlayedUrl != iUrlArray->at(0))
   147             {
   157             {
   148                 emit initializeLogo();
   158                 emit initializeLogo();
   415             break;
   425             break;
   416         }
   426         }
   417 
   427 
   418         if (iResuming)
   428         if (iResuming)
   419         {
   429         {
   420             HbMessageBox note(tr("Connecting failed, try next URL"), HbMessageBox::MessageTypeInformation);
   430             HbMessageBox::information(tr("Connecting failed, try next URL"), (QObject*)NULL, NULL);
   421             note.exec();
       
   422             connectToChannel(iNowPlayingPreset,iConnectedFrom);
   431             connectToChannel(iNowPlayingPreset,iConnectedFrom);
   423             iResuming = false;
   432             iResuming = false;
   424             return;
   433             return;
   425         }
   434         }
   426 
   435 
   563  * Description : show a note to user to inform that error occured.
   572  * Description : show a note to user to inform that error occured.
   564  *                
   573  *                
   565  */
   574  */
   566 void IRPlayController::createNote(const QString &aNote)
   575 void IRPlayController::createNote(const QString &aNote)
   567 {
   576 {
   568     HbMessageBox note(aNote, HbMessageBox::MessageTypeWarning);
   577     HbMessageBox::warning(aNote, (QObject*)NULL, NULL);
   569 	note.setPrimaryAction(NULL);
       
   570     note.exec();
       
   571 }
   578 }
   572 
   579 
   573 /*
   580 /*
   574  * Description : establish the signal&slot connection between media player and play controller
   581  * Description : establish the signal&slot connection between media player and play controller
   575  */
   582  */
   625                     break;
   632                     break;
   626             }        
   633             }        
   627             
   634             
   628             if(tryingContinue)
   635             if(tryingContinue)
   629             {
   636             {
   630                 HbMessageBox note(tr("Connecting failed, try next URL"), HbMessageBox::MessageTypeInformation);
   637                 HbMessageBox::information(tr("Connecting failed, try next URL"), (QObject*)NULL, NULL); 
   631                 note.exec();  
       
   632                 delete iUrlArray;
   638                 delete iUrlArray;
   633                 iUrlArray = iNowPlayingPreset->getURLsForBitrate(iTryingBitrate);
   639                 iUrlArray = iNowPlayingPreset->getURLsForBitrate(iTryingBitrate);
   634                 iLastPlayedUrl = iUrlArray->at(0);
   640                 iLastPlayedUrl = iUrlArray->at(0);
   635                 doPlay(iLastPlayedUrl);
   641                 doPlay(iLastPlayedUrl);
   636                 return true;
   642                 return true;
   641     else // try next url in iUrlArray
   647     else // try next url in iUrlArray
   642     {
   648     {
   643         iLastPlayedUrl = iUrlArray->at(0);
   649         iLastPlayedUrl = iUrlArray->at(0);
   644         doPlay(iLastPlayedUrl);
   650         doPlay(iLastPlayedUrl);
   645 
   651 
   646         HbMessageBox note(tr("Connecting failed, try next URL"), HbMessageBox::MessageTypeInformation);
   652         HbMessageBox::information(tr("Connecting failed, try next URL"), (QObject*)NULL, NULL);
   647         note.exec();
       
   648 
       
   649         return true;
   653         return true;
   650     }
   654     }
   651     
   655     
   652     return false;
   656     return false;
   653 }
   657 }
   694 int IRPlayController::bitrateTrying() const
   698 int IRPlayController::bitrateTrying() const
   695 {
   699 {
   696     return iTryingBitrate;
   700     return iTryingBitrate;
   697 }
   701 }
   698 #endif 
   702 #endif 
       
   703 
       
   704 //get IP address configuration of test radio server
       
   705 #ifdef Q_CC_NOKIAX86
       
   706 void getRadioServerAddress(QString & aUrl)
       
   707 {
       
   708     QFile file("C:\\data\\QTIRConfigure.txt");
       
   709     
       
   710     if (file.open(QIODevice::ReadOnly)) 
       
   711     {
       
   712         QTextStream stream(&file);
       
   713         QString line;
       
   714         QStringList parameter;
       
   715         while (!stream.atEnd())
       
   716         {
       
   717             line = stream.readLine();
       
   718             parameter = line.split("=");
       
   719             if (parameter.count() == 2)
       
   720             {
       
   721                 if (parameter.first() == "RadioServerAddress")
       
   722                 {
       
   723                     aUrl = parameter.last();
       
   724                     break;
       
   725                 }
       
   726             }
       
   727         }
       
   728         file.close();
       
   729     }
       
   730 }
       
   731 #endif