Merge lp:~ahayzen/music-app/refactor-use-sdk-listitems into lp:music-app

Proposed by Andrew Hayzen on 2015-06-07
Status: Superseded
Proposed branch: lp:~ahayzen/music-app/refactor-use-sdk-listitems
Merge into: lp:music-app
Prerequisite: lp:~ahayzen/music-app/refactor-bump-framework-1504
Diff against target: 1433 lines (+245/-790)
21 files modified
app/components/BlurredHeader.qml (+1/-2)
app/components/Delegates/ActionDelegate.qml (+46/-0)
app/components/Delegates/ListItemWithActions.qml (+0/-507)
app/components/Delegates/MusicListItem.qml (+48/-113)
app/components/Flickables/MultiSelectListView.qml (+31/-12)
app/components/HeadState/MultiSelectHeadState.qml (+15/-15)
app/components/ListItemActions/AddToQueueAndPlaylist.qml (+34/-0)
app/components/ListItemActions/CheckBox.qml (+0/-25)
app/components/MusicRow.qml (+0/-6)
app/components/Queue.qml (+30/-30)
app/components/Walkthrough/Walkthrough.qml (+0/-1)
app/ui/AddToPlaylist.qml (+0/-1)
app/ui/ArtistView.qml (+0/-1)
app/ui/Artists.qml (+0/-1)
app/ui/NowPlaying.qml (+1/-1)
app/ui/Recent.qml (+0/-1)
app/ui/Songs.qml (+2/-7)
app/ui/SongsView.qml (+24/-26)
debian/changelog (+3/-0)
tests/autopilot/music_app/__init__.py (+9/-29)
tests/autopilot/music_app/tests/test_music.py (+1/-12)
To merge this branch: bzr merge lp:~ahayzen/music-app/refactor-use-sdk-listitems
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2015-10-18
Andrew Hayzen Needs Fixing on 2015-08-20
Review via email: mp+261328@code.launchpad.net

This proposal has been superseded by a proposal from 2015-10-18.

Commit message

* Switch to using the new listitems within the SDK

Description of the change

* Switch to using the new listitems within the SDK

Note: this includes lp:~ahayzen/music-app/fix-child-page-freezes to ease testing otherwise you'll likely be able to freeze some views

To post a comment you must log in.

PASSED: Continuous integration, rev:867
http://91.189.93.70:8080/job/music-app-ci/1319/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/music-app-vivid-amd64-ci/171

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/music-app-ci/1319/rebuild

review: Approve (continuous-integration)
868. By Andrew Hayzen on 2015-06-27

* Ensure indicies are sorted and fix issue of multiselect delete within a playlist not working

PASSED: Continuous integration, rev:868
http://91.189.93.70:8080/job/music-app-ci/1320/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/music-app-vivid-amd64-ci/172

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/music-app-ci/1320/rebuild

review: Approve (continuous-integration)
869. By Andrew Hayzen on 2015-06-27

* Fix for playlists tracks model not being updated when inside a playlist

PASSED: Continuous integration, rev:869
http://91.189.93.70:8080/job/music-app-ci/1321/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/music-app-vivid-amd64-ci/173

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/music-app-ci/1321/rebuild

review: Approve (continuous-integration)
870. By Andrew Hayzen on 2015-06-27

* Fixes for autopilot
* Fixes for freezes on child pages

871. By Andrew Hayzen on 2015-06-27

* Pull of simplify from lp:~ahayzen/music-app/fix-child-page-freezes

PASSED: Continuous integration, rev:870
http://91.189.93.70:8080/job/music-app-ci/1323/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/music-app-vivid-amd64-ci/175

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/music-app-ci/1323/rebuild

review: Approve (continuous-integration)
872. By Andrew Hayzen on 2015-06-27

* Fix for autopilot issue
* Fix for bad merge conflict

PASSED: Continuous integration, rev:871
http://91.189.93.70:8080/job/music-app-ci/1324/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/music-app-vivid-amd64-ci/176

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/music-app-ci/1324/rebuild

review: Approve (continuous-integration)

PASSED: Continuous integration, rev:872
http://91.189.93.70:8080/job/music-app-ci/1326/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/music-app-vivid-amd64-ci/178

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/music-app-ci/1326/rebuild

review: Approve (continuous-integration)
873. By Andrew Hayzen on 2015-06-27

* Pull of extra protection from lp:~ahayzen/music-app/fix-child-page-freezes

874. By Andrew Hayzen on 2015-06-28

* Merge of lp:music-app/refactor

875. By Andrew Hayzen on 2015-06-28

* Fix for minor console error

Andrew Hayzen (ahayzen) wrote :

#blocked

This is blocked primarily on bug 1469471 (causes checkbox to not update in selectMode) and secondarily [lower priority] bug 1468100 (swiping can break selectMode)

review: Needs Fixing

PASSED: Continuous integration, rev:875
http://91.189.93.70:8080/job/music-app-ci/1329/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/music-app-vivid-amd64-ci/181

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/music-app-ci/1329/rebuild

review: Approve (continuous-integration)
Andrew Hayzen (ahayzen) wrote :

A further UI issue I forgot was that if you over-drag a trailing action from right to left, you get a white background instead of our background colour.

876. By Andrew Hayzen on 2015-07-18

* Add changelog

FAILED: Continuous integration, rev:876
http://91.189.93.70:8080/job/music-app-ci/1340/
Executed test runs:
    FAILURE: http://91.189.93.70:8080/job/music-app-vivid-amd64-ci/192/console

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/music-app-ci/1340/rebuild

review: Needs Fixing (continuous-integration)
877. By Andrew Hayzen on 2015-07-18

* Merge of trunk

PASSED: Continuous integration, rev:877
http://91.189.93.70:8080/job/music-app-ci/1341/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/music-app-vivid-amd64-ci/193

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/music-app-ci/1341/rebuild

review: Approve (continuous-integration)
Andrew Hayzen (ahayzen) wrote :

#blocked

This is blocked primarily on bug 1469471 (causes checkbox to not update in selectMode) and secondarily [lower priority] bug 1468100 (swiping can break selectMode)

And now additionally bug 1486008 (swipe remove button is too small on mako) :-/

review: Needs Fixing
878. By Andrew Hayzen on 2015-10-18

* Merge of trunk

PASSED: Continuous integration, rev:878
http://91.189.93.70:8080/job/music-app-ci/1385/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/music-app-vivid-amd64-ci/237

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/music-app-ci/1385/rebuild

review: Approve (continuous-integration)
879. By Andrew Hayzen on 2015-10-18

* Removal of import Ubuntu.Components.ListItems 1.0
* Workaround for #1507339

PASSED: Continuous integration, rev:879
http://91.189.93.70:8080/job/music-app-ci/1386/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/music-app-vivid-amd64-ci/238

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/music-app-ci/1386/rebuild

review: Approve (continuous-integration)
Andrew Hayzen (ahayzen) wrote :

So hopefully for OTA7 the following should be fixed:
bug 1469471 - causes checkbox to not update in selectMode
bug 1468100 - swiping can break selectMode
bug 1486008 - swipe remove button is too small on mako

