on xenial help sign in
renamed IndicatorIcon -> IndicatorWidget. javascript ;
d4bcf25Nick Dedekind
Panel/Indicators/DatetimeIndicatorPage.qml+5−5
@@ -83,11 +83,11 @@ Flickable {
83 }
83 }
84
84
85 function updateTime() {
85 function updateTime() {
86− var dt = new Date()
86+ var dt = new Date();
87− var time = Qt.formatTime(dt)
87+ var time = Qt.formatTime(dt);
88− var space = time.indexOf(" ")
88+ var space = time.indexOf(" ");
89− timeLabel.text = time.substr(0, space > 0 ? space : 5)
89+ timeLabel.text = time.substr(0, space > 0 ? space : 5);
90− dateLabel.text = Qt.formatDateTime(dt, "dddd,\ndd MMMM")
90+ dateLabel.text = Qt.formatDateTime(dt, "dddd,\ndd MMMM");
91 }
91 }
92
92
93 // Make it compatible with the PluginItem interface
93 // Make it compatible with the PluginItem interface
Panel/Indicators/DatetimeIndicatorWidget.qml+6−6
@@ -21,8 +21,8 @@ import QtQuick 2.0
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import Unity.Indicators 0.1 as Indicators
22import Unity.Indicators 0.1 as Indicators
23
23
24−Indicators.IndicatorIcon {
24+Indicators.IndicatorWidget {
25− id: indicatorIcon
25+ id: indicatorWidget
26
26
27 width: timeLabel.width + units.gu(1)
27 width: timeLabel.width + units.gu(1)
28
28
@@ -42,7 +42,7 @@ Indicators.IndicatorIcon {
42 Timer {
42 Timer {
43 id: timer
43 id: timer
44 interval: 1000 * 10
44 interval: 1000 * 10
45− running: indicatorIcon.visible
45+ running: indicatorWidget.visible
46 repeat: true
46 repeat: true
47 triggeredOnStart: true
47 triggeredOnStart: true
48 property date dateNow
48 property date dateNow
@@ -52,14 +52,14 @@ Indicators.IndicatorIcon {
52
52
53 onActionStateChanged: {
53 onActionStateChanged: {
54 if (action == undefined || !action.valid) {
54 if (action == undefined || !action.valid) {
55− return
55+ return;
56 }
56 }
57
57
58 if (action.state == undefined) {
58 if (action.state == undefined) {
59 visible = false;
59 visible = false;
60− return
60+ return;
61 }
61 }
62
62
63− indicatorIcon.visible = action.state[3]
63+ indicatorWidget.visible = action.state[3];
64 }
64 }
65}
65}
Panel/Indicators/DefaultIndicatorWidget.qml+8−8
@@ -21,8 +21,8 @@ import QtQuick 2.0
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import Unity.Indicators 0.1 as Indicators
22import Unity.Indicators 0.1 as Indicators
23
23
24−Indicators.IndicatorIcon {
24+Indicators.IndicatorWidget {
25− id: indicatorIcon
25+ id: indicatorWidget
26
26
27 width: itemRow.width + units.gu(1)
27 width: itemRow.width + units.gu(1)
28
28
@@ -43,8 +43,8 @@ Indicators.IndicatorIcon {
43 id: itemImage
43 id: itemImage
44 objectName: "itemImage"
44 objectName: "itemImage"
45 visible: source != ""
45 visible: source != ""
46− height: indicatorIcon.iconSize
46+ height: indicatorWidget.iconSize
47− width: indicatorIcon.iconSize
47+ width: indicatorWidget.iconSize
48 anchors.verticalCenter: parent.verticalCenter
48 anchors.verticalCenter: parent.verticalCenter
49 }
49 }
50
50
@@ -62,16 +62,16 @@ Indicators.IndicatorIcon {
62
62
63 onActionStateChanged: {
63 onActionStateChanged: {
64 if (action == undefined || !action.valid) {
64 if (action == undefined || !action.valid) {
65− return
65+ return;
66 }
66 }
67
67
68 if (action.state == undefined) {
68 if (action.state == undefined) {
69 label = "";
69 label = "";
70 iconSource = "";
70 iconSource = "";
71− return
71+ return;
72 }
72 }
73
73
74− label = action.state[Indicators.ActionState.Label]
74+ label = action.state[Indicators.ActionState.Label];
75− iconSource = "image://gicon/" + action.state[Indicators.ActionState.IconSource]
75+ iconSource = "image://gicon/" + action.state[Indicators.ActionState.IconSource];
76 }
76 }
77}
77}
Panel/Indicators/NetworkIndicatorPage.qml+5−5
@@ -63,18 +63,18 @@ PageStack {
63
63
64 function start()
64 function start()
65 {
65 {
66− push(_mainPage)
66+ push(_mainPage);
67− _pluginItem.start()
67+ _pluginItem.start();
68 }
68 }
69
69
70 function stop()
70 function stop()
71 {
71 {
72− clear()
72+ clear();
73− _pluginItem.stop()
73+ _pluginItem.stop();
74 }
74 }
75
75
76 function reset()
76 function reset()
77 {
77 {
78− _pluginItem.reset()
78+ _pluginItem.reset();
79 }
79 }
80}
80}
Panel/Indicators/NetworkIndicatorWidget.qml+18−18
@@ -21,8 +21,8 @@ import QtQuick 2.0
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import Unity.Indicators 0.1 as Indicators
22import Unity.Indicators 0.1 as Indicators
23
23
24−Indicators.IndicatorIcon {
24+Indicators.IndicatorWidget {
25− id: indicatorIcon
25+ id: indicatorWidget
26
26
27 width: networkIcon.width + units.gu(1)
27 width: networkIcon.width + units.gu(1)
28
28
@@ -34,8 +34,8 @@ Indicators.IndicatorIcon {
34 objectName: "itemImage"
34 objectName: "itemImage"
35 source: get_icon_for_signal(connectionState, signalStrength)
35 source: get_icon_for_signal(connectionState, signalStrength)
36 visible: source != ""
36 visible: source != ""
37− height: indicatorIcon.iconSize
37+ height: indicatorWidget.iconSize
38− width: indicatorIcon.iconSize
38+ width: indicatorWidget.iconSize
39 anchors {
39 anchors {
40 verticalCenter: parent.verticalCenter
40 verticalCenter: parent.verticalCenter
41 horizontalCenter: parent.horizontalCenter
41 horizontalCenter: parent.horizontalCenter
@@ -44,29 +44,29 @@ Indicators.IndicatorIcon {
44
44
45 function parseRootElement(type, data) {
45 function parseRootElement(type, data) {
46 if (type == "com.canonical.indicator.root.network")
46 if (type == "com.canonical.indicator.root.network")
47− return true
47+ return true;
48− return false
48+ return false;
49 }
49 }
50
50
51 onActionStateChanged: {
51 onActionStateChanged: {
52 if (action == undefined || !action.valid) {
52 if (action == undefined || !action.valid) {
53− return
53+ return;
54 }
54 }
55
55
56 if (action.state == undefined) {
56 if (action.state == undefined) {
57− connectionState = 0
57+ connectionState = 0;
58− return
58+ return;
59 }
59 }
60
60
61− connectionState = action.state[1]
61+ connectionState = action.state[1];
62 if (connectionState == 2) {
62 if (connectionState == 2) {
63− signalStrength = action.state[2]
63+ signalStrength = action.state[2];
64 }
64 }
65 }
65 }
66
66
67 NumberAnimation {
67 NumberAnimation {
68 id: activation_animation
68 id: activation_animation
69− target: indicatorIcon
69+ target: indicatorWidget
70 property: "signalStrength"
70 property: "signalStrength"
71 from: 0
71 from: 0
72 to: 100
72 to: 100
@@ -101,16 +101,16 @@ Indicators.IndicatorIcon {
101 function get_icon_for_signal(con_state, value) {
101 function get_icon_for_signal(con_state, value) {
102 if (con_state >= 1 && con_state <= 3) {
102 if (con_state >= 1 && con_state <= 3) {
103 if (value == 0) {
103 if (value == 0) {
104− return "image://gicon/nm-signal-00"
104+ return "image://gicon/nm-signal-00";
105 } else if (value <= 25) {
105 } else if (value <= 25) {
106− return "image://gicon/nm-signal-25"
106+ return "image://gicon/nm-signal-25";
107 } else if (value <= 50) {
107 } else if (value <= 50) {
108− return "image://gicon/nm-signal-50"
108+ return "image://gicon/nm-signal-50";
109 } else if (value <= 75) {
109 } else if (value <= 75) {
110− return "image://gicon/nm-signal-75"
110+ return "image://gicon/nm-signal-75";
111 }
111 }
112− return "image://gicon/nm-signal-100"
112+ return "image://gicon/nm-signal-100";
113 }
113 }
114− return "image://gicon/wifi-none"
114+ return "image://gicon/wifi-none";
115 }
115 }
116}
116}
Panel/Indicators/client/IndicatorsClient.qml+3−3
@@ -34,9 +34,9 @@ Rectangle {
34
34
35 function reset() {
35 function reset() {
36 pages.clear();
36 pages.clear();
37− var component = Qt.createComponent("IndicatorsList.qml")
37+ var component = Qt.createComponent("IndicatorsList.qml");
38− var page = component.createObject(pages)
38+ var page = component.createObject(pages);
39− console.log(component.errorString())
39+ console.log(component.errorString());
40 pages.push(page);
40 pages.push(page);
41 }
41 }
42}
42}
Panel/Indicators/client/IndicatorsList.qml+2−2
@@ -54,8 +54,8 @@ Page {
54
54
55 onClicked: {
55 onClicked: {
56 if (progression) {
56 if (progression) {
57− var page = Qt.createComponent("IndicatorsPage.qml")
57+ var page = Qt.createComponent("IndicatorsPage.qml");
58− pages.push(page.createObject(pages), {"indicatorProperties" : model.indicatorProperties, "pageSource" : model.pageSource})
58+ pages.push(page.createObject(pages), {"indicatorProperties" : model.indicatorProperties, "pageSource" : model.pageSource});
59 }
59 }
60 }
60 }
61 }
61 }
Panel/Indicators/client/IndicatorsPage.qml+2−2
@@ -39,10 +39,10 @@ Page {
39 if (status == Loader.Ready) {
39 if (status == Loader.Ready) {
40 for(var pName in indicatorProperties) {
40 for(var pName in indicatorProperties) {
41 if (item.hasOwnProperty(pName)) {
41 if (item.hasOwnProperty(pName)) {
42− item[pName] = indicatorProperties[pName]
42+ item[pName] = indicatorProperties[pName];
43 }
43 }
44 }
44 }
45− item.start()
45+ item.start();
46 }
46 }
47 }
47 }
48 }
48 }
modules/Unity/Indicators/qml/IndicatorPage.qml+12−12
@@ -74,13 +74,13 @@ IndicatorBase {
74 if (!item.empty) {
74 if (!item.empty) {
75 mainMenu.visibleItems += 1;
75 mainMenu.visibleItems += 1;
76 }
76 }
77− ready = true
77+ ready = true;
78 }
78 }
79 Component.onDestruction: {
79 Component.onDestruction: {
80 if (!item.empty) {
80 if (!item.empty) {
81 mainMenu.visibleItems -= 1;
81 mainMenu.visibleItems -= 1;
82 }
82 }
83− ready = false
83+ ready = false;
84 }
84 }
85
85
86 onEmptyChanged: {
86 onEmptyChanged: {
@@ -117,9 +117,9 @@ IndicatorBase {
117 return 0;
117 return 0;
118 }
118 }
119 if (hasSection || ((depth == 0) && (!factory.empty))) {
119 if (hasSection || ((depth == 0) && (!factory.empty))) {
120− return implicitHeight
120+ return implicitHeight;
121 } else {
121 } else {
122− return 0
122+ return 0;
123 }
123 }
124 }
124 }
125 }
125 }
@@ -162,25 +162,25 @@ IndicatorBase {
162 {
162 {
163 reset()
163 reset()
164 if (!__active) {
164 if (!__active) {
165− proxyModel.start()
165+ proxyModel.start();
166− actionGroup.start()
166+ actionGroup.start();
167− __active = true
167+ __active = true;
168 }
168 }
169 }
169 }
170
170
171 function stop()
171 function stop()
172 {
172 {
173 if (__active) {
173 if (__active) {
174− __active = false
174+ __active = false;
175− proxyModel.stop()
175+ proxyModel.stop();
176− actionGroup.stop()
176+ actionGroup.stop();
177 }
177 }
178 }
178 }
179
179
180 function reset()
180 function reset()
181 {
181 {
182− mainMenu.currentIndex = -1
182+ mainMenu.currentIndex = -1;
183− mainMenu.positionViewAtBeginning()
183+ mainMenu.positionViewAtBeginning();
184 }
184 }
185
185
186 Component.onCompleted: {
186 Component.onCompleted: {
modules/Unity/Indicators/qml/IndicatorIcon.qml → modules/Unity/Indicators/qml/IndicatorWidget.qmlrenamed+12−12
@@ -24,7 +24,7 @@ import Ubuntu.Components.ListItems 0.1 as ListItem
24import Unity.Indicators 0.1 as Indicators
24import Unity.Indicators 0.1 as Indicators
25
25
26IndicatorBase {
26IndicatorBase {
27− id: indicatorIcon
27+ id: indicatorWidget
28 property var action: undefined
28 property var action: undefined
29 property bool started: (busType != 0) && (busName != "") && (deviceMenuObjectPath != "")
29 property bool started: (busType != 0) && (busName != "") && (deviceMenuObjectPath != "")
30 property int iconSize: height - units.gu(0.5)
30 property int iconSize: height - units.gu(0.5)
@@ -33,12 +33,12 @@ IndicatorBase {
33
33
34 onStartedChanged: {
34 onStartedChanged: {
35 if (started) {
35 if (started) {
36− proxyModel.start()
36+ proxyModel.start();
37− actionGroup.start()
37+ actionGroup.start();
38 }
38 }
39 else {
39 else {
40− proxyModel.stop()
40+ proxyModel.stop();
41− actionGroup.stop()
41+ actionGroup.stop();
42 }
42 }
43 }
43 }
44 onActionChanged: actionStateChanged()
44 onActionChanged: actionStateChanged()
@@ -47,9 +47,9 @@ IndicatorBase {
47
47
48
48
49 function update_state() {
49 function update_state() {
50− var data = proxyModel.get(0)
50+ var data = proxyModel.get(0);
51 if (data == undefined || data.extra == undefined) {
51 if (data == undefined || data.extra == undefined) {
52− return
52+ return;
53 }
53 }
54
54
55 if (!data.extra.hasOwnProperty("canonical_type")) {
55 if (!data.extra.hasOwnProperty("canonical_type")) {
@@ -57,7 +57,7 @@ IndicatorBase {
57 }
57 }
58
58
59 if (parseRootElement(data.extra.canonical_type, data)) {
59 if (parseRootElement(data.extra.canonical_type, data)) {
60− action = actionGroup.action(data.action)
60+ action = actionGroup.action(data.action);
61 }
61 }
62 }
62 }
63
63
@@ -75,14 +75,14 @@ IndicatorBase {
75
75
76 onActionStateChanged: {
76 onActionStateChanged: {
77 if (action == undefined || !action.valid) {
77 if (action == undefined || !action.valid) {
78− return
78+ return;
79 }
79 }
80
80
81 if (action.state == undefined) {
81 if (action.state == undefined) {
82− enabled = false
82+ enabled = false;
83− return
83+ return;
84 }
84 }
85
85
86− enabled = action.state[Indicators.ActionState.Visible]
86+ enabled = action.state[Indicators.ActionState.Visible];
87 }
87 }
88}
88}
modules/Unity/Indicators/qml/MenuFactory.qml+7−7
@@ -74,25 +74,25 @@ Item {
74 asynchronous: true
74 asynchronous: true
75 sourceComponent: {
75 sourceComponent: {
76 if (!__menuFactory.menu || !__menuFactory.menu.extra) {
76 if (!__menuFactory.menu || !__menuFactory.menu.extra) {
77− return undefined
77+ return undefined;
78 }
78 }
79
79
80− var widgetType = __menuFactory.menu.extra.canonical_type
80+ var widgetType = __menuFactory.menu.extra.canonical_type;
81 if (widgetType) {
81 if (widgetType) {
82− return _map[widgetType]
82+ return _map[widgetType];
83 }
83 }
84 else {
84 else {
85 if (widgetType === "com.canonical.indicator.root") {
85 if (widgetType === "com.canonical.indicator.root") {
86− return undefined
86+ return undefined;
87 // Try discovery the item based on the basic properties
87 // Try discovery the item based on the basic properties
88 } else if (menu.hasSection) {
88 } else if (menu.hasSection) {
89− return sectionMenu
89+ return sectionMenu;
90 }
90 }
91 else {
91 else {
92− return indicatorMenu
92+ return indicatorMenu;
93 }
93 }
94 }
94 }
95− return undefined
95+ return undefined;
96 }
96 }
97
97
98 onStatusChanged: {
98 onStatusChanged: {
modules/Unity/Indicators/qml/qmldir+2−2
@@ -1,8 +1,8 @@
1module Unity.Indicators
1module Unity.Indicators
2plugin IndicatorsQml
2plugin IndicatorsQml
3
3
4−IndicatorItem 0.1 IndicatorItem.qml
4+IndicatorBase 0.1 IndicatorBase.qml
5−IndicatorIcon 0.1 IndicatorIcon.qml
5+IndicatorWidget 0.1 IndicatorWidget.qml
6IndicatorPage 0.1 IndicatorPage.qml
6IndicatorPage 0.1 IndicatorPage.qml
7BasicMenu 0.1 BasicMenu.qml
7BasicMenu 0.1 BasicMenu.qml
8ButtonMenu 0.1 ButtonMenu.qml
8ButtonMenu 0.1 ButtonMenu.qml