LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EmergencyWindowManager.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 EMERGENCYWINDOWMANAGER_H
23 #define EMERGENCYWINDOWMANAGER_H
24 
25 #include "Common.h"
26 
27 #include "WindowManagerBase.h"
28 #include "GraphicsItemContainer.h"
29 
30 #include <QGraphicsPixmapItem>
31 #include <QGraphicsSceneMouseEvent>
32 #include <QPointer>
33 #include <QPropertyAnimation>
34 
36 {
37  Q_OBJECT
38 
39 public:
40 
41  EmergencyWindowManager(int maxWidth, int maxHeight);
42  virtual ~EmergencyWindowManager();
43 
44  virtual void addWindow(Window* win);
45  virtual void removeWindow(Window* win);
46  virtual void focusWindow(Window* win);
47 
48  bool okToResize();
49  void resize(int width, int height);
50 
51  virtual bool handleNavigationEvent(QKeyEvent* keyEvent, bool& propogate);
52 
53 protected:
54 
55  // eat up events if the window is active
56  virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
57  virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event);
58 
59  virtual bool sceneEvent(QEvent* event);
60 
61 private Q_SLOTS:
62 
63  void slotPositiveSpaceChanged(const QRect& r);
64  void slotIncomingPhoneCall();
65  void fadeAnimationFinished();
66  void slotHomeButtonPressed();
67  void slotEmergencyModeWindowFocusChange(bool enable);
68  void slotUiRotationCompleted();
69 private:
70 
71  virtual void init();
72 
73  void positionCornerWindows();
74  void showCornerWindows();
75  void hideCornerWindows();
76 
77  bool emergencyWindowBeingDeleted() const;
78 
79 private:
80 
81  Window* m_emergencyWindow;
82  QGraphicsPixmapItem* m_corners[4];
83  GraphicsItemContainer* m_cornerContainer;
84  QRectF m_winRect;
85  QPointer<QPropertyAnimation> m_opacityAnimPtr;
86 };
87 
88 #endif /* EMERGENCYWINDOWMANAGER_H */