Merge lp:~josharenson/unity8/autoscroller-alternative into lp:unity8

Proposed by Josh Arenson
Status: Merged
Approved by: Andrea Cimitan
Approved revision: 2666
Merged at revision: 2762
Proposed branch: lp:~josharenson/unity8/autoscroller-alternative
Merge into: lp:unity8
Diff against target: 326 lines (+140/-48)
6 files modified
qml/Dash/ScopesList.qml (+120/-39)
qml/Dash/ScopesListCategory.qml (+3/-0)
tests/mocks/Unity/fake_scopes.cpp (+7/-0)
tests/qmltests/Dash/tst_Dash.qml (+6/-5)
tests/qmltests/Dash/tst_DashContent.qml (+3/-3)
tests/qmltests/Dash/tst_DashShell.qml (+1/-1)
To merge this branch: bzr merge lp:~josharenson/unity8/autoscroller-alternative
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve
Andrea Cimitan (community) Approve
Review via email: mp+311207@code.launchpad.net

Commit message

Allow the scopes list to automatically scroll when a scope is being dragged past the bounds of the screen.

Description of the change

* Are there any related MPs required for this MP to build/function as expected? Please list.
lp:~josharenson/unity-scopes-shell/fix-overview-results-sorting which fixes lp:1646947

* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes.

* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

* If you changed the UI, has there been a design review?
There has not.

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2660
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2507/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3309
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1894
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1894
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/1894
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3337
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3189
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3189/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3189
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3189/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3189
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3189/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3189
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3189/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3189
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3189/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3189
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3189/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3189
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3189/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3189
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3189/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3189
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3189/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2507/rebuild

review: Needs Fixing (continuous-integration)
2661. By Josh Arenson

Fix content tests

2662. By Josh Arenson

Fix dash tests

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2662
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2508/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3310
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1895
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1895
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/1895
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3338
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3190
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3190/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3190
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3190/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3190
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3190/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3190
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3190/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3190
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3190/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3190
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3190/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3190
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3190/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3190
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3190/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3190
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3190/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2508/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2662
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2510/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3314
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1899
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1899
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/1899
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3342
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3194
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3194/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3194
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3194/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3194
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3194/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3194
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3194/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3194
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3194/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3194
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3194/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3194
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3194/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3194
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3194/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3194
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3194/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2510/rebuild

review: Approve (continuous-integration)
2663. By Josh Arenson

Fix warnings and cleanup

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
2664. By Josh Arenson

Merge trunk

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2664
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2628/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3460
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1983
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/1983
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3488
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3334
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3334/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3334
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3334/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3334
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3334/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3334
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3334/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3334
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3334/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3334
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3334/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2628/rebuild

review: Needs Fixing (continuous-integration)
2665. By Josh Arenson

Merge trunk

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

Triggered a rebuild

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Text conflict in tests/qmltests/Stage/tst_DesktopStage.qml
1 conflicts encountered.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Text conflict in tests/qmltests/Stage/tst_DesktopStage.qml
1 conflicts encountered.

2666. By Josh Arenson

Merge trunk

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2666
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2807/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3674
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2105
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2105
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3702
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3546
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3546/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3546
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3546/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3546
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3546/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3546
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3546/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3546
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3546/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3546
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3546/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2807/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

I cannot reproduce this test failure locally, so I assume it was unrelated

