24 // User includes |
24 // User includes |
25 #include "fmradiohswidget.h" |
25 #include "fmradiohswidget.h" |
26 #include "fmradiohswidgetprocesshandler.h" |
26 #include "fmradiohswidgetprocesshandler.h" |
27 #include "fmradiohswidgetprofilereader.h" |
27 #include "fmradiohswidgetprofilereader.h" |
28 #include "fmradiohswidgetradioserviceclient.h" |
28 #include "fmradiohswidgetradioserviceclient.h" |
|
29 #include "radioservicedef.h" |
|
30 #include "radio_global.h" |
29 |
31 |
30 /*! |
32 /*! |
31 \ingroup group_fmradiohs_widget |
33 \ingroup group_fmradiohs_widget |
32 \class FmRadioHsWidget |
34 \class FmRadioHsWidget |
33 \brief Example implementation for home screen widget. |
35 \brief Example implementation for home screen widget. |
278 /param value Information content. |
282 /param value Information content. |
279 */ |
283 */ |
280 void FmRadioHsWidget::handleRadioInformationChange( |
284 void FmRadioHsWidget::handleRadioInformationChange( |
281 int notificationId, QVariant value) |
285 int notificationId, QVariant value) |
282 { |
286 { |
283 QString informationText; |
287 switch ( notificationId ) { |
284 if (value.canConvert(QVariant::String)) { |
288 |
285 informationText = value.toString(); |
289 case RadioServiceNotification::FavoriteCount: |
286 } else { |
290 break; |
287 return; |
291 |
288 } |
292 case RadioServiceNotification::Frequency: |
289 |
293 { |
290 switch (notificationId) { |
294 const uint frequency = value.toUInt(); |
291 /* |
295 QString freqString; |
292 Name = 0, |
296 freqString.sprintf( "%.1f", qreal( frequency ) / KFrequencyMultiplier ); |
293 Genre, |
297 if (updateRadioInformation( KRadioInformationFrequency, freqString )) { |
294 RadioText, |
298 radioInformationChanged(); |
295 Homepage, |
299 } |
296 Song |
300 } |
297 */ |
301 break; |
298 case 0: // Name |
302 |
299 if (updateRadioInformation(KRadioInformationStationName, |
303 case RadioServiceNotification::Name: |
300 informationText)) { |
304 if (updateRadioInformation( KRadioInformationStationName, value.toString() )) { |
301 radioInformationChanged(); |
305 radioInformationChanged(); |
302 } |
306 } |
303 break; |
307 break; |
|
308 |
304 /* case FmRadioHsWidgetRadioServiceClient::InformationTypeCallSign: |
309 /* case FmRadioHsWidgetRadioServiceClient::InformationTypeCallSign: |
305 if (updateRadioInformation(KRadioInformationCallSign, informationText)) { |
310 if (updateRadioInformation(KRadioInformationCallSign, informationText)) { |
306 |
311 |
307 } |
312 } |
308 break; |
313 break; |
310 if (updateRadioInformation(KRadioInformationFrequency, |
315 if (updateRadioInformation(KRadioInformationFrequency, |
311 informationText)) { |
316 informationText)) { |
312 |
317 |
313 } |
318 } |
314 break; |
319 break; |
315 */ case 2: // RadioText |
320 */ |
316 if (updateRadioInformation(KRadioInformationRt, informationText)) { |
321 case RadioServiceNotification::RadioText: |
317 radioInformationChanged(); |
322 if (updateRadioInformation( KRadioInformationRt, value.toString() )) { |
318 } |
323 radioInformationChanged(); |
319 break; |
324 } |
|
325 break; |
|
326 |
320 /* case FmRadioHsWidgetRadioServiceClient::InformationTypeDynamicPsName: |
327 /* case FmRadioHsWidgetRadioServiceClient::InformationTypeDynamicPsName: |
321 if (updateRadioInformation(KRadioInformationDynamicPsName, |
328 if (updateRadioInformation(KRadioInformationDynamicPsName, |
322 informationText)) { |
329 informationText)) { |
323 |
330 |
324 } |
331 } |
325 break; |
332 break; |
326 */ case 1: // Genre |
333 */ |
327 if (updateRadioInformation(KRadioInformationPty, informationText)) { |
334 case RadioServiceNotification::Genre: |
328 radioInformationChanged(); |
335 if (updateRadioInformation( KRadioInformationPty, value.toString() )) { |
329 } |
336 radioInformationChanged(); |
330 break; |
337 } |
|
338 break; |
|
339 |
|
340 case RadioServiceNotification::HomePage: |
|
341 break; |
|
342 |
|
343 case RadioServiceNotification::Song: |
|
344 break; |
|
345 |
331 default: |
346 default: |
332 break; |
347 break; |
333 } |
348 } |
334 } |
349 } |
335 |
350 |