Merge lp:~nick-dedekind/unity8/indicators.menu-items-cleaning into lp:unity8

Proposed by Nick Dedekind
Status: Merged
Approved by: Michael Zanetti
Approved revision: 233
Merged at revision: 249
Proposed branch: lp:~nick-dedekind/unity8/indicators.menu-items-cleaning
Merge into: lp:unity8
Diff against target: 637 lines (+174/-184)
16 files modified
plugins/Unity/Indicators/Network/qml/AccessPoint.qml (+18/-8)
plugins/Unity/Indicators/Network/qml/PasswordPage.qml (+1/-1)
plugins/Unity/Indicators/Network/qml/WifiSection.qml (+0/-28)
plugins/Unity/Indicators/Network/qml/qmldir (+1/-2)
plugins/Unity/Indicators/qml/BaseMenuItem.qml (+0/-4)
plugins/Unity/Indicators/qml/ButtonMenuItem.qml (+4/-9)
plugins/Unity/Indicators/qml/FramedMenuItem.qml (+0/-2)
plugins/Unity/Indicators/qml/IndicatorPage.qml (+4/-9)
plugins/Unity/Indicators/qml/MenuAction.qml (+0/-59)
plugins/Unity/Indicators/qml/MenuItemFactory.qml (+124/-7)
plugins/Unity/Indicators/qml/ProgressMenuItem.qml (+1/-8)
plugins/Unity/Indicators/qml/SectionMenuItem.qml (+3/-3)
plugins/Unity/Indicators/qml/SliderMenuItem.qml (+8/-23)
plugins/Unity/Indicators/qml/StandardMenuItem.qml (+6/-11)
plugins/Unity/Indicators/qml/SwitchMenuItem.qml (+4/-9)
plugins/Unity/Indicators/qml/qmldir (+0/-1)
To merge this branch: bzr merge lp:~nick-dedekind/unity8/indicators.menu-items-cleaning
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Albert Astals Cid (community) Approve
Review via email: mp+181410@code.launchpad.net

Commit message

Abstraction of indicator menu item properties prior to move into common components library.

Description of the change

Abstraction of indicator menu item properties prior to move into common components library.

Changes:
* Moved activate/changeState signals from BaseMenuItem to specific menu items. Now handled by MenuFactory components.
* Moved menu model related code (setup of menu item data [labels/icons/values/etc]) into MenuFactoryComponents.

MenuItems now only have properties and signals for updating visual/backend data. They do not directly access any implementation specific model data. The MenuFactory now holds the unityumenumodel specifc code.

To post a comment you must log in.
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

436 +// property var strenthAction: QMenuModel.UnityMenuAction {
437 +// model: menuFactory.model ? menuFactory.model : null
438 +// name: menu ? menu.ext.xCanonicalWifiApStrengthAction : ""
439 +// }

446 +// signalStrength: strenthAction.valid ? strenthAction.state : 0

Waiting for new code from qmenumodel.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

We don't need
text: ""
in FramedMenuItem.qml, no?

review: Needs Information
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> We don't need
> text: ""
> in FramedMenuItem.qml, no?

