camerauis/cameraxui/cxui/inc/cxuiapplicationstate.h
changeset 41 67457b2ffb33
child 42 feebad15db8c
equal deleted inserted replaced
40:2922f70fca82 41:67457b2ffb33
       
     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                          CxuiCaptureKeyHandler &keyHandler,
       
    53                          CxuiDocumentLoader *documentLoader);
       
    54     ~CxuiApplicationState();
       
    55 
       
    56 
       
    57 public:
       
    58     State currentState() const;
       
    59 
       
    60 signals:
       
    61     void stateChanged(CxuiApplicationState::State newState,
       
    62                       CxuiApplicationState::State oldState);
       
    63 
       
    64 public slots:
       
    65     void startMonitoring();
       
    66     void handleApplicationError(CxeError::Id error);
       
    67     void enterStandby();
       
    68     void exitStandby();
       
    69 
       
    70 private slots:
       
    71     void handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState state);
       
    72     void handleUsbMassMemoryModeChanged(bool active);
       
    73     void handleBatteryEmpty();
       
    74     void handleSevereError();
       
    75     void handleErrorCleared();
       
    76 
       
    77 private:
       
    78     void setState(State newState);
       
    79     void checkErrors();
       
    80 
       
    81 private:
       
    82     State mState;
       
    83     CxuiApplicationFrameworkMonitor *mApplicationMonitor;
       
    84     CxuiErrorManager *mErrorManager;
       
    85     CxuiEventLog *mEventLog;
       
    86 };
       
    87 
       
    88 #endif // CXUIAPPLICATIONSTATE_H