camerauis/cameraxui/cxui/inc/cxuistandby.h
changeset 19 d9aefe59d544
child 36 b12f3922a74f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/inc/cxuistandby.h	Fri Apr 16 14:51:30 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* 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 CXUISTANDBY_H
+#define CXUISTANDBY_H
+
+#include <QObject>
+
+// constants
+
+const int CXUI_STANDBY_CAMERA_TIMEOUT = 60000; // 60 seconds
+
+// forward declaration
+class HbDialog;
+class QTimer;
+class CxeEngine;
+class CxuiDocumentLoader;
+class CxuiCaptureKeyHandler;
+
+
+/*
+* class CxuiStandby continuously monitors for releasing camera when there are no user actions
+* for a specific time period. Timer is used to release the camera HW and switching to stanby mode
+* after a delay.Releasing the camera improves power efficiency, but creates additional latency
+* when returning to pre-capture view.
+*/
+class CxuiStandby : public QObject
+{
+    Q_OBJECT
+
+public:
+    CxuiStandby(CxuiCaptureKeyHandler &keyHandler, CxuiDocumentLoader *documentLoader, CxeEngine *engine);
+    ~CxuiStandby();
+
+signals:
+
+    /*
+    * signal to prepare for standby
+    */
+    void aboutToEnterStandby();
+
+    /*
+    * signal to prepare UI for exiting standby
+    */
+    void aboutToExitStandby();
+
+public slots:
+
+    /*
+    * starts standby timer
+    */
+    void startTimer();
+
+    /*
+    * stops standby timer
+    */
+    void stopTimer();
+
+    /*
+    * handles focus gain event
+    */
+    bool handleMouseEvent();
+
+private slots:
+
+    void dismissStandby();
+    void toStandby();
+
+private: // helper methods
+
+    bool proceedToStandy();
+    bool eventFilter(QObject *object, QEvent *event);
+
+private:
+
+    CxuiCaptureKeyHandler &mKeyHandler;
+    CxuiDocumentLoader *mDocumentLoader; // not own
+    CxeEngine *mEngine; // not own
+    HbDialog *mStandbyPopup;
+    QTimer *mStandbyTimer;
+    bool mStandbyDialogVisible;
+};
+
+#endif // CXUISTANDBY_H