qtinternetradio/ui/src/main.cpp
changeset 0 09774dfdd46b
child 3 ee64f059b8e1
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <hbapplication.h>
       
    19 #include <hbdevicemessagebox.h>
       
    20 #include "irviewmanager.h"
       
    21 #include "irapplication.h"
       
    22 #include "irqdiskspacewatcher.h"
       
    23 #include "irmemorycollector.h"
       
    24 #include "irsymbianapplication.h"
       
    25 #include "irqlogger.h"
       
    26 
       
    27 bool isDiskSpaceLow();
       
    28 
       
    29 int main(int argc, char* argv[])
       
    30 {
       
    31     INSTALL_MESSAGE_HANDLER;
       
    32     
       
    33     QCoreApplication::setApplicationName("InternetRadioApplication");
       
    34     HbApplication app(newS60Application, argc, argv);
       
    35     if (IRSymbianApplication::getInstance()->getInstanceFlag())
       
    36     {
       
    37         return 0;
       
    38     }
       
    39     
       
    40     if(isDiskSpaceLow())
       
    41     {       
       
    42         return 0;
       
    43     }  
       
    44 
       
    45     IRViewManager *mainWindow = new IRViewManager;
       
    46     
       
    47     mainWindow->show();
       
    48     
       
    49     //when constructing irapp, OpenFileL() has already been called
       
    50     IRApplication *irapp = new IRApplication(mainWindow);
       
    51     
       
    52     IRMemoryCollector mc(irapp);
       
    53     
       
    54     if(!mainWindow->isExiting())
       
    55     {
       
    56         return app.exec();
       
    57     }
       
    58 	return 0;
       
    59 }
       
    60 
       
    61 bool isDiskSpaceLow()
       
    62 {
       
    63     IRQDiskSpaceWatcher diskSpaceWatcher;
       
    64     bool ret = diskSpaceWatcher.isBelowCriticalLevel();
       
    65     if(ret)
       
    66     {
       
    67         HbDeviceMessageBox messageBox(hbTrId("txt_irad_info_no_space_on_c_drive_internet_radio_closed"),
       
    68                 HbMessageBox::MessageTypeWarning);
       
    69         messageBox.setTimeout(HbPopup::NoTimeout);
       
    70         messageBox.exec();
       
    71     }
       
    72     return ret;
       
    73 }
       
    74