qtinternetradio/ui/src/main.cpp
changeset 12 608f67c22514
parent 5 0930554dc389
child 14 896e9dbc5f19
equal deleted inserted replaced
11:f683e24efca3 12:608f67c22514
    16 */
    16 */
    17 
    17 
    18 #include <hbapplication.h>
    18 #include <hbapplication.h>
    19 #include <hbdevicemessagebox.h>
    19 #include <hbdevicemessagebox.h>
    20 #include <QLocalSocket>
    20 #include <QLocalSocket>
       
    21 #include <hbsplashscreen.h>
       
    22 #include <QSettings>
    21 
    23 
    22 #include "irviewmanager.h"
    24 #include "irviewmanager.h"
    23 #include "irapplication.h"
    25 #include "irapplication.h"
    24 #include "irmemorycollector.h"
    26 #include "irmemorycollector.h"
    25 #include "irqlogger.h"
    27 #include "irqlogger.h"
    26 #include "irqsystemeventhandler.h"
    28 #include "irqsystemeventhandler.h"
       
    29 #include "irqsettings.h"
       
    30 #include "irservicedef.h"
    27 
    31 
    28 #ifdef LOCALIZATION 
    32 #ifdef LOCALIZATION 
    29 #include <QTranslator> 
    33 #include <QTranslator> 
    30 void initLanguage(QTranslator*& aTranslator);
    34 void initLanguage(QTranslator*& aTranslator);
    31 #endif
    35 #endif
    32 
    36 
    33 bool isDiskSpaceLow(IRQSystemEventHandler* aEventHandler);
    37 bool isDiskSpaceLow(IRQSystemEventHandler* aEventHandler);
    34 bool isSecondInstance();
    38 bool isSecondInstance();
       
    39 void setSplashScreen();
       
    40 bool isSplashNowplaying();
    35 
    41 
    36 int main(int argc, char* argv[])
    42 int main(int argc, char* argv[])
    37 {
    43 {
    38     installLogDir();
    44     installLogDir();
    39     
    45     
    40     INSTALL_MESSAGE_HANDLER;
    46     INSTALL_MESSAGE_HANDLER;
       
    47     //the following is for splash screen, this must be placed 
       
    48     //before the creating of HbApplication
       
    49     setSplashScreen(); 
       
    50     
    41     HbApplication app(argc, argv);
    51     HbApplication app(argc, argv);
    42     
    52     
    43 #ifdef LOCALIZATION    
    53 #ifdef LOCALIZATION    
    44     QTranslator* translator = NULL;
    54     QTranslator* translator = NULL;
    45     initLanguage(translator);
    55     initLanguage(translator);
    46     Q_ASSERT( NULL != translator );
    56     Q_ASSERT( NULL != translator );
    47 #endif
    57 #endif
    48     
    58     
       
    59 #ifdef SUBTITLE_STR_BY_LOCID
    49     QCoreApplication::setApplicationName(hbTrId("txt_irad_title_internet_radio"));
    60     QCoreApplication::setApplicationName(hbTrId("txt_irad_title_internet_radio"));
       
    61 #else
       
    62     QCoreApplication::setApplicationName(hbTrId("Internet radio"));    
       
    63 #endif
    50     if (isSecondInstance())
    64     if (isSecondInstance())
    51     {
    65     {
    52         return 0;
    66         return 0;
    53     }
    67     }
    54     
    68     
    87 bool isDiskSpaceLow(IRQSystemEventHandler* aEventHandler)
   101 bool isDiskSpaceLow(IRQSystemEventHandler* aEventHandler)
    88 {     
   102 {     
    89     bool ret = aEventHandler->isBelowCriticalLevel();
   103     bool ret = aEventHandler->isBelowCriticalLevel();
    90     if(ret)
   104     if(ret)
    91     {
   105     {
    92         HbDeviceMessageBox messageBox(hbTrId("txt_irad_info_no_space_on_c_drive_internet_radio_closed"),
   106 #ifdef SUBTITLE_STR_BY_LOCID
       
   107         HbDeviceMessageBox messageBox(hbTrId("txt_irad_info_insufficient_disk_space"),
    93                 HbMessageBox::MessageTypeWarning);
   108                 HbMessageBox::MessageTypeWarning);
       
   109 #else
       
   110         HbDeviceMessageBox messageBox(hbTrId("Insufficient disk space"),
       
   111                 HbMessageBox::MessageTypeWarning);        
       
   112 #endif
    94         messageBox.setTimeout(HbPopup::NoTimeout);
   113         messageBox.setTimeout(HbPopup::NoTimeout);
    95         messageBox.exec();
   114         messageBox.exec();
    96     }
   115     }
    97     return ret;
   116     return ret;
    98 }
   117 }
   121     else
   140     else
   122     {
   141     {
   123         return false;
   142         return false;
   124     }
   143     }
   125 }
   144 }
       
   145 
       
   146 void setSplashScreen()
       
   147 {     
       
   148     if( isSplashNowplaying() )
       
   149     {
       
   150         HbSplashScreen::setScreenId("nowplaying_screen");
       
   151     }
       
   152     else
       
   153     {
       
   154         HbSplashScreen::setScreenId("normal_screen");
       
   155     }    
       
   156 }
       
   157 
       
   158 bool isSplashNowplaying()
       
   159 {
       
   160     QSettings settings(KIrSettingOrganization, KIrSettingApplication);
       
   161     return settings.value(KIrSettingSplashNowplaying,false).toBool();
       
   162 }
       
   163