Merge lp:~danielholm/music-app/show-tracks-in-playlists into lp:music-app/trusty

Proposed by Daniel Holm
Status: Merged
Approved by: Daniel Holm
Approved revision: 66
Merged at revision: 69
Proposed branch: lp:~danielholm/music-app/show-tracks-in-playlists
Merge into: lp:music-app/trusty
Diff against target: 732 lines (+311/-203)
8 files modified
MusicAlbums.qml (+1/-0)
MusicArtists.qml (+1/-1)
MusicPlaylists.qml (+258/-122)
MusicTracks.qml (+1/-0)
QueueDialog.qml (+0/-64)
debian/changelog (+10/-1)
music-app.qml (+11/-3)
playlists.js (+29/-12)
To merge this branch: bzr merge lp:~danielholm/music-app/show-tracks-in-playlists
Reviewer Review Type Date Requested Status
Andrew Hayzen Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
David Planella Needs Fixing
Review via email: mp+175333@code.launchpad.net

Commit message

Show tracks in playlist; click on track to play it.

Description of the change

  * Show tracks in playlists.
  * Play track from playlist.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel Holm (danielholm) wrote :

The changelog has to be merged before I think.

Revision history for this message
David Planella (dpm) wrote :

The "diff against target" section on the merge proposal's page highlights the issues:

Text conflict in debian/changelog
Text conflict in music-app.qml

To fix this, you'll need to:

1. do a 'bzr merge lp:music-app' to get the latest changes from trunk
2. resolve any conflicts manually
3. commit the changes locally with 'bzr commit'
4. push the changes online to update the merge proposal 'bzr push lp:~danielholm/music-app/show-tracks-in-playlists'

review: Needs Fixing
57. By Daniel Holm

Save changes that I've forgot, before merge.

58. By Daniel Holm

* Show tracks in playlists.
* Provide new icons.
* Added worker for adding rows to Library model (allows gui to respond while adding to the ListModel)
* Tracks are now sorted by Artist->Album->File
* Text on rows in MusicTracks and MusicArtists now doesn't wrap. This means that if it is too long it now doesn't cover the row below.
* Rows in MusicTracks and MusicArtists now expand to fit their parent, therefore expanding as the window expands.
* Use resolution independent font sizes for text.
* Create new playlists.
* Edit name of existing playlists.
* Remove playlists.
* Add track to playlist.
* Popover in track list.

Revision history for this message
Daniel Holm (danielholm) wrote :

Done!

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
David Planella (dpm) wrote :

While trying the branch and adding a new song to an existing playlist, I get this:

file:///tmp/show-tracks-in-playlists/playlists.js:94: Error: table playlist has 2 columns but 5 values were supplied Unable to execute statement

review: Needs Fixing
Revision history for this message
Daniel Holm (danielholm) wrote :

Sure you got the latest revision? I thought that I resolved this yesterday. What does row 94 say?

Revision history for this message
David Planella (dpm) wrote :

The show-tracks-in-playlists path in file:///tmp/show-tracks-in-playlists/playlists.js:94 confirms that I checked out this branch and looking at bzr qlog, I'm on the latest revision (r58)

Line 94 says this: http://bazaar.launchpad.net/~danielholm/music-app/show-tracks-in-playlists/view/head:/playlists.js#L94 (i.e. same as my local code)

Revision history for this message
Daniel Holm (danielholm) wrote :

Well, that's really odd then. It works for me. But I will take a further look.

Revision history for this message
Victor Thompson (vthompson) wrote :

I think this is because David's LocalStorage needs to be re-initialized. His playlist table probably needs to be DROP'd and CREATE'd

Revision history for this message
Daniel Holm (danielholm) wrote :

Of course, thanks Victor!

David, in MusicSettings.qml: 524 there is a dev button that is used to drop every setting for Music. Uncomment that button and comment out each reset except Playlist.reset().

Run app, press button and restart the app. You're good to go.

Revision history for this message
Victor Thompson (vthompson) wrote :

We really should implement some sort of schema management. The app should detect that the user has an older version of the settings, playlists, or music library and update the databases accordingly.

Revision history for this message
Daniel Holm (danielholm) wrote :

Good idea. We could have a line the the DB with the version number, and then check that line on startup.

