radioapp/radiouiengine/inc/radiouiengine.h
changeset 16 f54ebcfc1b80
parent 14 63aabac4416d
child 19 afea38384506
equal deleted inserted replaced
14:63aabac4416d 16:f54ebcfc1b80
    30 // Forward declarations
    30 // Forward declarations
    31 class RadioUiEnginePrivate;
    31 class RadioUiEnginePrivate;
    32 class RadioStationModel;
    32 class RadioStationModel;
    33 class RadioSettings;
    33 class RadioSettings;
    34 class RadioStation;
    34 class RadioStation;
    35 class RadioPlayLogModel;
    35 class RadioHistoryModel;
    36 class RadioStationFilterModel;
    36 class RadioStationFilterModel;
       
    37 class RadioScannerEngine;
    37 class RadioMonitorService;
    38 class RadioMonitorService;
       
    39 
       
    40 namespace GenreTarget
       
    41 {
       
    42     enum Target{
       
    43         Carousel,
       
    44         StationsList,
       
    45         HomeScreen
       
    46     };
       
    47 }
       
    48 
    38 
    49 
    39 class UI_ENGINE_DLL_EXPORT RadioUiEngine : public QObject
    50 class UI_ENGINE_DLL_EXPORT RadioUiEngine : public QObject
    40 {
    51 {
    41     Q_OBJECT
    52     Q_OBJECT
    42     Q_DECLARE_PRIVATE_D( d_ptr, RadioUiEngine )
    53     Q_DECLARE_PRIVATE_D( d_ptr, RadioUiEngine )
    43     Q_DISABLE_COPY( RadioUiEngine )
    54     Q_DISABLE_COPY( RadioUiEngine )
    44 
    55 
    45 public:
    56 public:
    46 
    57 
    47     static bool isOfflineProfile();
    58     static bool isOfflineProfile();
    48     static QString parseFrequency( uint frequency );
       
    49     static QString nameOrFrequency( const RadioStation& station, uint frequency = 0 );
       
    50 
    59 
    51     RadioUiEngine( QObject* parent = 0 );
    60     RadioUiEngine( QObject* parent = 0 );
    52     ~RadioUiEngine();
    61     ~RadioUiEngine();
    53 
    62 
    54     bool startRadio();
    63     bool startRadio();
    58     /**
    67     /**
    59      * Getters for things owned by the engine
    68      * Getters for things owned by the engine
    60      */
    69      */
    61     RadioSettings& settings();
    70     RadioSettings& settings();
    62     RadioStationModel& model();
    71     RadioStationModel& model();
    63     RadioPlayLogModel& playLogModel();
    72     RadioHistoryModel& historyModel();
    64     RadioStationFilterModel* createNewFilterModel( QObject* parent = 0 );
    73     RadioStationFilterModel* createNewFilterModel( QObject* parent = 0 );
       
    74     RadioScannerEngine* createScannerEngine();
    65     RadioMonitorService& monitor();
    75     RadioMonitorService& monitor();
    66 
    76 
    67     bool isRadioOn() const;
    77     bool isRadioOn() const;
    68     bool isScanning() const;
    78     bool isScanning() const;
    69     bool isMuted() const;
    79     bool isMuted() const;
    74     uint currentFrequency() const;
    84     uint currentFrequency() const;
    75     uint minFrequency() const;
    85     uint minFrequency() const;
    76     uint maxFrequency() const;
    86     uint maxFrequency() const;
    77     uint frequencyStepSize() const;
    87     uint frequencyStepSize() const;
    78 
    88 
    79     void scanFrequencyBand();
       
    80     void cancelScanFrequencyBand();
       
    81 
       
    82     QList<RadioStation> stationsInRange( uint minFrequency, uint maxFrequency );
    89     QList<RadioStation> stationsInRange( uint minFrequency, uint maxFrequency );
    83 
    90 
    84     QString genreToString( int genre );
    91     QString genreToString( int genre, GenreTarget::Target target );
    85 
    92 
    86     bool isSongRecognitionAppAvailable();
    93     bool isSongRecognitionAppAvailable();
    87 
    94 
    88     void addRecognizedSong( const QString& artist, const QString& title, const RadioStation& station );
    95     void addRecognizedSong( const QString& artist, const QString& title, const RadioStation& station );
    89 
    96 
    97 
   104 
    98     void volumeChanged( int volume );
   105     void volumeChanged( int volume );
    99     void muteChanged( bool muted );
   106     void muteChanged( bool muted );
   100 
   107 
   101     void audioRouteChanged( bool loudspeaker );
   108     void audioRouteChanged( bool loudspeaker );
   102     void scanAndSaveFinished();
   109     void antennaStatusChanged( bool connected );
   103     void headsetStatusChanged( bool connected );
       
   104 
   110 
   105 public slots:
   111 public slots:
   106 
   112 
   107     /**
   113     /**
   108      * Slots to tune to given frequency or preset
   114      * Slots to tune to given frequency or preset
   109      */
   115      */
   110     void tuneFrequency( uint frequency, const int sender = CommandSender::Unspecified );
   116     void tuneFrequency( uint frequency, const int sender = TuneReason::Unspecified );
   111     void tuneWithDelay( uint frequency, const int sender = CommandSender::Unspecified );
   117     void tuneWithDelay( uint frequency, const int sender = TuneReason::Unspecified );
   112     void tunePreset( int presetIndex );
   118     void tunePreset( int presetIndex );
   113 
   119 
   114     /*!
   120     /*!
   115      * volume update command slot for the engine
   121      * volume update command slot for the engine
   116      */
   122      */
   136     void emitRadioStatusChanged( bool radioIsOn );
   142     void emitRadioStatusChanged( bool radioIsOn );
   137     void emitRdsAvailabilityChanged( bool available );
   143     void emitRdsAvailabilityChanged( bool available );
   138     void emitVolumeChanged( int volume );
   144     void emitVolumeChanged( int volume );
   139     void emitMuteChanged( bool muted );
   145     void emitMuteChanged( bool muted );
   140     void emitAudioRouteChanged( bool loudspeaker );
   146     void emitAudioRouteChanged( bool loudspeaker );
   141     void emitScanAndSaveFinished();
   147     void emitAntennaStatusChanged( bool connected );
   142     void emitheadsetStatusChanged( bool connected );
       
   143 
   148 
   144 private: // data
   149 private: // data
   145 
   150 
   146     /**
   151     /**
   147      * Unmodifiable pointer to the private implementation
   152      * Unmodifiable pointer to the private implementation