author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 11 Jun 2010 13:38:32 +0300 | |
changeset 28 | 075425b8d9a4 |
parent 24 | 6df133bd92e1 |
child 32 | 189d20c34778 |
child 34 | bc10a61bd7d3 |
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 |
// System includes |
|
19 |
#include <QScopedPointer> |
|
20 |
#include <QProcess> |
|
21 |
#include <QFile> |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
22 |
#include <QTimer> |
24 | 23 |
|
24 |
#ifdef BUILD_WIN32 |
|
25 |
# include <QSettings> |
|
26 |
#else |
|
27 |
# include <XQSettingsManager> |
|
28 |
#endif // WIN32_BUILD |
|
29 |
||
30 |
// User includes |
|
31 |
#include "radiouiengine.h" |
|
32 |
#include "radiouiengine_p.h" |
|
33 |
#include "radioenginewrapper.h" |
|
34 |
#include "radiostationmodel.h" |
|
35 |
#include "radiohistorymodel.h" |
|
36 |
#include "radiohistoryitem.h" |
|
37 |
#include "radiosettings.h" |
|
38 |
#include "radioscannerengine.h" |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
39 |
#include "radiogenrelocalizer.h" |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
40 |
#include "radiologger.h" |
24 | 41 |
|
42 |
// Constants |
|
43 |
const uint DEFAULT_MIN_FREQUENCY = 87500000; |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
44 |
const uint RADIO_CENREP_UID = 0x2002FF52; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
45 |
const uint RADIO_CENREP_FREQUENCY_KEY = 0x207; |
24 | 46 |
|
47 |
||
48 |
/*! |
|
49 |
* |
|
50 |
*/ |
|
51 |
uint RadioUiEngine::lastTunedFrequency() |
|
52 |
{ |
|
53 |
uint frequency = DEFAULT_MIN_FREQUENCY; |
|
54 |
||
55 |
#ifdef BUILD_WIN32 |
|
56 |
QScopedPointer<QSettings> settings( new QSettings( "Nokia", "QtFmRadio" ) ); |
|
57 |
frequency = settings->value( "CurrentFreq", DEFAULT_MIN_FREQUENCY ).toUInt(); |
|
58 |
if ( frequency == 0 ) { |
|
59 |
frequency = DEFAULT_MIN_FREQUENCY; |
|
60 |
} |
|
61 |
#else |
|
62 |
QScopedPointer<XQSettingsManager> settings( new XQSettingsManager() ); |
|
63 |
XQSettingsKey key( XQSettingsKey::TargetCentralRepository, RADIO_CENREP_UID, RADIO_CENREP_FREQUENCY_KEY ); |
|
64 |
frequency = settings->readItemValue( key, XQSettingsManager::TypeInt ).toUInt(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
65 |
if ( frequency == 0 ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
66 |
frequency = DEFAULT_MIN_FREQUENCY; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
67 |
} |
24 | 68 |
#endif |
69 |
||
70 |
return frequency; |
|
71 |
} |
|
72 |
||
73 |
/*! |
|
74 |
* |
|
75 |
*/ |
|
76 |
RadioUiEngine::RadioUiEngine( QObject* parent ) : |
|
77 |
QObject( parent ), |
|
78 |
d_ptr( new RadioUiEnginePrivate( this ) ) |
|
79 |
{ |
|
80 |
} |
|
81 |
||
82 |
/*! |
|
83 |
* |
|
84 |
*/ |
|
85 |
RadioUiEngine::~RadioUiEngine() |
|
86 |
{ |
|
87 |
delete d_ptr; |
|
88 |
} |
|
89 |
||
90 |
/*! |
|
91 |
* |
|
92 |
*/ |
|
93 |
bool RadioUiEngine::isInitialized() const |
|
94 |
{ |
|
95 |
Q_D( const RadioUiEngine ); |
|
96 |
return !d->mEngineWrapper.isNull(); |
|
97 |
} |
|
98 |
||
99 |
/*! |
|
100 |
* |
|
101 |
*/ |
|
102 |
bool RadioUiEngine::init() |
|
103 |
{ |
|
104 |
Q_D( RadioUiEngine ); |
|
105 |
return d->init(); |
|
106 |
} |
|
107 |
||
108 |
/*! |
|
109 |
* |
|
110 |
*/ |
|
111 |
bool RadioUiEngine::isFirstTimeStart() |
|
112 |
{ |
|
113 |
Q_D( RadioUiEngine ); |
|
114 |
return d->mEngineWrapper->settings().isFirstTimeStart(); |
|
115 |
} |
|
116 |
||
117 |
/*! |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
118 |
* |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
119 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
120 |
void RadioUiEngine::setFirstTimeStartPerformed( bool firstTimeStartPerformed ) |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
121 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
122 |
Q_D( RadioUiEngine ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
123 |
d->mEngineWrapper->settings().setFirstTimeStartPerformed( firstTimeStartPerformed ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
124 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
125 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
126 |
/*! |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
127 |
* |
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 |
void RadioUiEngine::setPowerOn() |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
130 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
131 |
setMute( false ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
132 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
133 |
Q_D( RadioUiEngine ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
134 |
if ( d->mPowerOffTimer ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
135 |
d->mPowerOffTimer->stop(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
136 |
d->mPowerOffTimer->deleteLater(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
137 |
d->mPowerOffTimer = NULL; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
138 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
139 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
140 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
141 |
/*! |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
142 |
* |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
143 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
144 |
void RadioUiEngine::setPowerOff( int delay ) |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
145 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
146 |
Q_D( RadioUiEngine ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
147 |
d->mEngineWrapper->setMute( true, false ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
148 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
149 |
if ( delay > 0 ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
150 |
if ( !d->mPowerOffTimer ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
151 |
d->mPowerOffTimer = new QTimer( this ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
152 |
Radio::connect( d->mPowerOffTimer, SIGNAL(timeout()), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
153 |
this, SIGNAL(powerOffRequested()) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
154 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
155 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
156 |
d->mPowerOffTimer->start( delay ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
157 |
} else { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
158 |
emit powerOffRequested(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
159 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
160 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
161 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
162 |
/*! |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
163 |
* |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
164 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
165 |
bool RadioUiEngine::isPoweringOff() const |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
166 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
167 |
Q_D( const RadioUiEngine ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
168 |
return d->mPowerOffTimer && d->mPowerOffTimer->isActive(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
169 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
170 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
171 |
/*! |
24 | 172 |
* Returns the settings handler owned by the engine |
173 |
*/ |
|
174 |
RadioSettingsIf& RadioUiEngine::settings() |
|
175 |
{ |
|
176 |
Q_D( RadioUiEngine ); |
|
177 |
return d->mEngineWrapper->settings(); |
|
178 |
} |
|
179 |
||
180 |
/*! |
|
181 |
* Returns the station model |
|
182 |
*/ |
|
183 |
RadioStationModel& RadioUiEngine::stationModel() |
|
184 |
{ |
|
185 |
Q_D( RadioUiEngine ); |
|
186 |
return *d->mStationModel; |
|
187 |
} |
|
188 |
||
189 |
/*! |
|
190 |
* Returns the history model |
|
191 |
*/ |
|
192 |
RadioHistoryModel& RadioUiEngine::historyModel() |
|
193 |
{ |
|
194 |
Q_D( RadioUiEngine ); |
|
195 |
return *d->mHistoryModel; |
|
196 |
} |
|
197 |
||
198 |
/*! |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
199 |
* |
24 | 200 |
*/ |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
201 |
RadioScannerEngine* RadioUiEngine::createScannerEngine() |
24 | 202 |
{ |
203 |
Q_D( RadioUiEngine ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
204 |
if ( !d->mScannerEngine ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
205 |
d->mScannerEngine = new RadioScannerEngine( *d ); |
24 | 206 |
} |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
207 |
return d->mScannerEngine; |
24 | 208 |
} |
209 |
||
210 |
/*! |
|
211 |
* |
|
212 |
*/ |
|
213 |
RadioScannerEngine* RadioUiEngine::scannerEngine() |
|
214 |
{ |
|
215 |
Q_D( RadioUiEngine ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
216 |
return d->mScannerEngine.data(); |
24 | 217 |
} |
218 |
||
219 |
/*! |
|
220 |
* |
|
221 |
*/ |
|
222 |
bool RadioUiEngine::isRadioOn() const |
|
223 |
{ |
|
224 |
Q_D( const RadioUiEngine ); |
|
225 |
return d->mEngineWrapper->isRadioOn(); |
|
226 |
} |
|
227 |
||
228 |
/*! |
|
229 |
* |
|
230 |
*/ |
|
231 |
bool RadioUiEngine::isScanning() const |
|
232 |
{ |
|
233 |
Q_D( const RadioUiEngine ); |
|
234 |
if ( d->mScannerEngine ) { |
|
235 |
return d->mScannerEngine->isScanning(); |
|
236 |
} |
|
237 |
return false; |
|
238 |
} |
|
239 |
||
240 |
/*! |
|
241 |
* |
|
242 |
*/ |
|
243 |
bool RadioUiEngine::isMuted() const |
|
244 |
{ |
|
245 |
Q_D( const RadioUiEngine ); |
|
246 |
return d->mEngineWrapper->isMuted(); |
|
247 |
} |
|
248 |
||
249 |
/*! |
|
250 |
* |
|
251 |
*/ |
|
252 |
bool RadioUiEngine::isAntennaAttached() const |
|
253 |
{ |
|
254 |
Q_D( const RadioUiEngine ); |
|
255 |
return d->mEngineWrapper->isAntennaAttached(); |
|
256 |
} |
|
257 |
||
258 |
/*! |
|
259 |
* |
|
260 |
*/ |
|
261 |
bool RadioUiEngine::isUsingLoudspeaker() const |
|
262 |
{ |
|
263 |
Q_D( const RadioUiEngine ); |
|
264 |
return d->mEngineWrapper->isUsingLoudspeaker(); |
|
265 |
} |
|
266 |
||
267 |
/*! |
|
268 |
* Returns the selected radio region |
|
269 |
*/ |
|
270 |
RadioRegion::Region RadioUiEngine::region() const |
|
271 |
{ |
|
272 |
Q_D( const RadioUiEngine ); |
|
273 |
return d->mEngineWrapper->region(); |
|
274 |
} |
|
275 |
||
276 |
/*! |
|
277 |
* Returns the currently tuned frequency |
|
278 |
*/ |
|
279 |
uint RadioUiEngine::currentFrequency() const |
|
280 |
{ |
|
281 |
Q_D( const RadioUiEngine ); |
|
282 |
return d->mEngineWrapper->currentFrequency(); |
|
283 |
} |
|
284 |
||
285 |
/*! |
|
286 |
* Returns the minimum frequency |
|
287 |
*/ |
|
288 |
uint RadioUiEngine::minFrequency() const |
|
289 |
{ |
|
290 |
Q_D( const RadioUiEngine ); |
|
291 |
return d->mEngineWrapper->minFrequency(); |
|
292 |
} |
|
293 |
||
294 |
/*! |
|
295 |
* Returns the maximum frequency |
|
296 |
*/ |
|
297 |
uint RadioUiEngine::maxFrequency() const |
|
298 |
{ |
|
299 |
Q_D( const RadioUiEngine ); |
|
300 |
return d->mEngineWrapper->maxFrequency(); |
|
301 |
} |
|
302 |
||
303 |
/*! |
|
304 |
* Returns the frequency step size from the selected region |
|
305 |
*/ |
|
306 |
uint RadioUiEngine::frequencyStepSize() const |
|
307 |
{ |
|
308 |
Q_D( const RadioUiEngine ); |
|
309 |
return d->mEngineWrapper->frequencyStepSize(); |
|
310 |
} |
|
311 |
||
312 |
/*! |
|
313 |
* Sets the mute status |
|
314 |
*/ |
|
315 |
void RadioUiEngine::setMute( bool muted ) |
|
316 |
{ |
|
317 |
Q_D( RadioUiEngine ); |
|
318 |
d->mEngineWrapper->setMute( muted ); |
|
319 |
} |
|
320 |
||
321 |
/*! |
|
322 |
* |
|
323 |
*/ |
|
324 |
QList<RadioStation> RadioUiEngine::stationsInRange( uint minFrequency, uint maxFrequency ) |
|
325 |
{ |
|
326 |
Q_D( RadioUiEngine ); |
|
327 |
return d->mStationModel->stationsInRange( minFrequency, maxFrequency ); |
|
328 |
} |
|
329 |
||
330 |
/*! |
|
331 |
* |
|
332 |
*/ |
|
333 |
QString RadioUiEngine::genreToString( int genre, GenreTarget::Target target ) |
|
334 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
335 |
return RadioGenreLocalizer::genreToString( region(), genre, target ); |
24 | 336 |
} |
337 |
||
338 |
/*! |
|
339 |
* |
|
340 |
*/ |
|
341 |
bool RadioUiEngine::isSongRecognitionAppAvailable() |
|
342 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
343 |
//TODO: Implement Shazam support |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
344 |
return false; |
24 | 345 |
} |
346 |
||
347 |
/*! |
|
348 |
* |
|
349 |
*/ |
|
350 |
void RadioUiEngine::addRecognizedSong( const QString& artist, const QString& title, const RadioStation& station ) |
|
351 |
{ |
|
352 |
Q_D( RadioUiEngine ); |
|
353 |
d->mHistoryModel->addItem( artist, title, station ); |
|
354 |
} |
|
355 |
||
356 |
/*! |
|
357 |
* |
|
358 |
*/ |
|
359 |
uint RadioUiEngine::skipStation( StationSkip::Mode mode, uint startFrequency ) |
|
360 |
{ |
|
361 |
Q_D( RadioUiEngine ); |
|
362 |
return d->skip( mode, startFrequency ); |
|
363 |
} |
|
364 |
||
365 |
/*! |
|
366 |
* |
|
367 |
*/ |
|
368 |
void RadioUiEngine::openMusicStore( const RadioHistoryItem& item, MusicStore store ) |
|
369 |
{ |
|
370 |
Q_UNUSED( item ); |
|
371 |
Q_UNUSED( store ); |
|
372 |
//TODO: Integrate to music store |
|
373 |
} |
|
374 |
||
375 |
/*! |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
376 |
* Sets or unsets the engine to manual seek mode |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
377 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
378 |
void RadioUiEngine::setManualSeekMode( bool manualSeek ) |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
379 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
380 |
Q_D( RadioUiEngine ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
381 |
d->mEngineWrapper->setManualSeekMode( manualSeek ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
382 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
383 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
384 |
/*! |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
385 |
* Checks if the engine is in manual seek mode |
24 | 386 |
*/ |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
387 |
bool RadioUiEngine::isInManualSeekMode() const |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
388 |
{ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
389 |
Q_D( const RadioUiEngine ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
390 |
return d->mEngineWrapper->isInManualSeekMode(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
391 |
} |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
392 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
393 |
/*! |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
394 |
* Tunes the radio engine to given frequency |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
395 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
396 |
void RadioUiEngine::setFrequency( uint frequency, const int reason ) |
24 | 397 |
{ |
398 |
Q_D( RadioUiEngine ); |
|
399 |
if ( frequency != d->mStationModel->currentStation().frequency() && d->mEngineWrapper->isFrequencyValid( frequency ) ) { |
|
400 |
LOG_FORMAT( "RadioUiEngine::tuneFrequency, frequency: %d", frequency ); |
|
401 |
d->cancelSeeking(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
402 |
d->mEngineWrapper->setFrequency( frequency, reason ); |
24 | 403 |
} |
404 |
} |
|
405 |
||
406 |
/*! |
|
407 |
* Public slot |
|
408 |
* volume update command slot for the engine |
|
409 |
*/ |
|
410 |
void RadioUiEngine::setVolume( int volume ) |
|
411 |
{ |
|
412 |
Q_D( RadioUiEngine ); |
|
413 |
d->mEngineWrapper->setVolume( volume ); |
|
414 |
} |
|
415 |
||
416 |
/*! |
|
417 |
* Public slot |
|
418 |
* |
|
419 |
*/ |
|
420 |
void RadioUiEngine::toggleMute() |
|
421 |
{ |
|
422 |
Q_D( RadioUiEngine ); |
|
423 |
if ( !isScanning() ) { |
|
424 |
d->mEngineWrapper->setMute( !d->mEngineWrapper->isMuted() ); |
|
425 |
} |
|
426 |
} |
|
427 |
||
428 |
/*! |
|
429 |
* Public slot |
|
430 |
* |
|
431 |
*/ |
|
432 |
void RadioUiEngine::toggleAudioRoute() |
|
433 |
{ |
|
434 |
Q_D( RadioUiEngine ); |
|
435 |
d->mEngineWrapper->toggleAudioRoute(); |
|
436 |
} |
|
437 |
||
438 |
/*! |
|
439 |
* Public slot |
|
440 |
* |
|
441 |
*/ |
|
442 |
void RadioUiEngine::seekStation( int seekDirection ) |
|
443 |
{ |
|
444 |
if ( isAntennaAttached() ) { |
|
445 |
Q_D( RadioUiEngine ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
446 |
Seek::Direction direction = static_cast<Seek::Direction>( seekDirection ); |
24 | 447 |
emitSeekingStarted( direction ); |
448 |
d->mEngineWrapper->startSeeking( direction, TuneReason::Seek ); |
|
449 |
} |
|
450 |
} |
|
451 |
||
452 |
/*! |
|
453 |
* Public slot |
|
454 |
* |
|
455 |
*/ |
|
456 |
void RadioUiEngine::launchSongRecognition() |
|
457 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
458 |
//TODO: Implement Shazam support |
24 | 459 |
} |
460 |
||
461 |
/*! |
|
462 |
* Function used by the private implementation to emit a tunedToFrequency signal |
|
463 |
*/ |
|
464 |
void RadioUiEngine::emitTunedToFrequency( uint frequency, int commandSender ) |
|
465 |
{ |
|
466 |
emit tunedToFrequency( frequency, commandSender ); |
|
467 |
} |
|
468 |
||
469 |
/*! |
|
470 |
* Function used by the private implementation to emit a seekingStarted signal |
|
471 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
472 |
void RadioUiEngine::emitSeekingStarted( Seek::Direction direction ) |
24 | 473 |
{ |
474 |
emit seekingStarted( direction ); |
|
475 |
} |
|
476 |
||
477 |
/*! |
|
478 |
* Function used by the private implementation to emit a radioStatusChanged signal |
|
479 |
*/ |
|
480 |
void RadioUiEngine::emitRadioStatusChanged( bool radioIsOn ) |
|
481 |
{ |
|
482 |
emit radioStatusChanged( radioIsOn ); |
|
483 |
} |
|
484 |
||
485 |
/*! |
|
486 |
* Function used by the private implementation to emit a rdsAvailabilityChanged signal |
|
487 |
*/ |
|
488 |
void RadioUiEngine::emitRdsAvailabilityChanged( bool available ) |
|
489 |
{ |
|
490 |
emit rdsAvailabilityChanged( available ); |
|
491 |
} |
|
492 |
||
493 |
/*! |
|
494 |
* Function used by the private implementation to emit a volumeChanged signal |
|
495 |
*/ |
|
496 |
void RadioUiEngine::emitVolumeChanged( int volume ) |
|
497 |
{ |
|
498 |
emit volumeChanged( volume ); |
|
499 |
} |
|
500 |
||
501 |
/*! |
|
502 |
* Function used by the private implementation to emit a muteChanged signal |
|
503 |
*/ |
|
504 |
void RadioUiEngine::emitMuteChanged( bool muted ) |
|
505 |
{ |
|
506 |
emit muteChanged( muted ); |
|
507 |
} |
|
508 |
||
509 |
/*! |
|
510 |
* Function used by the private implementation to emit a audioRouteChanged signal |
|
511 |
*/ |
|
512 |
void RadioUiEngine::emitAudioRouteChanged( bool loudspeaker ) |
|
513 |
{ |
|
514 |
emit audioRouteChanged( loudspeaker ); |
|
515 |
} |
|
516 |
||
517 |
/*! |
|
518 |
* Function used by the private implementation to emit a antennaStatusChanged signal |
|
519 |
*/ |
|
520 |
void RadioUiEngine::emitAntennaStatusChanged( bool connected ) |
|
521 |
{ |
|
522 |
emit antennaStatusChanged( connected ); |
|
523 |
} |
|
524 |