LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StatusBarInfo.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 STATUSBARINFO_H
23 #define STATUSBARINFO_H
24 
25 #include "StatusBar.h"
26 #include "StatusBarItem.h"
27 #include "StatusBarIcon.h"
29 
30 #include <QGraphicsObject>
31 #include <QPixmap>
32 
33 
35 {
36  Q_OBJECT
37 
38 public:
41 
42  void loadImage(int index, std::string imgPath);
43  void selectImage(unsigned int index);
44  int selectedImageIndex() { return m_imgIndex; }
45 
46 private:
47 
48  QVector<QPixmap> m_images;
49  int m_imgIndex;
50 
51 };
52 
53 
55  , public StatusBarIconContainer
56 {
57  Q_OBJECT
58 
59 public:
62 
63  int width() const { return m_bounds.width(); }
64  int height() const { return m_bounds.height(); }
65 
66  QRectF boundingRect() const; // This item is Right Aligned (The position of the icon is the position of the RIGHT EDGE of the bounding rect)
67 
68  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
69 
70  void init();
71 
72  StatusBar::StatusBarType getType() { return m_type; }
73 
74  void setRSSI(bool shown, StatusBar::IndexRSSI index);
75  void setRSSI1x(bool shown, StatusBar::IndexRSSI1x index);
76  void setTTY(bool enabled);
77  void setHAC(bool enabled);
78  void setCallForward(bool enabled);
79  void setRoaming(bool enabled);
80  void setVpn(bool enabled);
81  void setWAN(bool shown, StatusBar::IndexWAN index);
82  void setBluetooth(bool shown, StatusBar::IndexBluetooth index);
83  void setWifi(bool shown, StatusBar::IndexWiFi index);
84  void setRotationLock(bool locked);
85  void setMute(bool muteOn);
86  void setAirplaneMode(bool airplaneModeOn);
87 
88  void updateBoundingRect(bool forceRepaint=false);
89 
90 private Q_SLOTS:
91  void slotRoamingIndicatorChanged();
92  void slotDualRssiEnabled();
93  void slotAirplaneModeState(t_airplaneModeState state);
94 private:
95  void updateItem(StatusBarInfoItem * item, bool shown, int index);
96  std::string getRoamingImageName(std::string roamingIndicatorName);
97 
99 
100  QVector<StatusBarInfoItem*> m_icons; // items order from right (0) to left
101 
102  StatusBarInfoItem *m_rssi;
103  StatusBarInfoItem *m_rssi1x;
104  StatusBarInfoItem *m_wan;
105  StatusBarInfoItem *m_bluetooth;
106  StatusBarInfoItem *m_wifi;
107  StatusBarInfoItem *m_tty;
108  StatusBarInfoItem *m_hac;
109  StatusBarInfoItem *m_callForward;
110  StatusBarInfoItem *m_roaming;
111  StatusBarInfoItem *m_vpn;
112  StatusBarInfoItem *m_rotationLock;
113  StatusBarInfoItem *m_mute;
114  StatusBarInfoItem *m_airplaneMode;
115 
116 };
117 
118 
119 
120 #endif /* STATUSBARINFO_H */