12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
|
17 #include <hbtoolbar.h> |
17 #include <QPixmap> |
18 #include <QPixmap> |
18 #include <hbaction.h> |
19 #include <hbaction.h> |
19 #include <hblabel.h> |
20 #include <hblabel.h> |
20 #include <hbnotificationdialog.h> |
21 #include <hbnotificationdialog.h> |
|
22 #include <QSettings> |
|
23 |
|
24 #ifdef NOWPLAYING_VIEW_OPTION_B |
|
25 #include <hbframedrawer.h> |
|
26 #include <hbframeitem.h> |
|
27 #endif |
|
28 |
21 |
29 |
22 #include "irviewmanager.h" |
30 #include "irviewmanager.h" |
23 #include "irapplication.h" |
31 #include "irapplication.h" |
24 #include "irplaycontroller.h" |
32 #include "irplaycontroller.h" |
25 #include "irqisdsdatastructure.h" |
33 #include "irqisdsdatastructure.h" |
36 #include "irstationshare.h" |
44 #include "irstationshare.h" |
37 #include "irqutility.h" |
45 #include "irqutility.h" |
38 #include "irqlogger.h" |
46 #include "irqlogger.h" |
39 #include "irplaylist.h" |
47 #include "irplaylist.h" |
40 #include "irstationdetailsview.h" |
48 #include "irstationdetailsview.h" |
|
49 #include "irservicedef.h" |
41 |
50 |
42 #ifdef ADV_ENABLED |
51 #ifdef ADV_ENABLED |
43 #include <QTimer> |
52 #include <QTimer> |
44 #include <qgraphicssceneevent.h> |
53 #include <qgraphicssceneevent.h> |
45 static const QString KDefaultAdvLink(""); // default advertisement link |
54 static const QString KDefaultAdvLink(""); // default advertisement link |
48 const int KNowPlayingLogoSize = 300; // Now playing logo size |
57 const int KNowPlayingLogoSize = 300; // Now playing logo size |
49 static const QString KDefaultStationLogo("qtg_large_internet_radio"); |
58 static const QString KDefaultStationLogo("qtg_large_internet_radio"); |
50 static const QString KPlayButtonIcon("qtg_mono_play"); |
59 static const QString KPlayButtonIcon("qtg_mono_play"); |
51 static const QString KStopButtonIcon("qtg_mono_stop"); |
60 static const QString KStopButtonIcon("qtg_mono_stop"); |
52 |
61 |
|
62 #ifdef NOWPLAYING_VIEW_OPTION_B |
|
63 static const QString KLcdGraphics("qtg_fr_lcd"); |
|
64 #endif |
|
65 |
|
66 |
|
67 static void saveStationLogo(const QPixmap &aStationLogo); |
|
68 |
53 /* |
69 /* |
54 * Description : constructor |
70 * Description : constructor |
55 */ |
71 */ |
56 IRNowPlayingView::IRNowPlayingView(IRApplication* aApplication, TIRViewId aViewId) : |
72 IRNowPlayingView::IRNowPlayingView(IRApplication* aApplication, TIRViewId aViewId) : |
57 IRBaseView(aApplication, aViewId), |
73 IRBaseView(aApplication, aViewId), |
58 iStatisticsReporter(NULL), |
74 iStatisticsReporter(NULL), |
59 iNetworkController(NULL), |
75 iStationShare(NULL), |
60 iPlayStopAction(NULL), |
76 iPlayStopAction(NULL), |
61 iLaunchActionNeeded(false), |
77 iLaunchActionNeeded(false), |
62 iLogoDownloadState(EIdle), |
78 iLogoDownloadState(EIdle), |
63 iSongName(NULL), |
79 iSongName(NULL), |
64 iArtistName(NULL), |
80 iArtistName(NULL), |
78 //if this view is not starting view, finish all initialization in constructor |
94 //if this view is not starting view, finish all initialization in constructor |
79 if (getViewManager()->views().count() > 0) |
95 if (getViewManager()->views().count() > 0) |
80 { |
96 { |
81 normalInit(); |
97 normalInit(); |
82 } |
98 } |
|
99 |
|
100 setFlag(EViewFlag_StickyViewEnabled); |
83 } |
101 } |
84 |
102 |
85 /* |
103 /* |
86 * Description : destructor |
104 * Description : destructor |
87 */ |
105 */ |
88 IRNowPlayingView::~IRNowPlayingView() |
106 IRNowPlayingView::~IRNowPlayingView() |
89 { |
107 { |
90 if(iNetworkController) |
|
91 { |
|
92 iNetworkController->closeInstance(); |
|
93 } |
|
94 |
|
95 if (iStatisticsReporter) |
108 if (iStatisticsReporter) |
96 { |
109 { |
97 iStatisticsReporter->closeInstance(); |
110 iStatisticsReporter->closeInstance(); |
98 } |
111 } |
|
112 |
|
113 delete iStationShare; |
99 } |
114 } |
100 |
115 |
101 |
116 |
102 /* |
117 /* |
103 * Description: initializing. |
118 * Description: initializing. |
162 |
177 |
163 connect(musicStoreAction, SIGNAL(triggered()), this, SLOT(handleMusicStoreAction())); |
178 connect(musicStoreAction, SIGNAL(triggered()), this, SLOT(handleMusicStoreAction())); |
164 connect(iPlayStopAction, SIGNAL(triggered()), this, SLOT(handlePlayStopAction())); |
179 connect(iPlayStopAction, SIGNAL(triggered()), this, SLOT(handlePlayStopAction())); |
165 connect(add2FavAction, SIGNAL(triggered()), this, SLOT(handleAddToFavAction())); |
180 connect(add2FavAction, SIGNAL(triggered()), this, SLOT(handleAddToFavAction())); |
166 connect(flipAction, SIGNAL(triggered()), this, SLOT(handleDetailInfoAction())); |
181 connect(flipAction, SIGNAL(triggered()), this, SLOT(handleDetailInfoAction())); |
|
182 |
|
183 //could be removed after toolbar issue is ok |
|
184 HbToolBar *viewToolBar = toolBar(); |
|
185 viewToolBar->addAction(musicStoreAction); |
|
186 viewToolBar->addAction(iPlayStopAction); |
|
187 viewToolBar->addAction(add2FavAction); |
|
188 viewToolBar->addAction(flipAction); |
167 } |
189 } |
168 |
190 |
169 void IRNowPlayingView::initWidget() |
191 void IRNowPlayingView::initWidget() |
170 { |
192 { |
171 iStationLogo = qobject_cast<HbLabel *> (iLoader.findObject(NOW_PLAYING_VIEW_OBJECT_STATION_LOGO)); |
193 iStationLogo = qobject_cast<HbLabel *> (iLoader.findObject(NOW_PLAYING_VIEW_OBJECT_STATION_LOGO)); |
174 iStationName = qobject_cast<HbLabel *> (iLoader.findObject(NOW_PLAYING_VIEW_OBJECT_STATION_NAME)); |
196 iStationName = qobject_cast<HbLabel *> (iLoader.findObject(NOW_PLAYING_VIEW_OBJECT_STATION_NAME)); |
175 iStationLogo->setIcon(HbIcon(KDefaultStationLogo)); |
197 iStationLogo->setIcon(HbIcon(KDefaultStationLogo)); |
176 iStationName->setPlainText(""); |
198 iStationName->setPlainText(""); |
177 iSongName->setPlainText(""); |
199 iSongName->setPlainText(""); |
178 iArtistName->setPlainText(""); |
200 iArtistName->setPlainText(""); |
|
201 |
|
202 #ifdef NOWPLAYING_VIEW_OPTION_B |
|
203 HbWidget * viewContainer = qobject_cast<HbWidget *> (iLoader.findObject(VIEW_CONTAINER)); |
|
204 HbFrameDrawer* drawer = new HbFrameDrawer(KLcdGraphics, HbFrameDrawer::NinePieces); |
|
205 HbFrameItem* backgroundItem = new HbFrameItem(drawer, viewContainer); |
|
206 if (backgroundItem) |
|
207 { |
|
208 viewContainer->setBackgroundItem(backgroundItem); |
|
209 } |
|
210 #endif |
|
211 |
179 #ifdef ADV_ENABLED |
212 #ifdef ADV_ENABLED |
180 iAdvImage = qobject_cast<HbLabel *> (iLoader.findObject( NOW_PLAYING_VIEW_OBJECT_ADVERTISEMENT_IMAGE)); |
213 iAdvImage = qobject_cast<HbLabel *> (iLoader.findObject( NOW_PLAYING_VIEW_OBJECT_ADVERTISEMENT_IMAGE)); |
181 iAdvImage->setIcon(HbIcon(KDefaultStationLogo)); |
214 iAdvImage->setIcon(HbIcon(KDefaultStationLogo)); |
182 #endif |
215 #endif |
183 } |
216 } |
185 /* |
218 /* |
186 * Description : update station name and category according to the information in preset |
219 * Description : update station name and category according to the information in preset |
187 */ |
220 */ |
188 void IRNowPlayingView::updateWidgets() |
221 void IRNowPlayingView::updateWidgets() |
189 { |
222 { |
|
223 if (iLaunchActionNeeded) // if lunch as starting view, leave the update action to launchAction() |
|
224 { |
|
225 return; |
|
226 } |
|
227 |
190 if(iPlayController->getNowPlayingPreset()) |
228 if(iPlayController->getNowPlayingPreset()) |
191 { |
229 { |
192 iStationName->setPlainText(iPlayController->getNowPlayingPreset()->name); |
230 iStationName->setPlainText(iPlayController->getNowPlayingPreset()->name); |
193 } |
231 } |
|
232 loadStationLogo(); |
194 } |
233 } |
195 |
234 |
196 void IRNowPlayingView::updateMusicStoreStatus() |
235 void IRNowPlayingView::updateMusicStoreStatus() |
197 { |
236 { |
198 IRQPreset *preset = iPlayController->getNowPlayingPreset(); |
237 IRQPreset *preset = iPlayController->getNowPlayingPreset(); |
301 |
340 |
302 case EIR_ViewCommand_ACTIVATED: |
341 case EIR_ViewCommand_ACTIVATED: |
303 connect(iIsdsClient, SIGNAL(presetLogoDownloaded(IRQPreset* )), |
342 connect(iIsdsClient, SIGNAL(presetLogoDownloaded(IRQPreset* )), |
304 this, SLOT(handleLogoDownloaded(IRQPreset* ))); |
343 this, SLOT(handleLogoDownloaded(IRQPreset* ))); |
305 updateStationLogo(); |
344 updateStationLogo(); |
|
345 getViewManager()->saveScreenShot(); |
306 break; |
346 break; |
307 |
347 |
308 case EIR_ViewCommand_DEACTIVATE: |
348 case EIR_ViewCommand_DEACTIVATE: |
309 if( iLogoDownloadState != EIdle ) |
349 if( iLogoDownloadState != EIdle ) |
310 { |
350 { |
325 * Description : actions when view is launched. |
365 * Description : actions when view is launched. |
326 */ |
366 */ |
327 void IRNowPlayingView::launchAction() |
367 void IRNowPlayingView::launchAction() |
328 { |
368 { |
329 setUseNetworkReason(EIR_UseNetwork_StartingView); |
369 setUseNetworkReason(EIR_UseNetwork_StartingView); |
|
370 updateForLauchAction(); |
|
371 #ifdef HS_WIDGET_ENABLED |
|
372 iPlayController->setConnectingStationName(iStationName->plainText()); |
|
373 #endif |
330 iApplication->verifyNetworkConnectivity(); |
374 iApplication->verifyNetworkConnectivity(); |
331 getViewManager()->pushViewById(EIRView_MainView); |
375 getViewManager()->pushViewById(EIRView_MainView); |
|
376 iLaunchActionNeeded = false; |
|
377 } |
|
378 |
|
379 void IRNowPlayingView::lazyInit() |
|
380 { |
332 iLaunchActionNeeded = true; |
381 iLaunchActionNeeded = true; |
333 updateForLauchAction(); |
382 |
334 } |
|
335 |
|
336 void IRNowPlayingView::lazyInit() |
|
337 { |
|
338 if (!initCompleted()) |
383 if (!initCompleted()) |
339 { |
384 { |
340 normalInit(); |
385 normalInit(); |
341 |
386 |
342 //initization from handleCommand() |
387 //initization from handleCommand() |
350 if (!initCompleted()) |
395 if (!initCompleted()) |
351 { |
396 { |
352 IRBaseView::lazyInit(); |
397 IRBaseView::lazyInit(); |
353 |
398 |
354 iStatisticsReporter = IRQStatisticsReporter::openInstance(); |
399 iStatisticsReporter = IRQStatisticsReporter::openInstance(); |
355 iNetworkController = IRQNetworkController::openInstance(); |
|
356 |
400 |
357 connect(iPlayController, SIGNAL(metaDataAvailable(IRQMetaData*)), this, SLOT(updateMetaData(IRQMetaData*))); |
401 connect(iPlayController, SIGNAL(metaDataAvailable(IRQMetaData*)), this, SLOT(updateMetaData(IRQMetaData*))); |
358 connect(iPlayController, SIGNAL(playingStarted()), this, SLOT(handlePlayStarted())); |
402 connect(iPlayController, SIGNAL(playingStarted()), this, SLOT(handlePlayStarted())); |
359 connect(iPlayController, SIGNAL(playingStopped()), this, SLOT(handlePlayStopped())); |
403 connect(iPlayController, SIGNAL(playingStopped()), this, SLOT(handlePlayStopped())); |
360 |
404 |
379 if (playList && 1 == playList->getNumberOfEntries()) |
423 if (playList && 1 == playList->getNumberOfEntries()) |
380 { |
424 { |
381 IRQPreset *preset = playList->getPresetForEntry(0); |
425 IRQPreset *preset = playList->getPresetForEntry(0); |
382 iStationName->setPlainText(preset->name); |
426 iStationName->setPlainText(preset->name); |
383 iFindinNmsAllowed = (0 == preset->musicStoreStatus.compare("yes",Qt::CaseInsensitive)); |
427 iFindinNmsAllowed = (0 == preset->musicStoreStatus.compare("yes",Qt::CaseInsensitive)); |
|
428 #ifdef HS_WIDGET_ENABLED |
|
429 iPlayController->reloadNowplayingPreset(preset,false,EIRQAdhocExternal); |
|
430 #endif |
|
431 iStationLogo->setIcon(HbIcon(KDefaultStationLogo)); |
|
432 iLogoNeedUpdate = true; |
|
433 #ifdef ADV_ENABLED |
|
434 iAdvUrl = KDefaultAdvLink; |
|
435 iAdvImage->setIcon(logoHbIcon); |
|
436 iAdvImageNeedUpdate = true; |
|
437 #endif |
384 delete preset; |
438 delete preset; |
385 } |
439 } |
386 else |
440 else |
387 { |
441 { |
388 IRLastPlayedStationInfo *lastPlayedStationInfo = iApplication->getLastPlayedStationInfo(); |
442 IRLastPlayedStationInfo *lastPlayedStationInfo = iApplication->getLastPlayedStationInfo(); |
389 IRQPreset *lastPreset = lastPlayedStationInfo->getLastPlayedStation(); |
443 IRQPreset *lastPreset = lastPlayedStationInfo->getLastPlayedStation(); |
390 |
|
391 if (lastPreset) |
444 if (lastPreset) |
392 { |
445 { |
393 iStationName->setPlainText(lastPreset->name); |
446 iStationName->setPlainText(lastPreset->name); |
394 iFindinNmsAllowed = (0 == lastPreset->musicStoreStatus.compare("yes",Qt::CaseInsensitive)); |
447 iFindinNmsAllowed = (0 == lastPreset->musicStoreStatus.compare("yes",Qt::CaseInsensitive)); |
395 } |
448 } |
396 else |
449 else |
397 { |
450 { |
|
451 iStationName->setPlainText(QString("")); |
398 iFindinNmsAllowed = false; |
452 iFindinNmsAllowed = false; |
399 } |
453 } |
|
454 loadStationLogo(); |
400 } |
455 } |
401 } |
456 } |
402 |
457 |
403 /******************************************************************************************************** |
458 /******************************************************************************************************** |
404 * SLOTs for Logo Download |
459 * SLOTs for Logo Download |
435 const unsigned char * logoRawData = aPreset->logoData.Ptr(); |
490 const unsigned char * logoRawData = aPreset->logoData.Ptr(); |
436 QPixmap logoPixmap; |
491 QPixmap logoPixmap; |
437 if( logoPixmap.loadFromData(logoRawData, aPreset->logoData.Length()) ) |
492 if( logoPixmap.loadFromData(logoRawData, aPreset->logoData.Length()) ) |
438 { |
493 { |
439 if( EDownloadLogo == iLogoDownloadState ) |
494 if( EDownloadLogo == iLogoDownloadState ) |
440 { |
495 { |
|
496 saveStationLogo(logoPixmap); |
441 QPixmap newLogoPixmap = |
497 QPixmap newLogoPixmap = |
442 logoPixmap.scaled(QSize(KNowPlayingLogoSize,KNowPlayingLogoSize),Qt::KeepAspectRatio); |
498 logoPixmap.scaled(QSize(KNowPlayingLogoSize,KNowPlayingLogoSize),Qt::KeepAspectRatio); |
443 QIcon logoQIcon(newLogoPixmap); |
499 QIcon logoQIcon(newLogoPixmap); |
444 HbIcon logoHbIcon(logoQIcon); |
500 HbIcon logoHbIcon(logoQIcon); |
445 iStationLogo->setIcon(logoHbIcon); |
501 iStationLogo->setIcon(logoHbIcon); |
|
502 iPlayController->emitStationLogoUpdated(true); |
446 iLogoNeedUpdate = false; |
503 iLogoNeedUpdate = false; |
|
504 getViewManager()->saveScreenShot(); |
447 #ifdef ADV_ENABLED |
505 #ifdef ADV_ENABLED |
448 QTimer::singleShot(1, this, SLOT(updateAdvImage())); |
506 QTimer::singleShot(1, this, SLOT(updateAdvImage())); |
449 #endif |
507 #endif |
450 } |
508 } |
451 #ifdef ADV_ENABLED |
509 #ifdef ADV_ENABLED |
497 |
555 |
498 switch(aEvent) |
556 switch(aEvent) |
499 { |
557 { |
500 case EIRQNetworkConnectionEstablished: |
558 case EIRQNetworkConnectionEstablished: |
501 { |
559 { |
502 iApplication->closeConnectingDialog(); |
|
503 if( EIR_UseNetwork_StartingView == getUseNetworkReason() ) |
560 if( EIR_UseNetwork_StartingView == getUseNetworkReason() ) |
504 { |
561 { |
505 IRPlayList *playList = iApplication->getPlayList(); |
562 IRPlayList *playList = iApplication->getPlayList(); |
506 if (playList && 1 == playList->getNumberOfEntries()) |
563 if (playList && 1 == playList->getNumberOfEntries()) |
507 { |
564 { |
519 } |
576 } |
520 } |
577 } |
521 } |
578 } |
522 else if( EIR_UseNetwork_PlayStation == getUseNetworkReason() ) |
579 else if( EIR_UseNetwork_PlayStation == getUseNetworkReason() ) |
523 { |
580 { |
524 handlePlayStopAction(); |
581 iPlayController->resume(); |
525 } |
582 } |
526 setUseNetworkReason(EIR_UseNetwork_NoReason); |
|
527 break; |
583 break; |
528 } |
584 } |
529 |
|
530 case EIRQConnectingCancelled: |
|
531 case EIRQDisplayNetworkMessageNoConnectivity: |
|
532 { |
|
533 IRQPreset *preset = iPlayController->getNowPlayingPreset(); |
|
534 if( NULL == preset || preset->name == "" ) |
|
535 { |
|
536 getViewManager()->activateView(EIRView_MainView); |
|
537 } |
|
538 } |
|
539 break; |
|
540 |
|
541 default: |
585 default: |
542 break; |
586 break; |
543 } |
587 } |
|
588 |
|
589 setUseNetworkReason(EIR_UseNetwork_NoReason); |
544 } |
590 } |
545 |
591 |
546 /******************************************************************************************************** |
592 /******************************************************************************************************** |
547 * SLOT for Orientation Changed |
593 * SLOT for Orientation Changed |
548 ******************************************************************************************************* |
594 ******************************************************************************************************* |
550 |
596 |
551 void IRNowPlayingView::handleOrientationChanged(Qt::Orientation aOrientation) |
597 void IRNowPlayingView::handleOrientationChanged(Qt::Orientation aOrientation) |
552 { |
598 { |
553 if (aOrientation == Qt::Vertical) |
599 if (aOrientation == Qt::Vertical) |
554 { |
600 { |
555 iLoader.load(NOW_PLAYING_VIEW_LAYOUT_FILENAME, NOW_PLAYING_VIEW_PRT_SEC); |
601 iLoader.load(NOW_PLAYING_VIEW_LAYOUT_FILENAME, PORTRAIT_SEC); |
556 } |
602 } |
557 else |
603 else |
558 { |
604 { |
559 iLoader.load(NOW_PLAYING_VIEW_LAYOUT_FILENAME, NOW_PLAYING_VIEW_LSC_SEC); |
605 iLoader.load(NOW_PLAYING_VIEW_LAYOUT_FILENAME, LANDSCAPE_SEC); |
560 } |
606 } |
561 } |
607 } |
562 |
608 |
563 /******************************************************************************************************** |
609 /******************************************************************************************************** |
564 * SLOT for Play Controller |
610 * SLOT for Play Controller |
565 ******************************************************************************************************* |
611 ******************************************************************************************************* |
566 */ |
612 */ |
567 void IRNowPlayingView::handlePlayStarted() |
613 void IRNowPlayingView::handlePlayStarted() |
568 { |
614 { |
569 if(iLaunchActionNeeded) |
|
570 { |
|
571 iLaunchActionNeeded = false; |
|
572 updateStationLogo(); |
|
573 } |
|
574 iPlayStopAction->setIcon(HbIcon(KStopButtonIcon)); |
615 iPlayStopAction->setIcon(HbIcon(KStopButtonIcon)); |
575 } |
616 } |
576 |
617 |
577 void IRNowPlayingView::handlePlayStopped() |
618 void IRNowPlayingView::handlePlayStopped() |
578 { |
619 { |
579 iPlayStopAction->setIcon(HbIcon(KPlayButtonIcon)); |
620 iPlayStopAction->setIcon(HbIcon(KPlayButtonIcon)); |
580 iSongName->setPlainText(""); |
621 iSongName->setPlainText(""); |
581 iArtistName->setPlainText(""); |
622 iArtistName->setPlainText(""); |
582 iSongNameAvailable = false; |
623 iSongNameAvailable = false; |
583 |
|
584 if( this != getViewManager()->currentView() ) |
|
585 { |
|
586 iStationLogo->setIcon(HbIcon(KDefaultStationLogo)); |
|
587 iLogoNeedUpdate = true; |
|
588 #ifdef ADV_ENABLED |
|
589 iAdvUrl = KDefaultAdvLink; |
|
590 iAdvImage->setIcon(HbIcon(KDefaultStationLogo)); |
|
591 iAdvImageNeedUpdate = true; |
|
592 #endif |
|
593 } |
|
594 } |
624 } |
595 |
625 |
596 void IRNowPlayingView::updateMetaData(IRQMetaData* aMetaData) |
626 void IRNowPlayingView::updateMetaData(IRQMetaData* aMetaData) |
597 { |
627 { |
598 iSongNameAvailable = false; |
628 iSongNameAvailable = false; |
633 */ |
663 */ |
634 void IRNowPlayingView::handleMusicStoreAction() |
664 void IRNowPlayingView::handleMusicStoreAction() |
635 { |
665 { |
636 if(!iFindinNmsAllowed) |
666 if(!iFindinNmsAllowed) |
637 { |
667 { |
638 popupNote(hbTrId("txt_irad_info_disallowed_by_this_station"), HbMessageBox::MessageTypeInformation); |
668 #ifdef SUBTITLE_STR_BY_LOCID |
|
669 popupNote(hbTrId("txt_irad_info_not_allowed_by_this_station"), HbMessageBox::MessageTypeInformation); |
|
670 #else |
|
671 popupNote(hbTrId("Not allowed by this station"), HbMessageBox::MessageTypeInformation); |
|
672 #endif |
639 return; |
673 return; |
640 } |
674 } |
641 |
675 |
642 if(!iSongNameAvailable) |
676 if(!iSongNameAvailable) |
643 { |
677 { |
644 popupNote(hbTrId("txt_irad_info_no_song_info"), HbMessageBox::MessageTypeInformation); |
678 popupNote(hbTrId("txt_irad_info_no_song_info"), HbMessageBox::MessageTypeInformation); |
645 return; |
679 return; |
646 } |
680 } |
647 |
681 |
648 // Need to log the find song in NMS event, iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRFind,channelId); |
682 // Need to log the find song in NMS event, iStatisticsReporter->logNmsEvent(IRQStatisticsReporter::EIRFind,channelId); |
|
683 #ifdef SUBTITLE_STR_BY_LOCID |
649 popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation); |
684 popupNote(hbTrId("txt_irad_info_music_store_not_available"), HbMessageBox::MessageTypeInformation); |
|
685 #else |
|
686 popupNote(hbTrId("Music store not available"), HbMessageBox::MessageTypeInformation); |
|
687 #endif |
650 } |
688 } |
651 |
689 |
652 void IRNowPlayingView::handleIdentifySongAction() |
690 void IRNowPlayingView::handleIdentifySongAction() |
653 { |
691 { |
654 if(IRQUtility::openSongRecognition()) |
692 if(IRQUtility::openSongRecognition()) |
658 } |
696 } |
659 |
697 |
660 |
698 |
661 void IRNowPlayingView::handlePlayStopAction() |
699 void IRNowPlayingView::handlePlayStopAction() |
662 { |
700 { |
663 setUseNetworkReason(EIR_UseNetwork_PlayStation); |
701 switch (iPlayController->state()) |
664 if (false == iApplication->verifyNetworkConnectivity()) |
702 { |
665 { |
703 case IRPlayController::EPlaying: |
666 return; |
704 iPlayController->stop(EIRQUserTerminated); |
667 } |
705 return; |
668 setUseNetworkReason(EIR_UseNetwork_NoReason); |
706 |
669 |
707 case IRPlayController::EStopped: |
670 if (iPlayController->isPlaying()) |
708 setUseNetworkReason(EIR_UseNetwork_PlayStation); |
671 { |
709 break; |
672 iPlayController->stop(EIRQUserTerminated); |
710 |
673 } |
711 default: |
674 else |
712 return; |
675 { |
713 } |
|
714 |
|
715 |
|
716 #ifdef HS_WIDGET_ENABLED |
|
717 iPlayController->setConnectingStationName(iStationName->plainText()); |
|
718 #endif |
|
719 |
|
720 if (iApplication->verifyNetworkConnectivity()) |
|
721 { |
|
722 setUseNetworkReason(EIR_UseNetwork_NoReason); |
676 iPlayController->resume(); |
723 iPlayController->resume(); |
677 } |
724 } |
678 } |
725 } |
679 |
726 |
680 void IRNowPlayingView::handleAddToFavAction() |
727 void IRNowPlayingView::handleAddToFavAction() |
685 add2FavNote->setModal(true); |
732 add2FavNote->setModal(true); |
686 add2FavNote->setAttribute(Qt::WA_DeleteOnClose); |
733 add2FavNote->setAttribute(Qt::WA_DeleteOnClose); |
687 switch (retValue) |
734 switch (retValue) |
688 { |
735 { |
689 case EIRQErrorNone: |
736 case EIRQErrorNone: |
|
737 #ifdef SUBTITLE_STR_BY_LOCID |
690 add2FavNote->setTitle(hbTrId("txt_irad_info_added_to_favorites")); |
738 add2FavNote->setTitle(hbTrId("txt_irad_info_added_to_favorites")); |
|
739 #else |
|
740 add2FavNote->setTitle(hbTrId("Added to Favorites")); |
|
741 #endif |
691 //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); |
742 //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); |
692 add2FavNote->show(); |
743 add2FavNote->show(); |
693 break; |
744 break; |
694 |
745 |
695 case EIRQErrorOutOfMemory: |
746 case EIRQErrorOutOfMemory: |
|
747 #ifdef SUBTITLE_STR_BY_LOCID |
696 add2FavNote->setTitle(hbTrId("txt_irad_info_can_not_add_more")); |
748 add2FavNote->setTitle(hbTrId("txt_irad_info_can_not_add_more")); |
|
749 #else |
|
750 add2FavNote->setTitle(hbTrId("Can't add more")); |
|
751 #endif |
697 //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); |
752 //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); |
698 add2FavNote->show(); |
753 add2FavNote->show(); |
699 break; |
754 break; |
700 |
755 |
701 case EIRQErrorAlreadyExist: |
756 case EIRQErrorAlreadyExist: |
|
757 #ifdef SUBTITLE_STR_BY_LOCID |
702 add2FavNote->setTitle(hbTrId("txt_irad_info_favorite_updated")); |
758 add2FavNote->setTitle(hbTrId("txt_irad_info_favorite_updated")); |
|
759 #else |
|
760 add2FavNote->setTitle(hbTrId("Favorite updated")); |
|
761 #endif |
703 //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); |
762 //add2FavNote->setIcon(HbIcon( QString("qtg_large_ok"))); |
704 add2FavNote->show(); |
763 add2FavNote->show(); |
705 break; |
764 break; |
706 |
765 |
707 default: |
766 default: |
727 getViewManager()->activateView(EIRView_OpenWebAddressView); |
786 getViewManager()->activateView(EIRView_OpenWebAddressView); |
728 } |
787 } |
729 |
788 |
730 void IRNowPlayingView::handleShareStationAction() |
789 void IRNowPlayingView::handleShareStationAction() |
731 { |
790 { |
732 IRStationShare stationShare; |
791 if (NULL == iStationShare) |
733 stationShare.shareStations(*iPlayController->getNowPlayingPreset()); |
792 { |
|
793 iStationShare = new IRStationShare(); |
|
794 } |
|
795 iStationShare->shareStations(*iPlayController->getNowPlayingPreset()); |
734 } |
796 } |
735 |
797 |
736 void IRNowPlayingView::handleSettingAction() |
798 void IRNowPlayingView::handleSettingAction() |
737 { |
799 { |
738 getViewManager()->activateView(EIRView_SettingsView); |
800 getViewManager()->activateView(EIRView_SettingsView); |
754 { |
816 { |
755 IRQUtility::openAdvLink(iAdvUrl); |
817 IRQUtility::openAdvLink(iAdvUrl); |
756 } |
818 } |
757 #endif |
819 #endif |
758 |
820 |
|
821 void IRNowPlayingView::loadStationLogo() |
|
822 { |
|
823 if (iPlayController->isStationLogoAvailable()) |
|
824 { |
|
825 QSettings settings(KIrSettingOrganization, KIrSettingApplication); |
|
826 if (settings.value(KIrSettingStationLogo).canConvert<QPixmap>()) |
|
827 { |
|
828 QPixmap logoPixmap = settings.value(KIrSettingStationLogo).value<QPixmap>(); |
|
829 QPixmap newLogoPixmap = |
|
830 logoPixmap.scaled(QSize(KNowPlayingLogoSize,KNowPlayingLogoSize),Qt::KeepAspectRatio); |
|
831 QIcon logoQIcon(newLogoPixmap); |
|
832 HbIcon logoHbIcon(logoQIcon); |
|
833 iStationLogo->setIcon(logoHbIcon); |
|
834 iLogoNeedUpdate = false; |
|
835 #ifdef ADV_ENABLED |
|
836 iAdvUrl = iPlayController->getNowPlayingPreset()->advertisementUrl; |
|
837 iAdvImage->setIcon(logoHbIcon); |
|
838 iAdvImageNeedUpdate = false; |
|
839 #endif |
|
840 return; |
|
841 } |
|
842 } |
|
843 |
|
844 iStationLogo->setIcon(HbIcon(KDefaultStationLogo)); |
|
845 iLogoNeedUpdate = true; |
|
846 #ifdef ADV_ENABLED |
|
847 iAdvUrl = KDefaultAdvLink; |
|
848 iAdvImage->setIcon(logoHbIcon); |
|
849 iAdvImageNeedUpdate = true; |
|
850 #endif |
|
851 } |
|
852 |
|
853 void saveStationLogo(const QPixmap &aStationLogo) |
|
854 { |
|
855 QSettings settings(KIrSettingOrganization, KIrSettingApplication); |
|
856 QVariant logoData(QVariant::Pixmap); |
|
857 logoData.setValue(aStationLogo); |
|
858 settings.setValue(KIrSettingStationLogo,logoData); |
|
859 } |