Nope. removed.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks good

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/Unity/Indicators/Network/qml/AccessPoint.qml'
--- plugins/Unity/Indicators/Network/qml/AccessPoint.qml 2013-08-20 19:50:07 +0000
+++ plugins/Unity/Indicators/Network/qml/AccessPoint.qml 2013-08-23 11:34:24 +0000
@@ -25,29 +25,39 @@
25Indicators.FramedMenuItem {25Indicators.FramedMenuItem {
26 id: accessPoint26 id: accessPoint
2727
28 readonly property bool checked: menu ? menu.isToggled : false28 property bool checked: false
29 property bool secure: false
30 property bool adHoc: false
31 property int signalStrength: 0
32
33 signal activate()
2934
30 onCheckedChanged: {35 onCheckedChanged: {
31 // Can't rely on binding. Checked is assigned on click.36 // Can't rely on binding. Checked is assigned on click.
32 checkBoxActive.checked = checked;37 checkBoxActive.checked = checked;
33 }38 }
3439
35 // FIXME - we need to get the strength from menu.ext.xCanonicalWifiApStrengthAction40 icon: {
36 // but UnityMenuModel doesnt support fetching actions not attached to menu item.
37 function getNetworkIcon(data) {
38 var imageName = "nm-signal-100"41 var imageName = "nm-signal-100"
3942
40 if (data.ext.xCanonicalWifiApIsAdhoc) {43 if (adHoc) {
41 imageName = "nm-adhoc";44 imageName = "nm-adhoc";
45 } else if (signalStrength == 0) {
46 imageName = "nm-signal-00";
47 } else if (signalStrength <= 25) {
48 imageName = "nm-signal-25";
49 } else if (signalStrength <= 50) {
50 imageName = "nm-signal-50";
51 } else if (signalStrength <= 75) {
52 imageName = "nm-signal-75";
42 }53 }
43 if (data.ext.xCanonicalWifiApIsSecure) {54
55 if (secure) {
44 imageName += "-secure";56 imageName += "-secure";
45 }57 }
46
47 return "image://gicon/" + imageName;58 return "image://gicon/" + imageName;
48 }59 }
4960
50 icon: menu ? getNetworkIcon(menu) : "image://gicon/wifi-none"
51 iconFrame: false61 iconFrame: false
52 control: CheckBox {62 control: CheckBox {
53 id: checkBoxActive63 id: checkBoxActive
5464
=== modified file 'plugins/Unity/Indicators/Network/qml/PasswordPage.qml'
--- plugins/Unity/Indicators/Network/qml/PasswordPage.qml 2013-08-20 19:50:07 +0000
+++ plugins/Unity/Indicators/Network/qml/PasswordPage.qml 2013-08-23 11:34:24 +0000
@@ -38,7 +38,7 @@
38 }38 }
3939
40 Indicators.SectionMenuItem {40 Indicators.SectionMenuItem {
41 label: "Authentication"41 text: "Authentication"
42 }42 }
4343
44 Indicators.FramedMenuItem {44 Indicators.FramedMenuItem {
4545
=== removed file 'plugins/Unity/Indicators/Network/qml/WifiSection.qml'
--- plugins/Unity/Indicators/Network/qml/WifiSection.qml 2013-08-20 19:50:07 +0000
+++ plugins/Unity/Indicators/Network/qml/WifiSection.qml 1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
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.
7 *
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.
12 *
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/>.
15 *
16 * Authors:
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
18 */
19
20import QtQuick 2.0
21import Ubuntu.Components 0.1
22import Unity.Indicators 0.1 as Indicators
23
24Indicators.SectionMenuItem {
25 id: wifiSectionMenu
26
27 busy: menu ? menu.ext.xCanonicalBusyAction : false
28}
290
=== modified file 'plugins/Unity/Indicators/Network/qml/qmldir'
--- plugins/Unity/Indicators/Network/qml/qmldir 2013-08-20 19:50:07 +0000
+++ plugins/Unity/Indicators/Network/qml/qmldir 2013-08-23 11:34:24 +0000
@@ -5,5 +5,4 @@
5NetworkPage 0.1 NetworkPage.qml5NetworkPage 0.1 NetworkPage.qml
6AccessPoint 0.1 AccessPoint.qml6AccessPoint 0.1 AccessPoint.qml
7PasswordPage 0.1 PasswordPage.qml7PasswordPage 0.1 PasswordPage.qml
8PasswordTextField 0.1 PasswordTextField.qml
9WifiSection 0.1 WifiSection.qml
10\ No newline at end of file8\ No newline at end of file
9PasswordTextField 0.1 PasswordTextField.qml
11\ No newline at end of file10\ No newline at end of file
1211
=== modified file 'plugins/Unity/Indicators/qml/BaseMenuItem.qml'
--- plugins/Unity/Indicators/qml/BaseMenuItem.qml 2013-08-14 09:07:45 +0000
+++ plugins/Unity/Indicators/qml/BaseMenuItem.qml 2013-08-23 11:34:24 +0000
@@ -25,14 +25,10 @@
25 id: baseMenu25 id: baseMenu
2626
27 property bool menuActivated: false27 property bool menuActivated: false
28 property QtObject menu
2928
30 signal selectMenu()29 signal selectMenu()
31 signal deselectMenu()30 signal deselectMenu()
3231
33 signal activate()
34 signal changeState(var value)
35
36 showDivider: false32 showDivider: false
37 __foregroundColor: "#e8e1d0" // FIXME not in palette yet33 __foregroundColor: "#e8e1d0" // FIXME not in palette yet
3834
3935
=== modified file 'plugins/Unity/Indicators/qml/ButtonMenuItem.qml'
--- plugins/Unity/Indicators/qml/ButtonMenuItem.qml 2013-08-14 09:07:45 +0000
+++ plugins/Unity/Indicators/qml/ButtonMenuItem.qml 2013-08-23 11:34:24 +0000
@@ -24,14 +24,14 @@
2424
25BaseMenuItem {25BaseMenuItem {
26 id: menuItem26 id: menuItem
27 objectName: menuAction.name
28 implicitHeight: units.gu(7)27 implicitHeight: units.gu(7)
29 enabled: menuAction.active28
29 property alias text: button.text
30
31 signal activate()
3032
31 Button {33 Button {
32 id: button34 id: button
33 enabled: menuAction.enabled
34 text: menu ? menu.label : ""
35 anchors.centerIn: parent35 anchors.centerIn: parent
36 height: units.gu(4)36 height: units.gu(4)
37 width: units.gu(16)37 width: units.gu(16)
@@ -41,9 +41,4 @@
41 menuItem.activate();41 menuItem.activate();
42 }42 }
43 }43 }
44
45 Indicators.MenuAction {
46 id: menuAction
47 menu: menuItem.menu
48 }
49}44}
5045
=== modified file 'plugins/Unity/Indicators/qml/FramedMenuItem.qml'
--- plugins/Unity/Indicators/qml/FramedMenuItem.qml 2013-08-14 09:07:45 +0000
+++ plugins/Unity/Indicators/qml/FramedMenuItem.qml 2013-08-23 11:34:24 +0000
@@ -23,10 +23,8 @@
23import Ubuntu.Components.ListItems 0.1 as ListItem23import Ubuntu.Components.ListItems 0.1 as ListItem
2424
25BaseMenuItem {25BaseMenuItem {
26 text: menu && menu.label ? menu.label : ""
27 implicitHeight: units.gu(7)26 implicitHeight: units.gu(7)
2827
29 icon: menu ? menu.icon : ""
30 iconFrame: false28 iconFrame: false
3129
32 HLine {30 HLine {
3331
=== modified file 'plugins/Unity/Indicators/qml/IndicatorPage.qml'
--- plugins/Unity/Indicators/qml/IndicatorPage.qml 2013-08-14 09:07:45 +0000
+++ plugins/Unity/Indicators/qml/IndicatorPage.qml 2013-08-23 11:34:24 +0000
@@ -96,18 +96,13 @@
96 }96 }
97 if (item.hasOwnProperty("menu")) {97 if (item.hasOwnProperty("menu")) {
98 item.menu = Qt.binding(function() { return model; });98 item.menu = Qt.binding(function() { return model; });
99
100 item.activate.connect(onActivateMenu);
101 item.changeState.connect(onChangeState);
102 }99 }
103 }100 }
104101
105 function onActivateMenu(value) {102 Binding {
106 mainMenu.model.activate(index, value);103 target: item ? item : null
107 }104 property: "objectName"
108105 value: model.action
109 function onChangeState(value) {
110 mainMenu.model.changeState(index, value);
111 }106 }
112 }107 }
113 }108 }
114109
=== removed file 'plugins/Unity/Indicators/qml/MenuAction.qml'
--- plugins/Unity/Indicators/qml/MenuAction.qml 2013-08-14 09:07:45 +0000
+++ plugins/Unity/Indicators/qml/MenuAction.qml 1970-01-01 00:00:00 +0000
@@ -1,59 +0,0 @@
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
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.
7 *
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.
12 *
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/>.
15 *
16 * Authors:
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
18 * Nick Dedekind <nick.dedekind@canonical.com>
19 */
20
21import QtQuick 2.0
22
23/*!
24 \qmltype MenuAction
25 \inqmlmodule Indicators 0.1
26 \brief Helper class to connect to a qmenumodel action
27
28 Example:
29 \qml
30 BaseMenuItem {
31 id: menuItem
32
33 Switch {
34 checked: menuAction.state
35 }
36
37 Indicators.MenuAction {
38 id: menuAction
39 menu: menuItem.menu
40 }
41 }
42 \endqml
43*/
44
45Item {
46 id: menuAction
47
48 /*!
49 \preliminary
50 The dbus action group object
51 */
52 readonly property string name: menu ? menu.action : ""
53
54 property QtObject menu: null
55
56 readonly property var state: menu ? menu.actionState : undefined
57
58 readonly property bool active: menu ? menu.sensitive : false
59}
600
=== modified file 'plugins/Unity/Indicators/qml/MenuItemFactory.qml'
--- plugins/Unity/Indicators/qml/MenuItemFactory.qml 2013-08-20 19:50:07 +0000
+++ plugins/Unity/Indicators/qml/MenuItemFactory.qml 2013-08-23 11:34:24 +0000
@@ -20,6 +20,7 @@
20import QtQuick 2.020import QtQuick 2.0
21import Unity.Indicators 0.1 as Indicators21import Unity.Indicators 0.1 as Indicators
22import Unity.Indicators.Network 0.1 as ICNetwork22import Unity.Indicators.Network 0.1 as ICNetwork
23import QMenuModel 0.1 as QMenuModel
2324
24Item {25Item {
25 id: menuFactory26 id: menuFactory
@@ -47,35 +48,151 @@
47 Component {48 Component {
48 id: sliderMenu;49 id: sliderMenu;
49 Indicators.SliderMenuItem {50 Indicators.SliderMenuItem {
51 property QtObject menu: null
52
53 text: menu && menu.label ? menu.label : ""
54 icon: menu ? menu.icon : ""
55 minIcon: menu.ext.minIcon
56 maxIcon: menu.ext.maxIcon
57
58 minimumValue: menu.ext.minValue ? menu.ext.minValue : 0.0
59 maximumValue: {
60 var maximum = menu.ext.maxValue ? menu.ext.maxValue : 1.0
61 if (maximum <= minimumValue) {
62 return minimumValue + 1;
63 }
64 return maximum;
65 }
66 value: menu ? menu.actionState : 0.0
67 enabled: menu ? menu.sensitive : false
68
50 Component.onCompleted: {69 Component.onCompleted: {
51 model.loadExtendedAttributes(modelIndex, {'min-value': 'double',70 model.loadExtendedAttributes(modelIndex, {'min-value': 'double',
52 'max-value': 'double',71 'max-value': 'double',
53 'min-icon': 'icon',72 'min-icon': 'icon',
54 'max-icon': 'icon'});73 'max-icon': 'icon'});
55 }74 }
75
76 // FIXME: The interval should be [0.0 - 1.0]. Unfortunately, when
77 // reaching the boundaries (0.0 or 1.0), the value is converted
78 // to an integer when automatically wrapped in a variant when
79 // passed to QStateAction::updateState(…). The server chokes on
80 // those values, complaining that they’re not of the right type…
81 onChangeState: {
82 if (value == Math.round(value)) {
83 if (value >= maximumValue) {
84 model.changeState(modelIndex, maximumValue - 0.000001);
85 } else if (value <= minimumValue) {
86 model.changeState(modelIndex, minimumValue + 0.000001);
87 } else {
88 model.changeState(modelIndex, value * 1.000001);
89 }
90 } else {
91 model.changeState(modelIndex, value);
92 }
93 }
56 }94 }
57 }95 }
58 Component { id: buttonMenu; Indicators.ButtonMenuItem {} }96
59 Component { id: divMenu; Indicators.DivMenuItem {} }97 Component { id: divMenu; Indicators.DivMenuItem {} }
60 Component { id: sectionMenu; Indicators.SectionMenuItem {} }98
61 Component { id: progressMenu; Indicators.ProgressMenuItem {} }99 Component {
62 Component { id: standardMenu; Indicators.StandardMenuItem {} }100 id: buttonMenu;
63 Component { id: switchMenu; Indicators.SwitchMenuItem {} }101 Indicators.ButtonMenuItem {
102 property QtObject menu: null
103
104 text: menu && menu.label ? menu.label : ""
105 enabled: menu ? menu.sensitive : false
106
107 onActivate: model.activate(modelIndex);
108 }
109 }
110 Component {
111 id: sectionMenu;
112 Indicators.SectionMenuItem {
113 property QtObject menu: null
114
115 text: menu && menu.label ? menu.label : ""
116 }
117 }
118
119 Component {
120 id: progressMenu;
121 Indicators.ProgressMenuItem {
122 property QtObject menu: null
123
124 text: menu && menu.label ? menu.label : ""
125 icon: menu ? menu.icon : ""
126 value : menu ? menu.actionState : 0.0
127 }
128 }
129
130 Component {
131 id: standardMenu;
132 Indicators.StandardMenuItem {
133 property QtObject menu: null
134
135 text: menu && menu.label ? menu.label : ""
136 icon: menu ? menu.icon : ""
137 checkable: menu ? (menu.isCheck || menu.isRadio) : false
138 checked: checkable ? menu.isToggled : false
139 enabled: menu ? menu.sensitive : false
140
141 onActivate: model.activate(modelIndex);
142 }
143 }
144
145 Component {
146 id: switchMenu;
147 Indicators.SwitchMenuItem {
148 property QtObject menu: null
149
150 text: menu && menu.label ? menu.label : ""
151 icon: menu ? menu.icon : ""
152 checked: menu ? menu.isToggled : false
153 enabled: menu ? menu.sensitive : false
154
155 onActivate: model.activate(modelIndex);
156 }
157 }
158
64 Component {159 Component {
65 id: wifiSection;160 id: wifiSection;
66 ICNetwork.WifiSection {161 Indicators.SectionMenuItem {
162 property QtObject menu: null
163
164 text: menu && menu.label ? menu.label : ""
165 busy: menu ? menu.ext.xCanonicalBusyAction : false
166
67 Component.onCompleted: {167 Component.onCompleted: {
68 model.loadExtendedAttributes(modelIndex, {'x-canonical-busy-action': 'bool'});168 model.loadExtendedAttributes(modelIndex, {'x-canonical-busy-action': 'bool'});
69 }169 }
70 }170 }
71 }171 }
172
72 Component {173 Component {
73 id: accessPoint;174 id: accessPoint;
74 ICNetwork.AccessPoint {175 ICNetwork.AccessPoint {
176 property QtObject menu: null
177// property var strenthAction: QMenuModel.UnityMenuAction {
178// model: menuFactory.model ? menuFactory.model : null
179// name: menu ? menu.ext.xCanonicalWifiApStrengthAction : ""
180// }
181
182 text: menu && menu.label ? menu.label : ""
183 icon: menu ? menu.icon : ""
184 secure: menu ? menu.ext.xCanonicalWifiApIsSecure : false
185 adHoc: menu ? menu.ext.xCanonicalWifiApIsAdhoc : false
186 checked: menu ? menu.isToggled : false
187// signalStrength: strenthAction.valid ? strenthAction.state : 0
188 enabled: menu ? menu.sensitive : false
189
75 Component.onCompleted: {190 Component.onCompleted: {
76 model.loadExtendedAttributes(modelIndex, {'x-canonical-wifi-ap-is-adhoc': 'bool',191 model.loadExtendedAttributes(modelIndex, {'x-canonical-wifi-ap-is-adhoc': 'bool',
77 'x-canonical-wifi-ap-is-secure': 'bool'});192 'x-canonical-wifi-ap-is-secure': 'bool',
193 'x-canonical-wifi-ap-strength-action': 'string'});
78 }194 }
195 onActivate: model.activate(modelIndex);
79 }196 }
80 }197 }
81198
82199
=== modified file 'plugins/Unity/Indicators/qml/ProgressMenuItem.qml'
--- plugins/Unity/Indicators/qml/ProgressMenuItem.qml 2013-08-14 09:07:45 +0000
+++ plugins/Unity/Indicators/qml/ProgressMenuItem.qml 2013-08-23 11:34:24 +0000
@@ -23,10 +23,8 @@
2323
24FramedMenuItem {24FramedMenuItem {
25 id: menuItem25 id: menuItem
26 objectName: menuAction.name
27 enabled: menuAction.active
2826
29 property int value : menuAction.state27 property int value : 0.0
3028
31 control: Label {29 control: Label {
32 id: progress30 id: progress
@@ -37,9 +35,4 @@
37 fontSize: "medium"35 fontSize: "medium"
38 color: "#e8e1d0"36 color: "#e8e1d0"
39 }37 }
40
41 Indicators.MenuAction {
42 id: menuAction
43 menu: menuItem.menu
44 }
45}38}
4639
=== modified file 'plugins/Unity/Indicators/qml/SectionMenuItem.qml'
--- plugins/Unity/Indicators/qml/SectionMenuItem.qml 2013-08-14 09:07:45 +0000
+++ plugins/Unity/Indicators/qml/SectionMenuItem.qml 2013-08-23 11:34:24 +0000
@@ -22,15 +22,15 @@
22import Ubuntu.Components.ListItems 0.1 as ListItem22import Ubuntu.Components.ListItems 0.1 as ListItem
2323
24BaseMenuItem {24BaseMenuItem {
25 property string label: menu && menu.label ? menu.label : ""25 id: menuItem
26 property alias text: header.text
26 property bool busy: false27 property bool busy: false
2728
28 implicitHeight: label !== "" ? header.height : 029 implicitHeight: text !== "" ? header.height : 0
2930
30 ListItem.Header {31 ListItem.Header {
31 id: header32 id: header
3233
33 text: label
34 height: units.gu(4)34 height: units.gu(4)
35 anchors {35 anchors {
36 left: parent.left36 left: parent.left
3737
=== modified file 'plugins/Unity/Indicators/qml/SliderMenuItem.qml'
--- plugins/Unity/Indicators/qml/SliderMenuItem.qml 2013-08-14 09:07:45 +0000
+++ plugins/Unity/Indicators/qml/SliderMenuItem.qml 2013-08-23 11:34:24 +0000
@@ -24,17 +24,20 @@
2424
25FramedMenuItem {25FramedMenuItem {
26 id: menuItem26 id: menuItem
27 objectName: menuAction.name
28 enabled: menuAction.active
2927
30 property alias minimumValue: slider.minimumValue28 property alias minimumValue: slider.minimumValue
31 property alias maximumValue: slider.maximumValue29 property alias maximumValue: slider.maximumValue
32 readonly property double value: menu ? menuAction.state : 0.030 property double value: 0.0
31
32 property alias minIcon: leftImage.source
33 property alias maxIcon: rightImage.source
3334
34 property QtObject d: QtObject {35 property QtObject d: QtObject {
35 property bool enableValueConnection: true36 property bool enableValueConnection: true
36 }37 }
3738
39 signal changeState(real value)
40
38 onValueChanged: {41 onValueChanged: {
39 // TODO: look into adding a component to manage bi-directional bindings.42 // TODO: look into adding a component to manage bi-directional bindings.
40 var oldEnable = d.enableValueConnection43 var oldEnable = d.enableValueConnection
@@ -58,7 +61,6 @@
58 anchors.verticalCenter: row.verticalCenter61 anchors.verticalCenter: row.verticalCenter
59 height: units.gu(4)62 height: units.gu(4)
60 width: height63 width: height
61 source: menu.ext.minIcon
62 }64 }
6365
64 Components.Slider {66 Components.Slider {
@@ -75,19 +77,8 @@
75 value = menuItem.value77 value = menuItem.value
76 }78 }
7779
78 // FIXME: The interval should be [0.0 - 1.0]. Unfortunately, when80 minimumValue: 0.0
79 // reaching the boundaries (0.0 or 1.0), the value is converted81 maximumValue: 0.1
80 // to an integer when automatically wrapped in a variant when
81 // passed to QStateAction::updateState(…). The server chokes on
82 // those values, complaining that they’re not of the right type…
83 minimumValue: menu.ext.minValue ? menu.ext.minValue * 1.000001 : 0.0000001
84 maximumValue: {
85 var maximum = menu.ext.maxValue ? menu.ext.maxValue * 1.000001 : 0.9999999
86 if (maximum <= minimumValue) {
87 return minimumValue + 1;
88 }
89 return maximum;
90 }
9182
92 // FIXME - to be deprecated in Ubuntu.Components.83 // FIXME - to be deprecated in Ubuntu.Components.
93 // Use this to disable the label, since there is not way to do it on the component.84 // Use this to disable the label, since there is not way to do it on the component.
@@ -109,12 +100,6 @@
109 anchors.verticalCenter: row.verticalCenter100 anchors.verticalCenter: row.verticalCenter
110 height: units.gu(4)101 height: units.gu(4)
111 width: height102 width: height
112 source: menu.ext.maxIcon
113 }103 }
114 }104 }
115
116 Indicators.MenuAction {
117 id: menuAction
118 menu: menuItem.menu
119 }
120}105}
121106
=== modified file 'plugins/Unity/Indicators/qml/StandardMenuItem.qml'
--- plugins/Unity/Indicators/qml/StandardMenuItem.qml 2013-08-14 09:07:45 +0000
+++ plugins/Unity/Indicators/qml/StandardMenuItem.qml 2013-08-23 11:34:24 +0000
@@ -23,16 +23,16 @@
2323
24FramedMenuItem {24FramedMenuItem {
25 id: menuItem25 id: menuItem
26 objectName: menuAction.name26
27 enabled: menuAction.active27 property bool checkable: false
2828 property bool checked: false
29 readonly property bool checkable: menu ? (menu.isCheck || menu.isRadio) : false29
30 readonly property bool checked: checkable ? menu.isToggled : false30 signal activate()
3131
32 // FIXME : need a radio button from sdk32 // FIXME : need a radio button from sdk
33 // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/121186633 // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1211866
34 onCheckableChanged: {34 onCheckableChanged: {
35 if (menu && checkable) {35 if (checkable) {
36 icon = checkComponent.createObject(menuItem);36 icon = checkComponent.createObject(menuItem);
37 }37 }
38 }38 }
@@ -68,9 +68,4 @@
68 }68 }
69 }69 }
70 }70 }
71
72 Indicators.MenuAction {
73 id: menuAction
74 menu: menuItem.menu
75 }
76}71}
7772
=== modified file 'plugins/Unity/Indicators/qml/SwitchMenuItem.qml'
--- plugins/Unity/Indicators/qml/SwitchMenuItem.qml 2013-08-14 09:07:45 +0000
+++ plugins/Unity/Indicators/qml/SwitchMenuItem.qml 2013-08-23 11:34:24 +0000
@@ -24,10 +24,10 @@
2424
25FramedMenuItem {25FramedMenuItem {
26 id: menuItem26 id: menuItem
27 objectName: menuAction.name27
28 enabled: menuAction.enabled28 property bool checked: false
2929
30 readonly property bool checked: menu ? menu.isToggled : false30 signal activate()
3131
32 onCheckedChanged: {32 onCheckedChanged: {
33 // Can't rely on binding. Checked is assigned on click.33 // Can't rely on binding. Checked is assigned on click.
@@ -50,9 +50,4 @@
50 menuItem.activate();50 menuItem.activate();
51 }51 }
52 }52 }
53
54 Indicators.MenuAction {
55 id: menuAction
56 menu: menuItem.menu
57 }
58}53}
5954
=== modified file 'plugins/Unity/Indicators/qml/qmldir'
--- plugins/Unity/Indicators/qml/qmldir 2013-08-14 09:07:45 +0000
+++ plugins/Unity/Indicators/qml/qmldir 2013-08-23 11:34:24 +0000
@@ -11,7 +11,6 @@
11IndicatorBase 0.1 IndicatorBase.qml11IndicatorBase 0.1 IndicatorBase.qml
12IndicatorPage 0.1 IndicatorPage.qml12IndicatorPage 0.1 IndicatorPage.qml
13IndicatorWidget 0.1 IndicatorWidget.qml13IndicatorWidget 0.1 IndicatorWidget.qml
14MenuAction 0.1 MenuAction.qml
15MenuActionBinding 0.1 MenuActionBinding.qml14MenuActionBinding 0.1 MenuActionBinding.qml
16MenuItemFactory 0.1 MenuItemFactory.qml15MenuItemFactory 0.1 MenuItemFactory.qml
17ProgressMenuItem 0.1 ProgressMenuItem.qml16ProgressMenuItem 0.1 ProgressMenuItem.qml

Subscribers

People subscribed via source and target branches