While testing again I found the following bug, but we have a workaround so it not a blocker:
bug 1507339 - Small gap between listitem and first trailing action

Can we test this on rc-proposed so that we can land this with the framework and UC1.3 bump just after OTA7 is released?

880. By Andrew Hayzen on 2015-10-18

* Rebase on lp:~vthompson/music-app/music-uc1.3

881. By Andrew Hayzen on 2015-10-18

* Switch BlurredHeader to inherit from an Item not ListItem

882. By Andrew Hayzen on 2015-10-21

* Pull of lp:~vthompson/music-app/music-uc1.3

883. By Andrew Hayzen on 2015-10-21

* Use the page width rather than header.width

884. By Andrew Hayzen on 2015-10-28

* Use a hardcoded value for header.height for now

885. By Andrew Hayzen on 2015-10-28

* Pull of uc1.3 branch

886. By Andrew Hayzen on 2015-10-29

* Various fixes for inline comments

887. By Andrew Hayzen on 2015-10-29

* FIx for Autopilot Label is now UCLabel

888. By Andrew Hayzen on 2015-10-29

* Merge of trunk

889. By Andrew Hayzen on 2015-11-02

* Add popup import to ContentHubWaitDialog.qml

890. By Andrew Hayzen on 2015-11-02

* Fix for ContentHubExport.qml page not being converted to new format

891. By Andrew Hayzen on 2015-11-02

* Further fixes for ContentHubExport.qml

892. By Andrew Hayzen on 2015-11-02

* Tidy code

893. By Andrew Hayzen on 2015-11-02

* Sync with upstream

894. By Andrew Hayzen on 2015-11-02

* Fix for test_select_and_delete_playlist test

895. By Andrew Hayzen on 2015-11-02

* Fix for test_pressing_prev_after_5_seconds

896. By Andrew Hayzen on 2015-11-02

