radioapp/radiouiengine/inc/radiouiengine.h
branchGCC_SURGE
changeset 37 451b2e1545b2
parent 19 afea38384506
parent 33 11b6825f0862
--- a/radioapp/radiouiengine/inc/radiouiengine.h	Fri Jun 11 16:24:13 2010 +0100
+++ b/radioapp/radiouiengine/inc/radiouiengine.h	Thu Jul 22 16:33:45 2010 +0100
@@ -22,6 +22,8 @@
 // System includes
 #include <QObject>
 #include <QString>
+#include <QScopedPointer>
+#include <QSharedPointer>
 
 // User includes
 #include "radiouiengineexport.h"
@@ -34,36 +36,40 @@
 class RadioStation;
 class RadioHistoryModel;
 class RadioHistoryItem;
-class RadioCarouselModel;
-class RadioStationFilterModel;
 class RadioScannerEngine;
 class RadioMonitorService;
 
-namespace GenreTarget
-{
-    enum Target{
-        Carousel,
-        StationsList,
-        HomeScreen
-    };
-}
+typedef QSharedPointer<RadioScannerEngine> RadioScannerEnginePtr;
 
+// Constants
+const uint DEFAULT_MIN_FREQUENCY = 87500000;
 
 class UI_ENGINE_DLL_EXPORT RadioUiEngine : public QObject
 {
     Q_OBJECT
-    Q_DECLARE_PRIVATE_D( d_ptr, RadioUiEngine )
+    Q_DECLARE_PRIVATE_D( d_ptr.data(), RadioUiEngine )
     Q_DISABLE_COPY( RadioUiEngine )
 
     friend class RadioScannerEngine;
 
-public:
+public: // Static functions that are used before the ui engine is created
+
+    /*!
+     * Gets the last tuned frequency from central repository
+     */
+    static uint lastTunedFrequency( uint defaultFrequency = DEFAULT_MIN_FREQUENCY );
 
-    /**
-     * Static functions that are used before the ui engine is created
+    /*!
+     * Gets the last used volume level
      */
-    static bool isOfflineProfile();
-    static uint lastTunedFrequency();
+    static int lastVolume();
+
+    /*!
+     * Launches the radio server process
+     */
+    static void launchRadioServer();
+
+public:
 
     RadioUiEngine( QObject* parent = 0 );
     ~RadioUiEngine();
@@ -73,6 +79,11 @@
     bool init();
 
     bool isFirstTimeStart();
+    void setFirstTimeStartPerformed( bool firstTimeStartPerformed );
+
+    void setPowerOn();
+    void setPowerOff( int delay = 0 );
+    bool isPoweringOff() const;
 
     /**
      * Getters for things owned by the engine
@@ -80,8 +91,7 @@
     RadioSettingsIf& settings();
     RadioStationModel& stationModel();
     RadioHistoryModel& historyModel();
-    RadioStationFilterModel* createNewFilterModel( QObject* parent = 0 );
-    RadioCarouselModel* carouselModel();
+    RadioScannerEnginePtr createScannerEngine();
     RadioScannerEngine* scannerEngine();
 
     bool isRadioOn() const;
@@ -111,6 +121,16 @@
     enum MusicStore{ OviStore, OtherStore };
     void openMusicStore( const RadioHistoryItem& item, MusicStore store = OviStore );
 
+    void launchBrowser( const QString& url );
+
+    void setManualSeekMode( bool manualSeek );
+    bool isInManualSeekMode() const;
+
+    /**
+     * Tunes the radio engine to given frequency
+     */
+    void setFrequency( uint frequency, const int reason = TuneReason::Unspecified );
+
 signals:
 
     void tunedToFrequency( uint frequency, int commandSender );
@@ -125,14 +145,9 @@
     void audioRouteChanged( bool loudspeaker );
     void antennaStatusChanged( bool connected );
 
-public slots:
+    void powerOffRequested();
 
-    /**
-     * Slots to tune to given frequency or preset
-     */
-    void tuneFrequency( uint frequency, const int reason = TuneReason::Unspecified );
-    void tuneWithDelay( uint frequency, const int reason = TuneReason::Unspecified );
-    void tunePreset( int presetIndex );
+public slots:
 
     /*!
      * volume update command slot for the engine
@@ -151,7 +166,7 @@
      * functions used only by the private class to get signals emitted
      */
     void emitTunedToFrequency( uint frequency, int commandSender );
-    void emitSeekingStarted( Seeking::Direction direction );
+    void emitSeekingStarted( Seek::Direction direction );
     void emitRadioStatusChanged( bool radioIsOn );
     void emitRdsAvailabilityChanged( bool available );
     void emitVolumeChanged( int volume );
@@ -164,7 +179,7 @@
     /**
      * Unmodifiable pointer to the private implementation
      */
-    RadioUiEnginePrivate* const d_ptr;
+    const QScopedPointer<RadioUiEnginePrivate> d_ptr;
 
 };