on xenial help sign in
cleaned up overview removal
commitfa24e917d0df0dc271947a1148761797018404af authorNick Dedekind <nicholas.dedekind@gmail.com> dateWed 17 Jul 2013, 15:49 (13 years ago) parent11b682e
4 files changed+62−70
Panel/Indicators.qml+21−24 Panel/MenuContent.qml+8−11 tests/qmltests/Panel/tst_MenuContent.qml−2 tests/qmltests/Panel/tst_Panel.qml+33−33
Panel/Indicators.qml+21−24
@@ -56,19 +56,19 @@ Showable {
5656
5757 onHeightChanged: {
5858 // 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();
6060 if (!showAnimation.running && !hideAnimation.running) {
6161 if (contentProgress <= hintValue && indicators.state == "reveal") {
62− indicators.state = "hint"
62+ indicators.state = "hint";
6363 } else if (contentProgress > hintValue && contentProgress < lockThreshold) {
64− indicators.state = "reveal"
64+ indicators.state = "reveal";
6565 } else if (contentProgress >= lockThreshold && lockThreshold > 0) {
66− indicators.state = "locked"
66+ indicators.state = "locked";
6767 }
6868 }
6969
7070 if (contentProgress == 0) {
71− menuContent.releaseContent()
71+ menuContent.releaseContent();
7272 }
7373 }
7474
@@ -79,7 +79,7 @@ Showable {
7979 var distanceFromRightEdge
8080 var bufferExceeded = false
8181
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;
8383
8484 /*
8585 If user drags the indicator handle bar down a distance hintValue or less, this is 0.
@@ -88,14 +88,14 @@ Showable {
8888 */
8989 var verticalProgress =
9090 MathLocal.clamp((indicators.height - handle.height - hintValue) /
91− (lockThreshold - hintValue), 0, 1)
91+ (lockThreshold - hintValue), 0, 1);
9292
9393 /*
9494 Percentage of an indicator icon's width the user's press can stray horizontally from the
9595 focused icon before we change focus to another icon. E.g. a value of 0.5 means you must
9696 go right a distance of half an icon's width before focus moves to the icon on the right
9797 */
98− var maxBufferThreshold = 0.5
98+ var maxBufferThreshold = 0.5;
9999
100100 /*
101101 To help users find the indicator of their choice while opening the indicators, we add logic to add a
@@ -112,12 +112,12 @@ Showable {
112112 itemCoordinates = indicatorRow.row.mapToItem(currentItem, rowCoordinates.x, 0);
113113 distanceFromRightEdge = (currentItem.width - itemCoordinates.x) / (currentItem.width)
114114 if (Math.abs(currentItem.ownIndex - indicatorRow.currentItemIndex) > 1) {
115− bufferExceeded = true
115+ bufferExceeded = true;
116116 } else {
117117 if (indicatorRow.currentItemIndex < currentItem.ownIndex && distanceFromRightEdge < (1 - effectiveBufferThreshold)) {
118− bufferExceeded = true
118+ bufferExceeded = true;
119119 } else if (indicatorRow.currentItemIndex > currentItem.ownIndex && distanceFromRightEdge > effectiveBufferThreshold) {
120− bufferExceeded = true
120+ bufferExceeded = true;
121121 }
122122 }
123123 if ((!useBuffer || (useBuffer && bufferExceeded)) || indicatorRow.currentItem < 0 || indicatorRow.currentItem == null) {
@@ -158,8 +158,7 @@ Showable {
158158 bottom: parent.bottom
159159 }
160160 indicatorsModel: indicatorsModel
161− animate: false
162− clip: indicators.partiallyOpened
161+ clip: !indicators.fullyOpened
163162
164163 onMenuSelected: {
165164 indicatorRow.setItem(index)
@@ -195,7 +194,7 @@ Showable {
195194 clip: height < handleImage.height
196195
197196 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);
199198 }
200199
201200 BorderImage {
@@ -264,9 +263,10 @@ Showable {
264263 onRunningChanged: {
265264 if (hideAnimation.running) {
266265 indicators.state = "initial"
267− menuContent.hideAll()
268266 } else {
269− if (state == "initial") indicatorRow.setDefaultItem()
267+ if (state == "initial") {
268+ indicatorRow.setDefaultItem()
269+ }
270270 }
271271 }
272272 }
@@ -274,8 +274,8 @@ Showable {
274274 target: showAnimation
275275 onRunningChanged: {
276276 if (showAnimation.running) {
277− indicators.calculateCurrentItem(dragHandle.touchX, false)
278− indicators.state = "commit"
277+ indicators.calculateCurrentItem(dragHandle.touchX, false);
278+ indicators.state = "commit";
279279 }
280280 }
281281 }
@@ -283,8 +283,8 @@ Showable {
283283 Connections {
284284 target: dragHandle
285285 onTouchXChanged: {
286− var buffer = dragHandle.dragging ? true : false
287− indicators.calculateCurrentItem(dragHandle.touchX, buffer)
286+ var buffer = dragHandle.dragging ? true : false;
287+ indicators.calculateCurrentItem(dragHandle.touchX, buffer);
288288 }
289289 }
290290
@@ -319,8 +319,7 @@ Showable {
319319
320320 onStatusChanged: {
321321 if (status === DirectionalDragArea.Recognized) {
322− menuContent.hideAll()
323− menuContent.activateContent()
322+ menuContent.activateContent();
324323 }
325324 }
326325 }
@@ -348,7 +347,6 @@ Showable {
348347 State {
349348 name: "reveal"
350349 extend: "hint"
351− PropertyChanges { target: menuContent; animate: true }
352350 StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }
353351 },
354352 State {
@@ -370,7 +368,6 @@ Showable {
370368 },
371369 State {
372370 name: "reveal"
373− PropertyChanges { target: menuContent; animate: true }
374371 StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }
375372 },
376373 State {
Panel/MenuContent.qml+8−11
@@ -23,7 +23,6 @@ Rectangle {
2323 id: content
2424
2525 property QtObject indicatorsModel: null
26− property bool animate: true // FIXME: Remove. This doesnt seem to be being used and it's referenced in Indicators.
2726 property bool __contentActive: false
2827 property alias currentIndex : menus.currentIndex
2928 property color backgroundColor: "#221e1c"
@@ -36,13 +35,13 @@ Rectangle {
3635 signal menuSelected(int index)
3736
3837 function activateContent() {
39− contentReleaseTimer.stop()
40− __contentActive = true
38+ contentReleaseTimer.stop();
39+ __contentActive = true;
4140 }
4241
4342 function releaseContent() {
4443 if (__contentActive)
45− contentReleaseTimer.restart()
44+ contentReleaseTimer.restart();
4645 }
4746
4847 ListView {
@@ -68,9 +67,9 @@ Rectangle {
6867
6968 onContentActiveChanged: {
7069 if (contentActive && item) {
71− item.start()
70+ item.start();
7271 } else if (!contentActive && item) {
73− item.stop()
72+ item.stop();
7473 }
7574 }
7675
@@ -80,7 +79,7 @@ Rectangle {
8079 onVisibleChanged: {
8180 // Reset the indicator states
8281 if (!visible && item && item["reset"]) {
83− item.reset()
82+ item.reset();
8483 }
8584 }
8685 asynchronous: true
@@ -88,11 +87,11 @@ Rectangle {
8887 onLoaded: {
8988 for(var pName in indicatorProperties) {
9089 if (item.hasOwnProperty(pName)) {
91− item[pName] = indicatorProperties[pName]
90+ item[pName] = indicatorProperties[pName];
9291 }
9392 }
9493 if (contentActive && menus.visible) {
95− item.start()
94+ item.start();
9695 }
9796 }
9897
@@ -104,8 +103,6 @@ Rectangle {
104103 value: handle.height
105104 }
106105 }
107−
108− Behavior on opacity { NumberAnimation {duration: 200} }
109106 }
110107
111108 Rectangle {
tests/qmltests/Panel/tst_MenuContent.qml−2
@@ -86,7 +86,6 @@ Item {
8686 function activate_content(index)
8787 {
8888 menuContent.currentIndex = index
89− menuContent.showMenu();
9089 }
9190
9291 function get_test_menu_objecName(index) {
@@ -117,7 +116,6 @@ Item {
117116 when: windowShown
118117
119118 function init() {
120− menuContent.hideAll();
121119 if (menuContent.__contentActive)
122120 menuContent.releaseContent();
123121 tryCompare(menuContent, "__contentActive", false);
tests/qmltests/Panel/tst_Panel.qml+33−33
@@ -62,14 +62,14 @@ Item {
6262
6363 function get_indicator_item(index) {
6464 var row_repeater = findChild(panel.indicators, "rowRepeater");
65− verify(row_repeater != undefined)
65+ verify(row_repeater != undefined);
6666 return row_repeater.itemAt(index);
6767 }
6868
6969 function get_indicator_item_position(index) {
7070
7171 var indicator_row = findChild(panel.indicators, "indicatorRow");
72− verify(indicator_row != undefined)
72+ verify(indicator_row != undefined);
7373
7474 var indicator_item = get_indicator_item(index);
7575 verify(indicator_item != undefined);
@@ -83,11 +83,11 @@ Item {
8383 panel.fullscreenMode = false;
8484 // Wait for the indicators to get into position.
8585 // (switches between normal and fullscreen modes are animated)
86− tryCompare(panel.indicators, "y", 0)
86+ tryCompare(panel.indicators, "y", 0);
8787
8888 var indicator_item_coord = get_indicator_item_position(0);
8989
90− touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2)
90+ touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2);
9191
9292 // hint animation should be run, meaning that indicators will move downwards
9393 // by hintValue pixels without any drag taking place
@@ -96,7 +96,7 @@ Item {
9696 tryCompare(panel.indicators, "partiallyOpened", true);
9797 tryCompare(panel.indicators, "fullyOpened", false);
9898
99− touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2)
99+ touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2);
100100 }
101101
102102 // Pressing on the top edge of the screen should have no effect if the panel
@@ -105,31 +105,31 @@ Item {
105105 panel.fullscreenMode = true;
106106 // Wait for the indicators to get into position.
107107 // (switches between normal and fullscreen modes are animated)
108− tryCompare(panel.indicators, "y", -panel.panelHeight)
108+ tryCompare(panel.indicators, "y", -panel.panelHeight);
109109
110110 var indicator_item_coord = get_indicator_item_position(0);
111111
112− touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2)
112+ touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2);
113113
114114 // Give some time for a hint animation to change things, if any
115− wait(500)
115+ wait(500);
116116
117117 // no hint animation when fullscreen
118− compare(panel.indicators.y, -panel.panelHeight)
118+ compare(panel.indicators.y, -panel.panelHeight);
119119 var indicatorRow = findChild(panel.indicators, "indicatorRow");
120− verify(indicatorRow != undefined)
121− compare(indicatorRow.y, 0)
122− compare(panel.indicators.height, panel.indicators.panelHeight)
120+ verify(indicatorRow != undefined);
121+ compare(indicatorRow.y, 0);
122+ compare(panel.indicators.height, panel.indicators.panelHeight);
123123 compare(panel.indicators.partiallyOpened, false,
124124 "Indicator should not be partially opened when panel is pressed in" +
125− " fullscreenmode")
125+ " fullscreenmode");
126126 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");
128128
129− touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2)
129+ touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2);
130130 }
131131
132− function test_drag_show_data() { return get_window_data() }
132+ function test_drag_show_data() { return get_window_data(); }
133133
134134 // Dragging from a indicator item in the panel will gradually expose the
135135 // indicators, first by running the hint animation, then after dragging down will
@@ -138,50 +138,50 @@ Item {
138138 panel.fullscreenMode = data.fullscreenFlag;
139139
140140 var indicator_row = findChild(panel.indicators, "indicatorRow");
141− verify(indicator_row != undefined)
141+ verify(indicator_row != undefined);
142142
143143 var row_repeater = findChild(panel.indicators, "rowRepeater");
144− verify(indicator_row != undefined)
144+ verify(indicator_row != undefined);
145145
146146 var menu_content = findChild(panel.indicators, "menuContent");
147− verify(indicator_row != undefined)
147+ verify(indicator_row != undefined);
148148
149149 // Wait for the indicators to get into position.
150150 // (switches between normal and fullscreen modes are animated)
151151 if (data.fullscreenFlag) {
152− tryCompare(panel.indicators, "y", -panel.panelHeight)
152+ tryCompare(panel.indicators, "y", -panel.panelHeight);
153153 } else {
154− tryCompare(panel.indicators, "y", 0)
154+ tryCompare(panel.indicators, "y", 0);
155155 }
156156
157157 // do this for each indicator item
158158 for (var i = 0; i < row_repeater.count; i++) {
159159
160160 var indicator_item = get_indicator_item(i);
161− verify(indicator_item != undefined)
161+ verify(indicator_item != undefined);
162162
163163 var indicator_item_coord = get_indicator_item_position(i);
164164
165165 touchPress(panel,
166− indicator_item_coord.x, panel.panelHeight / 2)
166+ indicator_item_coord.x, panel.panelHeight / 2);
167167
168168 // 1) Drag the mouse down
169169 touchFlick(panel,
170170 indicator_item_coord.x, panel.panelHeight / 2,
171171 indicator_item_coord.x, panel.height * 0.8,
172− false /* beginTouch */, false /* endTouch */)
172+ false /* beginTouch */, false /* endTouch */);
173173
174174 // Indicators height should follow the drag, and therefore increase accordingly.
175175 // They should be at least half-way through the screen
176176 tryCompareFunction(
177177 function() {return panel.indicators.height >= panel.height * 0.5},
178− true)
178+ true);
179179
180− touchRelease(panel, indicator_item_coord.x, panel.height * 0.8)
180+ touchRelease(panel, indicator_item_coord.x, panel.height * 0.8);
181181
182182 compare(indicator_row.currentItem, indicator_item,
183− "Incorrect item activated at position " + i)
184− compare(menu_content.__shown, true, "Menu conetent should be enabled for item at position " + i);
183+ "Incorrect item activated at position " + i);
184+ compare(menu_content.currentIndex, i, "Menu conetent should be enabled for item at position " + i);
185185
186186 // init for next indicator_item
187187 init();
@@ -195,23 +195,23 @@ Item {
195195 var search_indicator = findChild(panel, "search");
196196 verify(search_indicator != undefined);
197197
198− tap(search_indicator, 1, 1)
198+ tap(search_indicator, 1, 1);
199199
200200 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");
202202 }
203203
204204 function test_search_click_when_not_visible() {
205205 panel.fullscreenMode = false;
206− panel.searchVisible = false
206+ panel.searchVisible = false;
207207
208208 var search_indicator = findChild(panel, "search");
209209 verify(search_indicator != undefined);
210210
211− tap(search_indicator, 1, 1)
211+ tap(search_indicator, 1, 1);
212212
213213 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");
215215 }
216216 }
217217}