LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StatusBarNotificationArea.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2010-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 STATUSBARNOTIFICATIONAREA_H
23 #define STATUSBARNOTIFICATIONAREA_H
24 
25 #include "StatusBar.h"
26 #include "StatusBarItem.h"
27 #include "StatusBarIcon.h"
28 #include "BannerMessageHandler.h"
29 #include "VariantAnimation.h"
30 
31 #include <QGraphicsObject>
32 #include <QPixmap>
33 
35 class DashboardWindow;
36 
37 
39 {
40  Q_OBJECT
41 
42 public:
45 
46  DashboardWindow* ownerWindow() const { return m_ownerWindow; }
47 
48 private:
49  void setVisible(bool visible);
50 
51  QPixmap m_iconImg;
52  DashboardWindow* m_ownerWindow;
53 };
54 
55 
56 
58  , public StatusBarIconContainer
59  , public BannerMessageView
60 {
61  Q_OBJECT
62 
63 public:
66 
67  int width() const { return m_bounds.width(); }
68  int height() const { return m_bounds.height(); }
69 
70  QRectF boundingRect() const; // This item is Right Aligned (The position of the icon is the position of the RIGHT EDGE of the bounding rect)
71 
72  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
73 
74  void init(DashboardWindowManager* dwm);
75 
76  void updateBoundingRect(bool forceRepaint=false);
77  void iconRemoved(StatusBarIcon* icon);
78 
79  void setMaxWidth(int maxWidth);
80  void setMaxHeight(int maxHeight);
81 
82  int maxWidth() { return m_maxWidth; }
83  int maxHeight() { return m_maxHeight; }
84 
85  bool handleBannerMsgTap();
86 
87  void registerBannerView() { m_bmHandler->registerView(this); }
88  void unregisterBannerView() { m_bmHandler->unregisterView (this); }
89 
90  int bmViewGetWidth() const;
91  int bmIsViewFullyExpanded() const;
92  void bmViewUpdated();
93  void bmViewMessageCountUpdated(int count);
94  void bmViewShowingNonSuppressibleMessage(bool showing);
95 
96  void bmViewAddActiveCallBanner(const std::string& msg, const std::string& icon, uint32_t time);
98  void bmViewUpdateActiveCallBanner(const std::string& msg, const std::string& icon, uint32_t time);
99 
100 
101 Q_SIGNALS:
102 
103  void signalNotificationArealVisibilityChanged(bool visible);
105 
106 private Q_SLOTS:
107  void slotDashboardWindowAdded(DashboardWindow* w);
108  void slotDashboardWindowsRemoved(DashboardWindow* w);
109 
110 private:
111 
112  void setIconsShown(bool shown);
113  void animValueChanged(const QVariant& value);
114  int m_maxWidth;
115  int m_maxHeight;
116  int m_croppedWidth;
117  DashboardWindowManager* m_dwm;
118  QVector<StatusBarNotificationIcon*> m_icons; // items order from right (0) to left
119 
120  QPixmap* m_arrowPix;
121  bool m_showArrow;
122 
123  BannerMessageHandler* m_bmHandler;
124  int m_bannerMsgCount;
125  typedef VariantAnimation<StatusBarNotificationArea> tIconsFadeAnim;
126  QPointer<tIconsFadeAnim> m_iconsAnimPtr;
127  qreal m_iconsOpacity;
128 
129 };
130 
131 
132 
133 #endif /* STATUSBARNOTIFICATIONAREA_H */