on xenial help sign in
Various changes for Indicator UI polishing
commit6af3cbe65feb52149592cd6a24884384d3ba28d6 authorNick Dedekind <nicholas.dedekind@gmail.com> dateFri 25 Jul 2014, 18:52 (12 years ago) parentb6247b4
5 files changed+104−83
qml/Panel/Indicators/DefaultIndicatorPage.qml+1−22 qml/Panel/Indicators/IndicatorDelegate.qml+2−10 qml/Panel/Indicators/MenuItemFactory.qml+88−29 qml/Panel/Indicators/MessageMenuItemFactory.qml+9−22 qml/Panel/Indicators/client/IndicatorsClient.qml+4
qml/Panel/Indicators/DefaultIndicatorPage.qml+1−22
@@ -28,7 +28,6 @@ IndicatorBase {
2828 //const
2929 property bool contentActive: false
3030 property string title: rootActionState.title
31− property alias emptyText: emptyLabel.text
3231 property alias highlightFollowsCurrentItem : mainMenu.highlightFollowsCurrentItem
3332
3433 Indicators.UnityMenuModelStack {
@@ -135,7 +134,7 @@ IndicatorBase {
135134 right: parent.right
136135 }
137136
138− sourceComponent: factory.load(model)
137+ sourceComponent: factory.load(model, identifier)
139138
140139 onLoaded: {
141140 if (item.hasOwnProperty("selected")) {
@@ -180,26 +179,6 @@ IndicatorBase {
180179 menuModel: mainMenu.model ? mainMenu.model : null
181180 }
182181
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−
203182 function start()
204183 {
205184 reset()
qml/Panel/Indicators/IndicatorDelegate.qml+2−10
@@ -20,14 +20,6 @@
2020import QtQuick 2.0
2121
2222IndicatorBase {
23− enabled: false
24−
25− onRootActionStateChanged: {
26− if (rootActionState == undefined) {
27− enabled = false;
28− return;
29− }
30−
31− enabled = rootActionState.visible;
32− }
23+ enabled: rootActionState.visible
24+ property string title: rootActionState.title
3325}
qml/Panel/Indicators/MenuItemFactory.qml+88−29
@@ -32,31 +32,36 @@ Item {
3232 property var menuModel: null
3333
3434 property var _map: {
35− "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
36− "unity.widgets.systemsettings.tablet.switch" : switchMenu,
37−
38− "com.canonical.indicator.button" : buttonMenu,
39− "com.canonical.indicator.div" : separatorMenu,
40− "com.canonical.indicator.section" : sectionMenu,
41− "com.canonical.indicator.progress" : progressMenu,
42− "com.canonical.indicator.slider" : sliderMenu,
43− "com.canonical.indicator.switch" : switchMenu,
44− "com.canonical.indicator.alarm" : alarmMenu,
45− "com.canonical.indicator.appointment" : appointmentMenu,
46− "com.canonical.indicator.transfer" : transferMenu,
47− "com.canonical.indicator.button-section" : buttonSectionMenu,
48−
49− "com.canonical.indicator.messages.messageitem" : messageItem,
50− "com.canonical.indicator.messages.sourceitem" : groupedMessage,
51−
52− "com.canonical.unity.slider" : sliderMenu,
53− "com.canonical.unity.switch" : switchMenu,
54−
55− "com.canonical.unity.media-player" : mediaPayerMenu,
56− "com.canonical.unity.playback-item" : playbackItemMenu,
57−
58− "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
59− "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
35+ "default": {
36+ "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
37+ "unity.widgets.systemsettings.tablet.switch" : switchMenu,
38+
39+ "com.canonical.indicator.button" : buttonMenu,
40+ "com.canonical.indicator.div" : separatorMenu,
41+ "com.canonical.indicator.section" : sectionMenu,
42+ "com.canonical.indicator.progress" : progressMenu,
43+ "com.canonical.indicator.slider" : sliderMenu,
44+ "com.canonical.indicator.switch" : switchMenu,
45+ "com.canonical.indicator.alarm" : alarmMenu,
46+ "com.canonical.indicator.appointment" : appointmentMenu,
47+ "com.canonical.indicator.transfer" : transferMenu,
48+ "com.canonical.indicator.button-section" : buttonSectionMenu,
49+
50+ "com.canonical.indicator.messages.messageitem" : messageItem,
51+ "com.canonical.indicator.messages.sourceitem" : groupedMessage,
52+
53+ "com.canonical.unity.slider" : sliderMenu,
54+ "com.canonical.unity.switch" : switchMenu,
55+
56+ "com.canonical.unity.media-player" : mediaPayerMenu,
57+ "com.canonical.unity.playback-item" : playbackItemMenu,
58+
59+ "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
60+ "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
61+ },
62+ "indicator-messages" : {
63+ "com.canonical.indicator.button" : messagesButtonMenu
64+ }
6065 }
6166
6267 function getExtendedProperty(object, propertyName, defaultValue) {
@@ -126,6 +131,7 @@ Item {
126131 }
127132 }
128133
134+
129135 Component {
130136 id: buttonMenu;
131137
@@ -143,6 +149,36 @@ Item {
143149 }
144150 }
145151 }
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+
146182 Component {
147183 id: sectionMenu;
148184
@@ -186,6 +222,20 @@ Item {
186222 onTriggered: {
187223 menuModel.activate(menuIndex);
188224 }
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+ }
189239 }
190240 }
191241
@@ -207,7 +257,6 @@ Item {
207257 }
208258 }
209259
210−
211260 Component {
212261 id: switchMenu;
213262
@@ -350,7 +399,7 @@ Item {
350399
351400 text: menuData && menuData.label || ""
352401 enabled: menuData && menuData.sensitive || false
353− checked: menuData && menuData.isToggled || false
402+ active: menuData && menuData.isToggled || false
354403 secure: getExtendedProperty(extendedData, "xCanonicalWifiApIsSecure", false)
355404 adHoc: getExtendedProperty(extendedData, "xCanonicalWifiApIsAdhoc", false)
356405 signalStrength: strengthAction.valid ? strengthAction.state : 0
@@ -439,6 +488,7 @@ Item {
439488 running: getExtendedProperty(actionState, "running", false)
440489 state: getExtendedProperty(actionState, "state", "")
441490 enabled: menuData && menuData.sensitive || false
491+ showDivider: false
442492
443493 onTriggered: {
444494 model.activate(modelIndex);
@@ -647,9 +697,18 @@ Item {
647697 }
648698 }
649699
650− function load(modelData) {
700+ function load(modelData, context) {
651701 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+ }
653712 if (component !== undefined) {
654713 return component;
655714 }
qml/Panel/Indicators/MessageMenuItemFactory.qml+9−22
@@ -76,18 +76,18 @@ Item {
7676 sourceComponent: loadMessage(actionsDescription);
7777
7878 Component {
79− id: simpleTextMessage
79+ id: simpleMessage
8080
81− Menus.SimpleTextMessageMenu {
81+ Menus.SimpleMessageMenu {
8282 id: message
8383 objectName: "simpleTextMessage"
8484 // text
8585 title: menuData && menuData.label || ""
8686 time: timeFormatter.timeString
87− message: getExtendedProperty(extendedData, "xCanonicalText", "")
87+ body: getExtendedProperty(extendedData, "xCanonicalText", "")
8888 // icons
8989 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")
9191 // actions
9292 enabled: menuData && menuData.sensitive || false
9393 removable: !selected
@@ -106,10 +106,6 @@ Item {
106106 menuSelected();
107107 }
108108 }
109−
110− backgroundIndicator: RemoveBackground {
111− state: message.swipingState
112− }
113109 }
114110 }
115111
@@ -130,11 +126,11 @@ Item {
130126 // text
131127 title: menuData && menuData.label || ""
132128 time: timeFormatter.timeString
133− message: getExtendedProperty(extendedData, "xCanonicalText", "")
129+ body: getExtendedProperty(extendedData, "xCanonicalText", "")
134130 replyButtonText: getExtendedProperty(replyActionDescription, "label", "Send")
135131 // icons
136132 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")
138134 // actions
139135 replyEnabled: replyAction.valid && replyAction.enabled
140136 enabled: menuData && menuData.sensitive || false
@@ -157,10 +153,6 @@ Item {
157153 menuSelected();
158154 }
159155 }
160−
161− backgroundIndicator: RemoveBackground {
162− state: message.swipingState
163− }
164156 }
165157 }
166158 Component {
@@ -186,13 +178,12 @@ Item {
186178 // text
187179 title: menuData && menuData.label || ""
188180 time: timeFormatter.timeString
189− message: getExtendedProperty(extendedData, "xCanonicalText", "")
181+ body: getExtendedProperty(extendedData, "xCanonicalText", "")
190182 actionButtonText: getExtendedProperty(activateActionDescription, "label", "Call back")
191183 replyButtonText: getExtendedProperty(replyActionDescription, "label", "Send")
192− replyMessages: getExtendedProperty(replyActionDescription, "parameter-hint", "")
193184 // icons
194185 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")
196187 // actions
197188 activateEnabled: activateAction.valid && activateAction.enabled
198189 replyEnabled: replyAction.valid && replyAction.enabled
@@ -219,10 +210,6 @@ Item {
219210 menuSelected();
220211 }
221212 }
222−
223− backgroundIndicator: RemoveBackground {
224− state: message.swipingState
225− }
226213 }
227214 }
228215 }
@@ -240,7 +227,7 @@ Item {
240227 }
241228
242229 if (parameterType === "") {
243− return simpleTextMessage;
230+ return simpleMessage;
244231 } else if (parameterType === "s") {
245232 return textMessage;
246233 } else if (parameterType === "_s") {
qml/Panel/Indicators/client/IndicatorsClient.qml+4
@@ -25,6 +25,10 @@ Rectangle {
2525 color: "black"
2626 id: root
2727
28+ Component.onCompleted: {
29+ Theme.name = "Ubuntu.Components.Themes.SuruGradient"
30+ }
31+
2832 PageStack {
2933 id: pages
3034 anchors.fill: parent