qtinternetradio/ui/src/irnowplayingview.cpp
changeset 5 0930554dc389
parent 3 ee64f059b8e1
child 8 3b03c28289e6
equal deleted inserted replaced
3:ee64f059b8e1 5:0930554dc389
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 */
    16 */
       
    17 #include <hbtoolbar.h>
    17 #include <QPixmap>
    18 #include <QPixmap>
    18 #include <hbaction.h>
    19 #include <hbaction.h>
    19 #include <hblabel.h>
    20 #include <hblabel.h>
    20 #include <hbnotificationdialog.h>
    21 #include <hbnotificationdialog.h>
    21 
    22 
    78     //if this view is not starting view, finish all initialization in constructor
    79     //if this view is not starting view, finish all initialization in constructor
    79     if (getViewManager()->views().count() > 0)
    80     if (getViewManager()->views().count() > 0)
    80     {
    81     {
    81         normalInit();
    82         normalInit();
    82     }
    83     }
       
    84     
       
    85     setFlag(EViewFlag_StickyViewEnabled);
    83 }
    86 }
    84 
    87 
    85 /*
    88 /*
    86  * Description : destructor
    89  * Description : destructor
    87  */
    90  */
   162 
   165 
   163     connect(musicStoreAction, SIGNAL(triggered()), this, SLOT(handleMusicStoreAction()));
   166     connect(musicStoreAction, SIGNAL(triggered()), this, SLOT(handleMusicStoreAction()));
   164     connect(iPlayStopAction, SIGNAL(triggered()), this, SLOT(handlePlayStopAction()));
   167     connect(iPlayStopAction, SIGNAL(triggered()), this, SLOT(handlePlayStopAction()));
   165     connect(add2FavAction, SIGNAL(triggered()), this, SLOT(handleAddToFavAction()));
   168     connect(add2FavAction, SIGNAL(triggered()), this, SLOT(handleAddToFavAction()));
   166     connect(flipAction, SIGNAL(triggered()), this, SLOT(handleDetailInfoAction()));
   169     connect(flipAction, SIGNAL(triggered()), this, SLOT(handleDetailInfoAction()));
       
   170     
       
   171     //could be removed after toolbar issue is ok
       
   172     HbToolBar *viewToolBar = toolBar();
       
   173     viewToolBar->addAction(musicStoreAction);
       
   174     viewToolBar->addAction(iPlayStopAction);
       
   175     viewToolBar->addAction(add2FavAction);
       
   176     viewToolBar->addAction(flipAction);
   167 }
   177 }
   168 
   178 
   169 void IRNowPlayingView::initWidget()
   179 void IRNowPlayingView::initWidget()
   170 {
   180 {
   171     iStationLogo = qobject_cast<HbLabel *> (iLoader.findObject(NOW_PLAYING_VIEW_OBJECT_STATION_LOGO));
   181     iStationLogo = qobject_cast<HbLabel *> (iLoader.findObject(NOW_PLAYING_VIEW_OBJECT_STATION_LOGO));
   497     
   507     
   498     switch(aEvent)
   508     switch(aEvent)
   499     {
   509     {
   500     case EIRQNetworkConnectionEstablished:
   510     case EIRQNetworkConnectionEstablished:
   501         {
   511         {
   502             iApplication->closeConnectingDialog();
       
   503             if( EIR_UseNetwork_StartingView == getUseNetworkReason() )
   512             if( EIR_UseNetwork_StartingView == getUseNetworkReason() )
   504             {
   513             {
   505                 IRPlayList *playList = iApplication->getPlayList();
   514                 IRPlayList *playList = iApplication->getPlayList();
   506                 if (playList && 1 == playList->getNumberOfEntries())
   515                 if (playList && 1 == playList->getNumberOfEntries())
   507                 {
   516                 {
   521             }
   530             }
   522             else if( EIR_UseNetwork_PlayStation == getUseNetworkReason() )
   531             else if( EIR_UseNetwork_PlayStation == getUseNetworkReason() )
   523             {
   532             {
   524                 handlePlayStopAction();
   533                 handlePlayStopAction();
   525             }
   534             }
   526             setUseNetworkReason(EIR_UseNetwork_NoReason);
       
   527             break;
   535             break;
   528         }
   536         }
   529         
       
   530     case EIRQConnectingCancelled:
       
   531     case EIRQDisplayNetworkMessageNoConnectivity:
       
   532         {
       
   533             IRQPreset *preset = iPlayController->getNowPlayingPreset();
       
   534             if( NULL == preset || preset->name == "" )
       
   535             {
       
   536                 getViewManager()->activateView(EIRView_MainView);
       
   537             }
       
   538         }
       
   539         break;
       
   540         
       
   541     default:
   537     default:
   542         break;
   538         break;
   543     }
   539     }
       
   540     
       
   541     setUseNetworkReason(EIR_UseNetwork_NoReason);
   544 }
   542 }
   545 
   543 
   546 /********************************************************************************************************
   544 /********************************************************************************************************
   547  * SLOT for Orientation Changed
   545  * SLOT for Orientation Changed
   548  *******************************************************************************************************
   546  *******************************************************************************************************
   550 
   548 
   551 void IRNowPlayingView::handleOrientationChanged(Qt::Orientation aOrientation)
   549 void IRNowPlayingView::handleOrientationChanged(Qt::Orientation aOrientation)
   552 {
   550 {
   553     if (aOrientation == Qt::Vertical)
   551     if (aOrientation == Qt::Vertical)
   554     {
   552     {
   555         iLoader.load(NOW_PLAYING_VIEW_LAYOUT_FILENAME, NOW_PLAYING_VIEW_PRT_SEC);
   553         iLoader.load(NOW_PLAYING_VIEW_LAYOUT_FILENAME, PORTRAIT_SEC);
   556     }
   554     }
   557     else
   555     else
   558     {
   556     {
   559         iLoader.load(NOW_PLAYING_VIEW_LAYOUT_FILENAME, NOW_PLAYING_VIEW_LSC_SEC);      
   557         iLoader.load(NOW_PLAYING_VIEW_LAYOUT_FILENAME, LANDSCAPE_SEC);      
   560     }
   558     }
   561 }
   559 }
   562 
   560 
   563 /********************************************************************************************************
   561 /********************************************************************************************************
   564  * SLOT for Play Controller
   562  * SLOT for Play Controller
   658 }
   656 }
   659 
   657 
   660 
   658 
   661 void IRNowPlayingView::handlePlayStopAction()
   659 void IRNowPlayingView::handlePlayStopAction()
   662 {
   660 {
   663     setUseNetworkReason(EIR_UseNetwork_PlayStation);
   661     if(iPlayController->isIdle())
       
   662     {
       
   663         setUseNetworkReason(EIR_UseNetwork_StartingView);
       
   664     }
       
   665     else
       
   666     {
       
   667         setUseNetworkReason(EIR_UseNetwork_PlayStation);
       
   668     }
       
   669     
   664     if (false == iApplication->verifyNetworkConnectivity())
   670     if (false == iApplication->verifyNetworkConnectivity())
   665     {
   671     {
   666         return;
   672         return;
   667     }
   673     }
   668     setUseNetworkReason(EIR_UseNetwork_NoReason);
   674     setUseNetworkReason(EIR_UseNetwork_NoReason);