on xenial help sign in
Preview comes from the right
commit1c2fb1998f02338de3432a3575aa6aef99211119 authorAlbert Astals <albert.astals@canonical.com> dateFri 21 Feb 2014, 16:35 (13 years ago) parent08ee0a6
4 files changed+20−55
qml/Dash/DashContent.qml+9−14 qml/Dash/GenericScopeView.qml−16 qml/Dash/PreviewListView.qml+2−10 qml/Dash/ScopeItem.qml+9−15
qml/Dash/DashContent.qml+9−14
@@ -93,7 +93,11 @@ Item {
9393
9494 Item {
9595 id: dashContentListHolder
96− anchors.fill: parent
96+
97+ x: previewListView.open ? -width : 0
98+ Behavior on x { UbuntuNumberAnimation { } }
99+ width: parent.width
100+ height: parent.height
97101
98102 ListView {
99103 id: dashContentList
@@ -114,6 +118,7 @@ Item {
114118 cacheBuffer: 1073741823
115119 onMovementStarted: dashContent.movementStarted()
116120 onMovementEnded: dashContent.movementEnded()
121+ clip: parent.x != 0
117122
118123 // If the number of items is less than the current index, then need to reset to another item.
119124 onCountChanged: {
@@ -149,7 +154,6 @@ Item {
149154 item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem })
150155 item.tabBarHeight = dashPageHeader.implicitHeight;
151156 item.pageHeader = dashPageHeader;
152− item.openEffect = openEffect;
153157 item.previewListView = previewListView;
154158 dashContentList.movementStarted.connect(item.movementStarted)
155159 dashContent.positionedAtBeginning.connect(item.positionedAtBeginning)
@@ -219,21 +223,12 @@ Item {
219223 }
220224 }
221225
222− DashContentOpenEffect {
223− id: openEffect
224− anchors {
225− fill: parent
226− bottomMargin: -bottomOverflow
227− }
228− sourceItem: dashContentListHolder
229− previewListView: previewListView
230− }
231−
232226 PreviewListView {
233227 id: previewListView
234− openEffect: openEffect
235228 scope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null
236229 pageHeader: dashPageHeader
237− anchors.fill: parent
230+ width: parent.width
231+ height: parent.height
232+ anchors.left: dashContentListHolder.right
238233 }
239234}
qml/Dash/GenericScopeView.qml−16
@@ -30,7 +30,6 @@ FocusScope {
3030 property alias moving: categoryView.moving
3131 property int tabBarHeight: 0
3232 property PageHeader pageHeader: null
33− property OpenEffect openEffect: null
3433 property Item previewListView: null
3534
3635 signal endReached
@@ -190,7 +189,6 @@ FocusScope {
190189 target: rendererLoader.item
191190 onClicked: {
192191 // Prepare the preview in case activate() triggers a preview only
193− openEffect.positionPx = Math.max(mapToItem(categoryView, 0, itemY).y, pageHeader.height + categoryView.stickyHeaderHeight);
194192 previewListView.model = target.model;
195193 previewListView.currentIndex = -1
196194 previewListView.currentIndex = index;
@@ -204,7 +202,6 @@ FocusScope {
204202 }
205203 }
206204 onPressAndHold: {
207− openEffect.positionPx = Math.max(mapToItem(categoryView, 0, itemY).y, pageHeader.height + categoryView.stickyHeaderHeight);
208205 previewListView.model = target.model;
209206 previewListView.currentIndex = -1
210207 previewListView.currentIndex = index;
@@ -325,17 +322,4 @@ FocusScope {
325322 default: return "CardFilterGrid.qml";
326323 }
327324 }
328−
329− // TODO: Move as InverseMouseArea to DashPreview
330− MouseArea {
331− objectName: "closePreviewMouseArea"
332− enabled: previewListView.onScreen
333− anchors {
334− fill: parent
335− topMargin: openEffect.bottomGapPx
336− }
337− onClicked: {
338− previewListView.open = false;
339− }
340− }
341325}
qml/Dash/PreviewListView.qml+2−10
@@ -23,7 +23,6 @@ import "Previews" as Previews
2323Item {
2424 id: root
2525
26− property OpenEffect openEffect: null
2726 property Scope scope: null
2827 property var pageHeader: null
2928
@@ -36,19 +35,12 @@ Item {
3635
3736 PageHeader {
3837 id: header
39− anchors.topMargin: openEffect.topGapPx
4038 width: parent.width
4139 searchEntryEnabled: false
4240 scope: root.scope
4341 height: units.gu(8.5)
4442 showBackButton: true
45− onBackClicked: {
46− visibleOnce = false;
47− root.open = false;
48− }
49− visible: previewListView.open && previewListView.currentItem && previewListView.currentItem.ready || visibleOnce
50− onVisibleChanged: visibleOnce = visible
51− property bool visibleOnce: false
43+ onBackClicked: root.open = false
5244
5345 childItem: Label {
5446 id: label
@@ -69,9 +61,9 @@ Item {
6961 ListView {
7062 id: previewListView
7163 objectName: "previewListView"
72− height: openEffect.bottomGapPx - openEffect.topGapPx
7364 anchors {
7465 top: header.bottom
66+ bottom: parent.bottom
7567 left: parent.left
7668 right: parent.right
7769 }
qml/Dash/ScopeItem.qml+9−15
@@ -33,7 +33,11 @@ Item {
3333
3434 Item {
3535 id: scopeViewHolder
36− anchors.fill: parent
36+
37+ x: previewListView.open ? -width : 0
38+ Behavior on x { UbuntuNumberAnimation { } }
39+ width: parent.width
40+ height: parent.height
3741
3842 GenericScopeView {
3943 id: scopeView
@@ -42,7 +46,6 @@ Item {
4246 isCurrent: scope != null
4347 tabBarHeight: scopeItemPageHeader.implicitHeight
4448 pageHeader: scopeItemPageHeader
45− openEffect: openEffect
4649 previewListView: previewListView
4750
4851 Connections {
@@ -58,7 +61,7 @@ Item {
5861 searchEntryEnabled: true
5962 searchHistory: root.searchHistory
6063 scope: root.scope
61− height: units.gu(7)
64+ height: units.gu(8.5)
6265 showBackButton: true
6366 onBackClicked: root.back();
6467
@@ -79,21 +82,12 @@ Item {
7982 }
8083 }
8184
82− DashContentOpenEffect {
83− id: openEffect
84− anchors {
85− fill: parent
86− bottomMargin: -bottomOverflow
87− }
88− sourceItem: scopeViewHolder
89− previewListView: previewListView
90− }
91−
9285 PreviewListView {
9386 id: previewListView
94− openEffect: openEffect
9587 pageHeader: scopeItemPageHeader
9688 scope: root.scope
97− anchors.fill: parent
89+ width: parent.width
90+ height: parent.height
91+ anchors.left: scopeViewHolder.right
9892 }
9993}