camerauis/cameraxui/cxui/inc/cxuiviewmanager.h
changeset 19 d9aefe59d544
child 21 fa6d9f75d6a6
equal deleted inserted replaced
3:8b2d6d0384b0 19:d9aefe59d544
       
     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 #ifndef CXUIVIEWMANAGER_H
       
    18 #define CXUIVIEWMANAGER_H
       
    19 
       
    20 #include <QObject>
       
    21 #include <QTimer>
       
    22 #include <QList>
       
    23 
       
    24 #include "cxeviewfindercontrol.h"
       
    25 #include "cxenamespace.h"
       
    26 #include "cxeerror.h"
       
    27 
       
    28 class QGraphicsSceneMouseEvent;
       
    29 class CxuiCaptureKeyHandler;
       
    30 class XQSettingsManager;
       
    31 class XQSettingsKey;
       
    32 class HbMainWindow;
       
    33 
       
    34 class CxuiPrecaptureView;
       
    35 class CxuiStillPrecaptureView;
       
    36 class CxuiStillPrecaptureView2;
       
    37 class CxuiVideoPrecaptureView;
       
    38 class CxuiVideoPrecaptureView2;
       
    39 class CxuiPostcaptureView;
       
    40 class CxeEngine;
       
    41 class CxuiDocumentLoader;
       
    42 class CxuiErrorManager; // class that handles all errors in ui.
       
    43 class CxuiStandby;
       
    44 
       
    45 class CxuiViewManager : public QObject
       
    46 {
       
    47     Q_OBJECT
       
    48 
       
    49 public:
       
    50     CxuiViewManager(HbMainWindow &mainWindow, CxeEngine &engine, CxuiCaptureKeyHandler &keyHandler);
       
    51     ~CxuiViewManager();
       
    52 
       
    53     void prepareWindow();
       
    54 
       
    55     /**
       
    56     * Get a pointer to the document loader instance.
       
    57     */
       
    58     CxuiDocumentLoader* documentLoader();
       
    59 
       
    60 public slots:
       
    61     void changeToPostcaptureView();
       
    62     void changeToPrecaptureView();
       
    63 
       
    64     /**
       
    65      * Switch camera from primary to secondary or vise versa.
       
    66      */
       
    67     void switchCamera();
       
    68 
       
    69     /**
       
    70      * Event monitor can be used to monitor changes in cenrep and PS values.
       
    71      */
       
    72     void eventMonitor(const XQSettingsKey& key, const QVariant& value);
       
    73 
       
    74     void createPostcaptureView();
       
    75 
       
    76 private slots:
       
    77     void aboutToLooseFocus();
       
    78     void aboutToGainFocus();
       
    79 
       
    80 signals:
       
    81     void focusGained();
       
    82     void focusLost();
       
    83     void batteryEmpty();
       
    84 
       
    85 protected:
       
    86     bool eventFilter(QObject *object, QEvent *event);
       
    87 
       
    88 private:
       
    89     void startEventMonitors();
       
    90     void createStillPrecaptureView();
       
    91     void createStillPrecaptureView2();
       
    92     void createVideoPrecaptureView();
       
    93     void createVideoPrecaptureView2();
       
    94     CxuiPrecaptureView* getPrecaptureView(Cxe::CameraMode mode, Cxe::CameraIndex camera);
       
    95 
       
    96     /*
       
    97     * connects all necessary signals for precapture view
       
    98     */
       
    99     void connectPreCaptureSignals();
       
   100 
       
   101     /*
       
   102     * disconnects signals
       
   103     */
       
   104     void disconnectSignals();
       
   105 
       
   106     /*
       
   107     * connects all necessary signals for postcapture view
       
   108     */
       
   109     void connectPostCaptureSignals();
       
   110 
       
   111 
       
   112     /*
       
   113     * connects capture key handler signals to the current view.
       
   114     */
       
   115     void connectCaptureKeySignals();
       
   116 
       
   117 private:
       
   118 
       
   119     //data
       
   120     HbMainWindow &mMainWindow;
       
   121     CxuiStillPrecaptureView *mStillPrecaptureView;
       
   122     CxuiVideoPrecaptureView *mVideoPrecaptureView;
       
   123     CxuiPostcaptureView *mPostcaptureView;
       
   124 
       
   125     CxuiStillPrecaptureView2 *mStillPrecaptureView2;
       
   126     CxuiVideoPrecaptureView2 *mVideoPrecaptureView2;
       
   127 
       
   128     CxeEngine &mEngine;
       
   129     CxuiCaptureKeyHandler &mKeyHandler;
       
   130 
       
   131 private:
       
   132     XQSettingsManager *mSettingsManager;
       
   133     int mKeyLockState; //! @todo: Needed due to Settings manager error: valueChanged is emmitted with same value repeatedly
       
   134     int mBatteryStatus;
       
   135     bool mFocused;
       
   136     CxuiDocumentLoader *mCameraDocumentLoader;
       
   137     CxuiStandby *mStandbyHandler;
       
   138     CxuiErrorManager *mErrorManager;
       
   139 };
       
   140 
       
   141 #endif // CXUIVIEWMANAGER_H