on xenial help sign in
Fix coding style.
f513162Ying-Chun Liu
Dash/Generic/GenericPreview.qml+6−6
@@ -26,20 +26,20 @@ DashPreview {
26 property var previewData
26 property var previewData
27
27
28 title: previewData.title
28 title: previewData.title
29− url: previewData.image
29+ url: IconUtil.from_gicon(IconpreviewData.image)
30 previewWidthRatio: 0.6
30 previewWidthRatio: 0.6
31
31
32 buttons: GridView {
32 buttons: GridView {
33 id: buttons
33 id: buttons
34 model: genericPreview.previewData.actions
34 model: genericPreview.previewData.actions
35
35
36− property int numOfRows: (count+1)/2
36+ property int numOfRows: (count + 1) / 2
37 property int spacing: units.gu(1)
37 property int spacing: units.gu(1)
38− height: Math.max(units.gu(4), units.gu(4)*numOfRows+spacing*(numOfRows-1))
38+ height: Math.max(units.gu(4), units.gu(4)*numOfRows + spacing*(numOfRows - 1))
39
39
40− cellWidth: Math.max(units.gu(9), width/2)
40+ cellWidth: Math.max(units.gu(9), width / 2)
41− cellHeight: buttonHeight+spacing
41+ cellHeight: buttonHeight + spacing
42− property int buttonWidth: Math.max(0, width/2-spacing)
42+ property int buttonWidth: Math.max(0, width / 2 - spacing)
43 property int buttonHeight: units.gu(4)
43 property int buttonHeight: units.gu(4)
44
44
45 delegate: Button {
45 delegate: Button {
Dash/GenericScopeView.qml+15−1
@@ -19,10 +19,10 @@ import Ubuntu.Components 0.1
19import "../Components"
19import "../Components"
20import "../Components/ListItems" as ListItems
20import "../Components/ListItems" as ListItems
21import "../Components/IconUtil.js" as IconUtil
21import "../Components/IconUtil.js" as IconUtil
22−import "Generic"
23
22
24ScopeView {
23ScopeView {
25 id: scopeView
24 id: scopeView
25+ property alias previewShown: previewLoader.onScreen
26
26
27 onIsCurrentChanged: {
27 onIsCurrentChanged: {
28 pageHeader.resetSearch();
28 pageHeader.resetSearch();
@@ -48,6 +48,8 @@ ScopeView {
48 id: categoryView
48 id: categoryView
49 anchors.fill: parent
49 anchors.fill: parent
50 model: scopeView.categories
50 model: scopeView.categories
51+ forceNoClip: previewLoader.onScreen
52+
51 onAtYEndChanged: if (atYEnd) endReached()
53 onAtYEndChanged: if (atYEnd) endReached()
52 onMovingChanged: if (moving && atYEnd) endReached()
54 onMovingChanged: if (moving && atYEnd) endReached()
53
55
@@ -198,4 +200,16 @@ ScopeView {
198 item.previewData = previewLoader.previewData
200 item.previewData = previewLoader.previewData
199 }
201 }
200 }
202 }
203+
204+ // TODO: Move as InverseMouseArea to DashPreview
205+ MouseArea {
206+ enabled: previewLoader.onScreen
207+ anchors {
208+ fill: parent
209+ topMargin: effect.bottomGapPx
210+ }
211+ onClicked: {
212+ previewLoader.open = false;
213+ }
214+ }
201}
215}
Dash/PreviewDelegateMapper.qml+8−6
@@ -17,16 +17,18 @@
17import QtQuick 2.0
17import QtQuick 2.0
18
18
19QtObject {
19QtObject {
20+ property var d: QtObject {
21+ readonly property string genericPreview: "Generic/GenericPreview.qml"
20− property var previewDelegateMapping: {"preview-generic": "Generic/GenericPreview.qml",
22+ property var previewDelegateMapping: {"preview-generic": genericPreview,
21− }
23+ }
22− property string genericPreview: "Generic/GenericPreview.qml"
24+ }
23
25
24 function map(rendererName) {
26 function map(rendererName) {
25− var customPreview = previewDelegateMapping[rendererName]
27+ var customPreview = d.previewDelegateMapping[rendererName]
26 if (customPreview != undefined) {
28 if (customPreview != undefined) {
27 return customPreview
29 return customPreview
28 }
30 }
29− console.info("Renderer "+rendererName+" not found, using preview-generic")
31+ console.debug("Renderer "+rendererName+" not found, using preview-generic")
30− return genericPreview
32+ return d.genericPreview
31 }
33 }
32}
34}