camerauis/cameraxui/cxui/inc/cxuiviewmanager.h
changeset 37 64817133cd1d
parent 36 b12f3922a74f
child 42 feebad15db8c
child 48 42ba2d16bf40
--- a/camerauis/cameraxui/cxui/inc/cxuiviewmanager.h	Wed Jun 23 17:59:54 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiviewmanager.h	Tue Jul 06 14:04:02 2010 +0300
@@ -24,8 +24,7 @@
 #include "cxeviewfindercontrol.h"
 #include "cxenamespace.h"
 #include "cxeerror.h"
-#include "cxuiapplicationframeworkmonitor.h"
-
+#include "cxuiapplicationstate.h"
 
 class QGraphicsSceneMouseEvent;
 class HbMainWindow;
@@ -38,8 +37,8 @@
 class CxeEngine;
 class CxuiDocumentLoader;
 class CxuiErrorManager; // class that handles all errors in ui.
-class CxuiStandby;
 class CxuiSceneModeView;
+class CxuiView;
 
 class CxuiViewManager : public QObject
 {
@@ -49,89 +48,65 @@
     CxuiViewManager(CxuiApplication &application, HbMainWindow &mainWindow, CxeEngine &engine);
     ~CxuiViewManager();
 
-    void prepareWindow();
+    CxuiDocumentLoader *documentLoader();
 
-    /**
-    * Get a pointer to the document loader instance.
-    */
-    CxuiDocumentLoader* documentLoader();
+    CxuiApplicationState &applicationState();
 
-    //@todo: Temporarily needed in main().
-    bool proceedStartup();
-
+    void initEngine();
 public slots:
     void changeToPostcaptureView();
     void changeToPrecaptureView();
     void switchCamera();
-    void createPostcaptureView();
     void showScenesView();
 
 private slots:
-    void startupCheck();
     void toForeground();
-    void handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState state);
-    void showUsbErrorPopup(bool show);
-    void handleBatteryEmpty();
-    void aboutToLooseFocus();
-    void aboutToGainFocus();
+    void handleApplicationStateChanged(CxuiApplicationState::State newState,
+                                       CxuiApplicationState::State oldState);
+    void startStandbyTimer();
+    void stopStandbyTimer();
 
 signals:
-    void focusGained();
-    void focusLost();
-    void batteryEmpty();
-    void disableStandbyTimer();
-    void startStandbyTimer();
+    void normalStateEntered();
+    void normalStateExited();
+    void standbyExitRequested();
 
 protected:
     bool eventFilter(QObject *object, QEvent *event);
 
 private:
+    CxuiView *currentView() const;
     void initStartupView();
-    void createStillPrecaptureView();
-    void createVideoPrecaptureView();
+    CxuiView *createView(const QString &viewName);
     CxuiPrecaptureView* getPrecaptureView(Cxe::CameraMode mode, Cxe::CameraIndex camera);
 
-    void createSceneModesView();
-
-    /*
-    * connects all necessary signals for precapture view
-    */
-    void connectPreCaptureSignals();
+    CxuiView *createSceneModesView();
 
-    /*
-    * disconnects signals
-    */
-    void disconnectSignals();
+    void connectSignals(QObject *view);
+    void disconnectSignals(QObject *view = NULL);
+    void connectPreCaptureSignals();
+    void connectPostCaptureSignals();
+    void connectSceneModeSignals();
+    void connectCaptureKeySignals();
 
-    /*
-    * connects all necessary signals for postcapture view
-    */
-    void connectPostCaptureSignals();
-
-
-    /*
-    * connects capture key handler signals to the current view.
-    */
-    void connectCaptureKeySignals();
+    void handleExitingNormalState();
+    void clearAllActivities();
 
 private:
 
     //data
     CxuiApplication &mApplication;
     HbMainWindow &mMainWindow;
-    CxuiStillPrecaptureView *mStillPrecaptureView;
-    CxuiVideoPrecaptureView *mVideoPrecaptureView;
-    CxuiPostcaptureView *mPostcaptureView;
+    QMap<QString, CxuiView*> mViews;
+    QMap<QString, QString> mDocmlFilesByView;
 
     CxeEngine &mEngine;
     CxuiCaptureKeyHandler *mKeyHandler;
-    CxuiApplicationFrameworkMonitor *mApplicationMonitor;
-
-private:
     CxuiDocumentLoader *mCameraDocumentLoader;
-    CxuiStandby *mStandbyHandler;
+    CxuiApplicationState *mApplicationState;
     CxuiErrorManager *mErrorManager;
     CxuiSceneModeView *mSceneModeView;
+    QTimer mStandbyTimer;
 };
 
 #endif // CXUIVIEWMANAGER_H