review: Approve
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2666
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2831/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3706
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2130
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2130
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3734
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3578
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3578/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3578
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3578/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3578
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3578/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3578
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3578/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3578
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3578/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3578
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3578/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2831/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qml/Dash/ScopesList.qml'
--- qml/Dash/ScopesList.qml 2016-07-27 16:23:18 +0000
+++ qml/Dash/ScopesList.qml 2017-01-03 17:43:44 +0000
@@ -22,6 +22,8 @@
22Item {22Item {
23 id: root23 id: root
2424
25 property alias scopesListFlickable: scopesListFlickable
26
25 // Properties set by parent27 // Properties set by parent
26 property var scope: null28 property var scope: null
2729
@@ -35,10 +37,97 @@
35 signal requestFavoriteMoveTo(string scopeId, int index)37 signal requestFavoriteMoveTo(string scopeId, int index)
36 signal requestRestore(string scopeId)38 signal requestRestore(string scopeId)
3739
40 Item {
41 id: autoscroller
42
43 property bool dragging: false
44 property var dragItem: new Object();
45
46 readonly property bool fuzzyAtYEnd: {
47 var contentHeight = root.scopesListFlickable.contentHeight
48 var contentY = root.scopesListFlickable.contentY
49 var dragItemHeight = dragItem ? autoscroller.dragItem.height : 0
50 var flickableHeight = root.scopesListFlickable.height
51
52 if (!dragItem) {
53 return true;
54 } else {
55 return contentY >= (contentHeight - flickableHeight) - dragItemHeight
56 }
57 }
58
59 readonly property real bottomBoundary: {
60 var contentHeight = root.scopesListFlickable.contentHeight
61 var contentY = root.scopesListFlickable.contentY
62 var dragItemHeight = dragItem ? autoscroller.dragItem.height : 0
63 var heightRatio = root.scopesListFlickable.visibleArea.heightRatio
64
65 if (!dragItem) {
66 return true;
67 } else {
68 return (heightRatio * contentHeight) -
69 (1.5 * dragItemHeight) + contentY
70 }
71 }
72
73 readonly property int delayMs: 32
74 readonly property real topBoundary: dragItem ? root.scopesListFlickable.contentY + (.5 * dragItem.height) : 0
75
76 visible: false
77 readonly property real maxStep: units.dp(10)
78 function stepSize(scrollingUp) {
79 var delta, step;
80 if (scrollingUp) {
81 delta = dragItem.y - topBoundary;
82 delta /= (1.5 * dragItem.height);
83 } else {
84 delta = dragItem.y - bottomBoundary;
85 delta /= (1.5 * dragItem.height);
86 }
87
88 step = Math.abs(delta) * autoscroller.maxStep
89 return Math.ceil(step);
90 }
91
92
93 Timer {
94 interval: autoscroller.delayMs
95 running: autoscroller.dragItem ? (autoscroller.dragging &&
96 autoscroller.dragItem.y < autoscroller.topBoundary &&
97 !root.scopesListFlickable.atYBeginning) : false
98 repeat: true
99 onTriggered: {
100 root.scopesListFlickable.contentY -= autoscroller.stepSize(true);
101 autoscroller.dragItem.y -= autoscroller.stepSize(true);
102 }
103 }
104
105 Timer {
106 interval: autoscroller.delayMs
107 running: autoscroller.dragItem ? (autoscroller.dragging &&
108 autoscroller.dragItem.y >= autoscroller.bottomBoundary &&
109 !autoscroller.fuzzyAtYEnd) : false
110 repeat: true
111 onTriggered: {
112 root.scopesListFlickable.contentY += autoscroller.stepSize(false);
113 autoscroller.dragItem.y += autoscroller.stepSize(false);
114 }
115 }
116 }
117
118 function autoscroll(dragging, dragItem) {
119 if (dragging) {
120 autoscroller.dragItem = dragItem
121 autoscroller.dragging = true;
122 } else {
123 autoscroller.dragItem = null;
124 autoscroller.dragging = false
125 }
126 }
127
38 state: "browse"128 state: "browse"
39129
40 property var scopeStyle: ScopeStyle {130 property var scopeStyle: ScopeStyle {}
41 }
42131
43 onStateChanged: {132 onStateChanged: {
44 if (state == "edit") {133 if (state == "edit") {
@@ -73,7 +162,8 @@
73 z: 1162 z: 1
74 }163 }
75164
76 Flickable {165 ListView {
166 id: scopesListFlickable
77 objectName: "scopesListFlickable"167 objectName: "scopesListFlickable"
78 anchors {168 anchors {
79 top: header.bottom169 top: header.bottom
@@ -82,43 +172,34 @@
82 right: parent.right172 right: parent.right
83 }173 }
84 clip: true174 clip: true
85 contentWidth: root.width175 model: scope ? scope.categories : null
86 contentHeight: column.height176 delegate: Loader {
87 onContentHeightChanged: returnToBounds();177 asynchronous: true
88 Column {178 width: root.width
89 id: column179 active: results.count > 0
90 Repeater {180 visible: active
91 model: scope ? scope.categories : null181 sourceComponent: ScopesListCategory {
92182 objectName: "scopesListCategory" + categoryId
93 delegate: Loader {183
94 asynchronous: true184 model: results
95 width: root.width185
96 active: results.count > 0186 title: {
97 visible: active187 if (isFavoritesFeed) return i18n.tr("Home");
98 sourceComponent: ScopesListCategory {188 else if (isAlsoInstalled) return i18n.tr("Also installed");
99 objectName: "scopesListCategory" + categoryId189 else return name;
100
101 model: results
102
103 title: {
104 if (isFavoritesFeed) return i18n.tr("Home");
105 else if (isAlsoInstalled) return i18n.tr("Also installed");
106 else return name;
107 }
108
109 editMode: root.state == "edit"
110
111 scopeStyle: root.scopeStyle
112 isFavoritesFeed: categoryId == "favorites"
113 isAlsoInstalled: categoryId == "other"
114
115 onRequestFavorite: root.requestFavorite(scopeId, favorite);
116 onRequestEditMode: root.state = "edit";
117 onRequestScopeMoveTo: root.requestFavoriteMoveTo(scopeId, index);
118 onRequestActivate: root.scope.activate(result, categoryId);
119 onRequestRestore: root.requestRestore(scopeId);
120 }190 }
121 }191
192 editMode: root.state == "edit"
193 scopeStyle: root.scopeStyle
194 isFavoritesFeed: categoryId == "favorites"
195 isAlsoInstalled: categoryId == "other"
196
197 onItemDragging: autoscroll(dragging, dragItem);
198 onRequestFavorite: root.requestFavorite(scopeId, favorite);
199 onRequestEditMode: root.state = "edit";
200 onRequestScopeMoveTo: root.requestFavoriteMoveTo(scopeId, index);
201 onRequestActivate: root.scope.activate(result, categoryId);
202 onRequestRestore: root.requestRestore(scopeId);
122 }203 }
123 }204 }
124 }205 }
125206
=== modified file 'qml/Dash/ScopesListCategory.qml'
--- qml/Dash/ScopesListCategory.qml 2016-10-04 09:32:15 +0000
+++ qml/Dash/ScopesListCategory.qml 2017-01-03 17:43:44 +0000
@@ -32,6 +32,7 @@
3232
33 visible: !editMode || isFavoritesFeed33 visible: !editMode || isFavoritesFeed
3434
35 signal itemDragging(bool dragging, var dragItem)
35 signal requestFavorite(string scopeId, bool favorite)36 signal requestFavorite(string scopeId, bool favorite)
36 signal requestEditMode()37 signal requestEditMode()
37 signal requestScopeMoveTo(string scopeId, int index)38 signal requestScopeMoveTo(string scopeId, int index)
@@ -109,6 +110,7 @@
109 onRequestFavorite: root.requestFavorite(model.scopeId, favorite);110 onRequestFavorite: root.requestFavorite(model.scopeId, favorite);
110 onHandlePressed: {111 onHandlePressed: {
111 if (editMode) {112 if (editMode) {
113 root.itemDragging(true, dragItem);
112 handle.drag.target = dragItem;114 handle.drag.target = dragItem;
113 handle.drag.maximumX = units.gu(1);115 handle.drag.maximumX = units.gu(1);
114 handle.drag.minimumX = units.gu(1);116 handle.drag.minimumX = units.gu(1);
@@ -126,6 +128,7 @@
126 }128 }
127 }129 }
128 onHandleReleased: {130 onHandleReleased: {
131 root.itemDragging(false, dragItem);
129 if (dragItem.visible) {132 if (dragItem.visible) {
130 handle.drag.target = undefined;133 handle.drag.target = undefined;
131 dragItem.visible = false;134 dragItem.visible = false;
132135
=== modified file 'tests/mocks/Unity/fake_scopes.cpp'
--- tests/mocks/Unity/fake_scopes.cpp 2016-06-07 03:33:35 +0000
+++ tests/mocks/Unity/fake_scopes.cpp 2017-01-03 17:43:44 +0000
@@ -73,6 +73,13 @@
73 addScope(longNavigationScope);73 addScope(longNavigationScope);
7474
75 addScope(new Scope("NullPreviewScope", "NPS", false, this, 1, true));75 addScope(new Scope("NullPreviewScope", "NPS", false, this, 1, true));
76
77 // Add enough scopes to test autoscrolling on the scopes managment page
78 for (int i = 0; i < 20; i++) {
79 addScope(new Scope("UselessScope" + QString::number(i),
80 "US" + QString::number(i), true, this));
81 }
82
76 m_scopesOverview = new ScopesOverview(this);83 m_scopesOverview = new ScopesOverview(this);
7784
78 if (!m_loaded) {85 if (!m_loaded) {
7986
=== modified file 'tests/qmltests/Dash/tst_Dash.qml'
--- tests/qmltests/Dash/tst_Dash.qml 2016-11-21 14:10:08 +0000
+++ tests/qmltests/Dash/tst_Dash.qml 2017-01-03 17:43:44 +0000
@@ -58,7 +58,7 @@
58 tryCompare(dashContentList, "count", 0);58 tryCompare(dashContentList, "count", 0);
59 scopes.load();59 scopes.load();
60 tryCompare(dashContentList, "currentIndex", 0);60 tryCompare(dashContentList, "currentIndex", 0);
61 tryCompare(dashContentList, "count", 8);61 tryCompare(dashContentList, "count", 28);
62 tryCompare(scopes, "loaded", true);62 tryCompare(scopes, "loaded", true);
63 tryCompareFunction(function() {63 tryCompareFunction(function() {
64 var mockScope1Loader = findChild(dash, "scopeLoader0");64 var mockScope1Loader = findChild(dash, "scopeLoader0");
@@ -589,10 +589,10 @@
589589
590 // Go to a temp scope590 // Go to a temp scope
591 open_manage_dash();591 open_manage_dash();
592 flickToYEnd(findChild(dash, "scopesListFlickable"));
592593
593 var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");594 var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
594 var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList");595 var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList");
595 flickToYEnd(findChild(dash, "scopesListFlickable"));
596 tryCompare(nonfavScopesListCategoryList, "currentIndex", 0);596 tryCompare(nonfavScopesListCategoryList, "currentIndex", 0);
597 mouseClick(nonfavScopesListCategoryList.currentItem);597 mouseClick(nonfavScopesListCategoryList.currentItem);
598 var dashTempScopeItem = findChild(dash, "dashTempScopeItem");598 var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
@@ -661,13 +661,14 @@
661 // Go to a temp scope661 // Go to a temp scope
662 open_manage_dash();662 open_manage_dash();
663663
664 var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
665 var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList");
666 var scopesListFlickable = findChild(dash, "scopesListFlickable");664 var scopesListFlickable = findChild(dash, "scopesListFlickable");
665 flickToYEnd(scopesListFlickable);
666
667 var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
668 var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList");
667 tryCompare(nonfavScopesListCategoryList, "currentIndex", 0);669 tryCompare(nonfavScopesListCategoryList, "currentIndex", 0);
668670
669 // Ensure the non-favorites, located at the bottom, are visible671 // Ensure the non-favorites, located at the bottom, are visible
670 flickToYEnd(scopesListFlickable);
671 mouseClick(nonfavScopesListCategoryList.currentItem);672 mouseClick(nonfavScopesListCategoryList.currentItem);
672 var dashTempScopeItem = findChild(dash, "dashTempScopeItem");673 var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
673 tryCompare(dashTempScopeItem, "x", 0);674 tryCompare(dashTempScopeItem, "x", 0);
674675
=== modified file 'tests/qmltests/Dash/tst_DashContent.qml'
--- tests/qmltests/Dash/tst_DashContent.qml 2016-11-12 16:33:58 +0000
+++ tests/qmltests/Dash/tst_DashContent.qml 2017-01-03 17:43:44 +0000
@@ -70,7 +70,7 @@
70 function loadScopes() {70 function loadScopes() {
71 scopeLoadedSpy.clear();71 scopeLoadedSpy.clear();
72 scopesModel.load();72 scopesModel.load();
73 tryCompare(scopeLoadedSpy, "count", 8, 15000);73 tryCompare(scopeLoadedSpy, "count", 28, 15000);
74 tryCompare(scopesModel, "loaded", true);74 tryCompare(scopesModel, "loaded", true);
75 tryCompareFunction(function() {75 tryCompareFunction(function() {
76 var mockScope1Loader = findChild(shell, "scopeLoader0");76 var mockScope1Loader = findChild(shell, "scopeLoader0");
@@ -124,7 +124,7 @@
124124
125 loadScopes();125 loadScopes();
126126
127 compare(dashContentList.count, 8);127 compare(dashContentList.count, 28);
128 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < dashContentList.count);128 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < dashContentList.count);
129 }129 }
130130
@@ -181,7 +181,7 @@
181181
182 // test greater than scope count.182 // test greater than scope count.
183 var currentScopeIndex = dashContent.currentIndex;183 var currentScopeIndex = dashContent.currentIndex;
184 dashContent.setCurrentScopeAtIndex(18, true, false);184 dashContent.setCurrentScopeAtIndex(29, true, false);
185 compare(dashContent.currentIndex, currentScopeIndex, "Scope should not change if changing to greater index than count");185 compare(dashContent.currentIndex, currentScopeIndex, "Scope should not change if changing to greater index than count");
186 }186 }
187187
188188
=== modified file 'tests/qmltests/Dash/tst_DashShell.qml'
--- tests/qmltests/Dash/tst_DashShell.qml 2016-11-29 18:27:40 +0000
+++ tests/qmltests/Dash/tst_DashShell.qml 2017-01-03 17:43:44 +0000
@@ -60,7 +60,7 @@
60 tryCompare(dashContentList, "count", 0);60 tryCompare(dashContentList, "count", 0);
61 scopes.load();61 scopes.load();
62 tryCompare(dashContentList, "currentIndex", 0);62 tryCompare(dashContentList, "currentIndex", 0);
63 tryCompare(dashContentList, "count", 8);63 tryCompare(dashContentList, "count", 28);
64 tryCompare(scopes, "loaded", true);64 tryCompare(scopes, "loaded", true);
65 tryCompareFunction(function() {65 tryCompareFunction(function() {
66 var mockScope1Loader = findChild(dash, "scopeLoader0");66 var mockScope1Loader = findChild(dash, "scopeLoader0");

Subscribers

People subscribed via source and target branches