* Merge of trunk

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/components/BlurredHeader.qml'
2--- app/components/BlurredHeader.qml 2015-05-03 16:22:31 +0000
3+++ app/components/BlurredHeader.qml 2015-10-18 17:06:27 +0000
4@@ -18,9 +18,8 @@
5
6 import QtQuick 2.4
7 import Ubuntu.Components 1.2
8-import Ubuntu.Components.ListItems 1.0 as ListItem
9
10-ListItem.Standard {
11+ListItem {
12 width: parent.width
13
14 property alias bottomColumn: bottomColumnLoader.sourceComponent
15
16=== added file 'app/components/Delegates/ActionDelegate.qml'
17--- app/components/Delegates/ActionDelegate.qml 1970-01-01 00:00:00 +0000
18+++ app/components/Delegates/ActionDelegate.qml 2015-10-18 17:06:27 +0000
19@@ -0,0 +1,46 @@
20+/*
21+ * Copyright (C) 2015
22+ * Andrew Hayzen <ahayzen@gmail.com>
23+ * Victor Thompson <victor.thompson@gmail.com>
24+ *
25+ * This program is free software; you can redistribute it and/or modify
26+ * it under the terms of the GNU General Public License as published by
27+ * the Free Software Foundation; version 3.
28+ *
29+ * This program is distributed in the hope that it will be useful,
30+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
31+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32+ * GNU General Public License for more details.
33+ *
34+ * You should have received a copy of the GNU General Public License
35+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
36+ */
37+
38+import QtQuick 2.4
39+import Ubuntu.Components 1.2
40+
41+Rectangle {
42+ color: currentColor
43+ width: height
44+
45+ Icon {
46+ anchors {
47+ centerIn: parent
48+ }
49+ objectName: action.objectName
50+ color: pressed ? UbuntuColors.blue : styleMusic.common.white
51+ name: action.iconName
52+ height: units.gu(3)
53+ width: units.gu(3)
54+ }
55+
56+ Rectangle { // FIXME: pad.lv/1507339 Workaround for gap between end of listitem and first action
57+ anchors {
58+ bottom: parent.bottom
59+ right: parent.left
60+ top: parent.top
61+ }
62+ color: currentColor
63+ width: units.gu(0.5)
64+ }
65+}
66
67=== removed file 'app/components/Delegates/ListItemWithActions.qml'
68--- app/components/Delegates/ListItemWithActions.qml 2015-05-03 16:22:31 +0000
69+++ app/components/Delegates/ListItemWithActions.qml 1970-01-01 00:00:00 +0000
70@@ -1,507 +0,0 @@
71-/*
72- * Copyright (C) 2012-2015 Canonical, Ltd.
73- *
74- * This program is free software; you can redistribute it and/or modify
75- * it under the terms of the GNU General Public License as published by
76- * the Free Software Foundation; version 3.
77- *
78- * This program is distributed in the hope that it will be useful,
79- * but WITHOUT ANY WARRANTY; without even the implied warranty of
80- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
81- * GNU General Public License for more details.
82- *
83- * You should have received a copy of the GNU General Public License
84- * along with this program. If not, see <http://www.gnu.org/licenses/>.
85- */
86-
87-import QtQuick 2.4
88-import Ubuntu.Components 1.2
89-import Ubuntu.Components.ListItems 1.0 as ListItem
90-
91-
92-Item {
93- id: root
94- width: parent.width
95-
96- property Action leftSideAction: null
97- property list<Action> rightSideActions
98- property double defaultHeight: units.gu(8)
99- property bool locked: false
100- property Action activeAction: null
101- property var activeItem: null
102- property bool triggerActionOnMouseRelease: false
103- property color color: styleMusic.mainView.backgroundColor
104- property color selectedColor: "#3d3d45" // "#E6E6E6" // CUSTOM
105- property bool selected: false
106- property bool selectionMode: false
107- property alias internalAnchors: mainContents.anchors
108- default property alias contents: mainContents.children
109-
110- readonly property double actionWidth: units.gu(4) // CUSTOM 5?
111- readonly property double leftActionWidth: units.gu(10)
112- readonly property double actionThreshold: actionWidth * 0.4
113- readonly property double threshold: 0.4
114- readonly property string swipeState: main.x == 0 ? "Normal" : main.x > 0 ? "LeftToRight" : "RightToLeft"
115- readonly property alias swipping: mainItemMoving.running
116- readonly property bool _showActions: mouseArea.pressed || swipeState != "Normal" || swipping
117-
118- property alias _main: main // CUSTOM
119- property alias pressed: mouseArea.pressed // CUSTOM
120-
121- /* internal */
122- property var _visibleRightSideActions: filterVisibleActions(rightSideActions)
123-
124- signal itemClicked(var mouse)
125- signal itemPressAndHold(var mouse)
126-
127- function returnToBoundsRTL(direction)
128- {
129- var actionFullWidth = actionWidth + units.gu(2)
130-
131- // go back to normal state if swipping reverse
132- if (direction === "LTR") {
133- updatePosition(0)
134- return
135- } else if (!triggerActionOnMouseRelease) {
136- updatePosition(-rightActionsView.width + units.gu(2))
137- return
138- }
139-
140- var xOffset = Math.abs(main.x)
141- var index = Math.min(Math.floor(xOffset / actionFullWidth), _visibleRightSideActions.length)
142- var newX = 0
143-
144- if (index === _visibleRightSideActions.length) {
145- newX = -(rightActionsView.width - units.gu(2))
146- } else if (index >= 1) {
147- newX = -(actionFullWidth * index)
148- }
149-
150- updatePosition(newX)
151- }
152-
153- function returnToBoundsLTR(direction)
154- {
155- var finalX = leftActionWidth
156- if ((direction === "RTL") || (main.x <= (finalX * root.threshold)))
157- finalX = 0
158- updatePosition(finalX)
159- }
160-
161- function returnToBounds(direction)
162- {
163- if (main.x < 0) {
164- returnToBoundsRTL(direction)
165- } else if (main.x > 0) {
166- returnToBoundsLTR(direction)
167- } else {
168- updatePosition(0)
169- }
170- }
171-
172- function contains(item, point, marginX)
173- {
174- var itemStartX = item.x - marginX
175- var itemEndX = item.x + item.width + marginX
176- return (point.x >= itemStartX) && (point.x <= itemEndX) &&
177- (point.y >= item.y) && (point.y <= (item.y + item.height));
178- }
179-
180- function getActionAt(point)
181- {
182- if (leftSideAction && contains(leftActionViewLoader.item, point, 0)) {
183- return leftSideAction
184- } else if (contains(rightActionsView, point, 0)) {
185- var newPoint = root.mapToItem(rightActionsView, point.x, point.y)
186- for (var i = 0; i < rightActionsRepeater.count; i++) {
187- var child = rightActionsRepeater.itemAt(i)
188- if (contains(child, newPoint, units.gu(1))) {
189- return i
190- }
191- }
192- }
193- return -1
194- }
195-
196- function updateActiveAction()
197- {
198- if (triggerActionOnMouseRelease &&
199- (main.x <= -(root.actionWidth + units.gu(2))) &&
200- (main.x > -(rightActionsView.width - units.gu(2)))) {
201- var actionFullWidth = actionWidth + units.gu(2)
202- var xOffset = Math.abs(main.x)
203- var index = Math.min(Math.floor(xOffset / actionFullWidth), _visibleRightSideActions.length)
204- index = index - 1
205- if (index > -1) {
206- root.activeItem = rightActionsRepeater.itemAt(index)
207- root.activeAction = root._visibleRightSideActions[index]
208- }
209- } else {
210- root.activeAction = null
211- }
212- }
213-
214- function resetSwipe()
215- {
216- updatePosition(0)
217- }
218-
219- function filterVisibleActions(actions)
220- {
221- var visibleActions = []
222- for(var i = 0; i < actions.length; i++) {
223- var action = actions[i]
224- if (action.visible) {
225- visibleActions.push(action)
226- }
227- }
228- return visibleActions
229- }
230-
231- function updatePosition(pos)
232- {
233- if (!root.triggerActionOnMouseRelease && (pos !== 0)) {
234- mouseArea.state = pos > 0 ? "RightToLeft" : "LeftToRight"
235- } else {
236- mouseArea.state = ""
237- }
238- main.x = pos
239- }
240-
241- // CUSTOM remove animation
242- SequentialAnimation {
243- id: removeAnimation
244-
245- property var action
246-
247- UbuntuNumberAnimation {
248- target: root
249- duration: UbuntuAnimation.BriskDuration
250- property: "height";
251- to: 0
252- }
253- ScriptAction {
254- script: removeAnimation.action.trigger()
255- }
256- }
257-
258- states: [
259- State {
260- name: "select"
261- when: selectionMode || selected
262- PropertyChanges {
263- target: selectionIcon
264- source: Qt.resolvedUrl("../ListItemActions/CheckBox.qml")
265- anchors.leftMargin: units.gu(2)
266- }
267- PropertyChanges {
268- target: root
269- locked: true
270- }
271- PropertyChanges {
272- target: main
273- x: 0
274- }
275- }
276- ]
277-
278- height: defaultHeight
279- //clip: height !== defaultHeight // CUSTOM
280-
281- Loader { // CUSTOM
282- id: leftActionViewLoader
283- anchors {
284- top: parent.top
285- bottom: parent.bottom
286- right: main.left
287- }
288- asynchronous: true
289- sourceComponent: leftSideAction ? leftActionViewComponent : undefined
290- }
291-
292- Component { // CUSTOM
293- id: leftActionViewComponent
294-
295- Rectangle {
296- id: leftActionView
297- width: root.leftActionWidth + actionThreshold
298- color: UbuntuColors.red
299-
300- Icon {
301- id: leftActionIcon
302- anchors {
303- centerIn: parent
304- horizontalCenterOffset: actionThreshold / 2
305- }
306- objectName: "swipeDeleteAction" // CUSTOM
307- name: leftSideAction && _showActions ? leftSideAction.iconName : ""
308- color: Theme.palette.selected.field
309- height: units.gu(3)
310- width: units.gu(3)
311- }
312- }
313- }
314-
315- //Rectangle {
316- Item { // CUSTOM
317- id: rightActionsView
318-
319- anchors {
320- top: main.top
321- left: main.right
322- bottom: main.bottom
323- }
324- visible: _visibleRightSideActions.length > 0
325- width: rightActionsRepeater.count > 0 ? rightActionsRepeater.count * (root.actionWidth + units.gu(2)) + root.actionThreshold + units.gu(2) : 0
326- // color: "white" // CUSTOM
327-
328- Rectangle { // CUSTOM
329- anchors {
330- bottom: parent.bottom
331- left: parent.left
332- top: parent.top
333- }
334- color: styleMusic.common.black
335- opacity: 0.7
336- width: parent.width + actionThreshold
337- }
338-
339- Row {
340- anchors{
341- top: parent.top
342- left: parent.left
343- leftMargin: units.gu(2)
344- right: parent.right
345- rightMargin: units.gu(2)
346- bottom: parent.bottom
347- }
348- spacing: units.gu(2)
349- Repeater {
350- id: rightActionsRepeater
351-
352- model: _showActions ? _visibleRightSideActions : []
353- Item {
354- property alias image: img
355-
356- height: rightActionsView.height
357- width: root.actionWidth
358-
359- Icon {
360- id: img
361-
362- anchors.centerIn: parent
363- objectName: rightSideActions[index].objectName // CUSTOM
364- width: units.gu(3)
365- height: units.gu(3)
366- name: modelData.iconName
367- color: root.activeAction === modelData ? UbuntuColors.blue : styleMusic.common.white // CUSTOM
368- }
369- }
370- }
371- }
372- }
373-
374- Rectangle {
375- id: main
376- objectName: "mainItem"
377-
378- anchors {
379- top: parent.top
380- bottom: parent.bottom
381- }
382-
383- width: parent.width
384- color: root.selected ? root.selectedColor : root.color
385-
386- Loader {
387- id: selectionIcon
388-
389- anchors {
390- left: main.left
391- verticalCenter: main.verticalCenter
392- }
393- asynchronous: true // CUSTOM
394- width: (status === Loader.Ready) ? item.implicitWidth : 0
395- visible: (status === Loader.Ready) && (item.width === item.implicitWidth)
396-
397- Behavior on width {
398- NumberAnimation {
399- duration: UbuntuAnimation.SnapDuration
400- }
401- }
402- }
403-
404- Item {
405- id: mainContents
406-
407- anchors {
408- left: selectionIcon.right
409- //leftMargin: units.gu(2) // CUSTOM
410- top: parent.top
411- //topMargin: units.gu(1) // CUSTOM
412- right: parent.right
413- //rightMargin: units.gu(2) // CUSTOM
414- bottom: parent.bottom
415- //bottomMargin: units.gu(1) // CUSTOM
416- }
417- }
418-
419- Behavior on x {
420- UbuntuNumberAnimation {
421- id: mainItemMoving
422-
423- easing.type: Easing.OutElastic
424- duration: UbuntuAnimation.SlowDuration
425- }
426- }
427- }
428-
429- SequentialAnimation {
430- id: triggerAction
431-
432- property var currentItem: root.activeItem ? root.activeItem.image : null
433-
434- running: false
435- ParallelAnimation {
436- UbuntuNumberAnimation {
437- target: triggerAction.currentItem
438- property: "opacity"
439- from: 1.0
440- to: 0.0
441- duration: UbuntuAnimation.SlowDuration
442- easing {type: Easing.InOutBack; }
443- }
444- UbuntuNumberAnimation {
445- target: triggerAction.currentItem
446- properties: "width, height"
447- from: units.gu(3)
448- to: root.actionWidth
449- duration: UbuntuAnimation.SlowDuration
450- easing {type: Easing.InOutBack; }
451- }
452- }
453- PropertyAction {
454- target: triggerAction.currentItem
455- properties: "width, height"
456- value: units.gu(3)
457- }
458- PropertyAction {
459- target: triggerAction.currentItem
460- properties: "opacity"
461- value: 1.0
462- }
463- ScriptAction {
464- script: {
465- root.activeAction.triggered(root)
466- mouseArea.state = ""
467- }
468- }
469- PauseAnimation {
470- duration: 500
471- }
472- UbuntuNumberAnimation {
473- target: main
474- property: "x"
475- to: 0
476- }
477- }
478-
479- MouseArea {
480- id: mouseArea
481-
482- property bool locked: root.locked || ((root.leftSideAction === null) && (root._visibleRightSideActions.count === 0)) // CUSTOM
483- property bool manual: false
484- property string direction: "None"
485- property real lastX: -1
486-
487- anchors.fill: parent
488- drag {
489- target: locked ? null : main
490- axis: Drag.XAxis
491- minimumX: rightActionsView.visible ? -(rightActionsView.width) : 0
492- maximumX: leftSideAction ? leftActionViewLoader.item.width : 0
493- threshold: root.actionThreshold
494- }
495-
496- states: [
497- State {
498- name: "LeftToRight"
499- PropertyChanges {
500- target: mouseArea
501- drag.maximumX: 0
502- }
503- },
504- State {
505- name: "RightToLeft"
506- PropertyChanges {
507- target: mouseArea
508- drag.minimumX: 0
509- }
510- }
511- ]
512-
513- onMouseXChanged: {
514- var offset = (lastX - mouseX)
515- if (Math.abs(offset) <= root.actionThreshold) {
516- return
517- }
518- lastX = mouseX
519- direction = offset > 0 ? "RTL" : "LTR";
520- }
521-
522- onPressed: {
523- lastX = mouse.x
524- }
525-
526- onReleased: {
527- if (root.triggerActionOnMouseRelease && root.activeAction) {
528- triggerAction.start()
529- } else {
530- root.returnToBounds()
531- root.activeAction = null
532- }
533- lastX = -1
534- direction = "None"
535- }
536- onClicked: {
537- if (selectionMode) { // CUSTOM - selecting a listitem should toggle selection if in selectionMode
538- selected = !selected
539- return
540- } else if (main.x === 0) {
541- root.itemClicked(mouse)
542- } else if (main.x > 0) {
543- var action = getActionAt(Qt.point(mouse.x, mouse.y))
544- if (action && action !== -1) {
545- //action.triggered(root)
546- removeAnimation.action = action // CUSTOM - use our animation instead
547- removeAnimation.start() // CUSTOM
548- }
549- } else {
550- var actionIndex = getActionAt(Qt.point(mouse.x, mouse.y))
551-
552- if (actionIndex !== -1 && actionIndex !== leftSideAction) { // CUSTOM - can be leftAction
553- root.activeItem = rightActionsRepeater.itemAt(actionIndex)
554- root.activeAction = root.rightSideActions[actionIndex]
555- triggerAction.start()
556- return
557- }
558- }
559- root.resetSwipe()
560- }
561-
562- onPositionChanged: {
563- if (mouseArea.pressed) {
564- updateActiveAction()
565-
566- listItemSwiping(index) // CUSTOM - tells other listitems to dismiss any swipe
567- }
568- }
569- onPressAndHold: {
570- if (main.x === 0) {
571- root.itemPressAndHold(mouse)
572- }
573- }
574-
575- z: -1
576- }
577-}
578
579=== modified file 'app/components/Delegates/MusicListItem.qml'
580--- app/components/Delegates/MusicListItem.qml 2015-05-03 16:22:31 +0000
581+++ app/components/Delegates/MusicListItem.qml 2015-10-18 17:06:27 +0000
582@@ -21,131 +21,66 @@
583 import Ubuntu.Components 1.2
584 import "../"
585
586+ListItem {
587+ color: styleMusic.mainView.backgroundColor
588+ highlightColor: Qt.lighter(color, 1.2)
589
590-ListItemWithActions {
591- id: root
592+ // Store the currentColor so that actions can bind to it
593+ property var currentColor: highlighted ? highlightColor : color
594
595 property alias column: musicRow.column
596 property alias imageSource: musicRow.imageSource
597
598- property int listItemIndex: index
599 property bool multiselectable: false
600- property int previousListItemIndex: -1
601 property bool reorderable: false
602
603- signal reorder(int from, int to)
604-
605- onItemPressAndHold: {
606+ signal itemClicked()
607+
608+ onClicked: {
609+ if (selectMode) {
610+ selected = !selected;
611+ } else {
612+ itemClicked()
613+ }
614+ }
615+
616+ onPressAndHold: {
617+ // FIXME: pad.lv/1468100 drag a listitem with no leadingActions to right, then press and hold causes no signal
618+
619+ if (reorderable) {
620+ ListView.view.ViewItems.dragMode = !ListView.view.ViewItems.dragMode
621+ }
622+
623 if (multiselectable) {
624- selectionMode = true
625- }
626- }
627-
628- onListItemIndexChanged: {
629- var i = parent.parent.selectedItems.lastIndexOf(previousListItemIndex)
630-
631- if (i !== -1) {
632- parent.parent.selectedItems[i] = listItemIndex
633- }
634-
635- previousListItemIndex = listItemIndex
636- }
637-
638- onSelectedChanged: {
639- if (selectionMode) {
640- var tmp = parent.parent.selectedItems
641-
642- if (selected) {
643- if (parent.parent.selectedItems.indexOf(listItemIndex) === -1) {
644- tmp.push(listItemIndex)
645- parent.parent.selectedItems = tmp
646- }
647- } else {
648- tmp.splice(parent.parent.selectedItems.indexOf(listItemIndex), 1)
649- parent.parent.selectedItems = tmp
650- }
651- }
652- }
653-
654- onSelectionModeChanged: {
655- if (reorderable && selectionMode) {
656- resetSwipe()
657- }
658-
659- for (var j=0; j < _main.children.length; j++) {
660- if (_main.children[j] !== actionReorderLoader) {
661- _main.children[j].anchors.rightMargin = reorderable && selectionMode ? actionReorderLoader.width + units.gu(2) : 0
662- }
663- }
664-
665- parent.parent.state = selectionMode ? "multiselectable" : "normal"
666-
667- if (!selectionMode) {
668- selected = false
669- }
670- }
671-
672- /* Highlight the listitem on press */
673- Rectangle {
674- id: listItemBrighten
675- color: root.pressed ? styleMusic.common.white : "transparent"
676- opacity: 0.1
677- height: root.height
678- x: root.x - parent.x // -parent.x due to selectionIcon in ListItemWithActions
679- width: root.width
680- }
681-
682- /* Reorder Component */
683- Loader {
684- id: actionReorderLoader
685- active: reorderable && selectionMode && root.parent.parent.selectedItems.length === 0
686- anchors {
687- bottom: parent.bottom
688- right: parent.right
689- rightMargin: units.gu(1)
690- top: parent.top
691- }
692- asynchronous: true
693- source: "../ListItemReorderComponent.qml"
694- }
695-
696- Item {
697- Connections { // Only allow one ListItem to be swiping at any time
698- target: mainView
699- onListItemSwiping: {
700- if (i !== index) {
701- root.resetSwipe();
702- }
703- }
704- }
705-
706- Connections { // Connections from signals in the ListView
707- target: root.parent.parent
708- onClearSelection: selected = false
709- onFlickingChanged: {
710- if (root.parent.parent.flicking) {
711- root.resetSwipe()
712- }
713- }
714- onSelectAll: selected = true
715- onStateChanged: selectionMode = root.parent.parent.state === "multiselectable"
716- }
717- }
718-
719+ ListView.view.ViewItems.selectMode = !ListView.view.ViewItems.selectMode
720+ }
721+ }
722+
723+ divider {
724+ visible: false
725+ }
726
727 MusicRow {
728 id: musicRow
729 anchors {
730- verticalCenter: parent.verticalCenter
731- }
732- height: parent.height
733- }
734-
735- Component.onCompleted: { // reload settings as delegates are destroyed
736- if (parent.parent.selectedItems.indexOf(index) !== -1) {
737- selected = true
738- }
739-
740- selectionMode = root.parent.parent.state === "multiselectable"
741+ fill: parent
742+ // When not in selectMode we want a margin between the Image and the left edge
743+ // when in selectMode the checkbox has its own margin so we don't want a double margin
744+ leftMargin: selectMode ? 0 : units.gu(2)
745+ rightMargin: selectMode ? 0 : units.gu(2)
746+ }
747+
748+ // Animate margin changes so it isn't noticible
749+ Behavior on anchors.leftMargin {
750+ NumberAnimation {
751+
752+ }
753+ }
754+
755+ Behavior on anchors.rightMargin {
756+ NumberAnimation {
757+
758+ }
759+ }
760 }
761 }
762
763=== modified file 'app/components/Flickables/MultiSelectListView.qml'
764--- app/components/Flickables/MultiSelectListView.qml 2015-05-03 16:22:31 +0000
765+++ app/components/Flickables/MultiSelectListView.qml 2015-10-18 17:06:27 +0000
766@@ -21,31 +21,50 @@
767 import Ubuntu.Components 1.2
768
769 MusicListView {
770- property var selectedItems: []
771+ // Can't access ViewItems externally
772+ // so we need to expose if in multiselect mode for the header states
773+ state: ViewItems.selectMode ? "multiselectable" : "normal"
774
775 signal clearSelection()
776 signal closeSelection()
777+ signal reorder(int from, int to)
778 signal selectAll()
779
780- onClearSelection: selectedItems = []
781+ onClearSelection: ViewItems.selectedIndices = []
782 onCloseSelection: {
783 clearSelection()
784- state = "normal"
785+ ViewItems.selectMode = false
786+ ViewItems.dragMode = false
787 }
788 onSelectAll: {
789- var tmp = selectedItems
790+ var tmp = []
791
792 for (var i=0; i < model.count; i++) {
793- if (tmp.indexOf(i) === -1) {
794- tmp.push(i)
795- }
796+ tmp.push(i)
797 }
798
799- selectedItems = tmp
800- }
801- onVisibleChanged: {
802- if (!visible) {
803- closeSelection()
804+ ViewItems.selectedIndices = tmp
805+ }
806+
807+ // Can't access ViewItems externally
808+ // so for the header actions we need to expose the selectedIndices
809+ function getSelectedIndices() {
810+ var indicies = ViewItems.selectedIndices.slice();
811+
812+ indicies.sort(); // ensure indicies are in-order
813+
814+ return indicies;
815+ }
816+
817+ ViewItems.selectMode: false
818+ ViewItems.dragMode: false
819+ ViewItems.onDragUpdated: {
820+ // Only update the model when the listitem is dropped, not 'live'
821+ if (event.status == ListItemDrag.Moving) {
822+ event.accept = false
823+ } else if (event.status == ListItemDrag.Dropped) {
824+ model.move(event.from, event.to, 1);
825+ reorder(event.from, event.to)
826 }
827 }
828 }
829
830=== modified file 'app/components/HeadState/MultiSelectHeadState.qml'
831--- app/components/HeadState/MultiSelectHeadState.qml 2015-06-27 21:06:26 +0000
832+++ app/components/HeadState/MultiSelectHeadState.qml 2015-10-18 17:06:27 +0000
833@@ -18,6 +18,7 @@
834
835 import QtQuick 2.4
836 import Ubuntu.Components 1.2
837+import "../Flickables"
838
839 PageHeadState {
840 id: selectionState
841@@ -26,7 +27,7 @@
842 iconName: "select"
843 text: i18n.tr("Select All")
844 onTriggered: {
845- if (listview.selectedItems.length === listview.model.count) {
846+ if (listview.getSelectedIndices().length === listview.model.count) {
847 listview.clearSelection()
848 } else {
849 listview.selectAll()
850@@ -34,14 +35,15 @@
851 }
852 },
853 Action {
854- enabled: listview !== null ? listview.selectedItems.length > 0 : false
855+ enabled: listview !== null ? listview.getSelectedIndices().length > 0 : false
856 iconName: "add-to-playlist"
857 text: i18n.tr("Add to playlist")
858 onTriggered: {
859 var items = []
860+ var indicies = listview.getSelectedIndices();
861
862- for (var i=0; i < listview.selectedItems.length; i++) {
863- items.push(makeDict(listview.model.get(listview.selectedItems[i], listview.model.RoleModelData)));
864+ for (var i=0; i < indicies.length; i++) {
865+ items.push(makeDict(listview.model.get(indicies[i], listview.model.RoleModelData)));
866 }
867
868 mainPageStack.push(Qt.resolvedUrl("../../ui/AddToPlaylist.qml"),
869@@ -51,16 +53,17 @@
870 }
871 },
872 Action {
873- enabled: listview !== null ? listview.selectedItems.length > 0 : false
874+ enabled: listview !== null ? listview.getSelectedIndices().length > 0 : false
875 iconName: "add"
876 text: i18n.tr("Add to queue")
877 visible: addToQueue
878
879 onTriggered: {
880 var items = []
881+ var indicies = listview.getSelectedIndices();
882
883- for (var i=0; i < listview.selectedItems.length; i++) {
884- items.push(listview.model.get(listview.selectedItems[i], listview.model.RoleModelData));
885+ for (var i=0; i < indicies.length; i++) {
886+ items.push(listview.model.get(indicies[i], listview.model.RoleModelData));
887 }
888
889 trackQueue.appendList(items)
890@@ -69,13 +72,13 @@
891 }
892 },
893 Action {
894- enabled: listview !== null ? listview.selectedItems.length > 0 : false
895+ enabled: listview !== null ? listview.getSelectedIndices().length > 0 : false
896 iconName: "delete"
897 text: i18n.tr("Delete")
898 visible: removable
899
900 onTriggered: {
901- removed(listview.selectedItems)
902+ removed(listview.getSelectedIndices())
903
904 listview.closeSelection()
905 }
906@@ -85,10 +88,7 @@
907 backAction: Action {
908 text: i18n.tr("Cancel selection")
909 iconName: "back"
910- onTriggered: {
911- listview.clearSelection()
912- listview.state = "normal"
913- }
914+ onTriggered: listview.closeSelection()
915 }
916 head: thisPage.head
917 name: "selection"
918@@ -100,9 +100,9 @@
919 }
920
921 property bool addToQueue: true
922- property ListView listview
923+ property MultiSelectListView listview
924 property bool removable: false
925 property Page thisPage
926
927- signal removed(var selectedItems)
928+ signal removed(var selectedIndices)
929 }
930
931=== added file 'app/components/ListItemActions/AddToQueueAndPlaylist.qml'
932--- app/components/ListItemActions/AddToQueueAndPlaylist.qml 1970-01-01 00:00:00 +0000
933+++ app/components/ListItemActions/AddToQueueAndPlaylist.qml 2015-10-18 17:06:27 +0000
934@@ -0,0 +1,34 @@
935+/*
936+ * Copyright (C) 2015
937+ * Andrew Hayzen <ahayzen@gmail.com>
938+ * Victor Thompson <victor.thompson@gmail.com>
939+ *
940+ * This program is free software; you can redistribute it and/or modify
941+ * it under the terms of the GNU General Public License as published by
942+ * the Free Software Foundation; version 3.
943+ *
944+ * This program is distributed in the hope that it will be useful,
945+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
946+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
947+ * GNU General Public License for more details.
948+ *
949+ * You should have received a copy of the GNU General Public License
950+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
951+ */
952+
953+import QtQuick 2.4
954+import Ubuntu.Components 1.2
955+import "../Delegates"
956+
957+ListItemActions {
958+ actions: [
959+ AddToQueue {
960+
961+ },
962+ AddToPlaylist {
963+ }
964+ ]
965+ delegate: ActionDelegate {
966+
967+ }
968+}
969
970=== removed file 'app/components/ListItemActions/CheckBox.qml'
971--- app/components/ListItemActions/CheckBox.qml 2015-06-27 20:18:02 +0000
972+++ app/components/ListItemActions/CheckBox.qml 1970-01-01 00:00:00 +0000
973@@ -1,25 +0,0 @@
974-/*
975- * Copyright (C) 2012-2015 Canonical, Ltd.
976- *
977- * This program is free software; you can redistribute it and/or modify
978- * it under the terms of the GNU General Public License as published by
979- * the Free Software Foundation; version 3.
980- *
981- * This program is distributed in the hope that it will be useful,
982- * but WITHOUT ANY WARRANTY; without even the implied warranty of
983- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
984- * GNU General Public License for more details.
985- *
986- * You should have received a copy of the GNU General Public License
987- * along with this program. If not, see <http://www.gnu.org/licenses/>.
988- */
989-
990-import QtQuick 2.4
991-import Ubuntu.Components 1.2
992-
993-CheckBox {
994- checked: root.selected
995- width: implicitWidth
996- // disable item mouse area to avoid conflicts with parent mouse area
997- __mouseArea.enabled: false
998-}
999
1000=== modified file 'app/components/MusicRow.qml'
1001--- app/components/MusicRow.qml 2015-05-03 16:22:31 +0000
1002+++ app/components/MusicRow.qml 2015-10-18 17:06:27 +0000
1003@@ -22,12 +22,6 @@
1004
1005
1006 Row {
1007- anchors {
1008- left: parent.left
1009- leftMargin: units.gu(2)
1010- right: parent.right
1011- rightMargin: units.gu(2)
1012- }
1013 height: units.gu(7)
1014
1015 property alias column: columnComponent.sourceComponent
1016
1017=== modified file 'app/components/Queue.qml'
1018--- app/components/Queue.qml 2015-06-27 21:06:26 +0000
1019+++ app/components/Queue.qml 2015-10-18 17:06:27 +0000
1020@@ -37,9 +37,6 @@
1021 model: trackQueue.model
1022 objectName: "nowPlayingqueueList"
1023
1024- property int normalHeight: units.gu(6)
1025- property int transitionDuration: 250 // transition length of animations
1026-
1027 onCountChanged: customdebug("Queue: Now has: " + queueList.count + " tracks")
1028
1029 delegate: MusicListItem {
1030@@ -62,41 +59,44 @@
1031 text: model.author
1032 }
1033 }
1034- height: queueList.normalHeight
1035+ leadingActions: ListItemActions {
1036+ actions: [
1037+ Remove {
1038+ onTriggered: trackQueue.removeQueueList([index])
1039+ }
1040+ ]
1041+ }
1042+ multiselectable: true
1043 objectName: "nowPlayingListItem" + index
1044- state: ""
1045- leftSideAction: Remove {
1046- onTriggered: trackQueue.removeQueueList([index])
1047- }
1048- multiselectable: true
1049 reorderable: true
1050- rightSideActions: [
1051- AddToPlaylist{
1052+ trailingActions: ListItemActions {
1053+ actions: [
1054+ AddToPlaylist {
1055+ }
1056+ ]
1057+ delegate: ActionDelegate {
1058+
1059 }
1060- ]
1061+ }
1062
1063 onItemClicked: {
1064 customdebug("File: " + model.filename) // debugger
1065 trackQueueClick(index); // toggle track state
1066 }
1067- onReorder: {
1068- console.debug("Move: ", from, to);
1069-
1070- trackQueue.model.move(from, to, 1);
1071- Library.moveQueueItem(from, to);
1072-
1073- // Maintain currentIndex with current song
1074- if (from === player.currentIndex) {
1075- player.currentIndex = to;
1076- }
1077- else if (from < player.currentIndex && to >= player.currentIndex) {
1078- player.currentIndex -= 1;
1079- }
1080- else if (from > player.currentIndex && to <= player.currentIndex) {
1081- player.currentIndex += 1;
1082- }
1083-
1084- queueIndex = player.currentIndex
1085+ }
1086+
1087+ onReorder: {
1088+ Library.moveQueueItem(from, to);
1089+
1090+ // Maintain currentIndex with current song
1091+ if (from === player.currentIndex) {
1092+ player.currentIndex = to;
1093+ } else if (from < player.currentIndex && to >= player.currentIndex) {
1094+ player.currentIndex -= 1;
1095+ } else if (from > player.currentIndex && to <= player.currentIndex) {
1096+ player.currentIndex += 1;
1097 }
1098+
1099+ queueIndex = player.currentIndex
1100 }
1101 }
1102
1103=== modified file 'app/components/Walkthrough/Walkthrough.qml'
1104--- app/components/Walkthrough/Walkthrough.qml 2015-08-27 23:19:48 +0000
1105+++ app/components/Walkthrough/Walkthrough.qml 2015-10-18 17:06:27 +0000
1106@@ -22,7 +22,6 @@
1107
1108 import QtQuick 2.4
1109 import Ubuntu.Components 1.2
1110-import Ubuntu.Components.ListItems 1.0 as ListItem
1111
1112 Page {
1113 id: walkthrough
1114
1115=== modified file 'app/ui/AddToPlaylist.qml'
1116--- app/ui/AddToPlaylist.qml 2015-08-19 14:03:16 +0000
1117+++ app/ui/AddToPlaylist.qml 2015-10-18 17:06:27 +0000
1118@@ -20,7 +20,6 @@
1119 import QtMultimedia 5.0
1120 import QtQuick 2.4
1121 import Ubuntu.Components 1.2
1122-import Ubuntu.Components.ListItems 1.0 as ListItem
1123 import Ubuntu.Components.Popups 1.0
1124 import QtQuick.LocalStorage 2.0
1125 import "../logic/meta-database.js" as Library
1126
1127=== modified file 'app/ui/ArtistView.qml'
1128--- app/ui/ArtistView.qml 2015-05-03 16:22:31 +0000
1129+++ app/ui/ArtistView.qml 2015-10-18 17:06:27 +0000
1130@@ -20,7 +20,6 @@
1131 import QtQuick 2.4
1132 import Ubuntu.Components 1.2
1133 import Ubuntu.Components.Popups 1.0
1134-import Ubuntu.Components.ListItems 1.0 as ListItem
1135 import Ubuntu.MediaScanner 0.1
1136 import Ubuntu.Thumbnailer 0.1
1137 import QtQuick.LocalStorage 2.0
1138
1139=== modified file 'app/ui/Artists.qml'
1140--- app/ui/Artists.qml 2015-05-03 16:22:31 +0000
1141+++ app/ui/Artists.qml 2015-10-18 17:06:27 +0000
1142@@ -20,7 +20,6 @@
1143 import QtQuick 2.4
1144 import Ubuntu.Components 1.2
1145 import Ubuntu.Components.Popups 1.0
1146-import Ubuntu.Components.ListItems 1.0 as ListItem
1147 import Ubuntu.MediaScanner 0.1
1148 import Ubuntu.Thumbnailer 0.1
1149 import QtQuick.LocalStorage 2.0
1150
1151=== modified file 'app/ui/NowPlaying.qml'
1152--- app/ui/NowPlaying.qml 2015-08-19 14:03:16 +0000
1153+++ app/ui/NowPlaying.qml 2015-10-18 17:06:27 +0000
1154@@ -128,7 +128,7 @@
1155 // Remove the tracks from the queue
1156 // Use slice() to copy the list
1157 // so that the indexes don't change as they are removed
1158- trackQueue.removeQueueList(selectedItems.slice())
1159+ trackQueue.removeQueueList(selectedIndices.slice())
1160 }
1161 }
1162 ]
1163
1164=== modified file 'app/ui/Recent.qml'
1165--- app/ui/Recent.qml 2015-06-27 21:06:26 +0000
1166+++ app/ui/Recent.qml 2015-10-18 17:06:27 +0000
1167@@ -20,7 +20,6 @@
1168 import QtQuick 2.4
1169 import Ubuntu.Components 1.2
1170 import Ubuntu.Components.Popups 1.0
1171-import Ubuntu.Components.ListItems 1.0 as ListItem
1172 import Ubuntu.MediaScanner 0.1
1173 import Ubuntu.Thumbnailer 0.1
1174 import QtMultimedia 5.0
1175
1176=== modified file 'app/ui/Songs.qml'
1177--- app/ui/Songs.qml 2015-06-27 21:06:26 +0000
1178+++ app/ui/Songs.qml 2015-10-18 17:06:27 +0000
1179@@ -65,7 +65,6 @@
1180 fill: parent
1181 topMargin: units.gu(2)
1182 }
1183- highlightFollowsCurrentItem: false
1184 objectName: "trackstab-listview"
1185 model: SortFilterModel {
1186 id: songsModelFilter
1187@@ -113,12 +112,8 @@
1188 height: units.gu(7)
1189 imageSource: {"art": model.art}
1190 multiselectable: true
1191- rightSideActions: [
1192- AddToQueue {
1193- },
1194- AddToPlaylist {
1195- }
1196- ]
1197+ trailingActions: AddToQueueAndPlaylist {
1198+ }
1199
1200 onItemClicked: {
1201 if (songsPage.state === "search") { // only play single track when searching
1202
1203=== modified file 'app/ui/SongsView.qml'
1204--- app/ui/SongsView.qml 2015-07-26 22:43:31 +0000
1205+++ app/ui/SongsView.qml 2015-10-18 17:06:27 +0000
1206@@ -19,7 +19,6 @@
1207
1208 import QtQuick 2.4
1209 import Ubuntu.Components 1.2
1210-import Ubuntu.Components.ListItems 1.0 as ListItem
1211 import Ubuntu.Components.Popups 1.0
1212 import Ubuntu.MediaScanner 0.1
1213 import Ubuntu.Thumbnailer 0.1
1214@@ -155,7 +154,7 @@
1215 thisPage: songStackPage
1216
1217 onRemoved: {
1218- Playlists.removeFromPlaylist(songStackPage.line2, selectedItems)
1219+ Playlists.removeFromPlaylist(songStackPage.line2, selectedIndices)
1220
1221 playlistChangedHelper() // update recent/playlist models
1222
1223@@ -315,18 +314,12 @@
1224 }
1225 }
1226 height: units.gu(6)
1227-
1228- leftSideAction: songStackPage.line1 === i18n.tr("Playlist")
1229+ leadingActions: songStackPage.line1 === i18n.tr("Playlist")
1230 ? playlistRemoveAction.item : null
1231 multiselectable: true
1232 reorderable: songStackPage.line1 === i18n.tr("Playlist")
1233- rightSideActions: [
1234- AddToQueue {
1235-
1236- },
1237- AddToPlaylist {
1238- }
1239- ]
1240+ trailingActions: AddToQueueAndPlaylist {
1241+ }
1242
1243 onItemClicked: {
1244 trackClicked(albumtrackslist.model, index) // play track
1245@@ -341,24 +334,21 @@
1246
1247 recentChangedHelper();
1248 }
1249- onReorder: {
1250- console.debug("Move: ", from, to);
1251-
1252- Playlists.move(songStackPage.line2, from, to)
1253-
1254- albumTracksModel.filterPlaylistTracks(songStackPage.line2)
1255- }
1256
1257 Loader {
1258 id: playlistRemoveAction
1259- sourceComponent: Remove {
1260- onTriggered: {
1261- Playlists.removeFromPlaylist(songStackPage.line2, [model.i])
1262-
1263- playlistChangedHelper() // update recent/playlist models
1264-
1265- albumTracksModel.filterPlaylistTracks(songStackPage.line2)
1266- }
1267+ sourceComponent: ListItemActions {
1268+ actions: [
1269+ Remove {
1270+ onTriggered: {
1271+ Playlists.removeFromPlaylist(songStackPage.line2, [model.i])
1272+
1273+ playlistChangedHelper() // update recent/playlist models
1274+
1275+ albumTracksModel.filterPlaylistTracks(songStackPage.line2)
1276+ }
1277+ }
1278+ ]
1279 }
1280 }
1281
1282@@ -370,6 +360,14 @@
1283 }
1284 }
1285 }
1286+
1287+ onReorder: {
1288+ console.debug("Move: ", from, to);
1289+
1290+ Playlists.move(songStackPage.line2, from, to)
1291+
1292+ albumTracksModel.filterPlaylistTracks(songStackPage.line2)
1293+ }
1294 }
1295
1296 Component.onCompleted: loaded = true
1297
1298=== modified file 'debian/changelog'
1299--- debian/changelog 2015-09-25 08:11:22 +0000
1300+++ debian/changelog 2015-10-18 17:06:27 +0000
1301@@ -6,6 +6,9 @@
1302 [ Victor Thompson ]
1303 * Remove some deprecated code for the UbuntuShape image property.
1304
1305+ [ Andrew Hayzen ]
1306+ * Switch to using the new listitems within the SDK
1307+
1308 -- Bartosz Kosiorek <gang65@poczta.onet.pl> Tue, 08 Sep 2015 10:08:49 +0200
1309
1310 music-app (2.2ubuntu1) vivid; urgency=medium
1311
1312=== modified file 'tests/autopilot/music_app/__init__.py'
1313--- tests/autopilot/music_app/__init__.py 2015-05-04 14:07:05 +0000
1314+++ tests/autopilot/music_app/__init__.py 2015-10-18 17:06:27 +0000
1315@@ -6,7 +6,9 @@
1316 # by the Free Software Foundation.
1317
1318 """music-app tests and emulators - top level package."""
1319-from ubuntuuitoolkit import MainView, UbuntuUIToolkitCustomProxyObjectBase
1320+from ubuntuuitoolkit import (
1321+ MainView, UbuntuUIToolkitCustomProxyObjectBase, UCListItem
1322+)
1323
1324
1325 class MusicAppException(Exception):
1326@@ -383,42 +385,20 @@
1327 now_playing_page.visible.wait_for(True)
1328
1329
1330-class MusicListItem(UbuntuUIToolkitCustomProxyObjectBase):
1331- @click_object
1332+class MusicListItem(UCListItem):
1333 def click_add_to_playlist_action(self):
1334- return self.wait_select_single(objectName="addToPlaylistAction")
1335+ return self.trigger_trailing_action("addToPlaylistAction")
1336
1337- @click_object
1338 def click_add_to_queue_action(self):
1339- return self.wait_select_single(objectName="addToQueueAction")
1340+ return self.trigger_trailing_action("addToQueueAction")
1341
1342- @click_object
1343- def confirm_removal(self):
1344- return self.wait_select_single(objectName="swipeDeleteAction")
1345+ def click_remove_action(self):
1346+ return self.trigger_leading_action("swipeDeleteAction",
1347+ self.wait_until_destroyed)
1348
1349 def get_label_text(self, name):
1350 return self.wait_select_single(objectName=name).text
1351
1352- def swipe_reveal_actions(self):
1353- x, y, width, height = self.globalRect
1354- start_x = x + (width * 0.8)
1355- stop_x = x + (width * 0.2)
1356- start_y = stop_y = y + (height // 2)
1357-
1358- self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
1359-
1360- self.swipping.wait_for(False)
1361-
1362- def swipe_to_delete(self):
1363- x, y, width, height = self.globalRect
1364- start_x = x + (width * 0.2)
1365- stop_x = x + (width * 0.8)
1366- start_y = stop_y = y + (height // 2)
1367-
1368- self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
1369-
1370- self.swipping.wait_for(False)
1371-
1372
1373 class Dialog(UbuntuUIToolkitCustomProxyObjectBase):
1374 @click_object
1375
1376=== modified file 'tests/autopilot/music_app/tests/test_music.py'
1377--- tests/autopilot/music_app/tests/test_music.py 2015-04-29 00:55:02 +0000
1378+++ tests/autopilot/music_app/tests/test_music.py 2015-10-18 17:06:27 +0000
1379@@ -79,7 +79,6 @@
1380
1381 # get track item to swipe and queue
1382 track = self.app.get_songs_view().get_track(0)
1383- track.swipe_reveal_actions()
1384
1385 # add track to the queue
1386 track.click_add_to_queue_action()
1387@@ -206,8 +205,6 @@
1388
1389 # get track row and swipe to reveal actions
1390 track = tracks_page.get_track(i)
1391- track.swipe_reveal_actions()
1392-
1393 track.click_add_to_queue_action() # add track to queue
1394
1395 # wait for the player index to change
1396@@ -344,8 +341,6 @@
1397 songs_page = self.app.get_songs_view()
1398
1399 track = songs_page.get_track(0)
1400- track.swipe_reveal_actions()
1401-
1402 track.click_add_to_queue_action() # add track to the queue
1403
1404 # verify track queue has added one to initial value
1405@@ -417,8 +412,6 @@
1406
1407 # get track row and swipe to reveal actions
1408 track = tracks_page.get_track(0)
1409- track.swipe_reveal_actions()
1410-
1411 track.click_add_to_queue_action() # add track to queue
1412
1413 # verify track queue has added all songs to initial value
1414@@ -452,8 +445,6 @@
1415
1416 # get track row and swipe to reveal actions
1417 track = tracks_page.get_track(0)
1418- track.swipe_reveal_actions()
1419-
1420 track.click_add_to_playlist_action() # add track to queue
1421
1422 add_to_playlist_page = self.app.get_add_to_playlist_page()
1423@@ -601,9 +592,7 @@
1424
1425 # get track row and swipe to reveal swipe to delete
1426 track = now_playing_page.get_track(0)
1427- track.swipe_to_delete()
1428-
1429- track.confirm_removal() # confirm delete
1430+ track.click_remove_action()
1431
1432 # verify song has been deleted
1433 self.assertThat(self.app.get_queue_count(),

Subscribers

People subscribed via source and target branches