on xenial help sign in
Use "expanded" instead of "filtered" thought pattern.
b7aaa80Michał Sawicz
qml/Dash/CardGrid.qml+2−2
@@ -22,8 +22,8 @@ DashRenderer {
22
22
23 readonly property int collapsedRows: cardTool && cardTool.template && cardTool.template["collapsed-rows"]
23 readonly property int collapsedRows: cardTool && cardTool.template && cardTool.template["collapsed-rows"]
24
24
25− uncollapsedHeight: grid.totalContentHeight
25+ expandedHeight: grid.totalContentHeight
26− collapsedHeight: collapsedRows ? Math.min(grid.contentHeightForRows(collapsedRows), uncollapsedHeight) : uncollapsedHeight
26+ collapsedHeight: collapsedRows ? Math.min(grid.contentHeightForRows(collapsedRows), expandedHeight) : expandedHeight
27 originY: grid.originY
27 originY: grid.originY
28
28
29 ResponsiveGridView {
29 ResponsiveGridView {
qml/Dash/CardVerticalJournal.qml+1−1
@@ -23,7 +23,7 @@ DashRenderer {
23
23
24 readonly property double collapseLimit: units.gu(35)
24 readonly property double collapseLimit: units.gu(35)
25
25
26− uncollapsedHeight: cardVerticalJournal.implicitHeight
26+ expandedHeight: cardVerticalJournal.implicitHeight
27 collapsedHeight: Math.max(Math.min(collapseLimit, cardVerticalJournal.implicitHeight), minHeight)
27 collapsedHeight: Math.max(Math.min(collapseLimit, cardVerticalJournal.implicitHeight), minHeight)
28
28
29 // This minHeight is used as bootstrapper for the height. Vertical Journal
29 // This minHeight is used as bootstrapper for the height. Vertical Journal
qml/Dash/DashRenderer.qml+1−1
@@ -19,7 +19,7 @@ import QtQuick 2.0
19Item {
19Item {
20 property int collapsedHeight: height
20 property int collapsedHeight: height
21
21
22− property int uncollapsedHeight: height
22+ property int expandedHeight: height
23
23
24 property int displayMarginBeginning: 0
24 property int displayMarginBeginning: 0
25
25
qml/Dash/GenericScopeView.qml+18−18
@@ -128,14 +128,14 @@ FocusScope {
128 highlightWhenPressed: false
128 highlightWhenPressed: false
129 showDivider: false
129 showDivider: false
130
130
131− readonly property bool expandable: item ? item.uncollapsedHeight > item.collapsedHeight : false
131+ readonly property bool expandable: item ? item.expandedHeight > item.collapsedHeight : false
132− property bool filtered: true
132+ property bool expanded: false
133 readonly property string category: categoryId
133 readonly property string category: categoryId
134 readonly property var item: rendererLoader.item
134 readonly property var item: rendererLoader.item
135
135
136− function setFilter(filter, animate) {
136+ function expand(expand, animate) {
137 heightBehaviour.enabled = animate;
137 heightBehaviour.enabled = animate;
138− filtered = filter;
138+ expanded = expand;
139 }
139 }
140
140
141 CardTool {
141 CardTool {
@@ -151,8 +151,8 @@ FocusScope {
151 // This can happen with the VJ that doesn't know how height it will be on creation
151 // This can happen with the VJ that doesn't know how height it will be on creation
152 // so doesn't set expandable until a bit too late for onLoaded
152 // so doesn't set expandable until a bit too late for onLoaded
153 if (expandable) {
153 if (expandable) {
154− var shouldFilter = baseItem.category != categoryView.expandedCategoryId;
154+ var shouldExpand = baseItem.category === categoryView.expandedCategoryId;
155− baseItem.setFilter(shouldFilter, false /*animate*/);
155+ baseItem.expand(shouldExpand, false /*animate*/);
156 }
156 }
157 }
157 }
158
158
@@ -180,7 +180,7 @@ FocusScope {
180 }
180 }
181 }
181 }
182
182
183− height: baseItem.filtered ? item.collapsedHeight : item.uncollapsedHeight
183+ height: baseItem.expanded ? item.expandedHeight : item.collapsedHeight
184
184
185 source: {
185 source: {
186 switch (cardTool.categoryLayout) {
186 switch (cardTool.categoryLayout) {
@@ -208,8 +208,8 @@ FocusScope {
208 item.objectName = Qt.binding(function() { return categoryId })
208 item.objectName = Qt.binding(function() { return categoryId })
209 item.scopeStyle = scopeView.scopeStyle;
209 item.scopeStyle = scopeView.scopeStyle;
210 if (baseItem.expandable) {
210 if (baseItem.expandable) {
211− var shouldFilter = categoryId != categoryView.expandedCategoryId;
211+ var shouldExpand = categoryId === categoryView.expandedCategoryId;
212− baseItem.setFilter(shouldFilter, false /*animate*/);
212+ baseItem.expand(shouldExpand, false /*animate*/);
213 }
213 }
214 updateDelegateCreationRange();
214 updateDelegateCreationRange();
215 item.cardTool = cardTool;
215 item.cardTool = cardTool;
@@ -251,16 +251,16 @@ FocusScope {
251 function collapseAllButExpandedCategory() {
251 function collapseAllButExpandedCategory() {
252 var item = rendererLoader.item;
252 var item = rendererLoader.item;
253 if (baseItem.expandable) {
253 if (baseItem.expandable) {
254− var shouldFilter = categoryId != categoryView.expandedCategoryId;
254+ var shouldExpand = categoryId === categoryView.expandedCategoryId;
255− if (shouldFilter != baseItem.filtered) {
255+ if (shouldExpand != baseItem.expanded) {
256 // If the filter animation will be seen start it, otherwise, just flip the switch
256 // If the filter animation will be seen start it, otherwise, just flip the switch
257− var shrinkingVisible = shouldFilter && y + item.collapsedHeight < categoryView.height;
257+ var shrinkingVisible = !shouldExpand && y + item.collapsedHeight < categoryView.height;
258− var growingVisible = !shouldFilter && y + height < categoryView.height;
258+ var growingVisible = shouldExpand && y + height < categoryView.height;
259− if (!previewListView.open || !shouldFilter) {
259+ if (!previewListView.open || shouldExpand) {
260 var animate = shrinkingVisible || growingVisible;
260 var animate = shrinkingVisible || growingVisible;
261− baseItem.setFilter(shouldFilter, animate)
261+ baseItem.expand(shouldExpand, animate)
262− if (!shouldFilter && !previewListView.open) {
262+ if (shouldExpand && !previewListView.open) {
263− categoryView.maximizeVisibleArea(index, item.uncollapsedHeight);
263+ categoryView.maximizeVisibleArea(index, item.expandedHeight);
264 }
264 }
265 }
265 }
266 }
266 }
@@ -338,7 +338,7 @@ FocusScope {
338 textColor: scopeStyle ? scopeStyle.foreground : "grey"
338 textColor: scopeStyle ? scopeStyle.foreground : "grey"
339 image: {
339 image: {
340 if (delegate && delegate.expandable)
340 if (delegate && delegate.expandable)
341− return delegate.filtered ? "graphics/header_handlearrow.png" : "graphics/header_handlearrow2.png"
341+ return delegate.expanded ? "graphics/header_handlearrow2.png" : "graphics/header_handlearrow.png"
342 return "";
342 return "";
343 }
343 }
344 onClicked: {
344 onClicked: {