radioapp/radiowidgets/inc/radiostationcarousel.h
changeset 34 bc10a61bd7d3
parent 28 075425b8d9a4
child 38 f8c3d4e6102c
equal deleted inserted replaced
28:075425b8d9a4 34:bc10a61bd7d3
    19 #define RADIOSTATIONCAROUSEL_H
    19 #define RADIOSTATIONCAROUSEL_H
    20 
    20 
    21 // System includes
    21 // System includes
    22 #include <HbScrollArea>
    22 #include <HbScrollArea>
    23 #include <HbIcon>
    23 #include <HbIcon>
    24 #include <QPointer>
    24 #include <QWeakPointer>
    25 
    25 
    26 // User includes
    26 // User includes
       
    27 #include "radiocarouselitemobserver.h"
    27 #include "radiowidgetsexport.h"
    28 #include "radiowidgetsexport.h"
    28 #include "radio_global.h"
    29 #include "radio_global.h"
    29 
    30 
    30 // Forward declarations
    31 // Forward declarations
    31 class RadioUiEngine;
    32 class RadioUiEngine;
    34 class RadioStation;
    35 class RadioStation;
    35 class RadioStationModel;
    36 class RadioStationModel;
    36 class RadioStationCarousel;
    37 class RadioStationCarousel;
    37 class RadioCarouselAnimator;
    38 class RadioCarouselAnimator;
    38 class HbLabel;
    39 class HbLabel;
       
    40 class HbMenu;
    39 
    41 
    40 namespace CarouselInfoText
    42 namespace CarouselInfoText
    41 {
    43 {
    42     enum Type
    44     enum Type
    43     {
    45     {
    51     };
    53     };
    52 }
    54 }
    53 
    55 
    54 // Class declaration
    56 // Class declaration
    55 class WIDGETS_DLL_EXPORT RadioStationCarousel : public HbScrollArea
    57 class WIDGETS_DLL_EXPORT RadioStationCarousel : public HbScrollArea
       
    58                                               , public RadioCarouselItemObserver
    56 {
    59 {
    57     Q_OBJECT
    60     Q_OBJECT
    58     Q_PROPERTY(HbIcon favoriteIcon READ favoriteIcon WRITE setFavoriteIcon)
    61     Q_PROPERTY(HbIcon favoriteIcon READ favoriteIcon WRITE setFavoriteIcon)
    59     Q_PROPERTY(HbIcon nonFavoriteIcon READ nonFavoriteIcon WRITE setNonFavoriteIcon)
    62     Q_PROPERTY(HbIcon nonFavoriteIcon READ nonFavoriteIcon WRITE setNonFavoriteIcon)
    60     Q_PROPERTY( int autoScrollTime READ autoScrollTime WRITE setAutoScrollTime )
    63     Q_PROPERTY( int autoScrollTime READ autoScrollTime WRITE setAutoScrollTime )
   106     void setInfoText( CarouselInfoText::Type type );
   109     void setInfoText( CarouselInfoText::Type type );
   107     void clearInfoText();
   110     void clearInfoText();
   108 
   111 
   109     void setManualSeekMode( bool manualSeekActive );
   112     void setManualSeekMode( bool manualSeekActive );
   110 
   113 
       
   114     void drawOffScreen( QPainter& painter );
       
   115 
   111     void setAlternateSkippingMode( bool alternateSkipping ); //TODO: Remove this! This is test code
   116     void setAlternateSkippingMode( bool alternateSkipping ); //TODO: Remove this! This is test code
   112 
   117 
   113 signals:
   118 signals:
   114 
   119 
   115     void frequencyChanged( uint frequency, int reason, int direction );
   120     void frequencyChanged( uint frequency, int reason, int direction );
   126     void adjustAfterScroll();
   131     void adjustAfterScroll();
   127     void update( const RadioStation& station );
   132     void update( const RadioStation& station );
   128     void updateRadioText( const RadioStation& station );
   133     void updateRadioText( const RadioStation& station );
   129     void updateStations();
   134     void updateStations();
   130     void timerFired();
   135     void timerFired();
   131     void toggleFavorite();
       
   132 //    void openContextMenu( HbAbstractViewItem* item, const QPointF& coords );
       
   133 
   136 
   134 #ifdef USE_DEBUGGING_CONTROLS
   137 #ifdef USE_DEBUGGING_CONTROLS
   135     void setRdsAvailable( bool available );
   138     void setRdsAvailable( bool available );
   136 #endif // USE_DEBUGGING_CONTROLS
   139 #endif // USE_DEBUGGING_CONTROLS
   137 
   140 
   142     void mousePressEvent( QGraphicsSceneMouseEvent* event );
   145     void mousePressEvent( QGraphicsSceneMouseEvent* event );
   143     void resizeEvent( QGraphicsSceneResizeEvent* event );
   146     void resizeEvent( QGraphicsSceneResizeEvent* event );
   144     void showEvent( QShowEvent* event );
   147     void showEvent( QShowEvent* event );
   145     void gestureEvent( QGestureEvent* event );
   148     void gestureEvent( QGestureEvent* event );
   146 
   149 
       
   150 // from base class RadioCarouselItemObserver
       
   151 
       
   152     void handleIconClicked( const RadioStation& station );
       
   153     void handleRadiotextClicked( const RadioStation& station );
       
   154     void handleUrlClicked( const RadioStation& station );
       
   155     QString localizeGenre( int genre );
       
   156     bool isInManualSeek() const;
       
   157     RadioStation findStation( uint frequency );
       
   158 
   147 // New functions
   159 // New functions
   148 
   160 
   149     bool isInitialized() const;
   161     bool isInitialized() const;
   150 
   162 
   151     void setCenterIndex( int index, ScrollMode mode = Default );
   163     void setCenterIndex( int index, ScrollMode mode = Default );
   180     QTimer*                             mGenericTimer;
   192     QTimer*                             mGenericTimer;
   181     TimerMode                           mTimerMode;
   193     TimerMode                           mTimerMode;
   182 
   194 
   183     QString                             mRadioTextHolder;
   195     QString                             mRadioTextHolder;
   184 
   196 
   185     QPointer<RadioCarouselAnimator>     mAnimator;
   197     QWeakPointer<RadioCarouselAnimator> mAnimator;
   186 
   198 
   187     HbLabel*                            mInfoText;
   199     HbLabel*                            mInfoText;
       
   200 
       
   201     HbMenu*                             mRadiotextPopup;
   188 
   202 
   189     HbWidget*                           mContainer;
   203     HbWidget*                           mContainer;
   190 
   204 
   191     enum CarouselItem                   { LeftItem, CenterItem, RightItem };
   205     enum CarouselItem                   { LeftItem, CenterItem, RightItem };
   192     RadioCarouselItem*                  mItems[3];
   206     RadioCarouselItem*                  mItems[3];
   207     Scroll::Direction                   mScrollDirection;
   221     Scroll::Direction                   mScrollDirection;
   208 
   222 
   209     bool                                mManualSeekMode;
   223     bool                                mManualSeekMode;
   210 
   224 
   211     bool                                mAlternateSkipping;
   225     bool                                mAlternateSkipping;
   212 	
   226 
   213 #ifdef USE_DEBUGGING_CONTROLS
   227 #ifdef USE_DEBUGGING_CONTROLS
   214     RadioFadingLabel*                   mRdsLabel;
   228     RadioFadingLabel*                   mRdsLabel;
   215 #endif
   229 #endif
   216 
   230 
   217 };
   231 };