radioapp/radioenginewrapper/inc/radioenginewrapper_p.h
changeset 16 f54ebcfc1b80
parent 14 63aabac4416d
child 19 afea38384506
--- a/radioapp/radioenginewrapper/inc/radioenginewrapper_p.h	Fri Apr 16 14:58:55 2010 +0300
+++ b/radioapp/radioenginewrapper/inc/radioenginewrapper_p.h	Mon May 03 12:31:41 2010 +0300
@@ -21,6 +21,7 @@
 // System includes
 #include <e32std.h>
 #include <QScopedPointer>
+#include <QList>
 
 // User includes
 #include "radioenginewrapper.h"
@@ -31,12 +32,18 @@
 class RadioControlEventListener;
 class RadioRdsListener;
 class RadioSettings;
-class RadioFrequencyScanningHandler;
 class RadioStationHandlerIf;
 class RadioEngineWrapperObserver;
 
+typedef QList<RadioEngineWrapperObserver*> ObserverList;
+
 // Constants
 
+#define RUN_NOTIFY_LOOP( list, func ) \
+        foreach( RadioEngineWrapperObserver* observer, list ) { \
+            observer->func; \
+        }
+
 // Class declaration
 class RadioEngineWrapperPrivate : public MRadioEngineHandlerObserver
 {
@@ -48,8 +55,7 @@
 public:
 
     RadioEngineWrapperPrivate( RadioEngineWrapper* wrapper,
-                               RadioStationHandlerIf& stationHandler,
-                               RadioEngineWrapperObserver& observer );
+                               RadioStationHandlerIf& stationHandler );
 
     virtual ~RadioEngineWrapperPrivate();
 
@@ -73,12 +79,12 @@
     /**
      * Functions called from slots to tune to given frequency or preset
      */
-    void tuneFrequency( uint frequency, const int sender );
-    void tuneWithDelay( uint frequency, const int sender );
+    void tuneFrequency( uint frequency, const int reason );
+    void tuneWithDelay( uint frequency, const int reason );
 
-    RadioEngineWrapperObserver& observer();
+    ObserverList& observers();
 
-    void startSeeking( Seeking::Direction direction );
+    void startSeeking( Seeking::Direction direction, const int reason = TuneReason::Unspecified );
 
 private:
 
@@ -110,13 +116,6 @@
     void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC8& /*aValue*/, TInt /*aError*/ ) {}
     void HandleRepositoryValueChangeL( const TUid& /*aUid*/, TUint32 /*aKey*/, const TDesC16& /*aValue*/, TInt /*aError*/ ) {}
 
-// New functions
-
-    /**
-     * Called by RadioFrequencyScanningHandler when the scanning has finished
-     */
-    void frequencyScannerFinished();
-
 private: // data
 
     /**
@@ -134,7 +133,7 @@
     /**
      * Reference to the wrapper observer
      */
-    RadioEngineWrapperObserver&                     mObserver;
+    ObserverList                                    mObservers;
 
     /**
      * Radio settings handler
@@ -161,26 +160,15 @@
     QScopedPointer<RadioRdsListener>                mRdsListener;
 
     /**
-     * Preset scanning handler
-     * Own.
+     * Reason for the tune event. Can be FrequencyStrip, Carousel or station scanner
      */
-    QScopedPointer<RadioFrequencyScanningHandler>   mFrequencyScanningHandler;
-
-    /**
-     * Id of the sender of the last tune command. RadioFrequencyStrip or someone else
-     */
-    int                                             mCommandSender;
+    int                                             mTuneReason;
 
     /**
      * Flag to indicate whether or not audio should be routed to loudspeaker
      */
     bool                                            mUseLoudspeaker;
 
-    /**
-     * Flag to indicate whether or not the engine is seeking
-     */
-    bool                                            mIsSeeking;
-
 };
 
 #endif // RADIOENGINEWRAPPER_P_H