Revision history for this message
David Planella (dpm) wrote :

Thanks a lot guys, that worked.

However, I'd argue that this still needs fixing: consider someone using the app in the phone - there is no way a regular user would know or be able to uncomment the code to reset the database and get the app back to work. The app should detect this automatically and update the database itself: it should be transparent to the user.

One solution that I can think of is to version the database schema There are some suggestions on how to do it here [1] (and I'm sure in other places), and I think the easiest one would be to add a schema table with the version.

So if the runtime detects that the database schema version is older than what the new code provides, the database could be repopulated.

This is just a suggestion and there might be better approaches, I'm by no means a database expert.

[1] http://stackoverflow.com/questions/550662/database-schema-updates

Revision history for this message
David Planella (dpm) wrote :

Nice to see that you guys have independently come to the same idea while I was writing my comment! :)

Revision history for this message
Victor Thompson (vthompson) wrote :

It actually looks like we can do schema upgrades almost automatically via LocalStorage's version number: http://qt-project.org/doc/qt-5.0/qtquick/qmlmodule-qtquick-localstorage2-qtquick-localstorage-2.html

59. By Daniel Holm

Added a DB scheme update.

Revision history for this message
Daniel Holm (danielholm) wrote :

Could someone please give this a try now?

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
60. By Daniel Holm

Put queued tracks in a page just like tracks in playlists, instead of a dialog.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

I think you need to change two things:
1. playlists.js line 25 should have version number 1.1 right?
2. It looks like calling getPlaylistDatabase() before the upgrade is performed (in initializePlaylist()) causes the database not to be opened--therefore the schema isn't upgraded.

Revision history for this message
Daniel Holm (danielholm) wrote :

1. I tried to set it as 1.1 but then the app gave me error. The guides I followed did not have any version numbering.

2. But how could we upgrade the DB if it hasn't been set? How do you propose we do it?

Revision history for this message
Victor Thompson (vthompson) wrote :

Daniel, this is the error I'm getting that's causing the schema not to be upgraded. I haven't been able to figure out what's wrong with the db.changeVersion() call you added however...

file:///home/victor/Development/show-tracks-in-playlists/playlists.js:42: Error: near "(": syntax error Unable to execute statement

Do you get similar output?

61. By Daniel Holm

Changes to scheme upgrade.

62. By Daniel Holm

Show tracks in queue in a page.

63. By Daniel Holm

Small changes.

Revision history for this message
Daniel Holm (danielholm) wrote :

I think that I've fixed it now. Also I removed the queue dialog and put the tracks in a page just like the tracks in playlists.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

You'll need to manually resolve the merge conflicts in MusicAlbums.qml. I'll try to test with how I assume you'll resolve them.

Revision history for this message
Victor Thompson (vthompson) wrote :

It looks like it upgrades the database now. Good work! However, I can not play a track in the playlist:

file:///home/victor/Development/show-tracks-in-playlists/MusicPlaylists.qml:397: ReferenceError: tracklist is not defined

Also, please be careful not to revert any changes in MusicAlbums.qml or other files. I see that your changes will probably overwrite some of what I had previously done. Can you pull in from trunk and make sure things check out?

Revision history for this message
Daniel Holm (danielholm) wrote :

Great! Thank you.

I'll take a look at the issue, merge latest and make sure no reverts are made :)

Revision history for this message
Daniel Holm (danielholm) wrote :

There.

When clicking on a track in queue or playlist, the now playing isn't updated, because I don't know how. Victor, could you help me with this?

Revision history for this message
Victor Thompson (vthompson) wrote :

Did you push your changes?

Revision history for this message
Victor Thompson (vthompson) wrote :

As for the Now Playing issue. Look at your code on L391-402 for onClicked. You'll want to make use of the trackClicked() function in music-app.qml (see MusicArtists.qml L193).

64. By Daniel Holm

Changed version; changelog; small fixes.

65. By Daniel Holm

Merge with trunk, small fixes.

Revision history for this message
Daniel Holm (danielholm) wrote :

Victor, yeah.. I forgot to push it. Andrew has some new stuff that will come in handy for updating the now playing info.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
66. By Daniel Holm

Use trackClicked() instead.

Revision history for this message
Daniel Holm (danielholm) wrote :

