LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AlertWindow.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2008-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 ALERTWINDOW_H
23 #define ALERTWINDOW_H
24 
25 #include "Common.h"
26 
27 #include "sptr.h"
28 #include "Window.h"
29 #include "HostWindow.h"
30 #include <Event.h>
31 
32 class QGraphicsSceneMouseEvent;
33 
34 class SoundPlayer;
35 class PIpcMessage;
36 
37 class AlertWindow : public HostWindow
38 {
39 public:
40 
41  AlertWindow(WindowType::Type type, int width, int height, bool hasAlpha);
42  AlertWindow(WindowType::Type type, HostWindowData* window, IpcClientHost* clientHost=0);
43  virtual ~AlertWindow();
44 
45  virtual void onMessageReceived(const PIpcMessage& msg);
46  void onSetContentRect(int left, int right, int top, int bottom);
47 
48  void setSoundParams(const std::string& fileName, const std::string& soundClass);
49  void setContentRect(const QRect& r);
50  QRect contentRect() const; // 0,0 is top left corner
51 
52  void activate();
53  void deactivate();
54 
55  bool isIncomingCallAlert() const;
56 
57  void setTransient(bool transient) { m_isTransientAlert = transient; }
58  bool isTransientAlert() { return m_isTransientAlert; }
59 
60 protected:
61 
62  virtual void onUpdateWindowRegion(int x, int y, int w, int h);
63  virtual void onUpdateFullWindow();
64 
65  virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
66  virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
67  virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
68 
69 private:
70 
71  void extractSoundParams();
72 
76  void sendInputEvent(QGraphicsSceneMouseEvent* event, Event::Type type, int clickCount = 0);
77 
78  sptr<SoundPlayer> m_player;
79  std::string m_filePath;
80  std::string m_soundClass;
81  std::string m_setFilePath;
82  std::string m_setSoundClass;
83  QRect m_contentRect;
84  bool m_playedSound;
85  bool m_isTransientAlert;
86 };
87 
88 #endif /* ALERTWINDOW_H */