|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef RADIOUIENGINE_H_ |
|
20 #define RADIOUIENGINE_H_ |
|
21 |
|
22 // System includes |
|
23 #include <QObject> |
|
24 #include <QString> |
|
25 |
|
26 // User includes |
|
27 #include "radiouiengineexport.h" |
|
28 #include "radio_global.h" |
|
29 |
|
30 // Forward declarations |
|
31 class RadioUiEnginePrivate; |
|
32 class RadioStationModel; |
|
33 class RadioSettingsIf; |
|
34 class RadioStation; |
|
35 class RadioHistoryModel; |
|
36 class RadioHistoryItem; |
|
37 class RadioCarouselModel; |
|
38 class RadioStationFilterModel; |
|
39 class RadioScannerEngine; |
|
40 class RadioMonitorService; |
|
41 |
|
42 namespace GenreTarget |
|
43 { |
|
44 enum Target{ |
|
45 Carousel, |
|
46 StationsList, |
|
47 HomeScreen |
|
48 }; |
|
49 } |
|
50 |
|
51 |
|
52 class UI_ENGINE_DLL_EXPORT RadioUiEngine : public QObject |
|
53 { |
|
54 Q_OBJECT |
|
55 Q_DECLARE_PRIVATE_D( d_ptr, RadioUiEngine ) |
|
56 Q_DISABLE_COPY( RadioUiEngine ) |
|
57 |
|
58 friend class RadioScannerEngine; |
|
59 |
|
60 public: |
|
61 |
|
62 /** |
|
63 * Static functions that are used before the ui engine is created |
|
64 */ |
|
65 static bool isOfflineProfile(); |
|
66 static uint lastTunedFrequency(); |
|
67 |
|
68 RadioUiEngine( QObject* parent = 0 ); |
|
69 ~RadioUiEngine(); |
|
70 |
|
71 bool isInitialized() const; |
|
72 |
|
73 bool init(); |
|
74 |
|
75 bool isFirstTimeStart(); |
|
76 |
|
77 /** |
|
78 * Getters for things owned by the engine |
|
79 */ |
|
80 RadioSettingsIf& settings(); |
|
81 RadioStationModel& stationModel(); |
|
82 RadioHistoryModel& historyModel(); |
|
83 RadioStationFilterModel* createNewFilterModel( QObject* parent = 0 ); |
|
84 RadioCarouselModel* carouselModel(); |
|
85 RadioScannerEngine* scannerEngine(); |
|
86 |
|
87 bool isRadioOn() const; |
|
88 bool isScanning() const; |
|
89 bool isMuted() const; |
|
90 bool isAntennaAttached() const; |
|
91 bool isUsingLoudspeaker() const; |
|
92 |
|
93 RadioRegion::Region region() const; |
|
94 uint currentFrequency() const; |
|
95 uint minFrequency() const; |
|
96 uint maxFrequency() const; |
|
97 uint frequencyStepSize() const; |
|
98 |
|
99 void setMute( bool muted ); |
|
100 |
|
101 QList<RadioStation> stationsInRange( uint minFrequency, uint maxFrequency ); |
|
102 |
|
103 QString genreToString( int genre, GenreTarget::Target target ); |
|
104 |
|
105 bool isSongRecognitionAppAvailable(); |
|
106 |
|
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 ); |
|
113 |
|
114 signals: |
|
115 |
|
116 void tunedToFrequency( uint frequency, int commandSender ); |
|
117 void seekingStarted( int direction ); |
|
118 void radioStatusChanged( bool radioIsOn ); |
|
119 |
|
120 void rdsAvailabilityChanged( bool available ); |
|
121 |
|
122 void volumeChanged( int volume ); |
|
123 void muteChanged( bool muted ); |
|
124 |
|
125 void audioRouteChanged( bool loudspeaker ); |
|
126 void antennaStatusChanged( bool connected ); |
|
127 |
|
128 public slots: |
|
129 |
|
130 /** |
|
131 * Slots to tune to given frequency or preset |
|
132 */ |
|
133 void tuneFrequency( uint frequency, const int reason = TuneReason::Unspecified ); |
|
134 void tuneWithDelay( uint frequency, const int reason = TuneReason::Unspecified ); |
|
135 void tunePreset( int presetIndex ); |
|
136 |
|
137 /*! |
|
138 * volume update command slot for the engine |
|
139 */ |
|
140 void setVolume( int volume ); |
|
141 void toggleMute(); |
|
142 void toggleAudioRoute(); |
|
143 |
|
144 void seekStation( int seekDirection ); |
|
145 |
|
146 void launchSongRecognition(); |
|
147 |
|
148 private: |
|
149 |
|
150 /** |
|
151 * functions used only by the private class to get signals emitted |
|
152 */ |
|
153 void emitTunedToFrequency( uint frequency, int commandSender ); |
|
154 void emitSeekingStarted( Seeking::Direction direction ); |
|
155 void emitRadioStatusChanged( bool radioIsOn ); |
|
156 void emitRdsAvailabilityChanged( bool available ); |
|
157 void emitVolumeChanged( int volume ); |
|
158 void emitMuteChanged( bool muted ); |
|
159 void emitAudioRouteChanged( bool loudspeaker ); |
|
160 void emitAntennaStatusChanged( bool connected ); |
|
161 |
|
162 private: // data |
|
163 |
|
164 /** |
|
165 * Unmodifiable pointer to the private implementation |
|
166 */ |
|
167 RadioUiEnginePrivate* const d_ptr; |
|
168 |
|
169 }; |
|
170 |
|
171 |
|
172 #endif // RADIOUIENGINE_H_ |