qtinternetradio/ui/src/irstationsview.cpp
changeset 3 ee64f059b8e1
parent 2 2e1adbfc62af
child 5 0930554dc389
equal deleted inserted replaced
2:2e1adbfc62af 3:ee64f059b8e1
    16 */
    16 */
    17 #include <QPixmap>
    17 #include <QPixmap>
    18 #include <hblistview.h>
    18 #include <hblistview.h>
    19 #include <hbaction.h>
    19 #include <hbaction.h>
    20 #include <QTimer>
    20 #include <QTimer>
    21 
    21 #include <hbprogressdialog.h>
    22 #include "irabstractviewmanager.h"
    22 
       
    23 #include "irviewmanager.h"
    23 #include "irstationsview.h"
    24 #include "irstationsview.h"
    24 #include "irapplication.h"
    25 #include "irapplication.h"
    25 #include "irplaycontroller.h"
    26 #include "irplaycontroller.h"
    26 #include "irqisdsclient.h"
    27 #include "irqisdsclient.h"
    27 #include "irqenums.h"
    28 #include "irqenums.h"
    40  */
    41  */
    41 IRStationsView::IRStationsView(IRApplication* aApplication, TIRViewId aViewId) 
    42 IRStationsView::IRStationsView(IRApplication* aApplication, TIRViewId aViewId) 
    42                                : IrAbstractListViewBase(aApplication, aViewId),
    43                                : IrAbstractListViewBase(aApplication, aViewId),
    43                                iLogoPreset(NULL),  iPreset(NULL), 
    44                                iLogoPreset(NULL),  iPreset(NULL), 
    44                                iWaitDialog(NULL),
    45                                iWaitDialog(NULL),
    45                                iViewParameter(EIRViewPara_InvalidId),iLastSelectitem(0),
    46                                iLastSelectitem(0),
    46                                iLastPopularItem(0)                          
    47                                iLastPopularItem(0)                          
    47 {       
    48 {       
       
    49     //this view won't be starting view, don't need lazy init
       
    50     IrAbstractListViewBase::lazyInit();
       
    51     setInitCompleted(true);
       
    52         
    48     iIconIndexArray.clear();
    53     iIconIndexArray.clear();
    49     iChannelModel = new IrChannelModel(this);
    54     iChannelModel = new IrChannelModel(this);
    50     iListView->setModel(iChannelModel);
    55     iListView->setModel(iChannelModel);
    51     
    56     
    52     
    57     
    77     delete iWaitDialog;
    82     delete iWaitDialog;
    78     iWaitDialog = NULL;
    83     iWaitDialog = NULL;
    79     
    84     
    80  
    85  
    81  
    86  
    82 }
       
    83 
       
    84 void IRStationsView::setViewParameter(TIRViewParameter aParameter)
       
    85 {
       
    86     iViewParameter = aParameter;
       
    87 }
       
    88 
       
    89 TIRViewParameter IRStationsView::getViewParameter() const
       
    90 {
       
    91     return iViewParameter;
       
    92 }
    87 }
    93 
    88 
    94 void IRStationsView::loadCategoryStations(int aIndex, const QString &aHeadingText)
    89 void IRStationsView::loadCategoryStations(int aIndex, const QString &aHeadingText)
    95 {
    90 {
    96     connectToIsdsClient();
    91     connectToIsdsClient();
   175         connect(iIsdsClient, SIGNAL(presetLogoDownloaded(IRQPreset* )),
   170         connect(iIsdsClient, SIGNAL(presetLogoDownloaded(IRQPreset* )),
   176                 this, SLOT(presetLogoDownload(IRQPreset* )));
   171                 this, SLOT(presetLogoDownload(IRQPreset* )));
   177         connect(iIsdsClient, SIGNAL(presetLogoDownloadError()),
   172         connect(iIsdsClient, SIGNAL(presetLogoDownloadError()),
   178                 this, SLOT(presetLogoDownloadError()));
   173                 this, SLOT(presetLogoDownloadError()));
   179         
   174         
       
   175         leftCount = iIconIndexArray.count();
       
   176         if( leftCount > 0 )
       
   177         {
       
   178             iConvertTimer->start();
       
   179         }
   180         ret = EIR_NoDefault;
   180         ret = EIR_NoDefault;
   181         break;
   181         break;
   182         
   182         
   183     case EIR_ViewCommand_DEACTIVATE:
   183     case EIR_ViewCommand_DEACTIVATE:
   184         if (aReason == EIR_ViewCommandReason_Back)
   184         if (aReason == EIR_ViewCommandReason_Back)
   196                    this, SLOT(presetLogoDownload(IRQPreset* )));
   196                    this, SLOT(presetLogoDownload(IRQPreset* )));
   197         disconnect(iIsdsClient, SIGNAL(presetLogoDownloadError()),
   197         disconnect(iIsdsClient, SIGNAL(presetLogoDownloadError()),
   198                    this, SLOT(presetLogoDownloadError()));        
   198                    this, SLOT(presetLogoDownloadError()));        
   199         ret = EIR_NoDefault;
   199         ret = EIR_NoDefault;
   200         break;
   200         break;
   201         
   201 
   202     case EIR_ViewCommand_EffectFinished:
       
   203         /* when the effect is finished, we start showing the logos  */
       
   204         leftCount = iIconIndexArray.count();
       
   205         if( leftCount > 0 )
       
   206         {
       
   207             iConvertTimer->start();
       
   208         }
       
   209         break;
       
   210  
       
   211     default:
   202     default:
   212         break;
   203         break;
   213     }
   204     }
   214     
   205     
   215     return ret;
   206     return ret;
   536     
   527     
   537     disconnect(iIsdsClient, SIGNAL(operationException(IRQError)),
   528     disconnect(iIsdsClient, SIGNAL(operationException(IRQError)),
   538                this, SLOT(operationException(IRQError)));
   529                this, SLOT(operationException(IRQError)));
   539 }
   530 }
   540 
   531 
   541 void IRStationsView::createWaitDialog(QString aStr)
   532 void IRStationsView::createWaitDialog(const QString &aStr)
   542 {
   533 {
   543     if (!iWaitDialog)
   534     if (!iWaitDialog)
   544     {
   535     {
   545         iWaitDialog = new HbMessageBox(aStr, HbMessageBox::MessageTypeInformation);
   536         iWaitDialog = new HbProgressDialog(HbProgressDialog::WaitDialog);
   546         iWaitDialog->setTimeout(HbPopup::NoTimeout);
   537         iWaitDialog->setTimeout(HbPopup::NoTimeout);
   547         iWaitDialog->setModal(true);
   538         iWaitDialog->setModal(true);
   548         iWaitDialog->setDismissPolicy(HbPopup::NoDismiss);
   539         iWaitDialog->setDismissPolicy(HbPopup::NoDismiss);
   549         QList<QAction*> actionsList = iWaitDialog->actions();
   540         QList<QAction*> actionsList = iWaitDialog->actions();
   550         QAction *action = actionsList.at(0);
   541         QAction *action = actionsList.at(0);
   551         action->setText(hbTrId("txt_common_button_cancel"));
   542         action->setText(hbTrId("txt_common_button_cancel"));
   552         connect(action, SIGNAL(triggered()), this, SLOT(cancelRequest()));
   543         connect(action, SIGNAL(triggered()), this, SLOT(cancelRequest()));
   553     }
   544     }
   554 
   545 
       
   546     iWaitDialog->setText(aStr);
   555     iWaitDialog->open();
   547     iWaitDialog->open();
   556 }
   548 }
   557 
   549 
   558 void IRStationsView::convertAnother()
   550 void IRStationsView::convertAnother()
   559 {
   551 {