on xenial help sign in
Use "expanded" instead of "filtered" thought pattern.
commitb7aaa80c0c6f4bd5419481966a58e54e68a751c1 authorMichał Sawicz <michal.sawicz@canonical.com> dateThu 10 Jul 2014, 17:51 (12 years ago) parentd18b147
4 files changed+22−22
qml/Dash/CardGrid.qml+2−2 qml/Dash/CardVerticalJournal.qml+1−1 qml/Dash/DashRenderer.qml+1−1 qml/Dash/GenericScopeView.qml+18−18
qml/Dash/CardGrid.qml+2−2
@@ -22,8 +22,8 @@ DashRenderer {
2222
2323 readonly property int collapsedRows: cardTool && cardTool.template && cardTool.template["collapsed-rows"]
2424
25− uncollapsedHeight: grid.totalContentHeight
26− collapsedHeight: collapsedRows ? Math.min(grid.contentHeightForRows(collapsedRows), uncollapsedHeight) : uncollapsedHeight
25+ expandedHeight: grid.totalContentHeight
26+ collapsedHeight: collapsedRows ? Math.min(grid.contentHeightForRows(collapsedRows), expandedHeight) : expandedHeight
2727 originY: grid.originY
2828
2929 ResponsiveGridView {
qml/Dash/CardVerticalJournal.qml+1−1
@@ -23,7 +23,7 @@ DashRenderer {
2323
2424 readonly property double collapseLimit: units.gu(35)
2525
26− uncollapsedHeight: cardVerticalJournal.implicitHeight
26+ expandedHeight: cardVerticalJournal.implicitHeight
2727 collapsedHeight: Math.max(Math.min(collapseLimit, cardVerticalJournal.implicitHeight), minHeight)
2828
2929 // 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
1919Item {
2020 property int collapsedHeight: height
2121
22− property int uncollapsedHeight: height
22+ property int expandedHeight: height
2323
2424 property int displayMarginBeginning: 0
2525
qml/Dash/GenericScopeView.qml+18−18
@@ -128,14 +128,14 @@ FocusScope {
128128 highlightWhenPressed: false
129129 showDivider: false
130130
131− readonly property bool expandable: item ? item.uncollapsedHeight > item.collapsedHeight : false
132− property bool filtered: true
131+ readonly property bool expandable: item ? item.expandedHeight > item.collapsedHeight : false
132+ property bool expanded: false
133133 readonly property string category: categoryId
134134 readonly property var item: rendererLoader.item
135135
136− function setFilter(filter, animate) {
136+ function expand(expand, animate) {
137137 heightBehaviour.enabled = animate;
138− filtered = filter;
138+ expanded = expand;
139139 }
140140
141141 CardTool {
@@ -151,8 +151,8 @@ FocusScope {
151151 // This can happen with the VJ that doesn't know how height it will be on creation
152152 // so doesn't set expandable until a bit too late for onLoaded
153153 if (expandable) {
154− var shouldFilter = baseItem.category != categoryView.expandedCategoryId;
155− baseItem.setFilter(shouldFilter, false /*animate*/);
154+ var shouldExpand = baseItem.category === categoryView.expandedCategoryId;
155+ baseItem.expand(shouldExpand, false /*animate*/);
156156 }
157157 }
158158
@@ -180,7 +180,7 @@ FocusScope {
180180 }
181181 }
182182
183− height: baseItem.filtered ? item.collapsedHeight : item.uncollapsedHeight
183+ height: baseItem.expanded ? item.expandedHeight : item.collapsedHeight
184184
185185 source: {
186186 switch (cardTool.categoryLayout) {
@@ -208,8 +208,8 @@ FocusScope {
208208 item.objectName = Qt.binding(function() { return categoryId })
209209 item.scopeStyle = scopeView.scopeStyle;
210210 if (baseItem.expandable) {
211− var shouldFilter = categoryId != categoryView.expandedCategoryId;
212− baseItem.setFilter(shouldFilter, false /*animate*/);
211+ var shouldExpand = categoryId === categoryView.expandedCategoryId;
212+ baseItem.expand(shouldExpand, false /*animate*/);
213213 }
214214 updateDelegateCreationRange();
215215 item.cardTool = cardTool;
@@ -251,16 +251,16 @@ FocusScope {
251251 function collapseAllButExpandedCategory() {
252252 var item = rendererLoader.item;
253253 if (baseItem.expandable) {
254− var shouldFilter = categoryId != categoryView.expandedCategoryId;
255− if (shouldFilter != baseItem.filtered) {
254+ var shouldExpand = categoryId === categoryView.expandedCategoryId;
255+ if (shouldExpand != baseItem.expanded) {
256256 // If the filter animation will be seen start it, otherwise, just flip the switch
257− var shrinkingVisible = shouldFilter && y + item.collapsedHeight < categoryView.height;
258− var growingVisible = !shouldFilter && y + height < categoryView.height;
259− if (!previewListView.open || !shouldFilter) {
257+ var shrinkingVisible = !shouldExpand && y + item.collapsedHeight < categoryView.height;
258+ var growingVisible = shouldExpand && y + height < categoryView.height;
259+ if (!previewListView.open || shouldExpand) {
260260 var animate = shrinkingVisible || growingVisible;
261− baseItem.setFilter(shouldFilter, animate)
262− if (!shouldFilter && !previewListView.open) {
263− categoryView.maximizeVisibleArea(index, item.uncollapsedHeight);
261+ baseItem.expand(shouldExpand, animate)
262+ if (shouldExpand && !previewListView.open) {
263+ categoryView.maximizeVisibleArea(index, item.expandedHeight);
264264 }
265265 }
266266 }
@@ -338,7 +338,7 @@ FocusScope {
338338 textColor: scopeStyle ? scopeStyle.foreground : "grey"
339339 image: {
340340 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"
342342 return "";
343343 }
344344 onClicked: {