on xenial help sign in
Remove the altnavigation qml code
90c5f00Albert Astals Cid
qml/Dash/DashNavigation.qml+3−33
@@ -30,28 +30,24 @@ Item {
30 property alias windowHeight: blackRect.height
30 property alias windowHeight: blackRect.height
31 readonly property var openList: {
31 readonly property var openList: {
32 if (navigationButton.showList) return navigationButton.listView;
32 if (navigationButton.showList) return navigationButton.listView;
33− if (altNavigationButton.showList) return altNavigationButton.listView;
34 return null;
33 return null;
35 }
34 }
36 readonly property bool disableParentInteractive: {
35 readonly property bool disableParentInteractive: {
37− return navigationButton.showList || altNavigationButton.showList ||
38− navigationButton.inverseMousePressed || altNavigationButton.inverseMousePressed;
36+ return navigationButton.showList || navigationButton.inverseMousePressed;
39 }
37 }
40
38
41 // FIXME this is only here for highlight purposes (see Background.qml, too)
39 // FIXME this is only here for highlight purposes (see Background.qml, too)
42 readonly property var background: backgroundItem
40 readonly property var background: backgroundItem
43
41
44 visible: height != 0
42 visible: height != 0
45− height: navigationButton.currentNavigation || altNavigationButton.currentNavigation ? units.gu(5) : 0
43+ height: navigationButton.currentNavigation ? units.gu(5) : 0
46
44
47 QtObject {
45 QtObject {
48 id: d
46 id: d
49 readonly property color foregroundColor: root.scopeStyle
47 readonly property color foregroundColor: root.scopeStyle
50 ? root.scopeStyle.getTextColor(backgroundItem.luminance)
48 ? root.scopeStyle.getTextColor(backgroundItem.luminance)
51 : Theme.palette.normal.baseText
49 : Theme.palette.normal.baseText
52− readonly property bool bothVisible: altNavigationButton.visible && navigationButton.visible
53 readonly property real navigationWidth: root.width >= units.gu(60) ? units.gu(40) : root.width
50 readonly property real navigationWidth: root.width >= units.gu(60) ? units.gu(40) : root.width
54− readonly property real buttonWidth: navigationWidth / (bothVisible ? 2 : 1)
55 }
51 }
56
52
57 Rectangle {
53 Rectangle {
@@ -76,27 +72,11 @@ Item {
76 anchors { top: parent.bottom; left: parent.left; right: parent.right }
72 anchors { top: parent.bottom; left: parent.left; right: parent.right }
77 }
73 }
78
74
79− DashNavigationButton {
80− id: altNavigationButton
81− objectName: "altNavigationButton"
82− height: root.height
83− width: d.buttonWidth
84− scope: root.scope
85− scopeStyle: root.scopeStyle
86− foregroundColor: d.foregroundColor
87− listView.width: d.navigationWidth
88− isAltNavigation: true
89− showDivider: navigationButton.visible || root.width > d.navigationWidth
90− // needed so that InverseMouseArea is above navigationButton
91− z: listView.height > 0 ? 1 : 0
92− }
93−
94 DashNavigationButton {
75 DashNavigationButton {
95 id: navigationButton
76 id: navigationButton
96 objectName: "navigationButton"
77 objectName: "navigationButton"
97 height: root.height
78 height: root.height
98− width: altNavigationButton.visible ? d.buttonWidth : d.navigationWidth
79+ width: d.navigationWidth
99− x: altNavigationButton.visible ? d.buttonWidth : 0
100 scope: root.scope
80 scope: root.scope
101 scopeStyle: root.scopeStyle
81 scopeStyle: root.scopeStyle
102 foregroundColor: d.foregroundColor
82 foregroundColor: d.foregroundColor
@@ -104,14 +84,4 @@ Item {
104 listView.x: -x
84 listView.x: -x
105 showDivider: root.width > d.navigationWidth
85 showDivider: root.width > d.navigationWidth
106 }
86 }
107−
108− Image {
109− fillMode: Image.Stretch
110− source: backgroundItem.luminance > 0.7 ? "graphics/navigation_shadow.png" : "graphics/navigation_shadow_light.png"
111− x: navigationButton.listView.height > 0 ? altNavigationButton.x : navigationButton.x
112− width: d.buttonWidth
113− rotation: 180
114− anchors.bottom: parent.bottom
115− visible: d.bothVisible && (navigationButton.listView.height > 0 || altNavigationButton.listView.height > 0)
116− }
117}
87}
qml/Dash/DashNavigationButton.qml+6−16
@@ -25,11 +25,10 @@ AbstractButton {
25 property var scope: null
25 property var scope: null
26 property var scopeStyle: null
26 property var scopeStyle: null
27 property color foregroundColor: Theme.palette.normal.baseText
27 property color foregroundColor: Theme.palette.normal.baseText
28− property bool isAltNavigation: false
29 property bool showDivider: false
28 property bool showDivider: false
30
29
31 // Used by parent
30 // Used by parent
32− readonly property var currentNavigation: scope && scope[hasNavigation] ? getNavigation(scope[currentNavigationId]) : null
31+ readonly property var currentNavigation: scope && scope.hasNavigation ? scope.getNavigation(scope.currentNavigationId) : null
33 readonly property alias listView: navigationListView
32 readonly property alias listView: navigationListView
34 readonly property bool inverseMousePressed: inverseMouseArea.pressed
33 readonly property bool inverseMousePressed: inverseMouseArea.pressed
35 property bool showList: false
34 property bool showList: false
@@ -37,15 +36,6 @@ AbstractButton {
37 // Internal
36 // Internal
38 // Are we drilling down the tree or up?
37 // Are we drilling down the tree or up?
39 property bool isGoingBack: false
38 property bool isGoingBack: false
40− readonly property string hasNavigation: isAltNavigation ? "hasAltNavigation" : "hasNavigation"
41− readonly property string currentNavigationId: isAltNavigation ? "currentAltNavigationId" : "currentNavigationId"
42− function getNavigation(navId) {
43− if (isAltNavigation) {
44− return scope.getAltNavigation(navId);
45− } else {
46− return scope.getNavigation(navId);
47− }
48− }
49
39
50 visible: root.currentNavigation != null
40 visible: root.currentNavigation != null
51
41
@@ -125,10 +115,10 @@ AbstractButton {
125 }
115 }
126 }
116 }
127 height: desiredHeight
117 height: desiredHeight
128− navigation: (nullifyNavigation || !scope) ? null : getNavigation(navigationId)
118+ navigation: (nullifyNavigation || !scope) ? null : scope.getNavigation(navigationId)
129 currentNavigation: root.currentNavigation
119 currentNavigation: root.currentNavigation
130 onEnterNavigation: {
120 onEnterNavigation: {
131− scope.setNavigationState(newNavigationId, isAltNavigation);
121+ scope.setNavigationState(newNavigationId);
132 // We only need to add a new item to the model
122 // We only need to add a new item to the model
133 // if we have children, otherwise just load it
123 // if we have children, otherwise just load it
134 if (hasChildren) {
124 if (hasChildren) {
@@ -151,7 +141,7 @@ AbstractButton {
151 navigationListView.highlightMoveDuration = aux;
141 navigationListView.highlightMoveDuration = aux;
152 }
142 }
153
143
154− scope.setNavigationState(navigation.parentNavigationId, isAltNavigation);
144+ scope.setNavigationState(navigation.parentNavigationId);
155 isGoingBack = true;
145 isGoingBack = true;
156 navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", false);
146 navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", false);
157 navigationListView.currentIndex--;
147 navigationListView.currentIndex--;
@@ -160,7 +150,7 @@ AbstractButton {
160 showList = false;
150 showList = false;
161 if (root.currentNavigation.parentNavigationId == navigation.navigationId) {
151 if (root.currentNavigation.parentNavigationId == navigation.navigationId) {
162 // For leaves we have to go to the parent too
152 // For leaves we have to go to the parent too
163− scope.setNavigationState(root.currentNavigation.parentNavigationId, isAltNavigation);
153+ scope.setNavigationState(root.currentNavigation.parentNavigationId);
164 }
154 }
165 }
155 }
166 }
156 }
@@ -198,7 +188,7 @@ AbstractButton {
198 if (isFirstLoad && currentNavigation && currentNavigation.loaded) {
188 if (isFirstLoad && currentNavigation && currentNavigation.loaded) {
199 isFirstLoad = false;
189 isFirstLoad = false;
200 if (currentNavigation.count > 0) {
190 if (currentNavigation.count > 0) {
201− navigationModel.append({"navigationId": scope[currentNavigationId], "nullifyNavigation": false});
191+ navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
202 } else {
192 } else {
203 navigationModel.append({"navigationId": currentNavigation.parentNavigationId, "nullifyNavigation": false});
193 navigationModel.append({"navigationId": currentNavigation.parentNavigationId, "nullifyNavigation": false});
204 }
194 }
tests/qmltests/Dash/tst_DashContent.qml+1−108
@@ -403,119 +403,12 @@ Item {
403 tryCompare(dashNavigationButton.currentNavigation, "navigationId", "middle2");
403 tryCompare(dashNavigationButton.currentNavigation, "navigationId", "middle2");
404 }
404 }
405
405
406− function test_altNavigation() {
407− var dashContentList = findChild(dashContent, "dashContentList");
408− tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation") != null; }, true);
409− var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation");
410− tryCompare(dashNavigation, "visible", true);
411− var dashNavigationButton = findChild(dashContentList.currentItem, "altNavigationButton");
412− verify(dashNavigationButton, "Can't find navigation button");
413−
414− compare(dashNavigationButton.showList, false);
415− waitForRendering(dashNavigationButton);
416− mouseClick(dashNavigationButton);
417− compare(dashNavigationButton.showList, true);
418−
419− var navigationListView = findChild(dashNavigationButton, "navigationListView");
420− tryCompareFunction(function() {
421− return navigationListView.currentItem &&
422− navigationListView.currentItem.navigation &&
423− navigationListView.currentItem.navigation.loaded; }, true);
424−
425− waitForRendering(navigationListView);
426− waitForRendering(navigationListView.currentItem);
427−
428− tryCompare(dashNavigationButton.currentNavigation, "navigationId", "altrootChild1");
429− tryCompare(navigationListView.currentItem.navigation, "navigationId", "altroot");
430−
431− var allButton = findChild(dashNavigationButton, "allButton");
432− compare(allButton.visible, false);
433− var backButton = findChild(navigationListView, "backButton");
434− compare(backButton.visible, false);
435−
436− var navigation = findChild(dashNavigationButton, "navigation0child3");
437− mouseClick(navigation);
438− compare(dashNavigationButton.showList, false);
439− tryCompare(dashNavigationButton.currentNavigation, "navigationId", "altrootChild3");
440− tryCompare(navigationListView.currentItem.navigation, "navigationId", "altroot");
441−
442− mouseClick(dashNavigationButton);
443− compare(dashNavigationButton.showList, true);
444− waitForRendering(navigationListView);
445− waitForRendering(navigationListView.currentItem);
446− compare(allButton.visible, false);
447−
448− navigation = findChild(dashNavigationButton, "navigation0child2");
449− mouseClick(navigation);
450− compare(dashNavigationButton.showList, false);
451− tryCompare(dashNavigationButton.currentNavigation, "navigationId", "altrootChild2");
452− tryCompare(navigationListView.currentItem.navigation, "navigationId", "altroot");
453−
454− mouseClick(dashNavigationButton);
455− compare(dashNavigationButton.showList, true);
456− waitForRendering(navigationListView);
457− waitForRendering(navigationListView.currentItem);
458− verify(!backButton.visible, "Back button should not be visible");
459−
460− compare(navigationListView.count, 1, "There should be no second-level navigation");
461−
462− mouseClick(dashNavigationButton);
463− compare(dashNavigationButton.showList, false);
464− }
465−
466− function test_navigationsClosing() {
467− var dashContentList = findChild(dashContent, "dashContentList");
468− tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation") != null; }, true);
469− var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation");
470− tryCompare(dashNavigation, "visible", true);
471− var dashNavigationButton = findChild(dashContentList.currentItem, "navigationButton");
472− verify(dashNavigationButton, "Can't find navigation button");
473− var dashAltNavigationButton = findChild(dashContentList.currentItem, "altNavigationButton");
474− verify(dashAltNavigationButton, "Can't find alternative navigation button");
475−
476− waitForRendering(dashNavigationButton);
477− waitForRendering(dashAltNavigationButton);
478−
479− compare(dashNavigationButton.showList, false);
480− compare(dashAltNavigationButton.showList, false);
481−
482− mouseClick(dashAltNavigationButton);
483− compare(dashNavigationButton.showList, false);
484− compare(dashAltNavigationButton.showList, true);
485−
486− var navigationListView = findChild(dashAltNavigationButton, "navigationListView");
487− tryCompareFunction(function() {
488− return navigationListView.currentItem &&
489− navigationListView.currentItem.navigation &&
490− navigationListView.currentItem.navigation.loaded; }, true);
491−
492− var blackRect = findChild(dashNavigation, "blackRect");
493− tryCompare(blackRect, "opacity", 0.5);
494−
495− mouseClick(dashNavigationButton);
496− compare(dashNavigationButton.showList, false);
497− compare(dashAltNavigationButton.showList, false);
498−
499− tryCompare(navigationListView, "visible", false);
500−
501− mouseClick(dashNavigationButton);
502− compare(dashNavigationButton.showList, true);
503− compare(dashAltNavigationButton.showList, false);
504−
505− navigationListView = findChild(dashNavigationButton, "navigationListView");
506− tryCompare(navigationListView.currentItem.navigation, "loaded", true);
507−
508− mouseClick(dashAltNavigationButton);
509− compare(dashNavigationButton.showList, false);
510− compare(dashAltNavigationButton.showList, false);
511− }
512−
513 function test_navigationsSwipeToNextScope() {
406 function test_navigationsSwipeToNextScope() {
514 var dashContentList = findChild(dashContent, "dashContentList");
407 var dashContentList = findChild(dashContent, "dashContentList");
515 tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation") != null; }, true);
408 tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation") != null; }, true);
516 var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation");
409 var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation");
517 tryCompare(dashNavigation, "visible", true);
410 tryCompare(dashNavigation, "visible", true);
518− var dashNavigationButton = findChild(dashContentList.currentItem, "altNavigationButton");
411+ var dashNavigationButton = findChild(dashContentList.currentItem, "navigationButton");
519 verify(dashNavigationButton, "Can't find navigation button");
412 verify(dashNavigationButton, "Can't find navigation button");
520
413
521 compare(dashNavigationButton.showList, false);
414 compare(dashNavigationButton.showList, false);