camerauis/cameraxui/cxui/inc/cxuiapplicationstate.h
branchRCL_3
changeset 24 bac7acad7cb3
parent 23 61bc0f252b2b
child 25 2c87b2808fd7
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
     1 /*
       
     2 * Copyright (c) 2010 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 #ifndef CXUIAPPLICATIONSTATE_H
       
    19 #define CXUIAPPLICATIONSTATE_H
       
    20 
       
    21 #include <QObject>
       
    22 #include "cxeerror.h"
       
    23 #include "cxuiapplicationframeworkmonitor.h"
       
    24 
       
    25 class CxuiApplication;
       
    26 class CxuiCaptureKeyHandler;
       
    27 class CxeSettings;
       
    28 class CxuiDocumentLoader;
       
    29 class CxuiErrorManager;
       
    30 class CxuiEventLog;
       
    31 
       
    32 
       
    33 /*!
       
    34 * @brief Class maintaining application overall state.
       
    35 */
       
    36 class CxuiApplicationState : public QObject
       
    37 {
       
    38     Q_OBJECT
       
    39     Q_ENUMS(State)
       
    40 
       
    41 public:
       
    42 
       
    43     enum State {
       
    44         Normal,
       
    45         Standby,
       
    46         Error,
       
    47         Background
       
    48     };
       
    49 
       
    50     CxuiApplicationState(CxuiApplication &application,
       
    51                          CxeSettings &settings,
       
    52                          CxuiDocumentLoader *documentLoader);
       
    53     ~CxuiApplicationState();
       
    54 
       
    55 
       
    56 public:
       
    57     State currentState() const;
       
    58 
       
    59 signals:
       
    60     void stateChanged(CxuiApplicationState::State newState,
       
    61                       CxuiApplicationState::State oldState);
       
    62 
       
    63 public slots:
       
    64     void startMonitoring();
       
    65     void handleApplicationError(CxeError::Id error);
       
    66     void enterStandby();
       
    67     void exitStandby();
       
    68 
       
    69 private slots:
       
    70     void handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState state);
       
    71     void handleUsbMassMemoryModeChanged(bool active);
       
    72     void handleBatteryEmpty();
       
    73     void handleSevereError();
       
    74     void handleErrorCleared();
       
    75 
       
    76 private:
       
    77     void setState(State newState);
       
    78     void checkErrors();
       
    79 
       
    80 private:
       
    81     State mState;
       
    82     CxuiApplicationFrameworkMonitor *mApplicationMonitor;
       
    83     CxuiErrorManager *mErrorManager;
       
    84     CxuiEventLog *mEventLog;
       
    85 };
       
    86 
       
    87 #endif // CXUIAPPLICATIONSTATE_H