on xenial help sign in
renamed IndicatorIcon -> IndicatorWidget. javascript ;
commitd4bcf25e7ca3c283c9443cbd1c4132c0503cca0f authorNick Dedekind <nicholas.dedekind@gmail.com> dateMon 17 Jun 2013, 10:57 (13 years ago) parentf943e0c
12 files changed+82−82
Panel/Indicators/DatetimeIndicatorPage.qml+5−5 Panel/Indicators/DatetimeIndicatorWidget.qml+6−6 Panel/Indicators/DefaultIndicatorWidget.qml+8−8 Panel/Indicators/NetworkIndicatorPage.qml+5−5 Panel/Indicators/NetworkIndicatorWidget.qml+18−18 Panel/Indicators/client/IndicatorsClient.qml+3−3 Panel/Indicators/client/IndicatorsList.qml+2−2 Panel/Indicators/client/IndicatorsPage.qml+2−2 modules/Unity/Indicators/qml/IndicatorPage.qml+12−12 modules/Unity/Indicators/qml/IndicatorIcon.qml → modules/Unity/Indicators/qml/IndicatorWidget.qml+12−12 modules/Unity/Indicators/qml/MenuFactory.qml+7−7 modules/Unity/Indicators/qml/qmldir+2−2
Panel/Indicators/DatetimeIndicatorPage.qml+5−5
@@ -83,11 +83,11 @@ Flickable {
8383 }
8484
8585 function updateTime() {
86− var dt = new Date()
87− var time = Qt.formatTime(dt)
88− var space = time.indexOf(" ")
89− timeLabel.text = time.substr(0, space > 0 ? space : 5)
90− dateLabel.text = Qt.formatDateTime(dt, "dddd,\ndd MMMM")
86+ var dt = new Date();
87+ var time = Qt.formatTime(dt);
88+ var space = time.indexOf(" ");
89+ timeLabel.text = time.substr(0, space > 0 ? space : 5);
90+ dateLabel.text = Qt.formatDateTime(dt, "dddd,\ndd MMMM");
9191 }
9292
9393 // Make it compatible with the PluginItem interface
Panel/Indicators/DatetimeIndicatorWidget.qml+6−6
@@ -21,8 +21,8 @@ import QtQuick 2.0
2121import Ubuntu.Components 0.1
2222import Unity.Indicators 0.1 as Indicators
2323
24−Indicators.IndicatorIcon {
25− id: indicatorIcon
24+Indicators.IndicatorWidget {
25+ id: indicatorWidget
2626
2727 width: timeLabel.width + units.gu(1)
2828
@@ -42,7 +42,7 @@ Indicators.IndicatorIcon {
4242 Timer {
4343 id: timer
4444 interval: 1000 * 10
45− running: indicatorIcon.visible
45+ running: indicatorWidget.visible
4646 repeat: true
4747 triggeredOnStart: true
4848 property date dateNow
@@ -52,14 +52,14 @@ Indicators.IndicatorIcon {
5252
5353 onActionStateChanged: {
5454 if (action == undefined || !action.valid) {
55− return
55+ return;
5656 }
5757
5858 if (action.state == undefined) {
5959 visible = false;
60− return
60+ return;
6161 }
6262
63− indicatorIcon.visible = action.state[3]
63+ indicatorWidget.visible = action.state[3];
6464 }
6565}
Panel/Indicators/DefaultIndicatorWidget.qml+8−8
@@ -21,8 +21,8 @@ import QtQuick 2.0
2121import Ubuntu.Components 0.1
2222import Unity.Indicators 0.1 as Indicators
2323
24−Indicators.IndicatorIcon {
25− id: indicatorIcon
24+Indicators.IndicatorWidget {
25+ id: indicatorWidget
2626
2727 width: itemRow.width + units.gu(1)
2828
@@ -43,8 +43,8 @@ Indicators.IndicatorIcon {
4343 id: itemImage
4444 objectName: "itemImage"
4545 visible: source != ""
46− height: indicatorIcon.iconSize
47− width: indicatorIcon.iconSize
46+ height: indicatorWidget.iconSize
47+ width: indicatorWidget.iconSize
4848 anchors.verticalCenter: parent.verticalCenter
4949 }
5050
@@ -62,16 +62,16 @@ Indicators.IndicatorIcon {
6262
6363 onActionStateChanged: {
6464 if (action == undefined || !action.valid) {
65− return
65+ return;
6666 }
6767
6868 if (action.state == undefined) {
6969 label = "";
7070 iconSource = "";
71− return
71+ return;
7272 }
7373
74− label = action.state[Indicators.ActionState.Label]
75− iconSource = "image://gicon/" + action.state[Indicators.ActionState.IconSource]
74+ label = action.state[Indicators.ActionState.Label];
75+ iconSource = "image://gicon/" + action.state[Indicators.ActionState.IconSource];
7676 }
7777}
Panel/Indicators/NetworkIndicatorPage.qml+5−5
@@ -63,18 +63,18 @@ PageStack {
6363
6464 function start()
6565 {
66− push(_mainPage)
67− _pluginItem.start()
66+ push(_mainPage);
67+ _pluginItem.start();
6868 }
6969
7070 function stop()
7171 {
72− clear()
73− _pluginItem.stop()
72+ clear();
73+ _pluginItem.stop();
7474 }
7575
7676 function reset()
7777 {
78− _pluginItem.reset()
78+ _pluginItem.reset();
7979 }
8080}
Panel/Indicators/NetworkIndicatorWidget.qml+18−18
@@ -21,8 +21,8 @@ import QtQuick 2.0
2121import Ubuntu.Components 0.1
2222import Unity.Indicators 0.1 as Indicators
2323
24−Indicators.IndicatorIcon {
25− id: indicatorIcon
24+Indicators.IndicatorWidget {
25+ id: indicatorWidget
2626
2727 width: networkIcon.width + units.gu(1)
2828
@@ -34,8 +34,8 @@ Indicators.IndicatorIcon {
3434 objectName: "itemImage"
3535 source: get_icon_for_signal(connectionState, signalStrength)
3636 visible: source != ""
37− height: indicatorIcon.iconSize
38− width: indicatorIcon.iconSize
37+ height: indicatorWidget.iconSize
38+ width: indicatorWidget.iconSize
3939 anchors {
4040 verticalCenter: parent.verticalCenter
4141 horizontalCenter: parent.horizontalCenter
@@ -44,29 +44,29 @@ Indicators.IndicatorIcon {
4444
4545 function parseRootElement(type, data) {
4646 if (type == "com.canonical.indicator.root.network")
47− return true
48− return false
47+ return true;
48+ return false;
4949 }
5050
5151 onActionStateChanged: {
5252 if (action == undefined || !action.valid) {
53− return
53+ return;
5454 }
5555
5656 if (action.state == undefined) {
57− connectionState = 0
58− return
57+ connectionState = 0;
58+ return;
5959 }
6060
61− connectionState = action.state[1]
61+ connectionState = action.state[1];
6262 if (connectionState == 2) {
63− signalStrength = action.state[2]
63+ signalStrength = action.state[2];
6464 }
6565 }
6666
6767 NumberAnimation {
6868 id: activation_animation
69− target: indicatorIcon
69+ target: indicatorWidget
7070 property: "signalStrength"
7171 from: 0
7272 to: 100
@@ -101,16 +101,16 @@ Indicators.IndicatorIcon {
101101 function get_icon_for_signal(con_state, value) {
102102 if (con_state >= 1 && con_state <= 3) {
103103 if (value == 0) {
104− return "image://gicon/nm-signal-00"
104+ return "image://gicon/nm-signal-00";
105105 } else if (value <= 25) {
106− return "image://gicon/nm-signal-25"
106+ return "image://gicon/nm-signal-25";
107107 } else if (value <= 50) {
108− return "image://gicon/nm-signal-50"
108+ return "image://gicon/nm-signal-50";
109109 } else if (value <= 75) {
110− return "image://gicon/nm-signal-75"
110+ return "image://gicon/nm-signal-75";
111111 }
112− return "image://gicon/nm-signal-100"
112+ return "image://gicon/nm-signal-100";
113113 }
114− return "image://gicon/wifi-none"
114+ return "image://gicon/wifi-none";
115115 }
116116}
Panel/Indicators/client/IndicatorsClient.qml+3−3
@@ -34,9 +34,9 @@ Rectangle {
3434
3535 function reset() {
3636 pages.clear();
37− var component = Qt.createComponent("IndicatorsList.qml")
38− var page = component.createObject(pages)
39− console.log(component.errorString())
37+ var component = Qt.createComponent("IndicatorsList.qml");
38+ var page = component.createObject(pages);
39+ console.log(component.errorString());
4040 pages.push(page);
4141 }
4242}
Panel/Indicators/client/IndicatorsList.qml+2−2
@@ -54,8 +54,8 @@ Page {
5454
5555 onClicked: {
5656 if (progression) {
57− var page = Qt.createComponent("IndicatorsPage.qml")
58− pages.push(page.createObject(pages), {"indicatorProperties" : model.indicatorProperties, "pageSource" : model.pageSource})
57+ var page = Qt.createComponent("IndicatorsPage.qml");
58+ pages.push(page.createObject(pages), {"indicatorProperties" : model.indicatorProperties, "pageSource" : model.pageSource});
5959 }
6060 }
6161 }
Panel/Indicators/client/IndicatorsPage.qml+2−2
@@ -39,10 +39,10 @@ Page {
3939 if (status == Loader.Ready) {
4040 for(var pName in indicatorProperties) {
4141 if (item.hasOwnProperty(pName)) {
42− item[pName] = indicatorProperties[pName]
42+ item[pName] = indicatorProperties[pName];
4343 }
4444 }
45− item.start()
45+ item.start();
4646 }
4747 }
4848 }
modules/Unity/Indicators/qml/IndicatorPage.qml+12−12
@@ -74,13 +74,13 @@ IndicatorBase {
7474 if (!item.empty) {
7575 mainMenu.visibleItems += 1;
7676 }
77− ready = true
77+ ready = true;
7878 }
7979 Component.onDestruction: {
8080 if (!item.empty) {
8181 mainMenu.visibleItems -= 1;
8282 }
83− ready = false
83+ ready = false;
8484 }
8585
8686 onEmptyChanged: {
@@ -117,9 +117,9 @@ IndicatorBase {
117117 return 0;
118118 }
119119 if (hasSection || ((depth == 0) && (!factory.empty))) {
120− return implicitHeight
120+ return implicitHeight;
121121 } else {
122− return 0
122+ return 0;
123123 }
124124 }
125125 }
@@ -162,25 +162,25 @@ IndicatorBase {
162162 {
163163 reset()
164164 if (!__active) {
165− proxyModel.start()
166− actionGroup.start()
167− __active = true
165+ proxyModel.start();
166+ actionGroup.start();
167+ __active = true;
168168 }
169169 }
170170
171171 function stop()
172172 {
173173 if (__active) {
174− __active = false
175− proxyModel.stop()
176− actionGroup.stop()
174+ __active = false;
175+ proxyModel.stop();
176+ actionGroup.stop();
177177 }
178178 }
179179
180180 function reset()
181181 {
182− mainMenu.currentIndex = -1
183− mainMenu.positionViewAtBeginning()
182+ mainMenu.currentIndex = -1;
183+ mainMenu.positionViewAtBeginning();
184184 }
185185
186186 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
2424import Unity.Indicators 0.1 as Indicators
2525
2626IndicatorBase {
27− id: indicatorIcon
27+ id: indicatorWidget
2828 property var action: undefined
2929 property bool started: (busType != 0) && (busName != "") && (deviceMenuObjectPath != "")
3030 property int iconSize: height - units.gu(0.5)
@@ -33,12 +33,12 @@ IndicatorBase {
3333
3434 onStartedChanged: {
3535 if (started) {
36− proxyModel.start()
37− actionGroup.start()
36+ proxyModel.start();
37+ actionGroup.start();
3838 }
3939 else {
40− proxyModel.stop()
41− actionGroup.stop()
40+ proxyModel.stop();
41+ actionGroup.stop();
4242 }
4343 }
4444 onActionChanged: actionStateChanged()
@@ -47,9 +47,9 @@ IndicatorBase {
4747
4848
4949 function update_state() {
50− var data = proxyModel.get(0)
50+ var data = proxyModel.get(0);
5151 if (data == undefined || data.extra == undefined) {
52− return
52+ return;
5353 }
5454
5555 if (!data.extra.hasOwnProperty("canonical_type")) {
@@ -57,7 +57,7 @@ IndicatorBase {
5757 }
5858
5959 if (parseRootElement(data.extra.canonical_type, data)) {
60− action = actionGroup.action(data.action)
60+ action = actionGroup.action(data.action);
6161 }
6262 }
6363
@@ -75,14 +75,14 @@ IndicatorBase {
7575
7676 onActionStateChanged: {
7777 if (action == undefined || !action.valid) {
78− return
78+ return;
7979 }
8080
8181 if (action.state == undefined) {
82− enabled = false
83− return
82+ enabled = false;
83+ return;
8484 }
8585
86− enabled = action.state[Indicators.ActionState.Visible]
86+ enabled = action.state[Indicators.ActionState.Visible];
8787 }
8888}
modules/Unity/Indicators/qml/MenuFactory.qml+7−7
@@ -74,25 +74,25 @@ Item {
7474 asynchronous: true
7575 sourceComponent: {
7676 if (!__menuFactory.menu || !__menuFactory.menu.extra) {
77− return undefined
77+ return undefined;
7878 }
7979
80− var widgetType = __menuFactory.menu.extra.canonical_type
80+ var widgetType = __menuFactory.menu.extra.canonical_type;
8181 if (widgetType) {
82− return _map[widgetType]
82+ return _map[widgetType];
8383 }
8484 else {
8585 if (widgetType === "com.canonical.indicator.root") {
86− return undefined
86+ return undefined;
8787 // Try discovery the item based on the basic properties
8888 } else if (menu.hasSection) {
89− return sectionMenu
89+ return sectionMenu;
9090 }
9191 else {
92− return indicatorMenu
92+ return indicatorMenu;
9393 }
9494 }
95− return undefined
95+ return undefined;
9696 }
9797
9898 onStatusChanged: {
modules/Unity/Indicators/qml/qmldir+2−2
@@ -1,8 +1,8 @@
11module Unity.Indicators
22plugin IndicatorsQml
33
4−IndicatorItem 0.1 IndicatorItem.qml
5−IndicatorIcon 0.1 IndicatorIcon.qml
4+IndicatorBase 0.1 IndicatorBase.qml
5+IndicatorWidget 0.1 IndicatorWidget.qml
66IndicatorPage 0.1 IndicatorPage.qml
77BasicMenu 0.1 BasicMenu.qml
88ButtonMenu 0.1 ButtonMenu.qml