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

Proposed by Josh Arenson on 2016-11-17
Status: Merged
Approved by: Andrea Cimitan on 2017-01-05
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 on 2017-01-05
Andrea Cimitan (community) 2016-11-17 Approve on 2017-01-05
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.
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 on 2016-11-17

Fix content tests

2662. By Josh Arenson on 2016-11-17

Fix dash tests

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)
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 on 2016-12-01

Fix warnings and cleanup

Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
2664. By Josh Arenson on 2016-12-02

Merge trunk

Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
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 on 2016-12-14

Merge trunk

Andrea Cimitan (cimi) wrote :

Triggered a rebuild

Albert Astals Cid (aacid) wrote :

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

Albert Astals Cid (aacid) wrote :

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

2666. By Josh Arenson on 2017-01-03

Merge trunk

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)
Andrea Cimitan (cimi) wrote :

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

review: Approve
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
1=== modified file 'qml/Dash/ScopesList.qml'
2--- qml/Dash/ScopesList.qml 2016-07-27 16:23:18 +0000
3+++ qml/Dash/ScopesList.qml 2017-01-03 17:43:44 +0000
4@@ -22,6 +22,8 @@
5 Item {
6 id: root
7
8+ property alias scopesListFlickable: scopesListFlickable
9+
10 // Properties set by parent
11 property var scope: null
12
13@@ -35,10 +37,97 @@
14 signal requestFavoriteMoveTo(string scopeId, int index)
15 signal requestRestore(string scopeId)
16
17+ Item {
18+ id: autoscroller
19+
20+ property bool dragging: false
21+ property var dragItem: new Object();
22+
23+ readonly property bool fuzzyAtYEnd: {
24+ var contentHeight = root.scopesListFlickable.contentHeight
25+ var contentY = root.scopesListFlickable.contentY
26+ var dragItemHeight = dragItem ? autoscroller.dragItem.height : 0
27+ var flickableHeight = root.scopesListFlickable.height
28+
29+ if (!dragItem) {
30+ return true;
31+ } else {
32+ return contentY >= (contentHeight - flickableHeight) - dragItemHeight
33+ }
34+ }
35+
36+ readonly property real bottomBoundary: {
37+ var contentHeight = root.scopesListFlickable.contentHeight
38+ var contentY = root.scopesListFlickable.contentY
39+ var dragItemHeight = dragItem ? autoscroller.dragItem.height : 0
40+ var heightRatio = root.scopesListFlickable.visibleArea.heightRatio
41+
42+ if (!dragItem) {
43+ return true;
44+ } else {
45+ return (heightRatio * contentHeight) -
46+ (1.5 * dragItemHeight) + contentY
47+ }
48+ }
49+
50+ readonly property int delayMs: 32
51+ readonly property real topBoundary: dragItem ? root.scopesListFlickable.contentY + (.5 * dragItem.height) : 0
52+
53+ visible: false
54+ readonly property real maxStep: units.dp(10)
55+ function stepSize(scrollingUp) {
56+ var delta, step;
57+ if (scrollingUp) {
58+ delta = dragItem.y - topBoundary;
59+ delta /= (1.5 * dragItem.height);
60+ } else {
61+ delta = dragItem.y - bottomBoundary;
62+ delta /= (1.5 * dragItem.height);
63+ }
64+
65+ step = Math.abs(delta) * autoscroller.maxStep
66+ return Math.ceil(step);
67+ }
68+
69+
70+ Timer {
71+ interval: autoscroller.delayMs
72+ running: autoscroller.dragItem ? (autoscroller.dragging &&
73+ autoscroller.dragItem.y < autoscroller.topBoundary &&
74+ !root.scopesListFlickable.atYBeginning) : false
75+ repeat: true
76+ onTriggered: {
77+ root.scopesListFlickable.contentY -= autoscroller.stepSize(true);
78+ autoscroller.dragItem.y -= autoscroller.stepSize(true);
79+ }
80+ }
81+
82+ Timer {
83+ interval: autoscroller.delayMs
84+ running: autoscroller.dragItem ? (autoscroller.dragging &&
85+ autoscroller.dragItem.y >= autoscroller.bottomBoundary &&
86+ !autoscroller.fuzzyAtYEnd) : false
87+ repeat: true
88+ onTriggered: {
89+ root.scopesListFlickable.contentY += autoscroller.stepSize(false);
90+ autoscroller.dragItem.y += autoscroller.stepSize(false);
91+ }
92+ }
93+ }
94+
95+ function autoscroll(dragging, dragItem) {
96+ if (dragging) {
97+ autoscroller.dragItem = dragItem
98+ autoscroller.dragging = true;
99+ } else {
100+ autoscroller.dragItem = null;
101+ autoscroller.dragging = false
102+ }
103+ }
104+
105 state: "browse"
106
107- property var scopeStyle: ScopeStyle {
108- }
109+ property var scopeStyle: ScopeStyle {}
110
111 onStateChanged: {
112 if (state == "edit") {
113@@ -73,7 +162,8 @@
114 z: 1
115 }
116
117- Flickable {
118+ ListView {
119+ id: scopesListFlickable
120 objectName: "scopesListFlickable"
121 anchors {
122 top: header.bottom
123@@ -82,43 +172,34 @@
124 right: parent.right
125 }
126 clip: true
127- contentWidth: root.width
128- contentHeight: column.height
129- onContentHeightChanged: returnToBounds();
130- Column {
131- id: column
132- Repeater {
133- model: scope ? scope.categories : null
134-
135- delegate: Loader {
136- asynchronous: true
137- width: root.width
138- active: results.count > 0
139- visible: active
140- sourceComponent: ScopesListCategory {
141- objectName: "scopesListCategory" + categoryId
142-
143- model: results
144-
145- title: {
146- if (isFavoritesFeed) return i18n.tr("Home");
147- else if (isAlsoInstalled) return i18n.tr("Also installed");
148- else return name;
149- }
150-
151- editMode: root.state == "edit"
152-
153- scopeStyle: root.scopeStyle
154- isFavoritesFeed: categoryId == "favorites"
155- isAlsoInstalled: categoryId == "other"
156-
157- onRequestFavorite: root.requestFavorite(scopeId, favorite);
158- onRequestEditMode: root.state = "edit";
159- onRequestScopeMoveTo: root.requestFavoriteMoveTo(scopeId, index);
160- onRequestActivate: root.scope.activate(result, categoryId);
161- onRequestRestore: root.requestRestore(scopeId);
162+ model: scope ? scope.categories : null
163+ delegate: Loader {
164+ asynchronous: true
165+ width: root.width
166+ active: results.count > 0
167+ visible: active
168+ sourceComponent: ScopesListCategory {
169+ objectName: "scopesListCategory" + categoryId
170+
171+ model: results
172+
173+ title: {
174+ if (isFavoritesFeed) return i18n.tr("Home");
175+ else if (isAlsoInstalled) return i18n.tr("Also installed");
176+ else return name;
177 }
178- }
179+
180+ editMode: root.state == "edit"
181+ scopeStyle: root.scopeStyle
182+ isFavoritesFeed: categoryId == "favorites"
183+ isAlsoInstalled: categoryId == "other"
184+
185+ onItemDragging: autoscroll(dragging, dragItem);
186+ onRequestFavorite: root.requestFavorite(scopeId, favorite);
187+ onRequestEditMode: root.state = "edit";
188+ onRequestScopeMoveTo: root.requestFavoriteMoveTo(scopeId, index);
189+ onRequestActivate: root.scope.activate(result, categoryId);
190+ onRequestRestore: root.requestRestore(scopeId);
191 }
192 }
193 }
194
195=== modified file 'qml/Dash/ScopesListCategory.qml'
196--- qml/Dash/ScopesListCategory.qml 2016-10-04 09:32:15 +0000
197+++ qml/Dash/ScopesListCategory.qml 2017-01-03 17:43:44 +0000
198@@ -32,6 +32,7 @@
199
200 visible: !editMode || isFavoritesFeed
201
202+ signal itemDragging(bool dragging, var dragItem)
203 signal requestFavorite(string scopeId, bool favorite)
204 signal requestEditMode()
205 signal requestScopeMoveTo(string scopeId, int index)
206@@ -109,6 +110,7 @@
207 onRequestFavorite: root.requestFavorite(model.scopeId, favorite);
208 onHandlePressed: {
209 if (editMode) {
210+ root.itemDragging(true, dragItem);
211 handle.drag.target = dragItem;
212 handle.drag.maximumX = units.gu(1);
213 handle.drag.minimumX = units.gu(1);
214@@ -126,6 +128,7 @@
215 }
216 }
217 onHandleReleased: {
218+ root.itemDragging(false, dragItem);
219 if (dragItem.visible) {
220 handle.drag.target = undefined;
221 dragItem.visible = false;
222
223=== modified file 'tests/mocks/Unity/fake_scopes.cpp'
224--- tests/mocks/Unity/fake_scopes.cpp 2016-06-07 03:33:35 +0000
225+++ tests/mocks/Unity/fake_scopes.cpp 2017-01-03 17:43:44 +0000
226@@ -73,6 +73,13 @@
227 addScope(longNavigationScope);
228
229 addScope(new Scope("NullPreviewScope", "NPS", false, this, 1, true));
230+
231+ // Add enough scopes to test autoscrolling on the scopes managment page
232+ for (int i = 0; i < 20; i++) {
233+ addScope(new Scope("UselessScope" + QString::number(i),
234+ "US" + QString::number(i), true, this));
235+ }
236+
237 m_scopesOverview = new ScopesOverview(this);
238
239 if (!m_loaded) {
240
241=== modified file 'tests/qmltests/Dash/tst_Dash.qml'
242--- tests/qmltests/Dash/tst_Dash.qml 2016-11-21 14:10:08 +0000
243+++ tests/qmltests/Dash/tst_Dash.qml 2017-01-03 17:43:44 +0000
244@@ -58,7 +58,7 @@
245 tryCompare(dashContentList, "count", 0);
246 scopes.load();
247 tryCompare(dashContentList, "currentIndex", 0);
248- tryCompare(dashContentList, "count", 8);
249+ tryCompare(dashContentList, "count", 28);
250 tryCompare(scopes, "loaded", true);
251 tryCompareFunction(function() {
252 var mockScope1Loader = findChild(dash, "scopeLoader0");
253@@ -589,10 +589,10 @@
254
255 // Go to a temp scope
256 open_manage_dash();
257+ flickToYEnd(findChild(dash, "scopesListFlickable"));
258
259 var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
260 var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList");
261- flickToYEnd(findChild(dash, "scopesListFlickable"));
262 tryCompare(nonfavScopesListCategoryList, "currentIndex", 0);
263 mouseClick(nonfavScopesListCategoryList.currentItem);
264 var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
265@@ -661,13 +661,14 @@
266 // Go to a temp scope
267 open_manage_dash();
268
269- var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
270- var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList");
271 var scopesListFlickable = findChild(dash, "scopesListFlickable");
272+ flickToYEnd(scopesListFlickable);
273+
274+ var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
275+ var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList");
276 tryCompare(nonfavScopesListCategoryList, "currentIndex", 0);
277
278 // Ensure the non-favorites, located at the bottom, are visible
279- flickToYEnd(scopesListFlickable);
280 mouseClick(nonfavScopesListCategoryList.currentItem);
281 var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
282 tryCompare(dashTempScopeItem, "x", 0);
283
284=== modified file 'tests/qmltests/Dash/tst_DashContent.qml'
285--- tests/qmltests/Dash/tst_DashContent.qml 2016-11-12 16:33:58 +0000
286+++ tests/qmltests/Dash/tst_DashContent.qml 2017-01-03 17:43:44 +0000
287@@ -70,7 +70,7 @@
288 function loadScopes() {
289 scopeLoadedSpy.clear();
290 scopesModel.load();
291- tryCompare(scopeLoadedSpy, "count", 8, 15000);
292+ tryCompare(scopeLoadedSpy, "count", 28, 15000);
293 tryCompare(scopesModel, "loaded", true);
294 tryCompareFunction(function() {
295 var mockScope1Loader = findChild(shell, "scopeLoader0");
296@@ -124,7 +124,7 @@
297
298 loadScopes();
299
300- compare(dashContentList.count, 8);
301+ compare(dashContentList.count, 28);
302 verify(dashContentList.currentIndex >= 0 && dashContentList.currentIndex < dashContentList.count);
303 }
304
305@@ -181,7 +181,7 @@
306
307 // test greater than scope count.
308 var currentScopeIndex = dashContent.currentIndex;
309- dashContent.setCurrentScopeAtIndex(18, true, false);
310+ dashContent.setCurrentScopeAtIndex(29, true, false);
311 compare(dashContent.currentIndex, currentScopeIndex, "Scope should not change if changing to greater index than count");
312 }
313
314
315=== modified file 'tests/qmltests/Dash/tst_DashShell.qml'
316--- tests/qmltests/Dash/tst_DashShell.qml 2016-11-29 18:27:40 +0000
317+++ tests/qmltests/Dash/tst_DashShell.qml 2017-01-03 17:43:44 +0000
318@@ -60,7 +60,7 @@
319 tryCompare(dashContentList, "count", 0);
320 scopes.load();
321 tryCompare(dashContentList, "currentIndex", 0);
322- tryCompare(dashContentList, "count", 8);
323+ tryCompare(dashContentList, "count", 28);
324 tryCompare(scopes, "loaded", true);
325 tryCompareFunction(function() {
326 var mockScope1Loader = findChild(dash, "scopeLoader0");

Subscribers

People subscribed via source and target branches