author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 00:17:30 +0300 | |
changeset 53 | bb6ed1806599 |
parent 41 | 3a6b55c6390c |
permissions | -rw-r--r-- |
24 | 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> |
|
32
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
25 |
#include <QScopedPointer> |
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
26 |
#include <QSharedPointer> |
24 | 27 |
|
28 |
// User includes |
|
29 |
#include "radiouiengineexport.h" |
|
30 |
#include "radio_global.h" |
|
31 |
||
32 |
// Forward declarations |
|
33 |
class RadioUiEnginePrivate; |
|
34 |
class RadioStationModel; |
|
35 |
class RadioSettingsIf; |
|
36 |
class RadioStation; |
|
37 |
class RadioHistoryModel; |
|
38 |
class RadioHistoryItem; |
|
39 |
class RadioScannerEngine; |
|
40 |
class RadioMonitorService; |
|
41 |
||
32
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
42 |
typedef QSharedPointer<RadioScannerEngine> RadioScannerEnginePtr; |
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
43 |
|
33
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
44 |
// Constants |
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
45 |
const uint DEFAULT_MIN_FREQUENCY = 87500000; |
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
46 |
|
24 | 47 |
class UI_ENGINE_DLL_EXPORT RadioUiEngine : public QObject |
48 |
{ |
|
49 |
Q_OBJECT |
|
32
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
50 |
Q_DECLARE_PRIVATE_D( d_ptr.data(), RadioUiEngine ) |
24 | 51 |
Q_DISABLE_COPY( RadioUiEngine ) |
52 |
||
53 |
friend class RadioScannerEngine; |
|
54 |
||
33
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
55 |
public: // Static functions that are used before the ui engine is created |
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
56 |
|
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
57 |
/*! |
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
58 |
* Gets the last tuned frequency from central repository |
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
59 |
*/ |
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
60 |
static uint lastTunedFrequency( uint defaultFrequency = DEFAULT_MIN_FREQUENCY ); |
24 | 61 |
|
33
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
62 |
/*! |
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
63 |
* Gets the last used volume level |
24 | 64 |
*/ |
33
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
65 |
static int lastVolume(); |
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
66 |
|
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
67 |
/*! |
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
68 |
* Launches the radio server process |
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
69 |
*/ |
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
70 |
static void launchRadioServer(); |
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
71 |
|
11b6825f0862
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
32
diff
changeset
|
72 |
public: |
24 | 73 |
|
74 |
RadioUiEngine( QObject* parent = 0 ); |
|
75 |
~RadioUiEngine(); |
|
76 |
||
77 |
bool isInitialized() const; |
|
78 |
||
79 |
bool init(); |
|
80 |
||
81 |
bool isFirstTimeStart(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
82 |
void setFirstTimeStartPerformed( bool firstTimeStartPerformed ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
83 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
84 |
void setPowerOn(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
85 |
void setPowerOff( int delay = 0 ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
86 |
bool isPoweringOff() const; |
24 | 87 |
|
88 |
/** |
|
89 |
* Getters for things owned by the engine |
|
90 |
*/ |
|
91 |
RadioSettingsIf& settings(); |
|
92 |
RadioStationModel& stationModel(); |
|
93 |
RadioHistoryModel& historyModel(); |
|
32
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
94 |
RadioScannerEnginePtr createScannerEngine(); |
24 | 95 |
RadioScannerEngine* scannerEngine(); |
96 |
||
97 |
bool isRadioOn() const; |
|
98 |
bool isScanning() const; |
|
99 |
bool isMuted() const; |
|
100 |
bool isAntennaAttached() const; |
|
101 |
bool isUsingLoudspeaker() const; |
|
102 |
||
103 |
RadioRegion::Region region() const; |
|
104 |
uint currentFrequency() const; |
|
105 |
uint minFrequency() const; |
|
106 |
uint maxFrequency() const; |
|
107 |
uint frequencyStepSize() const; |
|
108 |
||
109 |
void setMute( bool muted ); |
|
110 |
||
111 |
QList<RadioStation> stationsInRange( uint minFrequency, uint maxFrequency ); |
|
112 |
||
113 |
QString genreToString( int genre, GenreTarget::Target target ); |
|
114 |
||
115 |
bool isSongRecognitionAppAvailable(); |
|
116 |
||
117 |
void addRecognizedSong( const QString& artist, const QString& title, const RadioStation& station ); |
|
118 |
||
41
3a6b55c6390c
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
119 |
uint skipStation( StationSkip::Mode mode, uint startFrequency = 0, const int reason = TuneReason::Skip ); |
24 | 120 |
|
121 |
enum MusicStore{ OviStore, OtherStore }; |
|
122 |
void openMusicStore( const RadioHistoryItem& item, MusicStore store = OviStore ); |
|
123 |
||
32
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
124 |
void launchBrowser( const QString& url ); |
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
125 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
126 |
void setManualSeekMode( bool manualSeek ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
127 |
bool isInManualSeekMode() const; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
128 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
129 |
/** |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
130 |
* Tunes the radio engine to given frequency |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
131 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
132 |
void setFrequency( uint frequency, const int reason = TuneReason::Unspecified ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
133 |
|
24 | 134 |
signals: |
135 |
||
136 |
void tunedToFrequency( uint frequency, int commandSender ); |
|
137 |
void seekingStarted( int direction ); |
|
138 |
void radioStatusChanged( bool radioIsOn ); |
|
139 |
||
140 |
void rdsAvailabilityChanged( bool available ); |
|
141 |
||
142 |
void volumeChanged( int volume ); |
|
143 |
void muteChanged( bool muted ); |
|
144 |
||
145 |
void audioRouteChanged( bool loudspeaker ); |
|
146 |
void antennaStatusChanged( bool connected ); |
|
147 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
148 |
void powerOffRequested(); |
24 | 149 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
150 |
public slots: |
24 | 151 |
|
152 |
/*! |
|
153 |
* volume update command slot for the engine |
|
154 |
*/ |
|
155 |
void setVolume( int volume ); |
|
156 |
void toggleMute(); |
|
157 |
void toggleAudioRoute(); |
|
158 |
||
159 |
void seekStation( int seekDirection ); |
|
160 |
||
161 |
void launchSongRecognition(); |
|
162 |
||
163 |
private: |
|
164 |
||
165 |
/** |
|
166 |
* functions used only by the private class to get signals emitted |
|
167 |
*/ |
|
168 |
void emitTunedToFrequency( uint frequency, int commandSender ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
169 |
void emitSeekingStarted( Seek::Direction direction ); |
24 | 170 |
void emitRadioStatusChanged( bool radioIsOn ); |
171 |
void emitRdsAvailabilityChanged( bool available ); |
|
172 |
void emitVolumeChanged( int volume ); |
|
173 |
void emitMuteChanged( bool muted ); |
|
174 |
void emitAudioRouteChanged( bool loudspeaker ); |
|
175 |
void emitAntennaStatusChanged( bool connected ); |
|
176 |
||
177 |
private: // data |
|
178 |
||
179 |
/** |
|
180 |
* Unmodifiable pointer to the private implementation |
|
181 |
*/ |
|
32
189d20c34778
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
182 |
const QScopedPointer<RadioUiEnginePrivate> d_ptr; |
24 | 183 |
|
184 |
}; |
|
185 |
||
186 |
||
187 |
#endif // RADIOUIENGINE_H_ |