on xenial help sign in
Fixed up reveal states. Removed pin/unpin states from indicators
f089407Nick Dedekind
Panel/IndicatorRow.qml+3−12
@@ -63,20 +63,11 @@ Item {
63 widgetSource: model.widgetSource
63 widgetSource: model.widgetSource
64
64
65 indicatorProperties : model.indicatorProperties
65 indicatorProperties : model.indicatorProperties
66− highlighted: indicatorRow.state == "reveal" || indicatorRow.state == "locked" || indicatorRow.state == "commit" ? ownIndex == indicatorRow.currentItemIndex : false
66+ highlighted: indicatorRow.state != "initial" ? ownIndex == indicatorRow.currentItemIndex : false
67− dimmed: { //See FIXME in Indicators regarding the "states" change
68− if (indicatorRow.state == "initial" || indicatorRow.state == "") {
69− return false;
70− } else if (indicatorRow.state == "hint") {
71− return true
72− } else {
73− return ownIndex != indicatorRow.currentItemIndex
67+ dimmed: indicatorRow.state != "initial" ? ownIndex != indicatorRow.currentItemIndex : false
74− }
75− }
76 height: indicatorRow.height
68 height: indicatorRow.height
77 y: {
69 y: {
78− //FIXME: all indicators will be initial for now.
79− if (!highlighted && (indicatorRow.state == "locked" || indicatorRow.state == "commit")) {
70+ if (!highlighted && (indicatorRow.state == "locked" || indicatorRow.state == "commit")) {
80 return -indicatorRow.height
71 return -indicatorRow.height
81 } else {
72 } else {
82 return 0
73 return 0
Panel/Indicators.qml+17−39
@@ -58,7 +58,7 @@ Showable {
58 if (!showAnimation.running && !hideAnimation.running) {
58 if (!showAnimation.running && !hideAnimation.running) {
59 if (revealProgress == 0) {
59 if (revealProgress == 0) {
60 indicators.state = "initial"
60 indicators.state = "initial"
61− } else if (revealProgress <= hintValue && indicators.state == "reveal") {
61+ } else if (revealProgress <= hintValue) {
62 indicators.state = "hint";
62 indicators.state = "hint";
63 } else if (revealProgress > hintValue && revealProgress < lockThreshold) {
63 } else if (revealProgress > hintValue && revealProgress < lockThreshold) {
64 indicators.state = "reveal";
64 indicators.state = "reveal";
@@ -123,6 +123,8 @@ Showable {
123 if ((!useBuffer || (useBuffer && bufferExceeded)) || indicatorRow.currentItem < 0 || indicatorRow.currentItem == null) {
123 if ((!useBuffer || (useBuffer && bufferExceeded)) || indicatorRow.currentItem < 0 || indicatorRow.currentItem == null) {
124 indicatorRow.currentItem = currentItem;
124 indicatorRow.currentItem = currentItem;
125 }
125 }
126+ } else if (!currentItem) {
127+ indicatorRow.setDefaultItem();
126 }
128 }
127 }
129 }
128
130
@@ -239,10 +241,7 @@ Showable {
239 onRunningChanged: {
241 onRunningChanged: {
240 if (hideAnimation.running) {
242 if (hideAnimation.running) {
241 indicators.state = "initial"
243 indicators.state = "initial"
242− } else {
243− if (state == "initial") {
244− indicatorRow.setDefaultItem()
244+ indicatorRow.currentItem = null;
245− }
246 }
245 }
247 }
246 }
248 }
247 }
@@ -264,18 +263,6 @@ Showable {
264 }
263 }
265 }
264 }
266
265
267− // We start with pinned states. (default pinnedMode: true)
268− states: pinnedModeStates
269− // because of dynamic assignment of states, we need to assign state after completion.
270− Component.onCompleted: state = "initial"
271−
272− // changing states will reset state to "".
273− onPinnedModeChanged: {
274− var last_state = state;
275− states = (pinnedMode) ? pinnedModeStates : offScreenModeStates;
276− state = last_state;
277− }
278−
279 property var dragHandle: showDragHandle.dragging ? showDragHandle : hideDragHandle
266 property var dragHandle: showDragHandle.dragging ? showDragHandle : hideDragHandle
280 DragHandle {
267 DragHandle {
281 id: showDragHandle
268 id: showDragHandle
@@ -311,18 +298,27 @@ Showable {
311 distanceThreshold: 0
298 distanceThreshold: 0
312 }
299 }
313
300
314− property list<State> offScreenModeStates: [
301+ states: [
315 State {
302 State {
316 name: "initial"
303 name: "initial"
317 },
304 },
318 State {
305 State {
319 name: "hint"
306 name: "hint"
307+ PropertyChanges {
320− PropertyChanges { target: indicatorRow; y: panelHeight }
308+ target: indicatorRow;
309+ y: pinnedMode ? 0 : panelHeight
310+ }
311+ StateChangeScript {
312+ script: {
313+ if (dragHandle) {
314+ calculateCurrentItem(dragHandle.touchX, false);
315+ }
316+ }
317+ }
321 },
318 },
322 State {
319 State {
323 name: "reveal"
320 name: "reveal"
324 extend: "hint"
321 extend: "hint"
325− StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }
326 },
322 },
327 State {
323 State {
328 name: "locked"
324 name: "locked"
@@ -333,25 +329,7 @@ Showable {
333 extend: "hint"
329 extend: "hint"
334 }
330 }
335 ]
331 ]
336−
337− property list<State> pinnedModeStates: [
338− State {
339− name: "initial"
332+ state: "initial"
340− },
341− State {
342− name: "hint"
343− },
344− State {
345− name: "reveal"
346− StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }
347− },
348− State {
349− name: "locked"
350− },
351− State {
352− name: "commit"
353− }
354− ]
355
333
356 transitions: [
334 transitions: [
357 Transition {
335 Transition {
tests/qmltests/Panel/tst_IndicatorRow.qml+2−2
@@ -121,7 +121,7 @@ Item {
121 indicatorRow.state = "hint";
121 indicatorRow.state = "hint";
122 indicatorRow.setItem(0);
122 indicatorRow.setItem(0);
123
123
124− compare(indicatorRow.currentItem.highlighted, false, "Indicator should not highlight when in hint state");
124+ compare(indicatorRow.currentItem.highlighted, true, "Indicator should highlight when in hint state");
125 compare(get_indicator_item_at(1).highlighted, false, "Other indicators should not highlight when in hint state");
125 compare(get_indicator_item_at(1).highlighted, false, "Other indicators should not highlight when in hint state");
126 compare(get_indicator_item_at(2).highlighted, false, "Other indicators should not highlight when in hint state");
126 compare(get_indicator_item_at(2).highlighted, false, "Other indicators should not highlight when in hint state");
127 compare(get_indicator_item_at(3).highlighted, false, "Other indicators should not highlight when in hint state");
127 compare(get_indicator_item_at(3).highlighted, false, "Other indicators should not highlight when in hint state");
@@ -195,7 +195,7 @@ Item {
195 indicatorRow.state = "hint";
195 indicatorRow.state = "hint";
196 indicatorRow.setItem(0);
196 indicatorRow.setItem(0);
197
197
198− compare(get_indicator_item_at(0).dimmed, true, "Current indicator should dim when in hint state");
198+ compare(get_indicator_item_at(0).dimmed, false, "Current indicator should not dim when in hint state");
199 compare(get_indicator_item_at(1).dimmed, true, "Other indicators should dim when in hint state");
199 compare(get_indicator_item_at(1).dimmed, true, "Other indicators should dim when in hint state");
200 compare(get_indicator_item_at(2).dimmed, true, "Other indicators should dim when in hint state");
200 compare(get_indicator_item_at(2).dimmed, true, "Other indicators should dim when in hint state");
201 compare(get_indicator_item_at(3).dimmed, true, "Other indicators should dim when in hint state");
201 compare(get_indicator_item_at(3).dimmed, true, "Other indicators should dim when in hint state");