qtinternetradio/ui/inc/irapplication.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 23 Jun 2010 18:04:00 +0300
changeset 11 f683e24efca3
parent 8 3b03c28289e6
child 12 608f67c22514
permissions -rw-r--r--
Revision: 201023 Kit: 2010125

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
#ifndef IRAPPLICATION_H
#define IRAPPLICATION_H

#include <QObject>
#include <QEvent>
#include <hbglobal.h>
#include <qpoint.h>

#include "irqevent.h"
#include "irviewdefinitions.h"

 

class IRViewManager;
class IRQIsdsClient;
class IRPlayController;     
class IRQSettings;
class IRMediaKeyObserver;
class IRLastPlayedStationInfo;
class IRQFavoritesDB;
class IRQNetworkController;
class IRQDiskSpaceWatcher;
class QLocalServer;
class IRQAdvClient;
class HbProgressDialog;
class IRQSystemEventHandler;
class IRPlayList;
class HbIconItem;
class IRFileViewService;

#ifdef LOCALIZATION
class QTranslator;
#endif

class IRApplication : public QObject
{
    Q_OBJECT
    
public:
    IRApplication(IRViewManager *aViewManager, IRQSystemEventHandler* aSystemEventHandler);    

    ~IRApplication();
    
    bool verifyNetworkConnectivity(const QString &aConnectingText = hbTrId("txt_common_info_loading"));
    
    void startLoadingAnimation(const QObject *aReceiver, const char *aFunc);  
    void startLoadingAnimation(const QPointF& aPos);
    void stopLoadingAnimation();
    
    IRViewManager* getViewManager() const;
    IRQNetworkController* getNetworkController();
    IRQIsdsClient* getIsdsClient();
    IRPlayController* getPlayController();
    IRLastPlayedStationInfo* getLastPlayedStationInfo();
    IRQFavoritesDB* getFavoritesDB();
    IRQSettings *   getSettings();
    IRMediaKeyObserver* getMediaKeyObserver();
    IRQAdvClient* getAdvClient(); 
    IRPlayList* getPlayList() const;
    
    void launchStartingView(TIRViewId aViewId);
    
#ifdef LOCALIZATION
    /*
     * this function will take ownership of the translator
     */
    void setTranslator(QTranslator* aTranslator);
#endif
	
    //from QObject
    bool event(QEvent* e);

#ifdef _DEBUG
public:
    bool iTestPreferredBitrate;
#endif
    
signals:
    void quit();

private slots:
    //connect to signal 'networkEventNotified' from IRQNetworkController
    void networkEventNotified(IRQNetworkEvent aEvent);
    void cancelConnect();
    void loadGenre();
    void newLocalSocketConnection();
    void handleDiskSpaceLow(qint64 aCriticalLevel);
    void handleTermsConsAccepted();
    void handleCallActivated();
    void handleCallDeactivated();
    void handleHeadsetConnected();
    void handleHeadsetDisconnected();
    
private:
    void createComponents();
    void destroyComponents();
    void setupConnection();
    void setLaunchView();
    void startSystemEventMonitor();
    void initApp();
    void setExitingView();
    void getLoadingAnimation();
    
    TIRHandleResult handleConnectionEstablished();
    
    void startLocalServer();
    bool eventFilter(QObject *object, QEvent *event);
    
#ifdef _DEBUG
    void readConfiguration();
#endif

private:
    IRViewManager* iViewManager;
    
    TIRViewId   iStartingViewId;
    
    IRQNetworkController* iNetworkController;
    
    IRQIsdsClient* iIsdsClient;
    
    IRPlayController* iPlayController;
    
    IRQFavoritesDB* iFavPresets;
    
    IRQSettings      *iSettings;

    IRMediaKeyObserver *iMediaKeyObserver;

    IRLastPlayedStationInfo *iLastPlayedStationInfo;
    
    IRQAdvClient *iAdvertisementClient;   

    bool iEnableGlobalAdv;

    bool iDisconnected;

    bool iConnectingCanceled;

    QEvent::Type iInitEvent;

    QString iConnectingText;
    
    QLocalServer *iLocalServer;
    
    HbProgressDialog *iLoadingNote;
    
#ifdef LOCALIZATION
    QTranslator  *iTranslator;
#endif
    
    IRQSystemEventHandler *iSystemEventHandler;
    
    HbIconItem          *iLoadingAnimation;    
    IRFileViewService *iFileViewService;
};

#endif