radioapp/radiowidgets/inc/radiostationsview.h
changeset 24 6df133bd92e1
child 28 075425b8d9a4
equal deleted inserted replaced
23:a2b50a479edf 24:6df133bd92e1
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef RADIOSTATIONSVIEW_H
       
    19 #define RADIOSTATIONSVIEW_H
       
    20 
       
    21 // System includes
       
    22 #include <HbIcon>
       
    23 #include <QScopedPointer>
       
    24 
       
    25 // User includes
       
    26 #include "radioviewbase.h"
       
    27 #include "radiowidgetsexport.h"
       
    28 
       
    29 // Forward declarations
       
    30 class RadioWindow;
       
    31 class RadioStationModel;
       
    32 class HbListView;
       
    33 class HbPushButton;
       
    34 class RadioBannerLabel;
       
    35 class HbAbstractViewItem;
       
    36 class RadioUiLoader;
       
    37 class RadioStation;
       
    38 class RadioStationFilterModel;
       
    39 class RadioFrequencyScanner;
       
    40 
       
    41 // Class declaration
       
    42 class WIDGETS_DLL_EXPORT RadioStationsView : public RadioViewBase
       
    43 {
       
    44     Q_OBJECT
       
    45     Q_PROPERTY(HbIcon nowPlayingIcon READ nowPlayingIcon WRITE setNowPlayingIcon)
       
    46     Q_PROPERTY(HbIcon favoriteIcon READ favoriteIcon WRITE setFavoriteIcon)
       
    47 
       
    48 public:
       
    49 
       
    50     explicit RadioStationsView();
       
    51     ~RadioStationsView();
       
    52 
       
    53     void setNowPlayingIcon( const HbIcon& nowPlayingIcon );
       
    54     HbIcon nowPlayingIcon() const;
       
    55 
       
    56     void setFavoriteIcon( const HbIcon& favoriteIcon );
       
    57     HbIcon favoriteIcon() const;
       
    58 
       
    59 private slots:
       
    60 
       
    61     void listItemClicked( const QModelIndex& index );
       
    62     void listItemLongPressed( HbAbstractViewItem* item, const QPointF& coords );
       
    63     void updateAntennaStatus( bool connected );
       
    64     void updateCurrentStation();
       
    65     void deckButtonPressed();
       
    66     void startScanning();
       
    67     void finishScanning();
       
    68     void updateControlVisibilities();
       
    69     void clearList();
       
    70     void rename();          // Called from context menu
       
    71     void toggleFavorite();  // Called from context menu
       
    72     void deleteStation();   // Called from context menu
       
    73     void renameDone( HbAction* action );
       
    74 
       
    75 private:
       
    76 
       
    77 // from base class RadioViewBase
       
    78 
       
    79     void init();
       
    80     void userAccepted();
       
    81 
       
    82 // from base class QGraphicsWidget
       
    83 
       
    84     void showEvent( QShowEvent* event );
       
    85 
       
    86 // New functions
       
    87 
       
    88     void initListView();
       
    89 
       
    90 private: //data
       
    91 
       
    92     RadioStationModel*                      mModel;
       
    93 
       
    94     RadioStationFilterModel*                mFilterModel;
       
    95 
       
    96     HbAction*                               mScanStationsAction;
       
    97     HbAction*                               mClearListAction;
       
    98 
       
    99     HbListView*                             mStationsList;
       
   100 
       
   101     RadioBannerLabel*                       mHeadingBanner;
       
   102 
       
   103     HbAction*                               mFavoritesButton;
       
   104     HbAction*                               mLocalStationsButton;
       
   105 
       
   106     HbIcon                                  mFavoriteIcon;
       
   107     HbIcon                                  mNowPlayingIcon;
       
   108 
       
   109     QScopedPointer<RadioStation>            mSelectedStation;
       
   110 
       
   111     QScopedPointer<RadioFrequencyScanner>   mFrequencyScanner;
       
   112 
       
   113     enum UserQuestion { NoQuestion, DeleteStation, StartScanning, ClearList };
       
   114     UserQuestion                            mCurrentQuestion;
       
   115 
       
   116 };
       
   117 
       
   118 #endif // RADIOSTATIONSVIEW_H