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 CXUISTANDBY_H |
|
18 #define CXUISTANDBY_H |
|
19 |
|
20 #include <QObject> |
|
21 |
|
22 // constants |
|
23 |
|
24 const int CXUI_STANDBY_CAMERA_TIMEOUT = 60000; // 60 seconds |
|
25 |
|
26 // forward declaration |
|
27 class HbDialog; |
|
28 class QTimer; |
|
29 class CxeEngine; |
|
30 class CxuiDocumentLoader; |
|
31 class CxuiCaptureKeyHandler; |
|
32 |
|
33 |
|
34 /* |
|
35 * class CxuiStandby continuously monitors for releasing camera when there are no user actions |
|
36 * for a specific time period. Timer is used to release the camera HW and switching to stanby mode |
|
37 * after a delay.Releasing the camera improves power efficiency, but creates additional latency |
|
38 * when returning to pre-capture view. |
|
39 */ |
|
40 class CxuiStandby : public QObject |
|
41 { |
|
42 Q_OBJECT |
|
43 |
|
44 public: |
|
45 CxuiStandby(CxuiCaptureKeyHandler &keyHandler, CxuiDocumentLoader *documentLoader, CxeEngine *engine); |
|
46 ~CxuiStandby(); |
|
47 |
|
48 public: |
|
49 void allowDismiss(bool allow); |
|
50 bool isActive() const; |
|
51 |
|
52 signals: |
|
53 |
|
54 /* |
|
55 * signal to prepare for standby |
|
56 */ |
|
57 void aboutToEnterStandby(); |
|
58 |
|
59 /* |
|
60 * signal to prepare UI for exiting standby |
|
61 */ |
|
62 void aboutToExitStandby(); |
|
63 |
|
64 public slots: |
|
65 void startTimer(); |
|
66 void stopTimer(); |
|
67 bool handleMouseEvent(QEvent *event); |
|
68 void enterStandby(); |
|
69 void exitStandby(); |
|
70 |
|
71 private slots: |
|
72 |
|
73 void dismissStandby(); |
|
74 |
|
75 private: // helper methods |
|
76 |
|
77 bool proceedToStandy(); |
|
78 bool eventFilter(QObject *object, QEvent *event); |
|
79 |
|
80 private: |
|
81 |
|
82 CxuiCaptureKeyHandler &mKeyHandler; |
|
83 CxuiDocumentLoader *mDocumentLoader; // not own |
|
84 CxeEngine *mEngine; // not own |
|
85 HbDialog *mStandbyPopup; |
|
86 QTimer *mStandbyTimer; |
|
87 bool mStandbyDialogVisible; |
|
88 bool mAllowDismiss; |
|
89 }; |
|
90 |
|
91 #endif // CXUISTANDBY_H |
|