LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StatusBar.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 STATUSBAR_H
23 #define STATUSBAR_H
24 
25 #include "Window.h"
26 #include <QPointer>
27 #include <QGraphicsObject>
28 #include "VariantAnimation.h"
29 #include "CustomEvents.h"
30 
31 #define MAX_NOTIF_ICONS 10
32 #define NOTIF_ICON_WIDTH 24 // $$$ constant width??
33 #define ARROW_SPACING 7
34 
35 #define kMaxTitleLength 60
36 
37 #define kStatusBarQtLetterSpacing 90
38 
39 class StatusBarClock;
40 class StatusBarBattery;
41 class StatusBarTitle;
43 class StatusBarInfo;
45 class StatusBarItemGroup;
46 
47 class StatusBar : public QGraphicsObject
48 {
49  Q_OBJECT
50 
51 public:
52 
58  };
59 
60  // Info Items Index Enumerations
61  enum IndexRSSI {
62  RSSI_0 = 0,
70  RSSI_EV_0, // these EV values are only used for dual-RSSI (China)
76  };
77 
78  // 1x RSSI values for Dual RSSI only
79  enum IndexRSSI1x {
80  RSSI_1X_0 = 0,
86  };
87 
88  enum IndexWAN {
89  WAN_OFF = 0,
101  };
102 
108  };
109 
110  enum IndexWiFi {
111  WIFI_OFF = 0,
117  };
118 
119  StatusBar(StatusBarType type, int width, int height);
120  virtual ~StatusBar();
121 
122  void init();
123 
124  QRectF boundingRect() const { return m_bounds; }
125  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
126 
127  void resize(int w, int h);
128 
129  bool sceneEvent (QEvent* event);
130 
131  StatusBarType getType() { return m_type; }
132 
133  void setMaximizedAppTitle(bool appMaximized, const char* title = 0, const unsigned int customColor = 0, bool appTitleActionable = true);
134  void setBarOpaque(bool opaque);
135  void setCarrierText(const char* carrierTxt);
136  void setRssiShown(bool shown);
137 
138  void setNotificationWindowOpen(bool open);
139  void setSystemMenuOpen(bool open);
140  void setDockModeAppMenuOpen(bool open);
141 
143 
144 Q_SIGNALS:
145  void signalDashboardAreaRightEdgeOffset(int rightOffset);
146  void signalSystemMenuStateChanged(bool opened);
147  void signalDockModeMenuStateChanged(bool opened);
148 
149 private Q_SLOTS:
150  void slotTimeFormatChanged(const char* format);
151  void slotPhoneTypeUpdated();
152  void slotCarrierTextChanged(const char* text);
153  void slotRssiIndexChanged(bool show, StatusBar::IndexRSSI index);
154  void slotRssi1xIndexChanged(bool show, StatusBar::IndexRSSI1x index); // for dual RSSI only
155  void slotTTYStateChanged(bool enabled);
156  void slotHACStateChanged(bool enabled);
157  void slotCallForwardStateChanged(bool enabled);
158  void slotRoamingStateChanged(bool enabled);
159  void slotVpnStateChanged(bool enabled);
160  void slotWanIndexChanged(bool show, StatusBar::IndexWAN index);
161  void slotBluetoothIndexChanged(bool show, StatusBar::IndexBluetooth index);
162  void slotWifiIndexChanged(bool show, StatusBar::IndexWiFi index);
163  void slotRotationLockChanged(OrientationEvent::Orientation rotationLock);
164  void slotMuteSoundChanged(bool muteOn);
165  void slotChildBoundingRectChanged();
166  void slotNotificationArealVisibilityChanged(bool visible);
167  void slotBannerMessageActivated();
168  void slotNotificationMenuAction(bool active);
169  void slotSystemMenuMenuAction(bool active);
170  void slotAppMenuMenuAction(bool active);
171  void slotBannerActivated();
172  void slotBannerDeactivated();
173  void slotMenuGroupActivated(StatusBarItemGroup* group);
174  void slotDockModeStatusChanged(bool enabled);
175 
176 private:
177 
178  void setBackgroundColor(bool custom, QColor color=Qt::black);
179 
180  void layout();
181  void fadeAnimValueChanged(const QVariant& value);
182  void colorAnimValueChanged(const QVariant& value);
183 
184  void fadeBar(bool in);
185 
186  QRect m_bounds;
187  StatusBarType m_type;
188 
189  static QColor s_defaultColor;
190 
191  bool m_showRssiIndicators;
192  bool m_rssiShown;
193  bool m_rssi1xShown;
194  StatusBar::IndexRSSI m_rssiIndex;
195  StatusBar::IndexRSSI1x m_rssi1xIndex;
196 
197  StatusBarClock* m_clock;
198  StatusBarBattery* m_battery;
199  StatusBarTitle* m_title;
200  StatusBarInfo* m_infoItems;
201  StatusBarNotificationArea* m_notif;
202 
203  StatusBarItemGroup* m_systemUiGroup;
204  StatusBarItemGroup* m_titleGroup;
205  StatusBarItemGroup* m_notifGroup;
206 
207  StatusBarServicesConnector* m_svcConnector;
208 
209  bool m_platformHasPhoneRadio;
210  std::string m_carrierText;
211  std::string m_appTitle;
212  bool m_appMaximized;
213  bool m_forceOpaque;
214  bool m_showAppTitle;
215 
216  QPixmap* m_bkgPixmap;
217  QColor m_barColor, m_curColor, m_newColor;
218  qreal m_bkgOpacity;
219 
220  typedef VariantAnimation<StatusBar> tStatusBarAnim;
221  QPointer<tStatusBarAnim> m_fadeAnimPtr;
222  QPointer<tStatusBarAnim> m_colorAnimPtr;
223 };
224 
225 
226 
227 #endif /* STATUSBAR_H */