on xenial help sign in
cleaned up overview removal
fa24e91Nick Dedekind
Panel/Indicators.qml+21−24
@@ -56,19 +56,19 @@ Showable {
56
56
57 onHeightChanged: {
57 onHeightChanged: {
58 // need to use handle.get_height(). As the handle height depends on indicators.height changes (but this is called first!)
58 // need to use handle.get_height(). As the handle height depends on indicators.height changes (but this is called first!)
59− var contentProgress = indicators.height - handle.get_height()
59+ var contentProgress = indicators.height - handle.get_height();
60 if (!showAnimation.running && !hideAnimation.running) {
60 if (!showAnimation.running && !hideAnimation.running) {
61 if (contentProgress <= hintValue && indicators.state == "reveal") {
61 if (contentProgress <= hintValue && indicators.state == "reveal") {
62− indicators.state = "hint"
62+ indicators.state = "hint";
63 } else if (contentProgress > hintValue && contentProgress < lockThreshold) {
63 } else if (contentProgress > hintValue && contentProgress < lockThreshold) {
64− indicators.state = "reveal"
64+ indicators.state = "reveal";
65 } else if (contentProgress >= lockThreshold && lockThreshold > 0) {
65 } else if (contentProgress >= lockThreshold && lockThreshold > 0) {
66− indicators.state = "locked"
66+ indicators.state = "locked";
67 }
67 }
68 }
68 }
69
69
70 if (contentProgress == 0) {
70 if (contentProgress == 0) {
71− menuContent.releaseContent()
71+ menuContent.releaseContent();
72 }
72 }
73 }
73 }
74
74
@@ -79,7 +79,7 @@ Showable {
79 var distanceFromRightEdge
79 var distanceFromRightEdge
80 var bufferExceeded = false
80 var bufferExceeded = false
81
81
82− if (indicators.state == "commit" || indicators.state == "locked" || showAnimation.running || hideAnimation.running) return
82+ if (indicators.state == "commit" || indicators.state == "locked" || showAnimation.running || hideAnimation.running) return;
83
83
84 /*
84 /*
85 If user drags the indicator handle bar down a distance hintValue or less, this is 0.
85 If user drags the indicator handle bar down a distance hintValue or less, this is 0.
@@ -88,14 +88,14 @@ Showable {
88 */
88 */
89 var verticalProgress =
89 var verticalProgress =
90 MathLocal.clamp((indicators.height - handle.height - hintValue) /
90 MathLocal.clamp((indicators.height - handle.height - hintValue) /
91− (lockThreshold - hintValue), 0, 1)
91+ (lockThreshold - hintValue), 0, 1);
92
92
93 /*
93 /*
94 Percentage of an indicator icon's width the user's press can stray horizontally from the
94 Percentage of an indicator icon's width the user's press can stray horizontally from the
95 focused icon before we change focus to another icon. E.g. a value of 0.5 means you must
95 focused icon before we change focus to another icon. E.g. a value of 0.5 means you must
96 go right a distance of half an icon's width before focus moves to the icon on the right
96 go right a distance of half an icon's width before focus moves to the icon on the right
97 */
97 */
98− var maxBufferThreshold = 0.5
98+ var maxBufferThreshold = 0.5;
99
99
100 /*
100 /*
101 To help users find the indicator of their choice while opening the indicators, we add logic to add a
101 To help users find the indicator of their choice while opening the indicators, we add logic to add a
@@ -112,12 +112,12 @@ Showable {
112 itemCoordinates = indicatorRow.row.mapToItem(currentItem, rowCoordinates.x, 0);
112 itemCoordinates = indicatorRow.row.mapToItem(currentItem, rowCoordinates.x, 0);
113 distanceFromRightEdge = (currentItem.width - itemCoordinates.x) / (currentItem.width)
113 distanceFromRightEdge = (currentItem.width - itemCoordinates.x) / (currentItem.width)
114 if (Math.abs(currentItem.ownIndex - indicatorRow.currentItemIndex) > 1) {
114 if (Math.abs(currentItem.ownIndex - indicatorRow.currentItemIndex) > 1) {
115− bufferExceeded = true
115+ bufferExceeded = true;
116 } else {
116 } else {
117 if (indicatorRow.currentItemIndex < currentItem.ownIndex && distanceFromRightEdge < (1 - effectiveBufferThreshold)) {
117 if (indicatorRow.currentItemIndex < currentItem.ownIndex && distanceFromRightEdge < (1 - effectiveBufferThreshold)) {
118− bufferExceeded = true
118+ bufferExceeded = true;
119 } else if (indicatorRow.currentItemIndex > currentItem.ownIndex && distanceFromRightEdge > effectiveBufferThreshold) {
119 } else if (indicatorRow.currentItemIndex > currentItem.ownIndex && distanceFromRightEdge > effectiveBufferThreshold) {
120− bufferExceeded = true
120+ bufferExceeded = true;
121 }
121 }
122 }
122 }
123 if ((!useBuffer || (useBuffer && bufferExceeded)) || indicatorRow.currentItem < 0 || indicatorRow.currentItem == null) {
123 if ((!useBuffer || (useBuffer && bufferExceeded)) || indicatorRow.currentItem < 0 || indicatorRow.currentItem == null) {
@@ -158,8 +158,7 @@ Showable {
158 bottom: parent.bottom
158 bottom: parent.bottom
159 }
159 }
160 indicatorsModel: indicatorsModel
160 indicatorsModel: indicatorsModel
161− animate: false
162− clip: indicators.partiallyOpened
161+ clip: !indicators.fullyOpened
163
162
164 onMenuSelected: {
163 onMenuSelected: {
165 indicatorRow.setItem(index)
164 indicatorRow.setItem(index)
@@ -195,7 +194,7 @@ Showable {
195 clip: height < handleImage.height
194 clip: height < handleImage.height
196
195
197 function get_height() {
196 function get_height() {
198− return Math.max(Math.min(handleImage.height, indicators.height - handleImage.height), 0)
197+ return Math.max(Math.min(handleImage.height, indicators.height - handleImage.height), 0);
199 }
198 }
200
199
201 BorderImage {
200 BorderImage {
@@ -264,9 +263,10 @@ Showable {
264 onRunningChanged: {
263 onRunningChanged: {
265 if (hideAnimation.running) {
264 if (hideAnimation.running) {
266 indicators.state = "initial"
265 indicators.state = "initial"
267− menuContent.hideAll()
268 } else {
266 } else {
267+ if (state == "initial") {
269− if (state == "initial") indicatorRow.setDefaultItem()
268+ indicatorRow.setDefaultItem()
269+ }
270 }
270 }
271 }
271 }
272 }
272 }
@@ -274,8 +274,8 @@ Showable {
274 target: showAnimation
274 target: showAnimation
275 onRunningChanged: {
275 onRunningChanged: {
276 if (showAnimation.running) {
276 if (showAnimation.running) {
277− indicators.calculateCurrentItem(dragHandle.touchX, false)
277+ indicators.calculateCurrentItem(dragHandle.touchX, false);
278− indicators.state = "commit"
278+ indicators.state = "commit";
279 }
279 }
280 }
280 }
281 }
281 }
@@ -283,8 +283,8 @@ Showable {
283 Connections {
283 Connections {
284 target: dragHandle
284 target: dragHandle
285 onTouchXChanged: {
285 onTouchXChanged: {
286− var buffer = dragHandle.dragging ? true : false
286+ var buffer = dragHandle.dragging ? true : false;
287− indicators.calculateCurrentItem(dragHandle.touchX, buffer)
287+ indicators.calculateCurrentItem(dragHandle.touchX, buffer);
288 }
288 }
289 }
289 }
290
290
@@ -319,8 +319,7 @@ Showable {
319
319
320 onStatusChanged: {
320 onStatusChanged: {
321 if (status === DirectionalDragArea.Recognized) {
321 if (status === DirectionalDragArea.Recognized) {
322− menuContent.hideAll()
323− menuContent.activateContent()
322+ menuContent.activateContent();
324 }
323 }
325 }
324 }
326 }
325 }
@@ -348,7 +347,6 @@ Showable {
348 State {
347 State {
349 name: "reveal"
348 name: "reveal"
350 extend: "hint"
349 extend: "hint"
351− PropertyChanges { target: menuContent; animate: true }
352 StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }
350 StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }
353 },
351 },
354 State {
352 State {
@@ -370,7 +368,6 @@ Showable {
370 },
368 },
371 State {
369 State {
372 name: "reveal"
370 name: "reveal"
373− PropertyChanges { target: menuContent; animate: true }
374 StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }
371 StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }
375 },
372 },
376 State {
373 State {
Panel/MenuContent.qml+8−11
@@ -23,7 +23,6 @@ Rectangle {
23 id: content
23 id: content
24
24
25 property QtObject indicatorsModel: null
25 property QtObject indicatorsModel: null
26− property bool animate: true // FIXME: Remove. This doesnt seem to be being used and it's referenced in Indicators.
27 property bool __contentActive: false
26 property bool __contentActive: false
28 property alias currentIndex : menus.currentIndex
27 property alias currentIndex : menus.currentIndex
29 property color backgroundColor: "#221e1c"
28 property color backgroundColor: "#221e1c"
@@ -36,13 +35,13 @@ Rectangle {
36 signal menuSelected(int index)
35 signal menuSelected(int index)
37
36
38 function activateContent() {
37 function activateContent() {
39− contentReleaseTimer.stop()
38+ contentReleaseTimer.stop();
40− __contentActive = true
39+ __contentActive = true;
41 }
40 }
42
41
43 function releaseContent() {
42 function releaseContent() {
44 if (__contentActive)
43 if (__contentActive)
45− contentReleaseTimer.restart()
44+ contentReleaseTimer.restart();
46 }
45 }
47
46
48 ListView {
47 ListView {
@@ -68,9 +67,9 @@ Rectangle {
68
67
69 onContentActiveChanged: {
68 onContentActiveChanged: {
70 if (contentActive && item) {
69 if (contentActive && item) {
71− item.start()
70+ item.start();
72 } else if (!contentActive && item) {
71 } else if (!contentActive && item) {
73− item.stop()
72+ item.stop();
74 }
73 }
75 }
74 }
76
75
@@ -80,7 +79,7 @@ Rectangle {
80 onVisibleChanged: {
79 onVisibleChanged: {
81 // Reset the indicator states
80 // Reset the indicator states
82 if (!visible && item && item["reset"]) {
81 if (!visible && item && item["reset"]) {
83− item.reset()
82+ item.reset();
84 }
83 }
85 }
84 }
86 asynchronous: true
85 asynchronous: true
@@ -88,11 +87,11 @@ Rectangle {
88 onLoaded: {
87 onLoaded: {
89 for(var pName in indicatorProperties) {
88 for(var pName in indicatorProperties) {
90 if (item.hasOwnProperty(pName)) {
89 if (item.hasOwnProperty(pName)) {
91− item[pName] = indicatorProperties[pName]
90+ item[pName] = indicatorProperties[pName];
92 }
91 }
93 }
92 }
94 if (contentActive && menus.visible) {
93 if (contentActive && menus.visible) {
95− item.start()
94+ item.start();
96 }
95 }
97 }
96 }
98
97
@@ -104,8 +103,6 @@ Rectangle {
104 value: handle.height
103 value: handle.height
105 }
104 }
106 }
105 }
107−
108− Behavior on opacity { NumberAnimation {duration: 200} }
109 }
106 }
110
107
111 Rectangle {
108 Rectangle {
tests/qmltests/Panel/tst_MenuContent.qml−2
@@ -86,7 +86,6 @@ Item {
86 function activate_content(index)
86 function activate_content(index)
87 {
87 {
88 menuContent.currentIndex = index
88 menuContent.currentIndex = index
89− menuContent.showMenu();
90 }
89 }
91
90
92 function get_test_menu_objecName(index) {
91 function get_test_menu_objecName(index) {
@@ -117,7 +116,6 @@ Item {
117 when: windowShown
116 when: windowShown
118
117
119 function init() {
118 function init() {
120− menuContent.hideAll();
121 if (menuContent.__contentActive)
119 if (menuContent.__contentActive)
122 menuContent.releaseContent();
120 menuContent.releaseContent();
123 tryCompare(menuContent, "__contentActive", false);
121 tryCompare(menuContent, "__contentActive", false);
tests/qmltests/Panel/tst_Panel.qml+33−33
@@ -62,14 +62,14 @@ Item {
62
62
63 function get_indicator_item(index) {
63 function get_indicator_item(index) {
64 var row_repeater = findChild(panel.indicators, "rowRepeater");
64 var row_repeater = findChild(panel.indicators, "rowRepeater");
65− verify(row_repeater != undefined)
65+ verify(row_repeater != undefined);
66 return row_repeater.itemAt(index);
66 return row_repeater.itemAt(index);
67 }
67 }
68
68
69 function get_indicator_item_position(index) {
69 function get_indicator_item_position(index) {
70
70
71 var indicator_row = findChild(panel.indicators, "indicatorRow");
71 var indicator_row = findChild(panel.indicators, "indicatorRow");
72− verify(indicator_row != undefined)
72+ verify(indicator_row != undefined);
73
73
74 var indicator_item = get_indicator_item(index);
74 var indicator_item = get_indicator_item(index);
75 verify(indicator_item != undefined);
75 verify(indicator_item != undefined);
@@ -83,11 +83,11 @@ Item {
83 panel.fullscreenMode = false;
83 panel.fullscreenMode = false;
84 // Wait for the indicators to get into position.
84 // Wait for the indicators to get into position.
85 // (switches between normal and fullscreen modes are animated)
85 // (switches between normal and fullscreen modes are animated)
86− tryCompare(panel.indicators, "y", 0)
86+ tryCompare(panel.indicators, "y", 0);
87
87
88 var indicator_item_coord = get_indicator_item_position(0);
88 var indicator_item_coord = get_indicator_item_position(0);
89
89
90− touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2)
90+ touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2);
91
91
92 // hint animation should be run, meaning that indicators will move downwards
92 // hint animation should be run, meaning that indicators will move downwards
93 // by hintValue pixels without any drag taking place
93 // by hintValue pixels without any drag taking place
@@ -96,7 +96,7 @@ Item {
96 tryCompare(panel.indicators, "partiallyOpened", true);
96 tryCompare(panel.indicators, "partiallyOpened", true);
97 tryCompare(panel.indicators, "fullyOpened", false);
97 tryCompare(panel.indicators, "fullyOpened", false);
98
98
99− touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2)
99+ touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2);
100 }
100 }
101
101
102 // Pressing on the top edge of the screen should have no effect if the panel
102 // Pressing on the top edge of the screen should have no effect if the panel
@@ -105,31 +105,31 @@ Item {
105 panel.fullscreenMode = true;
105 panel.fullscreenMode = true;
106 // Wait for the indicators to get into position.
106 // Wait for the indicators to get into position.
107 // (switches between normal and fullscreen modes are animated)
107 // (switches between normal and fullscreen modes are animated)
108− tryCompare(panel.indicators, "y", -panel.panelHeight)
108+ tryCompare(panel.indicators, "y", -panel.panelHeight);
109
109
110 var indicator_item_coord = get_indicator_item_position(0);
110 var indicator_item_coord = get_indicator_item_position(0);
111
111
112− touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2)
112+ touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2);
113
113
114 // Give some time for a hint animation to change things, if any
114 // Give some time for a hint animation to change things, if any
115− wait(500)
115+ wait(500);
116
116
117 // no hint animation when fullscreen
117 // no hint animation when fullscreen
118− compare(panel.indicators.y, -panel.panelHeight)
118+ compare(panel.indicators.y, -panel.panelHeight);
119 var indicatorRow = findChild(panel.indicators, "indicatorRow");
119 var indicatorRow = findChild(panel.indicators, "indicatorRow");
120− verify(indicatorRow != undefined)
120+ verify(indicatorRow != undefined);
121− compare(indicatorRow.y, 0)
121+ compare(indicatorRow.y, 0);
122− compare(panel.indicators.height, panel.indicators.panelHeight)
122+ compare(panel.indicators.height, panel.indicators.panelHeight);
123 compare(panel.indicators.partiallyOpened, false,
123 compare(panel.indicators.partiallyOpened, false,
124 "Indicator should not be partially opened when panel is pressed in" +
124 "Indicator should not be partially opened when panel is pressed in" +
125− " fullscreenmode")
125+ " fullscreenmode");
126 compare(panel.indicators.fullyOpened, false, "Indicator should not be partially" +
126 compare(panel.indicators.fullyOpened, false, "Indicator should not be partially" +
127− " opened when panel is pressed in fullscreenmode")
127+ " opened when panel is pressed in fullscreenmode");
128
128
129− touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2)
129+ touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2);
130 }
130 }
131
131
132− function test_drag_show_data() { return get_window_data() }
132+ function test_drag_show_data() { return get_window_data(); }
133
133
134 // Dragging from a indicator item in the panel will gradually expose the
134 // Dragging from a indicator item in the panel will gradually expose the
135 // indicators, first by running the hint animation, then after dragging down will
135 // indicators, first by running the hint animation, then after dragging down will
@@ -138,50 +138,50 @@ Item {
138 panel.fullscreenMode = data.fullscreenFlag;
138 panel.fullscreenMode = data.fullscreenFlag;
139
139
140 var indicator_row = findChild(panel.indicators, "indicatorRow");
140 var indicator_row = findChild(panel.indicators, "indicatorRow");
141− verify(indicator_row != undefined)
141+ verify(indicator_row != undefined);
142
142
143 var row_repeater = findChild(panel.indicators, "rowRepeater");
143 var row_repeater = findChild(panel.indicators, "rowRepeater");
144− verify(indicator_row != undefined)
144+ verify(indicator_row != undefined);
145
145
146 var menu_content = findChild(panel.indicators, "menuContent");
146 var menu_content = findChild(panel.indicators, "menuContent");
147− verify(indicator_row != undefined)
147+ verify(indicator_row != undefined);
148
148
149 // Wait for the indicators to get into position.
149 // Wait for the indicators to get into position.
150 // (switches between normal and fullscreen modes are animated)
150 // (switches between normal and fullscreen modes are animated)
151 if (data.fullscreenFlag) {
151 if (data.fullscreenFlag) {
152− tryCompare(panel.indicators, "y", -panel.panelHeight)
152+ tryCompare(panel.indicators, "y", -panel.panelHeight);
153 } else {
153 } else {
154− tryCompare(panel.indicators, "y", 0)
154+ tryCompare(panel.indicators, "y", 0);
155 }
155 }
156
156
157 // do this for each indicator item
157 // do this for each indicator item
158 for (var i = 0; i < row_repeater.count; i++) {
158 for (var i = 0; i < row_repeater.count; i++) {
159
159
160 var indicator_item = get_indicator_item(i);
160 var indicator_item = get_indicator_item(i);
161− verify(indicator_item != undefined)
161+ verify(indicator_item != undefined);
162
162
163 var indicator_item_coord = get_indicator_item_position(i);
163 var indicator_item_coord = get_indicator_item_position(i);
164
164
165 touchPress(panel,
165 touchPress(panel,
166− indicator_item_coord.x, panel.panelHeight / 2)
166+ indicator_item_coord.x, panel.panelHeight / 2);
167
167
168 // 1) Drag the mouse down
168 // 1) Drag the mouse down
169 touchFlick(panel,
169 touchFlick(panel,
170 indicator_item_coord.x, panel.panelHeight / 2,
170 indicator_item_coord.x, panel.panelHeight / 2,
171 indicator_item_coord.x, panel.height * 0.8,
171 indicator_item_coord.x, panel.height * 0.8,
172− false /* beginTouch */, false /* endTouch */)
172+ false /* beginTouch */, false /* endTouch */);
173
173
174 // Indicators height should follow the drag, and therefore increase accordingly.
174 // Indicators height should follow the drag, and therefore increase accordingly.
175 // They should be at least half-way through the screen
175 // They should be at least half-way through the screen
176 tryCompareFunction(
176 tryCompareFunction(
177 function() {return panel.indicators.height >= panel.height * 0.5},
177 function() {return panel.indicators.height >= panel.height * 0.5},
178− true)
178+ true);
179
179
180− touchRelease(panel, indicator_item_coord.x, panel.height * 0.8)
180+ touchRelease(panel, indicator_item_coord.x, panel.height * 0.8);
181
181
182 compare(indicator_row.currentItem, indicator_item,
182 compare(indicator_row.currentItem, indicator_item,
183− "Incorrect item activated at position " + i)
183+ "Incorrect item activated at position " + i);
184− compare(menu_content.__shown, true, "Menu conetent should be enabled for item at position " + i);
184+ compare(menu_content.currentIndex, i, "Menu conetent should be enabled for item at position " + i);
185
185
186 // init for next indicator_item
186 // init for next indicator_item
187 init();
187 init();
@@ -195,23 +195,23 @@ Item {
195 var search_indicator = findChild(panel, "search");
195 var search_indicator = findChild(panel, "search");
196 verify(search_indicator != undefined);
196 verify(search_indicator != undefined);
197
197
198− tap(search_indicator, 1, 1)
198+ tap(search_indicator, 1, 1);
199
199
200 compare(search_clicked, true,
200 compare(search_clicked, true,
201− "Tapping search indicator while it was enabled did not emit searchClicked signal")
201+ "Tapping search indicator while it was enabled did not emit searchClicked signal");
202 }
202 }
203
203
204 function test_search_click_when_not_visible() {
204 function test_search_click_when_not_visible() {
205 panel.fullscreenMode = false;
205 panel.fullscreenMode = false;
206− panel.searchVisible = false
206+ panel.searchVisible = false;
207
207
208 var search_indicator = findChild(panel, "search");
208 var search_indicator = findChild(panel, "search");
209 verify(search_indicator != undefined);
209 verify(search_indicator != undefined);
210
210
211− tap(search_indicator, 1, 1)
211+ tap(search_indicator, 1, 1);
212
212
213 compare(search_clicked, false,
213 compare(search_clicked, false,
214− "Tapping search indicator while it was not visible emitted searchClicked signal")
214+ "Tapping search indicator while it was not visible emitted searchClicked signal");
215 }
215 }
216 }
216 }
217}
217}