And now it uses trackClicked()

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

Looks good, some parts of the playqueue and playlist work will need to be updated. But this will be done after my branch lp:~andrew-hayzen/music-app/play-queue-implementation has been merged as it resolves a lot of issues in getting things to work (as discussed with Daniel).

review: Approve
Revision history for this message
Victor Thompson (vthompson) wrote :

I don't think this was ready to be approved, but it's too late now.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'MusicAlbums.qml'
2--- MusicAlbums.qml 2013-07-20 04:17:22 +0000
3+++ MusicAlbums.qml 2013-07-21 16:01:23 +0000
4@@ -26,6 +26,7 @@
5 import "settings.js" as Settings
6 import "meta-database.js" as Library
7 import "playing-list.js" as PlayingList
8+import "playlists.js" as Playlists
9
10 PageStack {
11 id: pageStack
12
13=== modified file 'MusicArtists.qml'
14--- MusicArtists.qml 2013-07-19 22:22:56 +0000
15+++ MusicArtists.qml 2013-07-21 16:01:23 +0000
16@@ -25,12 +25,12 @@
17 import QtQuick.LocalStorage 2.0
18 import "settings.js" as Settings
19 import "meta-database.js" as Library
20+import "playlists.js" as Playlists
21
22 PageStack {
23 id: pageStack
24 anchors.fill: parent
25
26-
27 Page {
28 id: mainpage
29 title: i18n.tr("Artists")
30
31=== modified file 'MusicPlaylists.qml'
32--- MusicPlaylists.qml 2013-07-18 23:04:20 +0000
33+++ MusicPlaylists.qml 2013-07-21 16:01:23 +0000
34@@ -26,30 +26,32 @@
35 import QtQuick.LocalStorage 2.0
36 import "settings.js" as Settings
37 import "meta-database.js" as Library
38+import "scrobble.js" as Scrobble
39 import "playing-list.js" as PlayingList
40-import "scrobble.js" as Scrobble
41 import "playlists.js" as Playlists
42
43+PageStack {
44+ id: pageStack
45+ anchors.fill: parent
46
47-Page {
48- property int filelistCurrentIndex: 0
49- property int filelistCount: 0
50+ property string playlistTracks: ""
51 property string oldPlaylistName: ""
52 property string oldPlaylistIndex: ""
53 property string oldPlaylistID: ""
54
55- onFilelistCurrentIndexChanged: {
56- tracklist.currentIndex = filelistCurrentIndex
57- }
58-
59- title: i18n.tr("Playlists")
60-
61 // function that adds each playlist in the listmodel to show it in the app
62 function addtoPlaylistModel(element,index,array) {
63- console.debug("Debug: Playlist #" + index + " = " + element);
64+ customdebug("Playlist #" + index + " = " + element);
65 playlistModel.append({"id": index, "name": element});
66 }
67
68+ // function that adds each track from playlist in the listmodel to show it in the app
69+ function addtoPlaylistTracksModel(element,index,array) {
70+ customdebug("Track #" + index + " = " + element);
71+ var arry = element.split(',');
72+ playlisttracksModel.append({"id": index, "track": arry[0], "artist": arry[1], "title": arry[2], "album": arry[3] });
73+ }
74+
75 // New playlist dialog
76 Component {
77 id: newPlaylistDialog
78@@ -83,18 +85,19 @@
79 PopupUtils.close(dialogueNewPlaylist)
80 }
81 else {
82- newplaylistoutput.text = i18n.tr("You didn't type in a name.")
83+ newplaylistoutput.text = i18n.tr("You didn't type in a name.")
84
85 }
86 }
87 }
88+
89 Button {
90 text: i18n.tr("Cancel")
91 color: "grey"
92 onClicked: PopupUtils.close(dialogueNewPlaylist)
93 }
94 }
95- }
96+ }
97
98 // Remove playlist dialog
99 Component {
100@@ -203,52 +206,9 @@
101 }
102 }
103
104-
105- tools: ToolbarItems {
106- // import playlist from lastfm
107- ToolbarButton {
108- objectName: "lastfmplaylistaction"
109-
110- iconSource: Qt.resolvedUrl("images/lastfm.png")
111- text: i18n.tr("Import")
112-
113- onTriggered: {
114- console.debug("Debug: User pressed action to import playlist from lastfm")
115- Scrobble.getPlaylists(Settings.getSetting("lastfmusername"))
116- }
117- }
118-
119- // Add playlist
120- ToolbarButton {
121- id: playlistAction
122- objectName: "playlistaction"
123- iconSource: Qt.resolvedUrl("images/playlist.png")
124- text: i18n.tr("New")
125- onTriggered: {
126- console.debug("Debug: User pressed add playlist")
127- // show new playlist dialog
128- PopupUtils.open(newPlaylistDialog, mainView)
129- }
130- }
131-
132- // Settings dialog
133- ToolbarButton {
134- objectName: "settingsaction"
135- iconSource: Qt.resolvedUrl("images/settings.png")
136- text: i18n.tr("Settings")
137-
138- onTriggered: {
139- console.debug('Debug: Show settings')
140- PopupUtils.open(Qt.resolvedUrl("MusicSettings.qml"), mainView,
141- {
142- title: i18n.tr("Settings")
143- } )
144- }
145- }
146- }
147-
148-
149 Component.onCompleted: {
150+ pageStack.push(playlistspage)
151+
152 random = Settings.getSetting("shuffle") == "1" // shuffle state
153 scrobble = Settings.getSetting("scrobble") == "1" // scrobble state
154 lastfmusername = Settings.getSetting("lastfmusername") // lastfm username
155@@ -263,72 +223,248 @@
156 playlist.forEach(addtoPlaylistModel) // send each item on playlist array to the model to show it
157 }
158
159- ListView {
160- id: tracklist
161- width: parent.width
162- anchors.top: parent.top
163- anchors.bottom: parent.bottom
164- anchors.bottomMargin: units.gu(8)
165- model: playlistModel
166- delegate: playlistDelegate
167- onCountChanged: {
168- customdebug("onCountChanged: " + tracklist.count)
169- }
170- onCurrentIndexChanged: {
171- customdebug("tracklist.currentIndex = " + tracklist.currentIndex)
172- }
173- onModelChanged: {
174- customdebug("PlayingList cleared")
175- }
176-
177- Component {
178- id: playlistDelegate
179- ListItem.Standard {
180- id: playlist
181- icon: Qt.resolvedUrl("images/playlist.png")
182- iconFrame: false
183- text: name
184-
185- onFocusChanged: {
186- if (focus == false) {
187- selected = false
188- } else {
189- selected = false
190- }
191- }
192- MouseArea {
193- anchors.fill: parent
194- onDoubleClicked: {
195- }
196- onPressAndHold: {
197- customdebug("Pressed and held playlist "+name+" : "+index)
198-
199- if (name === i18n.tr("Queue")) {
200- customdebug("User tried to change name of queue, but no go!")
201- }
202- else {
203- // show a dialog to change name and remove list
204- oldPlaylistName = name
205- oldPlaylistID = id
206- oldPlaylistIndex = index
207- PopupUtils.open(playlistPopoverComponent, mainView)
208- }
209- }
210- onClicked: {
211- if (name === i18n.tr("Queue")) {
212- customdebug("User clicked Queue.")
213- PopupUtils.open(Qt.resolvedUrl("QueueDialog.qml"), mainView,
214- {
215- title: i18n.tr("Queue")
216- } )
217- }
218- else {
219- customdebug("Playlist chosen: " + name)
220- }
221- }
222+ // page for the playlists
223+ Page {
224+ id: playlistspage
225+ title: i18n.tr("Playlists")
226+ ListView {
227+ id: playlistslist
228+ width: parent.width
229+ anchors.top: parent.top
230+ anchors.bottom: parent.bottom
231+ anchors.bottomMargin: units.gu(8)
232+ model: playlistModel
233+ delegate: playlistDelegate
234+ onCountChanged: {
235+ customdebug("onCountChanged: " + playlistslist.count)
236+ }
237+ onCurrentIndexChanged: {
238+ customdebug("tracklist.currentIndex = " + playlistslist.currentIndex)
239+ }
240+ onModelChanged: {
241+ customdebug("PlayingList cleared")
242+ }
243+
244+ Component {
245+ id: playlistDelegate
246+ ListItem.Subtitled {
247+ id: playlist
248+ icon: Qt.resolvedUrl("images/playlist.png")
249+ iconFrame: false
250+ text: name
251+ subText: i18n.tr("With "+ playlist.count + " tracks")
252+
253+ MouseArea {
254+ anchors.fill: parent
255+ onDoubleClicked: {
256+ }
257+
258+ onPressAndHold: {
259+ customdebug("Pressed and held playlist "+name+" : "+index)
260+
261+ // queue is not the same thing as a playlist, so do this
262+ if (name === i18n.tr("Queue")) {
263+ customdebug("User tried to change name of queue, but no go!")
264+ }
265+ else {
266+ // show a dialog to change name and remove list
267+ oldPlaylistName = name
268+ oldPlaylistID = id
269+ oldPlaylistIndex = index
270+ PopupUtils.open(playlistPopoverComponent, mainView)
271+ }
272+
273+ }
274+
275+ onClicked: {
276+ // queue is not the same thing as a playlist, so do this
277+ if (name === i18n.tr("Queue")) {
278+ customdebug("User clicked Queue.")
279+ pageStack.push(queuepage)
280+ }
281+ else {
282+ customdebug("Playlist chosen: " + name)
283+ // get tracks in playlists in array
284+ var playlistTracks = Playlists.getPlaylistTracks(name) // get array of tracks
285+ playlistTracks.forEach(addtoPlaylistTracksModel) // send each item in playlist array to the model to show it
286+ pageStack.push(playlistpage)
287+ }
288+ }
289+ }
290+ }
291+ }
292+ }
293+
294+ tools: ToolbarItems {
295+ // import playlist from lastfm
296+ ToolbarButton {
297+ objectName: "lastfmplaylistaction"
298+
299+ iconSource: Qt.resolvedUrl("images/lastfm.png")
300+ text: i18n.tr("Import")
301+ visible: false
302+
303+ onTriggered: {
304+ console.debug("Debug: User pressed action to import playlist from lastfm")
305+ Scrobble.getPlaylists(Settings.getSetting("lastfmusername"))
306+ }
307+ }
308+
309+ // Add playlist
310+ ToolbarButton {
311+ id: playlistAction
312+ objectName: "playlistaction"
313+ iconSource: Qt.resolvedUrl("images/playlist.png")
314+ text: i18n.tr("New")
315+ onTriggered: {
316+ console.debug("Debug: User pressed add playlist")
317+ // show new playlist dialog
318+ PopupUtils.open(newPlaylistDialog, mainView)
319+ }
320+ }
321+
322+ // Settings dialog
323+ ToolbarButton {
324+ objectName: "settingsaction"
325+ iconSource: Qt.resolvedUrl("images/settings.png")
326+ text: i18n.tr("Settings")
327+
328+ onTriggered: {
329+ console.debug('Debug: Show settings')
330+ PopupUtils.open(Qt.resolvedUrl("MusicSettings.qml"), mainView,
331+ {
332+ title: i18n.tr("Settings")
333+ } )
334+ }
335+ }
336+ }
337+ }
338+
339+ // page for the tracks in the playlist
340+ Page {
341+ id: playlistpage
342+ title: i18n.tr("Tracks in Playlist")
343+
344+ ListView {
345+ id: playlistlist
346+ width: parent.width
347+ anchors.top: parent.top
348+ anchors.bottom: parent.bottom
349+ anchors.bottomMargin: units.gu(8)
350+ model: playlisttracksModel
351+ delegate: playlisttrackDelegate
352+ onCountChanged: {
353+ console.log("Tracks in playlist onCountChanged: " + playlistlist.count)
354+ }
355+ onCurrentIndexChanged: {
356+ console.log("Tracks in playlist tracklist.currentIndex = " + playlistlist.currentIndex)
357+ }
358+ onModelChanged: {
359+ console.log("PlayingList cleared")
360+ }
361+
362+ Component {
363+ id: playlisttrackDelegate
364+ ListItem.Subtitled {
365+ id: playlistTracks
366+ icon: Qt.resolvedUrl("images/cover_default.png") // fix!
367+ iconFrame: false
368+ text: title
369+ subText: artist+" - "+album
370+
371+ onFocusChanged: {
372+ if (focus == false) {
373+ selected = false
374+ } else {
375+ selected = false
376+ }
377+ }
378+
379+ MouseArea {
380+ anchors.fill: parent
381+ onDoubleClicked: {
382+ }
383+ onPressAndHold: {
384+ customdebug("Pressed and held track playlist "+name)
385+ //PopupUtils.open(playlistPopoverComponent, mainView)
386+ }
387+ onClicked: {
388+ customdebug("Track: " + track) // debugger
389+ trackClicked(track, index, playlisttracksModel, playlistlist) // play track
390+ }
391+ }
392+ }
393+ }
394+ }
395+ }
396+
397+ // Page for Queue
398+ Page {
399+ id: queuepage
400+ title: i18n.tr("Queue")
401+
402+ ListView {
403+ id: queuelist
404+ width: parent.width
405+ anchors.top: parent.top
406+ anchors.bottom: parent.bottom
407+ anchors.bottomMargin: units.gu(8)
408+ model: trackQueue
409+ delegate: queueDelegate
410+ onCountChanged: {
411+ customdebug("Queue: Now has: " + queuelist.count + " tracks")
412+ }
413+
414+ Component {
415+ id: queueDelegate
416+ ListItem.Subtitled {
417+ id: playlistTracks
418+ icon: Qt.resolvedUrl("images/queue.png") // fix!
419+ iconFrame: false
420+ text: title
421+ subText: artist+" - "+album
422+
423+ onFocusChanged: {
424+ if (focus == false) {
425+ selected = false
426+ } else {
427+ selected = false
428+ }
429+ }
430+
431+ MouseArea {
432+ anchors.fill: parent
433+ onDoubleClicked: {
434+ }
435+ onPressAndHold: {
436+ customdebug("Pressed and held queued track "+name)
437+ }
438+ onClicked: {
439+ customdebug("Track: " + track) // debugger
440+ trackClicked(track, index, trackQueue, queuelist) // play track
441+ }
442+
443+ /*onItemRemoved: {
444+ trackQueue.remove(index)
445+ }*/
446+ }
447+ }
448+ }
449+ }
450+
451+ tools: ToolbarItems {
452+ // Clean queue button
453+ ToolbarButton {
454+ objectName: "clearqueueobject"
455+
456+ iconSource: Qt.resolvedUrl("images/clear.png")
457+ text: i18n.tr("Clear")
458+
459+ onTriggered: {
460+ console.debug("Debug: Track queue cleared.")
461+ trackQueue.clear()
462 }
463 }
464 }
465 }
466 }
467-
468
469=== modified file 'MusicTracks.qml'
470--- MusicTracks.qml 2013-07-19 22:22:56 +0000
471+++ MusicTracks.qml 2013-07-21 16:01:23 +0000
472@@ -162,6 +162,7 @@
473 chosenArtist = artist
474 chosenTitle = title
475 chosenTrack = file
476+ chosenAlbum = album
477 }
478 onClicked: {
479 if (focus == false) {
480
481=== removed file 'QueueDialog.qml'
482--- QueueDialog.qml 2013-07-15 11:59:28 +0000
483+++ QueueDialog.qml 1970-01-01 00:00:00 +0000
484@@ -1,64 +0,0 @@
485-/*
486- * Copyright (C) 2013 Victor Thompson <victor.thompson@gmail.com>
487- * Daniel Holm <d.holmen@gmail.com>
488- *
489- * This program is free software; you can redistribute it and/or modify
490- * it under the terms of the GNU General Public License as published by
491- * the Free Software Foundation; version 3.
492- *
493- * This program is distributed in the hope that it will be useful,
494- * but WITHOUT ANY WARRANTY; without even the implied warranty of
495- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
496- * GNU General Public License for more details.
497- *
498- * You should have received a copy of the GNU General Public License
499- * along with this program. If not, see <http://www.gnu.org/licenses/>.
500- */
501-
502-import QtQuick 2.0
503-import Ubuntu.Components 0.1
504-import Ubuntu.Components.Popups 0.1
505-import Ubuntu.Components.ListItems 0.1 as ListItem
506-
507-
508-Dialog {
509- id: queueDialog
510-
511- ListView {
512- id: queueList
513- height: units.gu(35)
514- model: trackQueue
515- delegate: ListItem.Standard {
516- text: artist+" - "+title
517- removable: true
518- onClicked: {
519- console.debug("Debug: Play "+file+" instead - now.")
520- playMusic.source = file
521- playMusic.play()
522- trackQueue.remove(index)
523- }
524- onItemRemoved: {
525- trackQueue.remove(index)
526- }
527- }
528- }
529-
530- // Clean whole queue button
531- Button {
532- text: i18n.tr("Clear")
533- onClicked: {
534- console.debug("Debug: Track queue cleared.")
535- trackQueue.clear()
536- PopupUtils.close(queueDialog)
537- }
538- }
539-
540- // close dialog button
541- Button {
542- text: i18n.tr("Close")
543- color: "grey"
544- onClicked: {
545- PopupUtils.close(queueDialog)
546- }
547- }
548-}
549
550=== modified file 'debian/changelog'
551--- debian/changelog 2013-07-18 12:22:49 +0000
552+++ debian/changelog 2013-07-21 16:01:23 +0000
553@@ -1,8 +1,17 @@
554+music-app (0.4.7) raring; urgency=low
555+
556+ * Queue moved to playlist tab.
557+ * Queue tracks now in own page.
558+
559+ -- Daniel Holm <d.holmen@gmail.com> Wed, 17 Jul 2013 18:29:50 +0200
560+
561 music-app (0.4.5) raring; urgency=low
562
563+ * Show tracks in playlists.
564 * Removed queue from toolbar to Playlist tab. Initial queue change.
565+ * Play track from playlist.
566
567- -- Daniel Holm <d.holmen@gmail.com> Wed, 17 Jul 2013 16:43:50 +0200
568+ -- Daniel Holm <d.holmen@gmail.com> Wed, 17 Jul 2013 18:29:50 +0200
569
570 music-app (0.4.3) raring; urgency=low
571
572
573=== modified file 'music-app.qml'
574--- music-app.qml 2013-07-20 16:21:54 +0000
575+++ music-app.qml 2013-07-21 16:01:23 +0000
576@@ -53,6 +53,7 @@
577 //Settings.setSetting("scrobble", "0") // default state of shuffle
578 //Settings.setSetting("scrobble", "0") // default state of scrobble
579 Settings.setSetting("currentfolder", folderModel.homePath() + "/Music")
580+ Playlists.addPlaylist("Testing") // for now, but remove when toolbar works again.
581 }
582 Library.reset()
583 Library.initialize()
584@@ -75,7 +76,7 @@
585 // VARIABLES
586 property string musicName: i18n.tr("Music")
587 property string musicDir: ""
588- property string appVersion: '0.4.5'
589+ property string appVersion: '0.4.7'
590 property int playing: 0
591 property bool isPlaying: false
592 property int itemnum: 0
593@@ -88,6 +89,7 @@
594 property string chosenTrack: ""
595 property string chosenTitle: ""
596 property string chosenArtist: ""
597+ property string chosenAlbum: ""
598
599 property string currentArtist: ""
600 property string currentAlbum: ""
601@@ -402,6 +404,12 @@
602 id: playlistModel
603 }
604
605+ // create the listmodel for tracks in playlists
606+ ListModel {
607+ id: playlisttracksModel
608+ }
609+
610+
611 Column {
612 Repeater {
613 id: filelist
614@@ -475,7 +483,7 @@
615 onClicked: {
616 console.debug("Debug: Add track to queue: " + chosenTitle)
617 PopupUtils.close(trackPopover)
618- trackQueue.append({"title": chosenTitle, "artist": chosenArtist, "file": chosenTrack})
619+ trackQueue.append({"title": chosenTitle, "artist": chosenArtist, "track": chosenTrack, "album": chosenAlbum})
620 }
621 }
622 ListItem.Standard {
623@@ -515,7 +523,7 @@
624 text: name
625 onClicked: {
626 console.debug("Debug: "+chosenTrack+" added to "+name)
627- Playlists.addtoPlaylist(name,chosenTrack)
628+ Playlists.addtoPlaylist(name,chosenTrack,chosenArtist,chosenTitle,chosenAlbum)
629 PopupUtils.close(dialogueAddToPlaylist)
630 }
631 }
632
633=== modified file 'playlists.js'
634--- playlists.js 2013-07-18 01:27:40 +0000
635+++ playlists.js 2013-07-21 16:01:23 +0000
636@@ -22,7 +22,7 @@
637
638 // database for individual playlists - the one witht the actual tracks in
639 function getPlaylistDatabase() {
640- return LocalStorage.openDatabaseSync("music-app-playlist", "1.0", "StorageDatabase", 1000000);
641+ return LocalStorage.openDatabaseSync("music-app-playlist", "1.1", "StorageDatabase", 1000000);
642 }
643
644 // At the start of the application, we can initialize the tables we need if they haven't been created yet
645@@ -35,10 +35,22 @@
646 }
647 // same thing for individal playlists
648 function initializePlaylist() {
649- var db = getPlaylistDatabase();
650+ var db = LocalStorage.openDatabaseSync("music-app-playlist", "", "StorageDatabase", 1000000);
651+
652+ // does the user have the latest db scheme?
653+ if (db.version === "1.0") {
654+ db.changeVersion("1.0","1.1",function(t){
655+ t.executeSql('DROP TABLE playlist'); // TODO: later, if we need a db version update, we should keep earlier settings. This is just for now.
656+ console.debug("DB: Changing version of playlist db to 1.1.")
657+ });
658+ }
659+ else {
660+ console.debug("DB: No change in playlist.")
661+ }
662+
663 db.transaction(
664 function(tx) {
665- tx.executeSql('CREATE TABLE IF NOT EXISTS playlist(playlist TEXT, track TEXT)');
666+ tx.executeSql('CREATE TABLE IF NOT EXISTS playlist(playlist TEXT, track TEXT, artist TEXT, title TEXT, album TEXT)');
667 });
668 }
669
670@@ -88,11 +100,11 @@
671 }
672
673 // add track to playlist
674-function addtoPlaylist(playlist,track) {
675+function addtoPlaylist(playlist,track,artist,title,album) {
676 var db = getPlaylistDatabase();
677 var res = "";
678 db.transaction(function(tx) {
679- var rs = tx.executeSql('INSERT OR REPLACE INTO playlist VALUES (?,?);', [playlist,track]);
680+ var rs = tx.executeSql('INSERT OR REPLACE INTO playlist VALUES (?,?,?,?,?);', [playlist,track,artist,title,album]);
681 if (rs.rowsAffected > 0) {
682 res = "OK";
683 } else {
684@@ -107,14 +119,14 @@
685 // This function is used to retrieve a playlist from the database in an array
686 function getPlaylists() {
687 var db = getPlaylistsDatabase();
688- var res = new Array();
689+ var res = new Array();
690
691 try {
692 db.transaction(function(tx) {
693 var rs = tx.executeSql('SELECT * FROM playlists');
694 for(var i = 0; i < rs.rows.length; i++) {
695 var dbItem = rs.rows.item(i);
696- console.log("id:"+ dbItem.id + ", Name:"+dbItem.name);
697+ //console.log("id:"+ dbItem.id + ", Name:"+dbItem.name);
698 res[i] = dbItem.name;
699 }
700 })
701@@ -126,22 +138,27 @@
702
703 // retrieve tracks from playlist
704 function getPlaylistTracks(playlist) {
705+ console.log("I got "+playlist)
706 var db = getPlaylistDatabase();
707- var res="";
708+ var res = new Array();
709
710 try {
711 db.transaction(function(tx) {
712 var rs = tx.executeSql('SELECT * FROM playlist WHERE playlist=?;', [playlist]);
713- if (rs.rows.length > 0) {
714- res = rs.rows.item(0).value;
715- } else {
716- res = "Unknown";
717+ for(var i = 0; i < rs.rows.length; i++) {
718+ var dbItem = rs.rows.item(i);
719+ console.log("Track: "+ dbItem.track);
720+ console.log("Artist: "+ dbItem.artist);
721+ console.log("Title: "+ dbItem.title);
722+ console.log("Album: "+ dbItem.album);
723+ res[i] = ""+dbItem.track+","+dbItem.artist+","+dbItem.title+","+dbItem.album+"";
724 }
725 })
726 } catch(e) {
727 return "";
728 }
729
730+ console.log(res);
731 return res
732 }
733

Subscribers

People subscribed via source and target branches

to status/vote changes: