--- a/radioapp/radiowidgets/inc/radiofrequencystrip.h Fri Jul 23 10:16:59 2010 +0300
+++ b/radioapp/radiowidgets/inc/radiofrequencystrip.h Fri Aug 06 09:29:48 2010 +0300
@@ -15,209 +15,60 @@
*
*/
-#ifndef FREQUENCYSTRIP_H
-#define FREQUENCYSTRIP_H
-
-// System includes
-#include <QMap>
-#include <QHash>
-#include <HbEffect>
-#include <QColor>
+#ifndef RADIOFREQUENCYSTRIP_H
+#define RADIOFREQUENCYSTRIP_H
// User includes
-#include "radiostripbase.h"
+#include "radiofrequencystripbase.h"
#include "radio_global.h"
#include "radiowidgetsexport.h"
// Forward declarations
class RadioUiEngine;
-class RadioFrequencyItem;
class RadioStation;
-class HbPushButton;
-class QTimer;
-class QModelIndex;
class RadioUiLoader;
typedef QList<RadioStation> StationList;
// Class declaration
-class WIDGETS_DLL_EXPORT RadioFrequencyStrip : public RadioStripBase
+class WIDGETS_DLL_EXPORT RadioFrequencyStrip : public RadioFrequencyStripBase
{
Q_OBJECT
- Q_PROPERTY(int itemHeight READ itemHeight WRITE setItemHeight)
- Q_PROPERTY(uint frequency READ frequency)
-
- friend class RadioFrequencyItem;
public:
RadioFrequencyStrip();
- void setItemHeight( int itemHeight );
- int itemHeight() const;
-
void init( RadioUiEngine* engine, RadioUiLoader& uiLoader );
- void setFrequency( const uint frequency, int reason, Scroll::Direction direction = Scroll::Shortest );
- uint frequency() const;
-
- bool isInManualSeekMode() const;
- void cancelManualSeek();
-
- void addScannedStation( const RadioStation& station );
-
- void updateFavorite( const RadioStation& station );
-
-public slots:
-
- void setScanningMode( bool isScanning );
+ void setFrequency( const uint newFrequency, int reason, Scroll::Direction direction = Scroll::Shortest );
signals:
void frequencyChanged( uint frequency, int reason, int direction );
void skipRequested( int skipMode );
void seekRequested( int seekDirection );
- void manualSeekChanged( bool manualSeek );
-
-private slots:
-
- void removeStation( const QModelIndex& parent, int first, int last );
- void updateStation( const QModelIndex& parent, int first, int last );
- void initEmptyItems();
- void handleLeftButton();
- void handleLongLeftButton();
- void handleRightButton();
- void handleLongRightButton();
- void toggleManualSeek();
- void handleScrollingEnd();
private:
-// from base class RadioStripBase
-
- void updateItemPrimitive( QGraphicsItem* itemToUpdate, int itemIndex );
- QGraphicsItem* createItemPrimitive( QGraphicsItem *parent );
- void scrollPosChanged();
-
-// from base class QGraphicsWidget
-
- void resizeEvent ( QGraphicsSceneResizeEvent* event );
-// void showEvent( QShowEvent* event );
- void changeEvent( QEvent* event );
-
-// from base class HbScrollArea
-
- void mousePressEvent( QGraphicsSceneMouseEvent* event );
- void mouseReleaseEvent( QGraphicsSceneMouseEvent* event );
- void gestureEvent( QGestureEvent* event );
-
-// from base class QObject
-
- void timerEvent( QTimerEvent* event );
-
-// New functions
-
- void initModel();
-
- void initSelector();
+// from base class RadioFrequencyStripBase
- void initPositions();
-
- void initButtons();
-
- void addFrequencyPos( int pos, uint frequency, RadioFrequencyItem* item );
-
- void updateStationsInRange( int first, int last, bool stationRemoved = false );
-
- void updateItem( RadioFrequencyItem* item, uint upperRange = 0, uint ignoredFrequency = 0 );
-
- void updateAllItems();
-
- QPixmap drawPixmap( uint frequency, QList<RadioStation> stations, RadioFrequencyItem* item );
-
- QLineF makeTab( qreal pos, int height );
-
- void emitFrequencyChanged( uint frequency );
-
- int selectorPos() const;
-
- void scrollToFrequency( uint frequency,
- Scroll::Direction direction = Scroll::Shortest,
- int time = 0,
- TuneReason::Reason reason = TuneReason::Unspecified );
-
- void hideButtons();
- void showButtons();
+ bool isInitialized() const;
+ QList<FrequencyStrip::StationMarker> stationsInRange( uint minFrequency, uint maxFrequency ) const;
+ void emitFrequencyChanged( uint frequency, int reason, int direction );
+ void skipToPrevious();
+ void skipToPreviousFavorite();
+ void skipToNext();
+ void skipToNextFavorite();
+ void seekDown();
+ void seekUp();
+ bool isScanning() const;
+ uint frequencyAtIndex( int index ) const;
private: // data
- class FrequencyPos
- {
- public:
- explicit FrequencyPos( int pos, RadioFrequencyItem* item ) :
- mPosition( pos ),
- mItem( item ) {}
-
- FrequencyPos() :
- mPosition( 0 ),
- mItem( 0 ) {}
-
- int mPosition;
- RadioFrequencyItem* mItem;
-
- };
-
RadioUiEngine* mUiEngine;
- int mItemHeight;
-
- uint mMinFrequency;
-
- uint mMaxFrequency;
-
- uint mFrequencyStepSize;
-
- uint mFrequency;
-
- QGraphicsPixmapItem* mSelectorImage;
-
- qreal mSeparatorPos;
-
- short mMaxWidth;
-
- qreal mSelectorPos;
-
- QList<RadioFrequencyItem*> mFrequencyItems;
-
- /**
- * Container to help map a frequency to strip position and additional information about the frequency.
- * In the default region contains an item for every valid frequency from 87.50 Mhz to 108.00 Mhz with
- * stepsize 50 Khz which amounts to 410 items.
- */
- QMap<uint,FrequencyPos> mFrequencies;
-
- /**
- * Container to help map strip position to frequency.
- * It is queried every time the strip moves so the lookup time needs to be fast. QHash is used because
- * it offers the fastest lookup time of any other QT container. QHash stores the items in arbitrary
- * order so we must never try to loop through them and assume they are in any particular order.
- */
- QHash<int,uint> mPositions;
-
- HbPushButton* mLeftButton;
-
- HbPushButton* mRightButton;
-
- QTimer* mManualSeekTimer;
-
- bool mManualSeekMode;
-
- uint mLastReportedFrequency;
-
- int mManualSeekTimerId;
-
- QColor mForegroundColor;
-
};
-#endif // FREQUENCYSTRIP_H
+#endif // RADIOFREQUENCYSTRIP_H