207 if (information.canConvert(QVariant::Int)) { |
207 if (information.canConvert(QVariant::Int)) { |
208 const int status = information.toInt(); |
208 const int status = information.toInt(); |
209 switch (status) { |
209 switch (status) { |
210 case RadioStatus::Playing: |
210 case RadioStatus::Playing: |
211 LOG("Playing"); |
211 LOG("Playing"); |
|
212 handleRadioStateChange(FmRadio::StateRunning); |
212 break; |
213 break; |
213 case RadioStatus::Muted: |
214 case RadioStatus::Muted: |
214 LOG("Muted"); |
215 LOG("Muted"); |
215 break; |
216 break; |
216 case RadioStatus::Seeking: |
217 case RadioStatus::Seeking: |
238 if (information.canConvert(QVariant::String)) { |
239 if (information.canConvert(QVariant::String)) { |
239 LOG_FORMAT("frequency: %s", GETSTRING(information.toString())); |
240 LOG_FORMAT("frequency: %s", GETSTRING(information.toString())); |
240 // TODO: Remove comment when localisation is working on device. |
241 // TODO: Remove comment when localisation is working on device. |
241 //frequencyString = hbTrId("txt_fmradiohswidget_rad_list_l1_mhz").arg(freqString); |
242 //frequencyString = hbTrId("txt_fmradiohswidget_rad_list_l1_mhz").arg(freqString); |
242 bool frequencyCleared = false; |
243 bool frequencyCleared = false; |
243 // If widget has some frequency information and new frequency |
244 |
244 // differs from that |
245 if (mRadioInformation.contains(Frequency)) { |
245 if (mRadioInformation.contains(Frequency) |
246 // Clear all infromation. |
246 && mRadioInformation[Frequency].compare(information.toString()) != 0) { |
|
247 // Clear all infromation from widget because station has changed. |
|
248 clearRadioInformation(); |
247 clearRadioInformation(); |
249 frequencyCleared = true; |
248 frequencyCleared = true; |
250 } |
249 } |
251 // If widget do not have any frquency information, update it. |
250 // If widget do not have any frquency information, update it. |
252 bool frequencyUpdated = updateRadioInformation(Frequency, |
251 bool frequencyUpdated = updateRadioInformation(Frequency, |
253 information.toString()); |
252 information.toString()); |
254 if (frequencyCleared || frequencyUpdated) { |
253 if (frequencyCleared || frequencyUpdated) { |
255 // Information changed, update the UI. |
254 // Information changed, update the UI. |
256 changeInRadioInformation(); |
255 changeInRadioInformation(); |
|
256 mFmRadioState = FmRadio::StateRunning; |
257 } |
257 } |
258 } |
258 } |
259 break; |
259 break; |
260 |
260 |
261 case RadioServiceNotification::Name: |
261 case RadioServiceNotification::Name: |
337 LOG("FmRadio::StateRunning"); |
337 LOG("FmRadio::StateRunning"); |
338 mFmRadioState = FmRadio::StateRunning; |
338 mFmRadioState = FmRadio::StateRunning; |
339 // Stop timer if it is running because radio is now running. |
339 // Stop timer if it is running because radio is now running. |
340 mRadioServiceClient->startMonitoring( |
340 mRadioServiceClient->startMonitoring( |
341 FmRadio::VisibiltyDoNotChange); |
341 FmRadio::VisibiltyDoNotChange); |
|
342 changeInRadioInformation(); |
342 changePowerButtonOn(true); |
343 changePowerButtonOn(true); |
343 enableStationButtons(); |
344 enableStationButtons(); |
344 changeInformationAreaLayout(OneRow); |
345 changeInformationAreaLayout(OneRow); |
345 break; |
346 break; |
346 case FmRadio::StateSeeking: |
347 case FmRadio::StateSeeking: |
347 LOG("FmRadio::StateSeeking"); |
348 LOG("FmRadio::StateSeeking"); |
348 mFmRadioState = FmRadio::StateSeeking; |
349 mFmRadioState = FmRadio::StateSeeking; |
349 mFavoriteStationCount = FAVORITE_STATION_COUNT_UNDEFINED; |
|
350 mCurrentStationIsFavorite = false; |
350 mCurrentStationIsFavorite = false; |
351 enableStationButtons(); |
351 enableStationButtons(); |
352 changeInformationAreaLayout(Animation); |
352 changeInformationAreaLayout(Animation); |
353 break; |
353 break; |
354 case FmRadio::StateAntennaNotConnected: |
354 case FmRadio::StateAntennaNotConnected: |
355 LOG("FmRadio::StateAntennaNotConnected"); |
355 LOG("FmRadio::StateAntennaNotConnected"); |
356 mFmRadioState = FmRadio::StateAntennaNotConnected; |
356 mFmRadioState = FmRadio::StateAntennaNotConnected; |
357 mFavoriteStationCount = FAVORITE_STATION_COUNT_UNDEFINED; |
|
358 mCurrentStationIsFavorite = false; |
357 mCurrentStationIsFavorite = false; |
359 enableStationButtons(); |
358 enableStationButtons(); |
360 mInformationFirstRowLabel->setPlainText(""); |
359 mInformationFirstRowLabel->setPlainText(""); |
361 mInformationSecondRowLabel->setPlainText(""); |
360 mInformationSecondRowLabel->setPlainText(""); |
362 mInformationLonelyRowLabel->setPlainText(hbTrId( |
361 mInformationLonelyRowLabel->setPlainText(hbTrId( |
907 Changes enabled state of station buttons. |
906 Changes enabled state of station buttons. |
908 */ |
907 */ |
909 void RadioHsWidget::enableStationButtons() |
908 void RadioHsWidget::enableStationButtons() |
910 { |
909 { |
911 LEVEL2(LOG_METHOD_ENTER); |
910 LEVEL2(LOG_METHOD_ENTER); |
912 if ((mFavoriteStationCount > 1) || (mFavoriteStationCount == 1 |
911 LOG_FORMAT("RadioHsWidget::enableStationButtons count: %d", mFavoriteStationCount); |
|
912 if (mFmRadioState == FmRadio::StateAntennaNotConnected){ |
|
913 changeButtonToDisabled(Next); |
|
914 changeButtonToDisabled(Previous); |
|
915 } |
|
916 else if ((mFavoriteStationCount > 1) || (mFavoriteStationCount == 1 |
913 && !mCurrentStationIsFavorite)) { |
917 && !mCurrentStationIsFavorite)) { |
914 changeButtonToEnabled(Next); |
918 changeButtonToEnabled(Next); |
915 changeButtonToEnabled(Previous); |
919 changeButtonToEnabled(Previous); |
916 } |
920 } |
917 else if ((mFavoriteStationCount == 1 && mCurrentStationIsFavorite) |
921 else if ((mFavoriteStationCount == 1 && mCurrentStationIsFavorite) |
1079 LOG_METHOD_ENTER; |
1083 LOG_METHOD_ENTER; |
1080 // This is true by default because we might not be in offline profile and |
1084 // This is true by default because we might not be in offline profile and |
1081 // starting the radio is allowed in other profiles without asking a |
1085 // starting the radio is allowed in other profiles without asking a |
1082 // permission. |
1086 // permission. |
1083 bool radioStartPermssion = true; |
1087 bool radioStartPermssion = true; |
1084 if (mProfileMonitor->isCurrentProfileOffline()) { |
1088 if (mProfileMonitor->isInOfflineMode()) { |
1085 // Device is in offline profile, ask the user for permission to start |
1089 // Device is in offline profile, ask the user for permission to start |
1086 HbDeviceMessageBox box(hbTrId( |
1090 HbDeviceMessageBox box(hbTrId( |
1087 "txt_fmradiohswidget_rad_info_activate_radio_in_offline_mode_hs"), |
1091 "txt_fmradiohswidget_rad_info_activate_radio_in_offline_mode_hs"), |
1088 HbMessageBox::MessageTypeQuestion); |
1092 HbMessageBox::MessageTypeQuestion); |
1089 box.setTimeout(HbPopup::NoTimeout); |
1093 box.setTimeout(HbPopup::NoTimeout); |