on xenial help sign in
Add support for preview button color customization. Deprecate support for action icons.

Approved by: Andrea Cimitan, PS Jenkins bot

commitbc473079291a8bc874ee1829178de9280eefb658 authorMichał Sawicz <michal.sawicz@canonical.com> dateWed 27 Aug 2014, 15:34 (12 years ago) parent3f36d301f5a0a2
6 files changed+23−17
qml/Dash/Previews/PreviewActionButton.qml+1−4 qml/Dash/Previews/PreviewActionCombo.qml+4−2 qml/Dash/Previews/PreviewActions.qml+6 qml/Dash/Previews/PreviewExpandable.qml+3−2 qml/Dash/Previews/PreviewWidgetFactory.qml+1−1 tests/qmltests/Dash/Previews/tst_PreviewActions.qml+8−8
qml/Dash/Previews/PreviewActionButton.qml+1−4
@@ -15,16 +15,13 @@
1515 */
1616
1717import QtQuick 2.0
18−import Ubuntu.Components 0.1
18+import Ubuntu.Components 1.1
1919
2020Button {
2121 signal triggeredAction(var actionData)
2222
2323 property var data: null
2424 objectName: "button" + (data && data.id || "")
25− color: Theme.palette.selected.foreground
2625 text: data && data.label || ""
27− iconSource: data && data.icon || ""
28− iconPosition: "left"
2926 onClicked: triggeredAction(data)
3027}
qml/Dash/Previews/PreviewActionCombo.qml+4−2
@@ -15,7 +15,7 @@
1515 */
1616
1717import QtQuick 2.0
18−import Ubuntu.Components 0.1
18+import Ubuntu.Components 1.1
1919
2020Item {
2121 id: root
@@ -25,6 +25,7 @@ Item {
2525 signal triggeredAction(var actionData)
2626
2727 property alias model: actionRepeater.model
28+ property alias strokeColor: moreButton.strokeColor
2829
2930 Button {
3031 id: moreButton
@@ -32,7 +33,7 @@ Item {
3233
3334 objectName: "moreLessButton"
3435 text: !expanded ? i18n.tr("More...") : i18n.tr("Less...")
35− color: Theme.palette.selected.foreground
36+ strokeColor: Theme.palette.normal.baseText
3637 onClicked: expanded = !expanded
3738 width: parent.width
3839 }
@@ -60,6 +61,7 @@ Item {
6061 data: modelData
6162 width: implicitWidth < parent.width ? parent.width : implicitWidth
6263 onClicked: root.triggeredAction(modelData)
64+ strokeColor: moreButton.strokeColor
6365 }
6466 }
6567 }
qml/Dash/Previews/PreviewActions.qml+6
@@ -46,6 +46,11 @@ PreviewWidget {
4646 item.model = row.actions.slice(1);
4747 }
4848 }
49+ Binding {
50+ target: loader.item
51+ property: "strokeColor"
52+ value: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText
53+ }
4954 Connections {
5055 target: loader.item
5156 onTriggeredAction: {
@@ -59,6 +64,7 @@ PreviewWidget {
5964 visible: row.actions && row.actions.length > 0
6065 onTriggeredAction: root.triggered(root.widgetId, actionData.id, actionData)
6166 width: (root.width - units.gu(1)) / 2
67+ color: root.scopeStyle ? root.scopeStyle.previewButtonColor : Theme.palette.selected.foreground
6268 }
6369 }
6470}
qml/Dash/Previews/PreviewExpandable.qml+3−2
@@ -59,9 +59,10 @@ PreviewWidget {
5959 }
6060 Icon {
6161 anchors.fill: parent
62− width: 64
63− height: 64
62+ width: units.gu(3)
63+ height: units.gu(3)
6464 name: root.expanded ? "view-collapse" : "view-expand"
65+ color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText
6566 }
6667 }
6768
qml/Dash/Previews/PreviewWidgetFactory.qml+1−1
@@ -70,7 +70,7 @@ Loader {
7070 item.widgetData = Qt.binding(function() { return root.widgetData } )
7171 item.isCurrentPreview = Qt.binding(function() { return root.isCurrentPreview } )
7272 item.expanded = Qt.binding(function() { return root.expanded } )
73− if (item.hasOwnProperty("scopeStyle")) item.scopeStyle = root.scopeStyle;
73+ item.scopeStyle = Qt.binding(function() { return root.scopeStyle } )
7474 }
7575
7676 Connections {
tests/qmltests/Dash/Previews/tst_PreviewActions.qml+8−8
@@ -27,21 +27,21 @@ Rectangle {
2727 height: units.gu(80)
2828
2929 property var actionDataOneAction: {
30− "actions": [{"label": "Some Label", "icon": "../graphics/play_button.png", "id": "someid"}]
30+ "actions": [{"label": "Some Label", "id": "someid"}]
3131 }
3232
3333 property var actionDataTwoActions: {
34− "actions": [{"label": "Some Label A", "icon": "../graphics/icon_clear.png", "id": "someid1"},
35− {"label": "Some Label B", "icon": "../graphics/play_button.png", "id": "someid2"}
34+ "actions": [{"label": "Some Label A", "id": "someid1"},
35+ {"label": "Some Label B", "id": "someid2"}
3636 ]
3737 }
3838
3939 property var actionDataFiveActions: {
40− "actions": [{"label": "Some Label C", "icon": "../graphics/play_button.png", "id": "someid3"},
41− {"label": "Some Label D", "icon": "../graphics/icon_clear.png", "id": "someid4"},
42− {"label": "Some Label E", "icon": "../graphics/play_button.png", "id": "someid5"},
43− {"label": "Some Label F", "icon": "../graphics/icon_clear.png", "id": "someid6"},
44− {"label": "Some Label G", "icon": "../graphics/play_button.png", "id": "someid7"}
40+ "actions": [{"label": "Some Label C", "id": "someid3"},
41+ {"label": "Some Label D", "id": "someid4"},
42+ {"label": "Some Label E", "id": "someid5"},
43+ {"label": "Some Label F", "id": "someid6"},
44+ {"label": "Some Label G", "id": "someid7"}
4545 ]
4646 }
4747