on xenial help sign in
Fix coding style.

Fix tapping outside of the preview. Fix private properties. Fix switching to adjacent dash. Fix import Generic.

commitf51316221816972ee19d02484ddc9a3592d5f263 authorYing-Chun Liu <paul.liu@canonical.com> dateWed 10 Jul 2013, 20:58 (13 years ago) parent6139af7
3 files changed+29−13
Dash/Generic/GenericPreview.qml+6−6 Dash/GenericScopeView.qml+15−1 Dash/PreviewDelegateMapper.qml+8−6
Dash/Generic/GenericPreview.qml+6−6
@@ -26,20 +26,20 @@ DashPreview {
2626 property var previewData
2727
2828 title: previewData.title
29− url: previewData.image
29+ url: IconUtil.from_gicon(IconpreviewData.image)
3030 previewWidthRatio: 0.6
3131
3232 buttons: GridView {
3333 id: buttons
3434 model: genericPreview.previewData.actions
3535
36− property int numOfRows: (count+1)/2
36+ property int numOfRows: (count + 1) / 2
3737 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))
3939
40− cellWidth: Math.max(units.gu(9), width/2)
41− cellHeight: buttonHeight+spacing
42− property int buttonWidth: Math.max(0, width/2-spacing)
40+ cellWidth: Math.max(units.gu(9), width / 2)
41+ cellHeight: buttonHeight + spacing
42+ property int buttonWidth: Math.max(0, width / 2 - spacing)
4343 property int buttonHeight: units.gu(4)
4444
4545 delegate: Button {
Dash/GenericScopeView.qml+15−1
@@ -19,10 +19,10 @@ import Ubuntu.Components 0.1
1919import "../Components"
2020import "../Components/ListItems" as ListItems
2121import "../Components/IconUtil.js" as IconUtil
22−import "Generic"
2322
2423ScopeView {
2524 id: scopeView
25+ property alias previewShown: previewLoader.onScreen
2626
2727 onIsCurrentChanged: {
2828 pageHeader.resetSearch();
@@ -48,6 +48,8 @@ ScopeView {
4848 id: categoryView
4949 anchors.fill: parent
5050 model: scopeView.categories
51+ forceNoClip: previewLoader.onScreen
52+
5153 onAtYEndChanged: if (atYEnd) endReached()
5254 onMovingChanged: if (moving && atYEnd) endReached()
5355
@@ -198,4 +200,16 @@ ScopeView {
198200 item.previewData = previewLoader.previewData
199201 }
200202 }
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+ }
201215}
Dash/PreviewDelegateMapper.qml+8−6
@@ -17,16 +17,18 @@
1717import QtQuick 2.0
1818
1919QtObject {
20− property var previewDelegateMapping: {"preview-generic": "Generic/GenericPreview.qml",
21− }
22− property string genericPreview: "Generic/GenericPreview.qml"
20+ property var d: QtObject {
21+ readonly property string genericPreview: "Generic/GenericPreview.qml"
22+ property var previewDelegateMapping: {"preview-generic": genericPreview,
23+ }
24+ }
2325
2426 function map(rendererName) {
25− var customPreview = previewDelegateMapping[rendererName]
27+ var customPreview = d.previewDelegateMapping[rendererName]
2628 if (customPreview != undefined) {
2729 return customPreview
2830 }
29− console.info("Renderer "+rendererName+" not found, using preview-generic")
30− return genericPreview
31+ console.debug("Renderer "+rendererName+" not found, using preview-generic")
32+ return d.genericPreview
3133 }
3234}