Merge lp:~vthompson/music-app/back-to-tabs-lucas-design-3 into lp:~danielholm/music-app/back-to-tabs-lucas-design-1
- back-to-tabs-lucas-design-3
- Merge into back-to-tabs-lucas-design-1
Proposed by
Victor Thompson
Status: | Merged |
---|---|
Approved by: | Daniel Holm |
Approved revision: | 38 |
Merge reported by: | Daniel Holm |
Merged at revision: | not available |
Proposed branch: | lp:~vthompson/music-app/back-to-tabs-lucas-design-3 |
Merge into: | lp:~danielholm/music-app/back-to-tabs-lucas-design-1 |
Diff against target: |
971 lines (+383/-477) 5 files modified
MusicAlbums.qml (+34/-79) MusicArtists.qml (+132/-177) MusicPlaylists.qml (+150/-217) MusicTracks.qml (+0/-4) music-app.qml (+67/-0) |
To merge this branch: | bzr merge lp:~vthompson/music-app/back-to-tabs-lucas-design-3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel Holm | Approve | ||
Review via email: mp+170224@code.launchpad.net |
Commit message
Populate music library works again.
Description of the change
Populate music library works again.
To post a comment you must log in.
Revision history for this message
Victor Thompson (vthompson) wrote : | # |
I think you'll have to merge this yourself... Jenkins probably can't operate on personal branches.
Revision history for this message
Daniel Holm (danielholm) wrote : | # |
Seems that way. I wanted to wait a while and see.
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-06-17 14:01:58 +0000 |
3 | +++ MusicAlbums.qml 2013-06-19 00:02:31 +0000 |
4 | @@ -27,88 +27,43 @@ |
5 | import "meta-database.js" as Library |
6 | import "playing-list.js" as PlayingList |
7 | |
8 | -PageStack { |
9 | - id: albumPageStack |
10 | - anchors.fill: parent |
11 | - |
12 | - Page { |
13 | - id: albumpage |
14 | - |
15 | - tools: ToolbarActions { |
16 | - // Settings dialog |
17 | - Action { |
18 | - id: settingsAction |
19 | - objectName: "settingsaction" |
20 | - |
21 | - iconSource: Qt.resolvedUrl("icons/settings@8.png") |
22 | - text: i18n.tr("Settings") |
23 | - |
24 | - onTriggered: { |
25 | - console.debug('Debug: Show settings') |
26 | - PopupUtils.open(Qt.resolvedUrl("MusicSettings.qml"), mainView, |
27 | - { |
28 | - title: i18n.tr("Settings") |
29 | - } ) |
30 | - } |
31 | - } |
32 | - |
33 | - // Queue dialog |
34 | - Action { |
35 | - id: queueAction |
36 | - objectName: "queuesaction" |
37 | - |
38 | - iconSource: Qt.resolvedUrl("icons/folder.png") // change this icon later |
39 | - text: i18n.tr("Queue") |
40 | - |
41 | - onTriggered: { |
42 | - console.debug('Debug: Show queue') |
43 | - PopupUtils.open(Qt.resolvedUrl("QueueDialog.qml"), mainView, |
44 | - { |
45 | - title: i18n.tr("Queue") |
46 | - } ) |
47 | - } |
48 | - } |
49 | - } |
50 | - |
51 | - title: i18n.tr("Albums") |
52 | - Component.onCompleted: { |
53 | - albumPageStack.push(albumpage) |
54 | - } |
55 | - |
56 | - GridView { |
57 | - id: albumlist |
58 | - width: parent.width |
59 | - anchors.top: parent.top |
60 | - anchors.bottom: parent.bottom |
61 | - cellHeight: units.gu(7) |
62 | - cellWidth: units.gu(7) |
63 | - model: albumModel.model |
64 | - delegate: albumDelegate |
65 | - |
66 | - Component { |
67 | - id: albumDelegate |
68 | - Item { |
69 | - height: units.gu(6) |
70 | - width: units.gu(6) |
71 | - anchors.margins: 10 |
72 | - UbuntuShape { |
73 | - height: parent.height |
74 | - width: parent.width |
75 | - image: Image { |
76 | - id: album |
77 | - fillMode: Image.Stretch |
78 | - property string artist: model.artist |
79 | - property string album: model.album |
80 | - property string title: model.title |
81 | - property string cover: model.cover |
82 | - property string length: model.length |
83 | - property string file: model.file |
84 | - source: cover === "" ? (file.match("\\.mp3") ? Qt.resolvedUrl("images/audio-x-mpeg.png") : Qt.resolvedUrl("images/audio-x-vorbis+ogg.png")) : "image://cover-art/"+file |
85 | - } |
86 | +Page { |
87 | + title: i18n.tr("Albums") |
88 | + |
89 | + GridView { |
90 | + id: albumlist |
91 | + width: parent.width |
92 | + anchors.top: parent.top |
93 | + anchors.bottom: parent.bottom |
94 | + cellHeight: units.gu(7) |
95 | + cellWidth: units.gu(7) |
96 | + model: albumModel.model |
97 | + delegate: albumDelegate |
98 | + |
99 | + Component { |
100 | + id: albumDelegate |
101 | + Item { |
102 | + height: units.gu(6) |
103 | + width: units.gu(6) |
104 | + anchors.margins: 10 |
105 | + UbuntuShape { |
106 | + height: parent.height |
107 | + width: parent.width |
108 | + image: Image { |
109 | + id: album |
110 | + fillMode: Image.Stretch |
111 | + property string artist: model.artist |
112 | + property string album: model.album |
113 | + property string title: model.title |
114 | + property string cover: model.cover |
115 | + property string length: model.length |
116 | + property string file: model.file |
117 | + source: cover === "" ? (file.match("\\.mp3") ? Qt.resolvedUrl("images/audio-x-mpeg.png") : Qt.resolvedUrl("images/audio-x-vorbis+ogg.png")) : "image://cover-art/"+file |
118 | } |
119 | } |
120 | + } |
121 | |
122 | - } |
123 | } |
124 | } |
125 | } |
126 | + |
127 | |
128 | === modified file 'MusicArtists.qml' |
129 | --- MusicArtists.qml 2013-06-17 14:01:58 +0000 |
130 | +++ MusicArtists.qml 2013-06-19 00:02:31 +0000 |
131 | @@ -27,191 +27,146 @@ |
132 | import "meta-database.js" as Library |
133 | import "playing-list.js" as PlayingList |
134 | |
135 | -PageStack { |
136 | - id: artistPageStack |
137 | - anchors.fill: parent |
138 | - |
139 | - Page { |
140 | - id: artistpage |
141 | - |
142 | - tools: ToolbarActions { |
143 | - // Settings dialog |
144 | - Action { |
145 | - id: settingsAction |
146 | - objectName: "settingsaction" |
147 | - |
148 | - iconSource: Qt.resolvedUrl("icons/settings@8.png") |
149 | - text: i18n.tr("Settings") |
150 | - |
151 | - onTriggered: { |
152 | - console.debug('Debug: Show settings') |
153 | - PopupUtils.open(Qt.resolvedUrl("MusicSettings.qml"), mainView, |
154 | - { |
155 | - title: i18n.tr("Settings") |
156 | - } ) |
157 | - } |
158 | - } |
159 | - |
160 | - // Queue dialog |
161 | - Action { |
162 | - id: queueAction |
163 | - objectName: "queuesaction" |
164 | - |
165 | - iconSource: Qt.resolvedUrl("icons/folder.png") // change this icon later |
166 | - text: i18n.tr("Queue") |
167 | - |
168 | - onTriggered: { |
169 | - console.debug('Debug: Show queue') |
170 | - PopupUtils.open(Qt.resolvedUrl("QueueDialog.qml"), mainView, |
171 | - { |
172 | - title: i18n.tr("Queue") |
173 | - } ) |
174 | - } |
175 | - } |
176 | - } |
177 | - |
178 | - title: i18n.tr("Artists") |
179 | - Component.onCompleted: { |
180 | - artistPageStack.push(artistpage) |
181 | - } |
182 | +Page { |
183 | + title: i18n.tr("Artists") |
184 | + |
185 | + Component { |
186 | + id: highlight |
187 | + Rectangle { |
188 | + width: 5; height: 40 |
189 | + color: "#DD4814"; |
190 | + Behavior on y { |
191 | + SpringAnimation { |
192 | + spring: 3 |
193 | + damping: 0.2 |
194 | + } |
195 | + } |
196 | + } |
197 | + } |
198 | + |
199 | + ListView { |
200 | + id: artistlist |
201 | + width: parent.width |
202 | + anchors.top: parent.top |
203 | + anchors.bottom: parent.bottom |
204 | + anchors.bottomMargin: units.gu(8) |
205 | + highlight: highlight |
206 | + highlightFollowsCurrentItem: true |
207 | + model: artistModel.model |
208 | + delegate: artistDelegate |
209 | |
210 | Component { |
211 | - id: highlight |
212 | - Rectangle { |
213 | - width: 5; height: 40 |
214 | - color: "#DD4814"; |
215 | - Behavior on y { |
216 | - SpringAnimation { |
217 | - spring: 3 |
218 | - damping: 0.2 |
219 | - } |
220 | - } |
221 | - } |
222 | - } |
223 | - |
224 | - ListView { |
225 | - id: artistlist |
226 | - width: parent.width |
227 | - anchors.top: parent.top |
228 | - anchors.bottom: parent.bottom |
229 | - anchors.bottomMargin: units.gu(8) |
230 | - highlight: highlight |
231 | - highlightFollowsCurrentItem: true |
232 | - model: artistModel.model |
233 | - delegate: artistDelegate |
234 | - |
235 | - Component { |
236 | - id: artistDelegate |
237 | - |
238 | - ListItem.Standard { |
239 | - id: track |
240 | - property string artist: model.artist |
241 | - property string album: model.album |
242 | - property string title: model.title |
243 | - property string cover: model.cover |
244 | - property string length: model.length |
245 | - property string file: model.file |
246 | - icon: cover === "" ? (file.match("\\.mp3") ? Qt.resolvedUrl("images/audio-x-mpeg.png") : Qt.resolvedUrl("images/audio-x-vorbis+ogg.png")) : "image://cover-art/"+file |
247 | - iconFrame: false |
248 | - Label { |
249 | - id: trackTitle |
250 | - width: 400 |
251 | - wrapMode: Text.Wrap |
252 | - maximumLineCount: 1 |
253 | - font.pixelSize: 16 |
254 | - anchors.left: parent.left |
255 | - anchors.leftMargin: 75 |
256 | - anchors.top: parent.top |
257 | - anchors.topMargin: 5 |
258 | - text: track.title == "" ? track.file : track.title |
259 | - } |
260 | - Label { |
261 | - id: trackArtistAlbum |
262 | - width: 400 |
263 | - wrapMode: Text.Wrap |
264 | - maximumLineCount: 2 |
265 | - font.pixelSize: 12 |
266 | - anchors.left: parent.left |
267 | - anchors.leftMargin: 75 |
268 | - anchors.top: trackTitle.bottom |
269 | - text: artist == "" ? "" : artist + " - " + album |
270 | - } |
271 | - Label { |
272 | - id: trackDuration |
273 | - width: 400 |
274 | - wrapMode: Text.Wrap |
275 | - maximumLineCount: 2 |
276 | - font.pixelSize: 12 |
277 | - anchors.left: parent.left |
278 | - anchors.leftMargin: 75 |
279 | - anchors.top: trackArtistAlbum.bottom |
280 | - visible: false |
281 | - text: "" |
282 | - } |
283 | - |
284 | - onFocusChanged: { |
285 | + id: artistDelegate |
286 | + |
287 | + ListItem.Standard { |
288 | + id: track |
289 | + property string artist: model.artist |
290 | + property string album: model.album |
291 | + property string title: model.title |
292 | + property string cover: model.cover |
293 | + property string length: model.length |
294 | + property string file: model.file |
295 | + icon: cover === "" ? (file.match("\\.mp3") ? Qt.resolvedUrl("images/audio-x-mpeg.png") : Qt.resolvedUrl("images/audio-x-vorbis+ogg.png")) : "image://cover-art/"+file |
296 | + iconFrame: false |
297 | + Label { |
298 | + id: trackTitle |
299 | + width: 400 |
300 | + wrapMode: Text.Wrap |
301 | + maximumLineCount: 1 |
302 | + font.pixelSize: 16 |
303 | + anchors.left: parent.left |
304 | + anchors.leftMargin: 75 |
305 | + anchors.top: parent.top |
306 | + anchors.topMargin: 5 |
307 | + text: track.title == "" ? track.file : track.title |
308 | + } |
309 | + Label { |
310 | + id: trackArtistAlbum |
311 | + width: 400 |
312 | + wrapMode: Text.Wrap |
313 | + maximumLineCount: 2 |
314 | + font.pixelSize: 12 |
315 | + anchors.left: parent.left |
316 | + anchors.leftMargin: 75 |
317 | + anchors.top: trackTitle.bottom |
318 | + text: artist == "" ? "" : artist + " - " + album |
319 | + } |
320 | + Label { |
321 | + id: trackDuration |
322 | + width: 400 |
323 | + wrapMode: Text.Wrap |
324 | + maximumLineCount: 2 |
325 | + font.pixelSize: 12 |
326 | + anchors.left: parent.left |
327 | + anchors.leftMargin: 75 |
328 | + anchors.top: trackArtistAlbum.bottom |
329 | + visible: false |
330 | + text: "" |
331 | + } |
332 | + |
333 | + onFocusChanged: { |
334 | + if (focus == false) { |
335 | + selected = false |
336 | + } else { |
337 | + selected = false |
338 | + fileArtistAlbumBottom.text = trackArtistAlbum.text |
339 | + fileTitleBottom.text = trackTitle.text |
340 | + fileArtistAlbumBottom_nowplaying.text = artist == "" ? "" : artist + "\n" + album |
341 | + fileTitleBottom_nowplaying.text = trackTitle.text |
342 | + iconbottom.source = track.icon |
343 | + iconbottom_nowplaying.source = cover !== "" ? "image://cover-art-full/" + file : "images/Blank_album.jpg" |
344 | + } |
345 | + } |
346 | + MouseArea { |
347 | + anchors.fill: parent |
348 | + onDoubleClicked: { |
349 | + } |
350 | + onPressAndHold: { |
351 | + trackQueue.append({"title": title, "artist": artist, "file": file}) |
352 | + } |
353 | + onClicked: { |
354 | if (focus == false) { |
355 | - selected = false |
356 | + focus = true |
357 | + } |
358 | + console.log("fileName: " + file) |
359 | + if (tracklist.currentIndex == index) { |
360 | + if (player.playbackState === MediaPlayer.PlayingState) { |
361 | + playindicator.source = "images/play.png" |
362 | + player.pause() |
363 | + } else if (player.playbackState === MediaPlayer.PausedState) { |
364 | + playindicator.source = "images/pause.png" |
365 | + player.play() |
366 | + } |
367 | } else { |
368 | - selected = false |
369 | - fileArtistAlbumBottom.text = trackArtistAlbum.text |
370 | - fileTitleBottom.text = trackTitle.text |
371 | - fileArtistAlbumBottom_nowplaying.text = artist == "" ? "" : artist + "\n" + album |
372 | - fileTitleBottom_nowplaying.text = trackTitle.text |
373 | - iconbottom.source = track.icon |
374 | - iconbottom_nowplaying.source = cover !== "" ? "image://cover-art-full/" + file : "images/Blank_album.jpg" |
375 | - } |
376 | - } |
377 | - MouseArea { |
378 | - anchors.fill: parent |
379 | - onDoubleClicked: { |
380 | - } |
381 | - onPressAndHold: { |
382 | - trackQueue.append({"title": title, "artist": artist, "file": file}) |
383 | - } |
384 | - onClicked: { |
385 | - if (focus == false) { |
386 | - focus = true |
387 | - } |
388 | - console.log("fileName: " + file) |
389 | - if (tracklist.currentIndex == index) { |
390 | - if (player.playbackState === MediaPlayer.PlayingState) { |
391 | - playindicator.source = "images/play.png" |
392 | - player.pause() |
393 | - } else if (player.playbackState === MediaPlayer.PausedState) { |
394 | - playindicator.source = "images/pause.png" |
395 | - player.play() |
396 | - } |
397 | - } else { |
398 | - player.stop() |
399 | - player.source = Qt.resolvedUrl(file) |
400 | - tracklist.currentIndex = index |
401 | - playing = PlayingList.indexOf(file) |
402 | - console.log("Playing click: "+player.source) |
403 | - console.log("Index: " + tracklist.currentIndex) |
404 | - player.play() |
405 | - playindicator.source = "images/pause.png" |
406 | - } |
407 | - console.log("Source: " + player.source.toString()) |
408 | - console.log("Length: " + length.toString()) |
409 | - playindicator_nowplaying.source = playindicator.source |
410 | - } |
411 | - } |
412 | - Component.onCompleted: { |
413 | - if (PlayingList.size() === 0) { |
414 | - player.source = file |
415 | - } |
416 | + player.stop() |
417 | + player.source = Qt.resolvedUrl(file) |
418 | + tracklist.currentIndex = index |
419 | + playing = PlayingList.indexOf(file) |
420 | + console.log("Playing click: "+player.source) |
421 | + console.log("Index: " + tracklist.currentIndex) |
422 | + player.play() |
423 | + playindicator.source = "images/pause.png" |
424 | + } |
425 | + console.log("Source: " + player.source.toString()) |
426 | + console.log("Length: " + length.toString()) |
427 | + playindicator_nowplaying.source = playindicator.source |
428 | + } |
429 | + } |
430 | + Component.onCompleted: { |
431 | + if (PlayingList.size() === 0) { |
432 | + player.source = file |
433 | + } |
434 | |
435 | - if (!PlayingList.contains(file)) { |
436 | - console.log("Adding file:" + file) |
437 | - PlayingList.addItem(file, itemnum) |
438 | - console.log(itemnum) |
439 | - } |
440 | - console.log("Title:" + title + " Artist: " + artist) |
441 | - itemnum++ |
442 | + if (!PlayingList.contains(file)) { |
443 | + console.log("Adding file:" + file) |
444 | + PlayingList.addItem(file, itemnum) |
445 | + console.log(itemnum) |
446 | } |
447 | + console.log("Title:" + title + " Artist: " + artist) |
448 | + itemnum++ |
449 | } |
450 | } |
451 | } |
452 | } |
453 | } |
454 | + |
455 | |
456 | === modified file 'MusicPlaylists.qml' |
457 | --- MusicPlaylists.qml 2013-06-17 21:14:56 +0000 |
458 | +++ MusicPlaylists.qml 2013-06-19 00:02:31 +0000 |
459 | @@ -29,10 +29,7 @@ |
460 | import "scrobble.js" as Scrobble |
461 | |
462 | |
463 | -PageStack { |
464 | - id: pageStack |
465 | - anchors.fill: parent |
466 | - |
467 | +Page { |
468 | property bool needsUpdate: false |
469 | property int filelistCurrentIndex: 0 |
470 | property int filelistCount: 0 |
471 | @@ -50,235 +47,171 @@ |
472 | fileDurationProgress_nowplaying.width = units.gu(Math.floor((player.position*100)/player.duration) * .4) // 40 max |
473 | fileDurationBottom.text = Math.floor((player.position/1000) / 60).toString() + ":" + ( |
474 | Math.floor((player.position/1000) % 60)<10 ? "0"+Math.floor((player.position/1000) % 60).toString() : |
475 | - Math.floor((player.position/1000) % 60).toString()) |
476 | + Math.floor((player.position/1000) % 60).toString()) |
477 | fileDurationBottom.text += " / " |
478 | fileDurationBottom.text += Math.floor((player.duration/1000) / 60).toString() + ":" + ( |
479 | Math.floor((player.duration/1000) % 60)<10 ? "0"+Math.floor((player.duration/1000) % 60).toString() : |
480 | - Math.floor((player.duration/1000) % 60).toString()) |
481 | + Math.floor((player.duration/1000) % 60).toString()) |
482 | fileDurationBottom_nowplaying.text = fileDurationBottom.text |
483 | } |
484 | } |
485 | |
486 | - Page { |
487 | - id: mainpage |
488 | - |
489 | - tools: ToolbarActions { |
490 | - // import playlist from lastfm |
491 | - Action { |
492 | - id: lastfmPlaylistAction |
493 | - objectName: "lastfmplaylistaction" |
494 | - |
495 | - iconSource: Qt.resolvedUrl("icons/lastfm.png") |
496 | - text: i18n.tr("Get from Last.fm") |
497 | - |
498 | - onTriggered: { |
499 | - console.debug("Debug: User pressed action to import playlist from lastfm") |
500 | - Scrobble.getPlaylists(Settings.getSetting("lastfmusername")) |
501 | - } |
502 | - } |
503 | - |
504 | - // Settings dialog |
505 | - Action { |
506 | - id: settingsAction |
507 | - objectName: "settingsaction" |
508 | - |
509 | - iconSource: Qt.resolvedUrl("icons/settings@8.png") |
510 | - text: i18n.tr("Settings") |
511 | - |
512 | - onTriggered: { |
513 | - console.debug('Debug: Show settings') |
514 | - PopupUtils.open(Qt.resolvedUrl("MusicSettings.qml"), mainView, |
515 | - { |
516 | - title: i18n.tr("Settings") |
517 | - } ) |
518 | - } |
519 | - } |
520 | - |
521 | - // Queue dialog |
522 | - Action { |
523 | - id: queueAction |
524 | - objectName: "queuesaction" |
525 | - |
526 | - iconSource: Qt.resolvedUrl("icons/folder.png") // change this icon later |
527 | - text: i18n.tr("Queue") |
528 | - |
529 | - onTriggered: { |
530 | - console.debug('Debug: Show queue') |
531 | - PopupUtils.open(Qt.resolvedUrl("QueueDialog.qml"), mainView, |
532 | - { |
533 | - title: i18n.tr("Queue") |
534 | - } ) |
535 | - } |
536 | - } |
537 | - } |
538 | - |
539 | - title: i18n.tr("Playlists") |
540 | - Component.onCompleted: { |
541 | - pageStack.push(mainpage) |
542 | - Settings.initialize() |
543 | - Library.initialize() |
544 | - console.debug("INITIALIZED") |
545 | - if (Settings.getSetting("initialized") !== "true") { |
546 | - // initialize settings |
547 | - console.debug("reset settings") |
548 | - Settings.setSetting("initialized", "true") // setting to make sure the DB is there |
549 | - //Settings.setSetting("scrobble", "0") // default state of shuffle |
550 | - //Settings.setSetting("scrobble", "0") // default state of scrobble |
551 | - Settings.setSetting("currentfolder", folderModel.homePath() + "/Music") |
552 | - } |
553 | - random = Settings.getSetting("shuffle") == "1" // shuffle state |
554 | - scrobble = Settings.getSetting("scrobble") == "1" // scrobble state |
555 | - lastfmusername = Settings.getSetting("lastfmusername") // lastfm username |
556 | - lastfmpassword = Settings.getSetting("lastfmpassword") // lastfm password |
557 | + title: i18n.tr("Playlists") |
558 | + Component.onCompleted: { |
559 | + random = Settings.getSetting("shuffle") == "1" // shuffle state |
560 | + scrobble = Settings.getSetting("scrobble") == "1" // scrobble state |
561 | + lastfmusername = Settings.getSetting("lastfmusername") // lastfm username |
562 | + lastfmpassword = Settings.getSetting("lastfmpassword") // lastfm password |
563 | + } |
564 | + |
565 | + Component { |
566 | + id: highlight |
567 | + Rectangle { |
568 | + width: 5; height: 40 |
569 | + color: "#DD4814"; |
570 | + Behavior on y { |
571 | + SpringAnimation { |
572 | + spring: 3 |
573 | + damping: 0.2 |
574 | + } |
575 | + } |
576 | + } |
577 | + } |
578 | + |
579 | + ListView { |
580 | + id: tracklist |
581 | + width: parent.width |
582 | + anchors.top: parent.top |
583 | + anchors.bottom: parent.bottom |
584 | + anchors.bottomMargin: units.gu(8) |
585 | + highlight: highlight |
586 | + highlightFollowsCurrentItem: true |
587 | + model: libraryModel.model |
588 | + delegate: trackDelegate |
589 | + onCountChanged: { |
590 | + console.log("onCountChanged: " + tracklist.count) |
591 | + filelistCount = tracklist.count |
592 | + } |
593 | + onCurrentIndexChanged: { |
594 | + filelistCurrentIndex = tracklist.currentIndex |
595 | + console.log("tracklist.currentIndex = " + tracklist.currentIndex) |
596 | + } |
597 | + onModelChanged: { |
598 | + console.log("PlayingList cleared") |
599 | + PlayingList.clear() |
600 | } |
601 | |
602 | Component { |
603 | - id: highlight |
604 | - Rectangle { |
605 | - width: 5; height: 40 |
606 | - color: "#DD4814"; |
607 | - Behavior on y { |
608 | - SpringAnimation { |
609 | - spring: 3 |
610 | - damping: 0.2 |
611 | - } |
612 | - } |
613 | - } |
614 | - } |
615 | - |
616 | - ListView { |
617 | - id: tracklist |
618 | - width: parent.width |
619 | - anchors.top: appContext.bottom |
620 | - anchors.bottom: playerControls.top |
621 | - highlight: highlight |
622 | - highlightFollowsCurrentItem: true |
623 | - model: libraryModel.model |
624 | - delegate: trackDelegate |
625 | - onCountChanged: { |
626 | - console.log("onCountChanged: " + tracklist.count) |
627 | - filelistCount = tracklist.count |
628 | - } |
629 | - onCurrentIndexChanged: { |
630 | - filelistCurrentIndex = tracklist.currentIndex |
631 | - console.log("tracklist.currentIndex = " + tracklist.currentIndex) |
632 | - } |
633 | - onModelChanged: { |
634 | - console.log("PlayingList cleared") |
635 | - PlayingList.clear() |
636 | - } |
637 | - |
638 | - Component { |
639 | - id: trackDelegate |
640 | - ListItem.Standard { |
641 | - id: track |
642 | - property string artist: model.artist |
643 | - property string album: model.album |
644 | - property string title: model.title |
645 | - property string cover: model.cover |
646 | - property string length: model.length |
647 | - property string file: model.file |
648 | - icon: cover === "" ? (file.match("\\.mp3") ? Qt.resolvedUrl("images/audio-x-mpeg.png") : Qt.resolvedUrl("images/audio-x-vorbis+ogg.png")) : "image://cover-art/"+file |
649 | - iconFrame: false |
650 | - Label { |
651 | - id: trackTitle |
652 | - width: 400 |
653 | - wrapMode: Text.Wrap |
654 | - maximumLineCount: 1 |
655 | - font.pixelSize: 16 |
656 | - anchors.left: parent.left |
657 | - anchors.leftMargin: 75 |
658 | - anchors.top: parent.top |
659 | - anchors.topMargin: 5 |
660 | - text: track.title == "" ? track.file : track.title |
661 | - } |
662 | - Label { |
663 | - id: trackArtistAlbum |
664 | - width: 400 |
665 | - wrapMode: Text.Wrap |
666 | - maximumLineCount: 2 |
667 | - font.pixelSize: 12 |
668 | - anchors.left: parent.left |
669 | - anchors.leftMargin: 75 |
670 | - anchors.top: trackTitle.bottom |
671 | - text: artist == "" ? "" : artist + " - " + album |
672 | - } |
673 | - Label { |
674 | - id: trackDuration |
675 | - width: 400 |
676 | - wrapMode: Text.Wrap |
677 | - maximumLineCount: 2 |
678 | - font.pixelSize: 12 |
679 | - anchors.left: parent.left |
680 | - anchors.leftMargin: 75 |
681 | - anchors.top: trackArtistAlbum.bottom |
682 | - visible: false |
683 | - text: "" |
684 | - } |
685 | - |
686 | - onFocusChanged: { |
687 | + id: trackDelegate |
688 | + ListItem.Standard { |
689 | + id: track |
690 | + property string artist: model.artist |
691 | + property string album: model.album |
692 | + property string title: model.title |
693 | + property string cover: model.cover |
694 | + property string length: model.length |
695 | + property string file: model.file |
696 | + icon: cover === "" ? (file.match("\\.mp3") ? Qt.resolvedUrl("images/audio-x-mpeg.png") : Qt.resolvedUrl("images/audio-x-vorbis+ogg.png")) : "image://cover-art/"+file |
697 | + iconFrame: false |
698 | + Label { |
699 | + id: trackTitle |
700 | + width: 400 |
701 | + wrapMode: Text.Wrap |
702 | + maximumLineCount: 1 |
703 | + font.pixelSize: 16 |
704 | + anchors.left: parent.left |
705 | + anchors.leftMargin: 75 |
706 | + anchors.top: parent.top |
707 | + anchors.topMargin: 5 |
708 | + text: track.title == "" ? track.file : track.title |
709 | + } |
710 | + Label { |
711 | + id: trackArtistAlbum |
712 | + width: 400 |
713 | + wrapMode: Text.Wrap |
714 | + maximumLineCount: 2 |
715 | + font.pixelSize: 12 |
716 | + anchors.left: parent.left |
717 | + anchors.leftMargin: 75 |
718 | + anchors.top: trackTitle.bottom |
719 | + text: artist == "" ? "" : artist + " - " + album |
720 | + } |
721 | + Label { |
722 | + id: trackDuration |
723 | + width: 400 |
724 | + wrapMode: Text.Wrap |
725 | + maximumLineCount: 2 |
726 | + font.pixelSize: 12 |
727 | + anchors.left: parent.left |
728 | + anchors.leftMargin: 75 |
729 | + anchors.top: trackArtistAlbum.bottom |
730 | + visible: false |
731 | + text: "" |
732 | + } |
733 | + |
734 | + onFocusChanged: { |
735 | + if (focus == false) { |
736 | + selected = false |
737 | + } else { |
738 | + selected = false |
739 | + fileArtistAlbumBottom.text = trackArtistAlbum.text |
740 | + fileTitleBottom.text = trackTitle.text |
741 | + fileArtistAlbumBottom_nowplaying.text = artist == "" ? "" : artist + "\n" + album |
742 | + fileTitleBottom_nowplaying.text = trackTitle.text |
743 | + iconbottom.source = track.icon |
744 | + iconbottom_nowplaying.source = cover !== "" ? "image://cover-art-full/" + file : "images/Blank_album.jpg" |
745 | + } |
746 | + } |
747 | + MouseArea { |
748 | + anchors.fill: parent |
749 | + onDoubleClicked: { |
750 | + } |
751 | + onPressAndHold: { |
752 | + trackQueue.append({"title": title, "artist": artist, "file": file}) |
753 | + } |
754 | + onClicked: { |
755 | if (focus == false) { |
756 | - selected = false |
757 | + focus = true |
758 | + } |
759 | + console.log("fileName: " + file) |
760 | + if (tracklist.currentIndex == index) { |
761 | + if (player.playbackState === MediaPlayer.PlayingState) { |
762 | + playindicator.source = "images/play.png" |
763 | + player.pause() |
764 | + } else if (player.playbackState === MediaPlayer.PausedState) { |
765 | + playindicator.source = "images/pause.png" |
766 | + player.play() |
767 | + } |
768 | } else { |
769 | - selected = false |
770 | - fileArtistAlbumBottom.text = trackArtistAlbum.text |
771 | - fileTitleBottom.text = trackTitle.text |
772 | - fileArtistAlbumBottom_nowplaying.text = artist == "" ? "" : artist + "\n" + album |
773 | - fileTitleBottom_nowplaying.text = trackTitle.text |
774 | - iconbottom.source = track.icon |
775 | - iconbottom_nowplaying.source = cover !== "" ? "image://cover-art-full/" + file : "images/Blank_album.jpg" |
776 | - } |
777 | - } |
778 | - MouseArea { |
779 | - anchors.fill: parent |
780 | - onDoubleClicked: { |
781 | - } |
782 | - onPressAndHold: { |
783 | - trackQueue.append({"title": title, "artist": artist, "file": file}) |
784 | - } |
785 | - onClicked: { |
786 | - if (focus == false) { |
787 | - focus = true |
788 | - } |
789 | - console.log("fileName: " + file) |
790 | - if (tracklist.currentIndex == index) { |
791 | - if (player.playbackState === MediaPlayer.PlayingState) { |
792 | - playindicator.source = "images/play.png" |
793 | - player.pause() |
794 | - } else if (player.playbackState === MediaPlayer.PausedState) { |
795 | - playindicator.source = "images/pause.png" |
796 | - player.play() |
797 | - } |
798 | - } else { |
799 | - player.stop() |
800 | - player.source = Qt.resolvedUrl(file) |
801 | - tracklist.currentIndex = index |
802 | - playing = PlayingList.indexOf(file) |
803 | - console.log("Playing click: "+player.source) |
804 | - console.log("Index: " + tracklist.currentIndex) |
805 | - player.play() |
806 | - playindicator.source = "images/pause.png" |
807 | - } |
808 | - console.log("Source: " + player.source.toString()) |
809 | - console.log("Length: " + length.toString()) |
810 | - playindicator_nowplaying.source = playindicator.source |
811 | - } |
812 | - } |
813 | - Component.onCompleted: { |
814 | - if (PlayingList.size() === 0) { |
815 | - player.source = file |
816 | - } |
817 | + player.stop() |
818 | + player.source = Qt.resolvedUrl(file) |
819 | + tracklist.currentIndex = index |
820 | + playing = PlayingList.indexOf(file) |
821 | + console.log("Playing click: "+player.source) |
822 | + console.log("Index: " + tracklist.currentIndex) |
823 | + player.play() |
824 | + playindicator.source = "images/pause.png" |
825 | + } |
826 | + console.log("Source: " + player.source.toString()) |
827 | + console.log("Length: " + length.toString()) |
828 | + playindicator_nowplaying.source = playindicator.source |
829 | + } |
830 | + } |
831 | + Component.onCompleted: { |
832 | + if (PlayingList.size() === 0) { |
833 | + player.source = file |
834 | + } |
835 | |
836 | - if (!PlayingList.contains(file)) { |
837 | - console.log("Adding file:" + file) |
838 | - PlayingList.addItem(file, itemnum) |
839 | - console.log(itemnum) |
840 | - } |
841 | - console.log("Title:" + title + " Artist: " + artist) |
842 | - itemnum++ |
843 | + if (!PlayingList.contains(file)) { |
844 | + console.log("Adding file:" + file) |
845 | + PlayingList.addItem(file, itemnum) |
846 | + console.log(itemnum) |
847 | } |
848 | + console.log("Title:" + title + " Artist: " + artist) |
849 | + itemnum++ |
850 | } |
851 | } |
852 | } |
853 | } |
854 | } |
855 | + |
856 | |
857 | === modified file 'MusicTracks.qml' |
858 | --- MusicTracks.qml 2013-06-16 22:13:15 +0000 |
859 | +++ MusicTracks.qml 2013-06-19 00:02:31 +0000 |
860 | @@ -65,10 +65,8 @@ |
861 | tools: ToolbarActions { |
862 | // Settings dialog |
863 | Action { |
864 | - id: settingsAction |
865 | objectName: "settingsaction" |
866 | iconSource: Qt.resolvedUrl("images/settings@8.png") |
867 | - |
868 | text: i18n.tr("Settings") |
869 | |
870 | onTriggered: { |
871 | @@ -82,9 +80,7 @@ |
872 | |
873 | // Queue dialog |
874 | Action { |
875 | - id: queueAction |
876 | objectName: "queuesaction" |
877 | - |
878 | iconSource: Qt.resolvedUrl("images/folder.png") // change this icon later |
879 | text: i18n.tr("Queue") |
880 | |
881 | |
882 | === modified file 'music-app.qml' |
883 | --- music-app.qml 2013-06-18 11:08:51 +0000 |
884 | +++ music-app.qml 2013-06-19 00:02:31 +0000 |
885 | @@ -276,6 +276,24 @@ |
886 | // tab content |
887 | page: MusicArtists { |
888 | id: musicArtistsPage |
889 | + |
890 | + tools: ToolbarActions { |
891 | + // Queue dialog |
892 | + Action { |
893 | + objectName: "queuesaction" |
894 | + |
895 | + iconSource: Qt.resolvedUrl("images/folder.png") // change this icon later |
896 | + text: i18n.tr("Queue") |
897 | + |
898 | + onTriggered: { |
899 | + console.debug('Debug: Show queue') |
900 | + PopupUtils.open(Qt.resolvedUrl("QueueDialog.qml"), mainView, |
901 | + { |
902 | + title: i18n.tr("Queue") |
903 | + } ) |
904 | + } |
905 | + } |
906 | + } |
907 | } |
908 | } |
909 | |
910 | @@ -289,6 +307,24 @@ |
911 | // Tab content begins here |
912 | page: MusicAlbums { |
913 | id: musicAlbumsPage |
914 | + |
915 | + tools: ToolbarActions { |
916 | + // Queue dialog |
917 | + Action { |
918 | + objectName: "queuesaction" |
919 | + |
920 | + iconSource: Qt.resolvedUrl("images/folder.png") // change this icon later |
921 | + text: i18n.tr("Queue") |
922 | + |
923 | + onTriggered: { |
924 | + console.debug('Debug: Show queue') |
925 | + PopupUtils.open(Qt.resolvedUrl("QueueDialog.qml"), mainView, |
926 | + { |
927 | + title: i18n.tr("Queue") |
928 | + } ) |
929 | + } |
930 | + } |
931 | + } |
932 | } |
933 | } |
934 | |
935 | @@ -302,6 +338,37 @@ |
936 | // Tab content begins here |
937 | page: MusicPlaylists { |
938 | id: musicPlaylistPage |
939 | + |
940 | + tools: ToolbarActions { |
941 | + // import playlist from lastfm |
942 | + Action { |
943 | + objectName: "lastfmplaylistaction" |
944 | + |
945 | + iconSource: Qt.resolvedUrl("images/lastfm.png") |
946 | + text: i18n.tr("Get from Last.fm") |
947 | + |
948 | + onTriggered: { |
949 | + console.debug("Debug: User pressed action to import playlist from lastfm") |
950 | + Scrobble.getPlaylists(Settings.getSetting("lastfmusername")) |
951 | + } |
952 | + } |
953 | + |
954 | + // Queue dialog |
955 | + Action { |
956 | + objectName: "queuesaction" |
957 | + |
958 | + iconSource: Qt.resolvedUrl("images/folder.png") // change this icon later |
959 | + text: i18n.tr("Queue") |
960 | + |
961 | + onTriggered: { |
962 | + console.debug('Debug: Show queue') |
963 | + PopupUtils.open(Qt.resolvedUrl("QueueDialog.qml"), mainView, |
964 | + { |
965 | + title: i18n.tr("Queue") |
966 | + } ) |
967 | + } |
968 | + } |
969 | + } |
970 | } |
971 | } |
972 |
Let's roll!