22 #include <QLocalServer> |
22 #include <QLocalServer> |
23 #include <QLocalSocket> |
23 #include <QLocalSocket> |
24 #include <QFile> |
24 #include <QFile> |
25 #include <QTextStream> |
25 #include <QTextStream> |
26 #include <QDir> |
26 #include <QDir> |
27 #include <xqsharablefile.h> |
27 |
28 #include <xqserviceutil.h> |
28 #include <xqserviceutil.h> |
29 #include <hbiconitem.h> |
29 #include <hbiconitem.h> |
30 #include <hbiconanimator.h> |
30 #include <hbiconanimator.h> |
31 #include <hbiconanimationmanager.h> |
31 #include <hbiconanimationmanager.h> |
32 |
32 |
47 #include "irmediakeyobserver.h" |
47 #include "irmediakeyobserver.h" |
48 #include "ircategoryview.h" |
48 #include "ircategoryview.h" |
49 #include "irqlogger.h" |
49 #include "irqlogger.h" |
50 #include "iruidefines.h" |
50 #include "iruidefines.h" |
51 #include "irqsystemeventhandler.h" |
51 #include "irqsystemeventhandler.h" |
52 #include "irplaylist.h" |
|
53 #include "irabstractlistviewbase.h" |
52 #include "irabstractlistviewbase.h" |
54 |
53 #include "irfileviewservice.h" |
55 #define INTERNETRADIO_SERVICE_NAME "internet_radio_10_1.com.nokia.symbian.IFileView" |
|
56 /* |
54 /* |
57 * Description : constructor, initialize all data members |
55 * Description : constructor, initialize all data members |
58 * Parameters : aViewManager : pointer to the view manager object |
56 * Parameters : aViewManager : pointer to the view manager object |
59 * Return : None |
57 * Return : None |
60 */ |
58 */ |
61 IRApplication::IRApplication(IRViewManager* aViewManager, IRQSystemEventHandler* aSystemEventHandler): |
59 IRApplication::IRApplication(IRViewManager* aViewManager, IRQSystemEventHandler* aSystemEventHandler): |
62 XQServiceProvider(INTERNETRADIO_SERVICE_NAME), |
|
63 #ifdef _DEBUG |
60 #ifdef _DEBUG |
64 iTestPreferredBitrate(false), |
61 iTestPreferredBitrate(false), |
65 #endif |
62 #endif |
66 iViewManager(aViewManager), |
63 iViewManager(aViewManager), |
67 iStartingViewId(EIRView_CategoryView), |
64 iStartingViewId(EIRView_CategoryView), |
80 iLoadingNote(NULL), |
77 iLoadingNote(NULL), |
81 #ifdef LOCALIZATION |
78 #ifdef LOCALIZATION |
82 iTranslator(NULL), |
79 iTranslator(NULL), |
83 #endif |
80 #endif |
84 iSystemEventHandler(aSystemEventHandler), |
81 iSystemEventHandler(aSystemEventHandler), |
85 iPlayList(NULL), |
82 iLoadingAnimation(NULL), |
86 iLoadingAnimation(NULL) |
83 iFileViewService(NULL) |
87 |
84 |
88 { |
85 { |
89 LOG_METHOD; |
86 LOG_METHOD; |
90 if (XQServiceUtil::isService()) |
|
91 { |
|
92 //Publishes all public slots on this object |
|
93 publishAll(); |
|
94 } |
|
95 |
87 |
96 iViewManager->setApplication(this); |
88 iViewManager->setApplication(this); |
97 iInitEvent = static_cast<QEvent::Type>(QEvent::registerEventType()); |
89 iInitEvent = static_cast<QEvent::Type>(QEvent::registerEventType()); |
98 |
90 |
99 #ifdef _DEBUG |
91 #ifdef _DEBUG |
103 createComponents(); |
95 createComponents(); |
104 // get advertisement setting |
96 // get advertisement setting |
105 iSettings->getGlobalAdvFlag(iEnableGlobalAdv); |
97 iSettings->getGlobalAdvFlag(iEnableGlobalAdv); |
106 setupConnection(); |
98 setupConnection(); |
107 setLaunchView(); |
99 setLaunchView(); |
|
100 |
|
101 QString name = XQServiceUtil::interfaceName(); |
|
102 if (name == QString("com.nokia.symbian.IFileView")) |
|
103 { |
|
104 iFileViewService = new IRFileViewService(this); |
|
105 } |
108 } |
106 } |
109 |
107 |
110 /* |
108 /* |
111 * Description : destructor, destroy all data members |
109 * Description : destructor, destroy all data members |
112 * Parameters : None |
110 * Parameters : None |
296 IRQNetworkController* IRApplication::getNetworkController() |
295 IRQNetworkController* IRApplication::getNetworkController() |
297 { |
296 { |
298 if(NULL == iNetworkController) |
297 if(NULL == iNetworkController) |
299 { |
298 { |
300 iNetworkController = IRQNetworkController::openInstance(); |
299 iNetworkController = IRQNetworkController::openInstance(); |
|
300 connect(iNetworkController, SIGNAL(networkEventNotified(IRQNetworkEvent)), |
|
301 this, SLOT(networkEventNotified(IRQNetworkEvent))); |
301 } |
302 } |
302 return iNetworkController; |
303 return iNetworkController; |
303 } |
304 } |
304 |
305 |
305 /* |
306 /* |
389 void IRApplication::setTranslator(QTranslator* aTranslator) |
395 void IRApplication::setTranslator(QTranslator* aTranslator) |
390 { |
396 { |
391 iTranslator = aTranslator; |
397 iTranslator = aTranslator; |
392 } |
398 } |
393 #endif |
399 #endif |
394 |
|
395 void IRApplication::view(const QString &aFileName) |
|
396 { |
|
397 if (NULL == iPlayList) |
|
398 { |
|
399 iPlayList = new IRPlayList; |
|
400 } |
|
401 |
|
402 iPlayList->parseFile(aFileName); |
|
403 |
|
404 if (1 == iPlayList->getNumberOfEntries()) |
|
405 { |
|
406 launchStartingView(EIRView_PlayingView); |
|
407 } |
|
408 else if (iPlayList->getNumberOfEntries() > 1) |
|
409 { |
|
410 launchStartingView(EIRView_PlsView); |
|
411 } |
|
412 else |
|
413 { |
|
414 //normal launch, launch starting view |
|
415 TIRViewId viewId = EIRView_CategoryView; |
|
416 iSettings->getStartingViewId(viewId); |
|
417 launchStartingView(viewId); |
|
418 } |
|
419 } |
|
420 |
|
421 void IRApplication::view(const XQSharableFile &/*aSharableFile*/) |
|
422 { |
|
423 |
|
424 } |
|
425 |
400 |
426 /* |
401 /* |
427 * Description : create all the application level components, including network controller, |
402 * Description : create all the application level components, including network controller, |
428 * favorites db, isds client, play controller, etc |
403 * favorites db, isds client, play controller, etc |
429 * Parameters : None |
404 * Parameters : None |
609 |
584 |
610 void IRApplication::initApp() |
585 void IRApplication::initApp() |
611 { |
586 { |
612 getNetworkController(); |
587 getNetworkController(); |
613 |
588 |
614 connect(iNetworkController, SIGNAL(networkEventNotified(IRQNetworkEvent)), |
|
615 this, SLOT(networkEventNotified(IRQNetworkEvent))); |
|
616 |
|
617 IRBaseView *view = static_cast<IRBaseView*> (iViewManager->currentView()); |
589 IRBaseView *view = static_cast<IRBaseView*> (iViewManager->currentView()); |
618 if (view) |
590 if (view) |
619 { |
591 { |
620 view->lazyInit(); |
592 view->lazyInit(); |
621 view->launchAction(); |
593 view->launchAction(); |