radioapp/radiouiengine/inc/radiouiengine.h
changeset 19 afea38384506
parent 16 f54ebcfc1b80
child 37 451b2e1545b2
equal deleted inserted replaced
16:f54ebcfc1b80 19:afea38384506
    28 #include "radio_global.h"
    28 #include "radio_global.h"
    29 
    29 
    30 // Forward declarations
    30 // Forward declarations
    31 class RadioUiEnginePrivate;
    31 class RadioUiEnginePrivate;
    32 class RadioStationModel;
    32 class RadioStationModel;
    33 class RadioSettings;
    33 class RadioSettingsIf;
    34 class RadioStation;
    34 class RadioStation;
    35 class RadioHistoryModel;
    35 class RadioHistoryModel;
       
    36 class RadioHistoryItem;
       
    37 class RadioCarouselModel;
    36 class RadioStationFilterModel;
    38 class RadioStationFilterModel;
    37 class RadioScannerEngine;
    39 class RadioScannerEngine;
    38 class RadioMonitorService;
    40 class RadioMonitorService;
    39 
    41 
    40 namespace GenreTarget
    42 namespace GenreTarget
    51 {
    53 {
    52     Q_OBJECT
    54     Q_OBJECT
    53     Q_DECLARE_PRIVATE_D( d_ptr, RadioUiEngine )
    55     Q_DECLARE_PRIVATE_D( d_ptr, RadioUiEngine )
    54     Q_DISABLE_COPY( RadioUiEngine )
    56     Q_DISABLE_COPY( RadioUiEngine )
    55 
    57 
       
    58     friend class RadioScannerEngine;
       
    59 
    56 public:
    60 public:
    57 
    61 
       
    62     /**
       
    63      * Static functions that are used before the ui engine is created
       
    64      */
    58     static bool isOfflineProfile();
    65     static bool isOfflineProfile();
       
    66     static uint lastTunedFrequency();
    59 
    67 
    60     RadioUiEngine( QObject* parent = 0 );
    68     RadioUiEngine( QObject* parent = 0 );
    61     ~RadioUiEngine();
    69     ~RadioUiEngine();
    62 
    70 
    63     bool startRadio();
    71     bool isInitialized() const;
       
    72 
       
    73     bool init();
    64 
    74 
    65     bool isFirstTimeStart();
    75     bool isFirstTimeStart();
    66 
    76 
    67     /**
    77     /**
    68      * Getters for things owned by the engine
    78      * Getters for things owned by the engine
    69      */
    79      */
    70     RadioSettings& settings();
    80     RadioSettingsIf& settings();
    71     RadioStationModel& model();
    81     RadioStationModel& stationModel();
    72     RadioHistoryModel& historyModel();
    82     RadioHistoryModel& historyModel();
    73     RadioStationFilterModel* createNewFilterModel( QObject* parent = 0 );
    83     RadioStationFilterModel* createNewFilterModel( QObject* parent = 0 );
    74     RadioScannerEngine* createScannerEngine();
    84     RadioCarouselModel* carouselModel();
    75     RadioMonitorService& monitor();
    85     RadioScannerEngine* scannerEngine();
    76 
    86 
    77     bool isRadioOn() const;
    87     bool isRadioOn() const;
    78     bool isScanning() const;
    88     bool isScanning() const;
    79     bool isMuted() const;
    89     bool isMuted() const;
    80     bool isAntennaAttached() const;
    90     bool isAntennaAttached() const;
    84     uint currentFrequency() const;
    94     uint currentFrequency() const;
    85     uint minFrequency() const;
    95     uint minFrequency() const;
    86     uint maxFrequency() const;
    96     uint maxFrequency() const;
    87     uint frequencyStepSize() const;
    97     uint frequencyStepSize() const;
    88 
    98 
       
    99     void setMute( bool muted );
       
   100 
    89     QList<RadioStation> stationsInRange( uint minFrequency, uint maxFrequency );
   101     QList<RadioStation> stationsInRange( uint minFrequency, uint maxFrequency );
    90 
   102 
    91     QString genreToString( int genre, GenreTarget::Target target );
   103     QString genreToString( int genre, GenreTarget::Target target );
    92 
   104 
    93     bool isSongRecognitionAppAvailable();
   105     bool isSongRecognitionAppAvailable();
    94 
   106 
    95     void addRecognizedSong( const QString& artist, const QString& title, const RadioStation& station );
   107     void addRecognizedSong( const QString& artist, const QString& title, const RadioStation& station );
       
   108 
       
   109     uint skipStation( StationSkip::Mode mode, uint startFrequency = 0 );
       
   110 
       
   111     enum MusicStore{ OviStore, OtherStore };
       
   112     void openMusicStore( const RadioHistoryItem& item, MusicStore store = OviStore );
    96 
   113 
    97 signals:
   114 signals:
    98 
   115 
    99     void tunedToFrequency( uint frequency, int commandSender );
   116     void tunedToFrequency( uint frequency, int commandSender );
   100     void seekingStarted( int direction );
   117     void seekingStarted( int direction );
   111 public slots:
   128 public slots:
   112 
   129 
   113     /**
   130     /**
   114      * Slots to tune to given frequency or preset
   131      * Slots to tune to given frequency or preset
   115      */
   132      */
   116     void tuneFrequency( uint frequency, const int sender = TuneReason::Unspecified );
   133     void tuneFrequency( uint frequency, const int reason = TuneReason::Unspecified );
   117     void tuneWithDelay( uint frequency, const int sender = TuneReason::Unspecified );
   134     void tuneWithDelay( uint frequency, const int reason = TuneReason::Unspecified );
   118     void tunePreset( int presetIndex );
   135     void tunePreset( int presetIndex );
   119 
   136 
   120     /*!
   137     /*!
   121      * volume update command slot for the engine
   138      * volume update command slot for the engine
   122      */
   139      */
   123     void setVolume( int volume );
   140     void setVolume( int volume );
   124     void toggleMute();
   141     void toggleMute();
   125     void toggleAudioRoute();
   142     void toggleAudioRoute();
   126 
   143 
   127     void skipPrevious();
   144     void seekStation( int seekDirection );
   128     void skipNext();
       
   129 
       
   130     void seekUp();
       
   131     void seekDown();
       
   132 
   145 
   133     void launchSongRecognition();
   146     void launchSongRecognition();
   134 
   147 
   135 private:
   148 private:
   136 
   149