LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CoreNaviManager.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2009-2012 Hewlett-Packard Development Company, L.P.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * LICENSE@@@ */
18 
19 
20 
21 
22 #ifndef __CORENAVIMANAGER_H__
23 #define __CORENAVIMANAGER_H__
24 
25 #include "Common.h"
26 
27 #include "HostBase.h"
28 #include "CoreNaviLeds.h"
29 #include "DisplayManager.h"
30 #include "SystemUiController.h"
31 #include "AmbientLightSensor.h"
32 
33 #include <QObject>
34 #include <QEvent>
35 
36 class CoreNaviManager : public QObject
37 {
38  Q_OBJECT
39 
40 public:
41 
42  static CoreNaviManager* instance ();
43 
45 
46  bool handleEvent(sptr<Event> e);
47  bool handleEvent(QEvent *event);
48 
49  /* these are for led patterns when the display is off */
50  void addStandbyRequest (const std::string& appId, const std::string& requestId);
51  void removeStandbyRequest (const std::string& appId, const std::string& requestId);
52  void clearStandbyRequests (const std::string& appId);
54  int numStandbyRequests() const;
55 
56  void updateBrightness (int brightness);
57  void setSubtleLightbar (bool enable);
58 
59  bool isSubtleLightbar() const { return m_isSubtleLightbar; }
60 
61  /* timer function */
62  bool restoreLightbar();
63  bool seesawLightbar();
64  bool swipeLeftLightbar();
65  bool swipeRightLightbar();
66 
67 private Q_SLOTS:
68 
69  void slotDisplayStateChange (int displayState);
70  void slotLockStateChange (int lockState, int displayEvent);
71  void slotCardWindowMinimized();
72  void slotCardWindowMaximized();
73  void slotFocusMaximizedCardWindow(bool enable);
74 
75 private:
76 
78 
79  static CoreNaviManager* m_instance; /* singleton instance */
80 
81  void setMetaGlow(bool enable);
82  bool useLightbar();
83 
84  void renderGesture(int key);
85  void renderGestureOnLightbar(int key);
86 
87  bool m_centerGlow;
88  bool m_allGlow;
89  int m_brightness;
90  bool m_isSubtleLightbar;
91  int m_subtleModeBrightness;
92  int m_animationSpeed;
93 
94  bool m_metaKeyDown;
95  Timer<CoreNaviManager> m_lightbarRestoreTimer;
96  Timer<CoreNaviManager> m_lightbarHoldTimer;
97  Timer<CoreNaviManager> m_lightbarSwipeLeftTimer;
98  Timer<CoreNaviManager> m_lightbarSwipeRightTimer;
99 
100  CoreNaviLeds* m_leds;
101  DisplayManager* m_displayManager;
102  AmbientLightSensor* m_ambientLightSensor;
103  SystemUiController* m_systemUiController;
104 
105  bool m_hasLightBar; // this means no core navi button
106  int m_lightbarMaxBrightness;
107  int m_lightbarDimBrightness;
108  int m_lightbarDarkBrightness;
109 
110  void lightbarOn (int brightness = -1);
111  void lightbarOff();
112 
113  // throbber related functionality
114  struct LedRequest {
115  std::string appId;
116  std::string requestId;
117  // const int priority;
118 
119  LedRequest (const std::string& appId, const std::string& requestId);
120  };
121 
122  void stopStandbyLeds();
123  void startStandbyLeds();
124 
125  typedef std::list<LedRequest> LedRequestList;
126  LedRequestList m_ledRequestList;
127 
128  bool m_isStandbyLedsActive;
129 
130  int m_throbberBrightness;
131  float m_throbberDimBrightness;
132 };
133 
134 #endif
135