2 * Copyright 2013 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 * Nick Dedekind <nick.dedekind@canonical.com>
21import Ubuntu.Components 0.1
22import Unity.Indicators 0.1 as Indicators
24Indicators.IndicatorWidget {
27 width: networkIcon.width + units.gu(1)
29 property int signalStrength: 0
30 property int connectionState: 0
34 objectName: "itemImage"
35 source: get_icon_for_signal(connectionState, signalStrength)
37 height: indicatorWidget.iconSize
38 width: indicatorWidget.iconSize
40 verticalCenter: parent.verticalCenter
41 horizontalCenter: parent.horizontalCenter
45 function parseRootElement(type, data) {
46 if (type == "com.canonical.indicator.root.network")
51 onActionStateChanged: {
52 if (action == undefined || !action.valid) {
56 if (action.state == undefined) {
61 connectionState = action.state[1];
62 if (connectionState == 2) {
63 signalStrength = action.state[2];
68 id: activation_animation
69 target: indicatorWidget
70 property: "signalStrength"
73 duration: 2500 // 5 states in 2.5 seconds
74 loops: Animation.Infinite
80 when: connectionState > 3 || connectionState < 1
81 PropertyChanges { target: activation_animation; running: false }
85 when: connectionState == 1
86 PropertyChanges { target: activation_animation; running: true }
90 when: connectionState == 2
91 PropertyChanges { target: activation_animation; running: false }
95 when: connectionState == 3
96 PropertyChanges { target: activation_animation; running: true }
101 function get_icon_for_signal(con_state, value) {
102 if (con_state >= 1 && con_state <= 3) {
104 return "image://gicon/nm-signal-00";
105 } else if (value <= 25) {
106 return "image://gicon/nm-signal-25";
107 } else if (value <= 50) {
108 return "image://gicon/nm-signal-50";
109 } else if (value <= 75) {
110 return "image://gicon/nm-signal-75";
112 return "image://gicon/nm-signal-100";
114 return "image://gicon/wifi-none";
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list