qtinternetradio/irhswidgetplugin/src/irhswidget.cpp
changeset 14 896e9dbc5f19
parent 12 608f67c22514
child 15 065198191975
equal deleted inserted replaced
12:608f67c22514 14:896e9dbc5f19
    17 
    17 
    18 // System includes
    18 // System includes
    19 #include <HbFrameDrawer>
    19 #include <HbFrameDrawer>
    20 #include <HbFrameItem>
    20 #include <HbFrameItem>
    21 #include <QGraphicsLinearLayout>
    21 #include <QGraphicsLinearLayout>
       
    22 #include <QTimer>
    22 
    23 
    23 // User includes
    24 // User includes
    24 #include "irhswidget.h"
    25 #include "irhswidget.h"
    25 #include "irserviceclient.h"
    26 #include "irserviceclient.h"
    26 #include "irhswidgettitlerow.h"
    27 #include "irhswidgettitlerow.h"
    28 #include "irqlogger.h"
    29 #include "irqlogger.h"
    29 
    30 
    30 // Constants
    31 // Constants
    31 static const int KIrHsWidgetContentsMargin = 0;
    32 static const int KIrHsWidgetContentsMargin = 0;
    32 static const QString KIrHsWidgetBackgroundImage = "qtg_fr_hswidget_normal";
    33 static const QString KIrHsWidgetBackgroundImage = "qtg_fr_hswidget_normal";
       
    34 
       
    35 static const int KLaunchLatency = 100; // ms, used for launch nowplyaing view later
    33 
    36 
    34 // ======== MEMBER FUNCTIONS ========
    37 // ======== MEMBER FUNCTIONS ========
    35 // Constructor
    38 // Constructor
    36 IrHsWidget::IrHsWidget(QGraphicsItem* aParent, Qt::WindowFlags aFlags)
    39 IrHsWidget::IrHsWidget(QGraphicsItem* aParent, Qt::WindowFlags aFlags)
    37     : HbWidget(aParent, aFlags),
    40     : HbWidget(aParent, aFlags),
   170         this, SLOT(handleControlFailed()));  
   173         this, SLOT(handleControlFailed()));  
   171         
   174         
   172     enableUserAction();          
   175     enableUserAction();          
   173 }
   176 }
   174 
   177 
       
   178 void IrHsWidget::launchNowplayingView()
       
   179 {
       
   180     mServiceClient->launchIrNowPlaying();  
       
   181 }
       
   182 
   175 // ================ handle user press event ===============
   183 // ================ handle user press event ===============
   176 void IrHsWidget::handleCommonAreaAction()
   184 void IrHsWidget::handleCommonAreaAction()
   177 {
   185 {
   178     switch (mIrState)
   186     switch (mIrState)
   179     {
   187     {
   204     disableUserAction();
   212     disableUserAction();
   205     
   213     
   206     switch (mIrState)
   214     switch (mIrState)
   207     {
   215     {
   208         case IrAppState::NoRunStopped:
   216         case IrAppState::NoRunStopped:
   209             mServiceClient->launchIrNowPlaying();           
   217             loadLoadingLayout();
       
   218             QTimer::singleShot(KLaunchLatency, this, SLOT(launchNowplayingView()));
   210             break;
   219             break;
   211                     
   220                     
   212         case IrAppState::RunningStopped:
   221         case IrAppState::RunningStopped:
   213             mServiceClient->startPlaying();        
   222             mServiceClient->startPlaying();        
   214             break;
   223             break;