on xenial help sign in
Various changes for Indicator UI polishing
6af3cbeNick Dedekind
qml/Panel/Indicators/DefaultIndicatorPage.qml+1−22
@@ -28,7 +28,6 @@ IndicatorBase {
28 //const
28 //const
29 property bool contentActive: false
29 property bool contentActive: false
30 property string title: rootActionState.title
30 property string title: rootActionState.title
31− property alias emptyText: emptyLabel.text
32 property alias highlightFollowsCurrentItem : mainMenu.highlightFollowsCurrentItem
31 property alias highlightFollowsCurrentItem : mainMenu.highlightFollowsCurrentItem
33
32
34 Indicators.UnityMenuModelStack {
33 Indicators.UnityMenuModelStack {
@@ -135,7 +134,7 @@ IndicatorBase {
135 right: parent.right
134 right: parent.right
136 }
135 }
137
136
138− sourceComponent: factory.load(model)
137+ sourceComponent: factory.load(model, identifier)
139
138
140 onLoaded: {
139 onLoaded: {
141 if (item.hasOwnProperty("selected")) {
140 if (item.hasOwnProperty("selected")) {
@@ -180,26 +179,6 @@ IndicatorBase {
180 menuModel: mainMenu.model ? mainMenu.model : null
179 menuModel: mainMenu.model ? mainMenu.model : null
181 }
180 }
182
181
183− Components.Label {
184− id: emptyLabel
185− objectName: "emptyLabel"
186− visible: mainMenu.count == 0
187− anchors {
188− top: parent.top
189− left: parent.left
190− right: parent.right
191− topMargin: units.gu(2)
192− }
193− wrapMode: Text.WordWrap
194− horizontalAlignment: Text.AlignHCenter
195−
196− //style
197− color: "#e8e1d0"
198− fontSize: "medium"
199−
200− text: "Empty!"
201− }
202−
203 function start()
182 function start()
204 {
183 {
205 reset()
184 reset()
qml/Panel/Indicators/IndicatorDelegate.qml+2−10
@@ -20,14 +20,6 @@
20import QtQuick 2.0
20import QtQuick 2.0
21
21
22IndicatorBase {
22IndicatorBase {
23− enabled: false
24−
25− onRootActionStateChanged: {
26− if (rootActionState == undefined) {
27− enabled = false;
28− return;
29− }
30−
31− enabled = rootActionState.visible;
23+ enabled: rootActionState.visible
32− }
24+ property string title: rootActionState.title
33}
25}
qml/Panel/Indicators/MenuItemFactory.qml+88−29
@@ -32,31 +32,36 @@ Item {
32 property var menuModel: null
32 property var menuModel: null
33
33
34 property var _map: {
34 property var _map: {
35+ "default": {
35− "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
36+ "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
36− "unity.widgets.systemsettings.tablet.switch" : switchMenu,
37+ "unity.widgets.systemsettings.tablet.switch" : switchMenu,
37−
38+
38− "com.canonical.indicator.button" : buttonMenu,
39+ "com.canonical.indicator.button" : buttonMenu,
39− "com.canonical.indicator.div" : separatorMenu,
40+ "com.canonical.indicator.div" : separatorMenu,
40− "com.canonical.indicator.section" : sectionMenu,
41+ "com.canonical.indicator.section" : sectionMenu,
41− "com.canonical.indicator.progress" : progressMenu,
42+ "com.canonical.indicator.progress" : progressMenu,
42− "com.canonical.indicator.slider" : sliderMenu,
43+ "com.canonical.indicator.slider" : sliderMenu,
43− "com.canonical.indicator.switch" : switchMenu,
44+ "com.canonical.indicator.switch" : switchMenu,
44− "com.canonical.indicator.alarm" : alarmMenu,
45+ "com.canonical.indicator.alarm" : alarmMenu,
45− "com.canonical.indicator.appointment" : appointmentMenu,
46+ "com.canonical.indicator.appointment" : appointmentMenu,
46− "com.canonical.indicator.transfer" : transferMenu,
47+ "com.canonical.indicator.transfer" : transferMenu,
47− "com.canonical.indicator.button-section" : buttonSectionMenu,
48+ "com.canonical.indicator.button-section" : buttonSectionMenu,
48−
49+
49− "com.canonical.indicator.messages.messageitem" : messageItem,
50+ "com.canonical.indicator.messages.messageitem" : messageItem,
50− "com.canonical.indicator.messages.sourceitem" : groupedMessage,
51+ "com.canonical.indicator.messages.sourceitem" : groupedMessage,
51−
52+
52− "com.canonical.unity.slider" : sliderMenu,
53+ "com.canonical.unity.slider" : sliderMenu,
53− "com.canonical.unity.switch" : switchMenu,
54+ "com.canonical.unity.switch" : switchMenu,
54−
55+
55− "com.canonical.unity.media-player" : mediaPayerMenu,
56+ "com.canonical.unity.media-player" : mediaPayerMenu,
56− "com.canonical.unity.playback-item" : playbackItemMenu,
57+ "com.canonical.unity.playback-item" : playbackItemMenu,
57−
58+
58− "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
59+ "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
59− "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
60+ "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
61+ },
62+ "indicator-messages" : {
63+ "com.canonical.indicator.button" : messagesButtonMenu
64+ }
60 }
65 }
61
66
62 function getExtendedProperty(object, propertyName, defaultValue) {
67 function getExtendedProperty(object, propertyName, defaultValue) {
@@ -126,6 +131,7 @@ Item {
126 }
131 }
127 }
132 }
128
133
134+
129 Component {
135 Component {
130 id: buttonMenu;
136 id: buttonMenu;
131
137
@@ -143,6 +149,36 @@ Item {
143 }
149 }
144 }
150 }
145 }
151 }
152+
153+ Component {
154+ id: messagesButtonMenu;
155+
156+ Item {
157+ objectName: "messagesButtonMenu"
158+ property QtObject menuData: null
159+ property var menuModel: menuFactory.menuModel
160+ property int menuIndex: -1
161+
162+ implicitHeight: units.gu(5)
163+ enabled: menuData && menuData.sensitive || false
164+
165+ Label {
166+ id: buttonMenuLabel
167+ text: menuData && menuData.label || ""
168+ anchors.centerIn: parent
169+ font.bold: true
170+ }
171+
172+ MouseArea {
173+ anchors {
174+ fill: buttonMenuLabel
175+ margins: units.gu(-1)
176+ }
177+ onClicked: menuModel.activate(menuIndex);
178+ }
179+ }
180+ }
181+
146 Component {
182 Component {
147 id: sectionMenu;
183 id: sectionMenu;
148
184
@@ -186,6 +222,20 @@ Item {
186 onTriggered: {
222 onTriggered: {
187 menuModel.activate(menuIndex);
223 menuModel.activate(menuIndex);
188 }
224 }
225+
226+ property bool settingsMenu: menuData.action.indexOf("settings") > -1
227+ backColor: settingsMenu ? Qt.rgba(1,1,1,0.05) : "transparent"
228+
229+ component: settingsMenu ? buttonForSettings : undefined
230+ Component {
231+ id: buttonForSettings
232+ Icon {
233+ name: "settings"
234+ height: units.gu(3)
235+ width: height
236+ color: Theme.palette.selected.backgroundText
237+ }
238+ }
189 }
239 }
190 }
240 }
191
241
@@ -207,7 +257,6 @@ Item {
207 }
257 }
208 }
258 }
209
259
210−
211 Component {
260 Component {
212 id: switchMenu;
261 id: switchMenu;
213
262
@@ -350,7 +399,7 @@ Item {
350
399
351 text: menuData && menuData.label || ""
400 text: menuData && menuData.label || ""
352 enabled: menuData && menuData.sensitive || false
401 enabled: menuData && menuData.sensitive || false
353− checked: menuData && menuData.isToggled || false
402+ active: menuData && menuData.isToggled || false
354 secure: getExtendedProperty(extendedData, "xCanonicalWifiApIsSecure", false)
403 secure: getExtendedProperty(extendedData, "xCanonicalWifiApIsSecure", false)
355 adHoc: getExtendedProperty(extendedData, "xCanonicalWifiApIsAdhoc", false)
404 adHoc: getExtendedProperty(extendedData, "xCanonicalWifiApIsAdhoc", false)
356 signalStrength: strengthAction.valid ? strengthAction.state : 0
405 signalStrength: strengthAction.valid ? strengthAction.state : 0
@@ -439,6 +488,7 @@ Item {
439 running: getExtendedProperty(actionState, "running", false)
488 running: getExtendedProperty(actionState, "running", false)
440 state: getExtendedProperty(actionState, "state", "")
489 state: getExtendedProperty(actionState, "state", "")
441 enabled: menuData && menuData.sensitive || false
490 enabled: menuData && menuData.sensitive || false
491+ showDivider: false
442
492
443 onTriggered: {
493 onTriggered: {
444 model.activate(modelIndex);
494 model.activate(modelIndex);
@@ -647,9 +697,18 @@ Item {
647 }
697 }
648 }
698 }
649
699
650− function load(modelData) {
700+ function load(modelData, context) {
651 if (modelData.type !== undefined) {
701 if (modelData.type !== undefined) {
652− var component = _map[modelData.type];
702+ var component = undefined;
703+
704+ var contextComponents = _map[context];
705+ if (contextComponents !== undefined) {
706+ component = contextComponents[modelData.type];
707+ }
708+
709+ if (component === undefined) {
710+ component = _map["default"][modelData.type];
711+ }
653 if (component !== undefined) {
712 if (component !== undefined) {
654 return component;
713 return component;
655 }
714 }
qml/Panel/Indicators/MessageMenuItemFactory.qml+9−22
@@ -76,18 +76,18 @@ Item {
76 sourceComponent: loadMessage(actionsDescription);
76 sourceComponent: loadMessage(actionsDescription);
77
77
78 Component {
78 Component {
79− id: simpleTextMessage
79+ id: simpleMessage
80
80
81− Menus.SimpleTextMessageMenu {
81+ Menus.SimpleMessageMenu {
82 id: message
82 id: message
83 objectName: "simpleTextMessage"
83 objectName: "simpleTextMessage"
84 // text
84 // text
85 title: menuData && menuData.label || ""
85 title: menuData && menuData.label || ""
86 time: timeFormatter.timeString
86 time: timeFormatter.timeString
87− message: getExtendedProperty(extendedData, "xCanonicalText", "")
87+ body: getExtendedProperty(extendedData, "xCanonicalText", "")
88 // icons
88 // icons
89 avatar: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_contact.png")
89 avatar: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_contact.png")
90− appIcon: getExtendedProperty(extendedData, "xCanonicalAppIcon", "qrc:/indicators/artwork/messaging/default_app.svg")
90+ icon: getExtendedProperty(extendedData, "xCanonicalAppIcon", "qrc:/indicators/artwork/messaging/default_app.svg")
91 // actions
91 // actions
92 enabled: menuData && menuData.sensitive || false
92 enabled: menuData && menuData.sensitive || false
93 removable: !selected
93 removable: !selected
@@ -106,10 +106,6 @@ Item {
106 menuSelected();
106 menuSelected();
107 }
107 }
108 }
108 }
109−
110− backgroundIndicator: RemoveBackground {
111− state: message.swipingState
112− }
113 }
109 }
114 }
110 }
115
111
@@ -130,11 +126,11 @@ Item {
130 // text
126 // text
131 title: menuData && menuData.label || ""
127 title: menuData && menuData.label || ""
132 time: timeFormatter.timeString
128 time: timeFormatter.timeString
133− message: getExtendedProperty(extendedData, "xCanonicalText", "")
129+ body: getExtendedProperty(extendedData, "xCanonicalText", "")
134 replyButtonText: getExtendedProperty(replyActionDescription, "label", "Send")
130 replyButtonText: getExtendedProperty(replyActionDescription, "label", "Send")
135 // icons
131 // icons
136 avatar: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_contact.png")
132 avatar: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_contact.png")
137− appIcon: getExtendedProperty(extendedData, "xCanonicalAppIcon", "qrc:/indicators/artwork/messaging/default_app.svg")
133+ icon: getExtendedProperty(extendedData, "xCanonicalAppIcon", "qrc:/indicators/artwork/messaging/default_app.svg")
138 // actions
134 // actions
139 replyEnabled: replyAction.valid && replyAction.enabled
135 replyEnabled: replyAction.valid && replyAction.enabled
140 enabled: menuData && menuData.sensitive || false
136 enabled: menuData && menuData.sensitive || false
@@ -157,10 +153,6 @@ Item {
157 menuSelected();
153 menuSelected();
158 }
154 }
159 }
155 }
160−
161− backgroundIndicator: RemoveBackground {
162− state: message.swipingState
163− }
164 }
156 }
165 }
157 }
166 Component {
158 Component {
@@ -186,13 +178,12 @@ Item {
186 // text
178 // text
187 title: menuData && menuData.label || ""
179 title: menuData && menuData.label || ""
188 time: timeFormatter.timeString
180 time: timeFormatter.timeString
189− message: getExtendedProperty(extendedData, "xCanonicalText", "")
181+ body: getExtendedProperty(extendedData, "xCanonicalText", "")
190 actionButtonText: getExtendedProperty(activateActionDescription, "label", "Call back")
182 actionButtonText: getExtendedProperty(activateActionDescription, "label", "Call back")
191 replyButtonText: getExtendedProperty(replyActionDescription, "label", "Send")
183 replyButtonText: getExtendedProperty(replyActionDescription, "label", "Send")
192− replyMessages: getExtendedProperty(replyActionDescription, "parameter-hint", "")
193 // icons
184 // icons
194 avatar: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_contact.png")
185 avatar: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_contact.png")
195− appIcon: getExtendedProperty(extendedData, "xCanonicalAppIcon", "qrc:/indicators/artwork/messaging/default_app.svg")
186+ icon: getExtendedProperty(extendedData, "xCanonicalAppIcon", "qrc:/indicators/artwork/messaging/default_app.svg")
196 // actions
187 // actions
197 activateEnabled: activateAction.valid && activateAction.enabled
188 activateEnabled: activateAction.valid && activateAction.enabled
198 replyEnabled: replyAction.valid && replyAction.enabled
189 replyEnabled: replyAction.valid && replyAction.enabled
@@ -219,10 +210,6 @@ Item {
219 menuSelected();
210 menuSelected();
220 }
211 }
221 }
212 }
222−
223− backgroundIndicator: RemoveBackground {
224− state: message.swipingState
225− }
226 }
213 }
227 }
214 }
228 }
215 }
@@ -240,7 +227,7 @@ Item {
240 }
227 }
241
228
242 if (parameterType === "") {
229 if (parameterType === "") {
243− return simpleTextMessage;
230+ return simpleMessage;
244 } else if (parameterType === "s") {
231 } else if (parameterType === "s") {
245 return textMessage;
232 return textMessage;
246 } else if (parameterType === "_s") {
233 } else if (parameterType === "_s") {
qml/Panel/Indicators/client/IndicatorsClient.qml+4
@@ -25,6 +25,10 @@ Rectangle {
25 color: "black"
25 color: "black"
26 id: root
26 id: root
27
27
28+ Component.onCompleted: {
29+ Theme.name = "Ubuntu.Components.Themes.SuruGradient"
30+ }
31+
28 PageStack {
32 PageStack {
29 id: pages
33 id: pages
30 anchors.fill: parent
34 anchors.fill: parent