radioapp/radioapplication/src/radioapplication.cpp
changeset 33 11b6825f0862
parent 32 189d20c34778
child 37 451b2e1545b2
child 41 3a6b55c6390c
equal deleted inserted replaced
32:189d20c34778 33:11b6825f0862
    17 
    17 
    18 // System includes
    18 // System includes
    19 #include <QTimer>
    19 #include <QTimer>
    20 #include <qsysteminfo.h>
    20 #include <qsysteminfo.h>
    21 #include <HbDeviceMessageBox>
    21 #include <HbDeviceMessageBox>
       
    22 #include <xqserviceutil.h>
       
    23 #include <HbSplashScreen>
    22 
    24 
    23 // User includes
    25 // User includes
    24 #include "radioapplication.h"
    26 #include "radioapplication.h"
    25 #include "radiowindow.h"
    27 #include "radiowindow.h"
    26 #include "radiouiengine.h"
    28 #include "radiouiengine.h"
    51     INIT_COMBINED_LOGGER
    53     INIT_COMBINED_LOGGER
    52 
    54 
    53     LOG_TIMESTAMP( "Start radio" );
    55     LOG_TIMESTAMP( "Start radio" );
    54     setApplicationName( hbTrId( "txt_rad_title_fm_radio" ) );
    56     setApplicationName( hbTrId( "txt_rad_title_fm_radio" ) );
    55 
    57 
       
    58     if ( !XQServiceUtil::isService() ) {
       
    59         HbSplashScreen::start();
       
    60     }
       
    61 
    56     QTimer::singleShot( 0, this, SLOT(init()) );
    62     QTimer::singleShot( 0, this, SLOT(init()) );
    57 }
    63 }
    58 
    64 
    59 /*!
    65 /*!
    60  *
    66  *
    71  *
    77  *
    72  */
    78  */
    73 void RadioApplication::init()
    79 void RadioApplication::init()
    74 {
    80 {
    75     // If started as a service, there is no need for offline-check
    81     // If started as a service, there is no need for offline-check
    76     const Hb::ActivationReason reason = activateReason();
    82     bool okToStart = XQServiceUtil::isService();
    77     bool okToStart = reason == Hb::ActivationReasonService;
       
    78     QScopedPointer<QtMobility::QSystemDeviceInfo> deviceInfo( new QtMobility::QSystemDeviceInfo() );
    83     QScopedPointer<QtMobility::QSystemDeviceInfo> deviceInfo( new QtMobility::QSystemDeviceInfo() );
    79 
    84 
    80     if ( !okToStart ) {
    85     if ( !okToStart ) {
    81         if ( deviceInfo->currentProfile() != QtMobility::QSystemDeviceInfo::OfflineProfile ) {
    86         if ( deviceInfo->currentProfile() != QtMobility::QSystemDeviceInfo::OfflineProfile ) {
    82             okToStart = true;
    87             okToStart = true;
    89         }
    94         }
    90     }
    95     }
    91 
    96 
    92     if ( okToStart ) {
    97     if ( okToStart ) {
    93 
    98 
    94         // MainWindow needs to be alive to be able to show the offline query dialog.
    99         // Try to optimize startup time by launching the radio server process as soon as possible.
    95         // The window is only constructed half-way at this point because we may need to shut down if
   100         // This way the server and UI are being initialized at the same time and the startup is faster.
    96         // offline usage is not allowed
   101 //        RadioUiEngine::launchRadioServer();
       
   102 
    97         mMainWindow.reset( new RadioWindow() );
   103         mMainWindow.reset( new RadioWindow() );
    98 
   104 
    99         CREATE_WIN32_TEST_WINDOW
   105         CREATE_WIN32_TEST_WINDOW
   100 
   106 
   101         INIT_WIN32_TEST_WINDOW
   107         INIT_WIN32_TEST_WINDOW