qtinternetradio/irhswidgetplugin/inc/irhswidget.h
changeset 11 f683e24efca3
child 12 608f67c22514
equal deleted inserted replaced
8:3b03c28289e6 11:f683e24efca3
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Internet Radio home screen widget
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef IRHSWIDGET_H
       
    19 #define IRHSWIDGET_H
       
    20 
       
    21 // System includes
       
    22 #include <QObject>
       
    23 #include <hbwidget.h>
       
    24 #include <hbicon.h>
       
    25 
       
    26 // User includes
       
    27 #include "irservicedef.h"
       
    28 
       
    29 // Forward declarations
       
    30 class HbLabel;
       
    31 class IrServiceClient;
       
    32 
       
    33 class IrHsWidget : public HbWidget
       
    34 {
       
    35     Q_OBJECT
       
    36 
       
    37 public:
       
    38     explicit IrHsWidget(QGraphicsItem *aParent = 0, Qt::WindowFlags aFlags = 0);
       
    39     virtual ~IrHsWidget();
       
    40 
       
    41 
       
    42 public slots:
       
    43     // from KQTI widget model framework, must be slots
       
    44     void onInitialize();
       
    45     void onUninitialize();    
       
    46     void onShow();
       
    47     void onHide();
       
    48 
       
    49 private:
       
    50     void setupUi();
       
    51     void setupConnection();
       
    52 
       
    53     enum IrHsWidgetState
       
    54     {
       
    55         EUnknown   = -1,
       
    56         EInit      = 0,
       
    57         EPlaying   = 1,
       
    58         EStopped   = 2,
       
    59         ELoading   = 3
       
    60         
       
    61     };
       
    62     void handleHsWidgetStateChange(IrHsWidgetState aNewState);
       
    63     
       
    64     void loadStationLogo();
       
    65     
       
    66     void initHomeSreenWidget();
       
    67     void loadInitLayout();
       
    68     void loadStoppedLayout();
       
    69     void loadPlayingLayout();
       
    70     void loadLoadingLayout();
       
    71 
       
    72     // from QObject
       
    73     bool eventFilter(QObject *aObject, QEvent *aEvent);
       
    74 
       
    75 private slots:
       
    76     // handle user press event
       
    77     void handleLogoAreaAction();
       
    78     void handleControlAreaAction();
       
    79     void handleGoToIrAreaAction();
       
    80     void handleCentralAreaAction();
       
    81     
       
    82     void handleControlFailed();
       
    83 
       
    84     // for service notification
       
    85     void handleStationNameUpdated(const QString &aStationName);
       
    86     void handleStationLogoUpdated(bool aLogoAvailable);
       
    87     void handleMetaDataUpdated(const QString &aMetaData);
       
    88     void handleIrStateUpdated(IrAppState::Type aNewState);
       
    89 
       
    90 private:   
       
    91     HbIcon   mLoadingIcon;
       
    92     
       
    93     HbLabel *mLogoLabel;
       
    94     HbLabel *mControlLabel;
       
    95     HbLabel *mGoToIrLabel;
       
    96     HbLabel *mStationNameLabel;
       
    97     HbLabel *mMetadataLabel;
       
    98 
       
    99     HbWidget *mInfoControlArea;
       
   100     HbWidget *mCentralArea;
       
   101 
       
   102     IrServiceClient *mServiceClient;
       
   103 
       
   104     IrAppState::Type mIrState;
       
   105     IrHsWidgetState  mIrHsWidgetState;
       
   106     
       
   107     Q_DISABLE_COPY(IrHsWidget)    
       
   108 };
       
   109 
       
   110 #endif // IRHSWIDGET_H