Merge lp:~danielholm/music-app/settings-sheet into lp:music-app/trusty

Proposed by Daniel Holm
Status: Merged
Approved by: Daniel Holm
Approved revision: 108
Merged at revision: 105
Proposed branch: lp:~danielholm/music-app/settings-sheet
Merge into: lp:music-app/trusty
Diff against target: 827 lines (+335/-309)
9 files modified
LoginLastFM.qml (+40/-88)
MusicAlbums.qml (+4/-0)
MusicArtists.qml (+4/-0)
MusicPlaylists.qml (+5/-1)
MusicSettings.qml (+170/-120)
MusicStart.qml (+100/-93)
MusicTracks.qml (+5/-1)
Style.qml (+4/-0)
music-app.qml (+3/-6)
To merge this branch: bzr merge lp:~danielholm/music-app/settings-sheet
Reviewer Review Type Date Requested Status
Victor Thompson Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+185665@code.launchpad.net

Commit message

New settings and now use Sheets instead.

Description of the change

Based on UX spec, move settings to a Sheet and add some new stuff. Most of the new stuff is disabled for the moment, since they won't fit inside the sheet.

Shuffle should be moved to the new toolbar, and I'm awainting answer on a bug report regarding the Sheet's size, which can not fill parent right now.
https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1224428

Andrew, can you help me with the setting regarding the "Snap to current song"? I've saved it in the settings DB and need to use it.

Also we need to change the color of the sheet later, but since there should be a new Sheet that we should use in the future, I thought we could wait untill then.

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: Approve (continuous-integration)
Revision history for this message
Victor Thompson (vthompson) wrote :

I think there are currently some readability issues (white text on grey background). Could you also make the sheet full sized like the spec?

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

I was going to look up how to change the color, since I dont know how. Regarding the full size, see the bug report above. Resize is not yet possible.

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

Daniel,

You should be able to do the following to get full sized Sheets. Please cancel the bug.

victor@bigdaddy:~/Development/settings-sheet$ bzr diff
=== modified file 'MusicSettings.qml'
--- MusicSettings.qml 2013-09-15 09:33:20 +0000
+++ MusicSettings.qml 2013-09-15 15:54:13 +0000
@@ -27,6 +27,8 @@
 ComposerSheet {
     id: musicSettings
     title: i18n.tr("Settings")
+ contentsHeight: parent.height
+ contentsWidth: parent.width

     onCancelClicked: PopupUtils.close(musicSettings)
     onConfirmClicked: {

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

I think the implementation of "snap to song" can wait for another branch--it might be tricky. BUT, if it's possible I would like you to change the colors such that they are readable.

106. By Daniel Holm

Changed text color in settings.

107. By Daniel Holm

Merge with trunk.

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

Actually, Daniel I think the font issue is an SDK bug. Filemanager filed a bug that was fixed for Popovers that used white text because of the darker Suru colors. It might be best to file a bug similar to the Popover bug: Bug #1205094.

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
Daniel Holm (danielholm) wrote :

The text color is now changed to coolGrey. The bug I was talking about is that Sheets cant fill the window.

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

Did you see my other comment? The Sheet not filling the parent is not a bug, use contentsHeight and contentsWidth. The Sheet not using the proper text color IS an SDK bug. We *should* be diligent and file said bug.

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

What?! ahah, it works! Thanks, mate. That really drove me crazy. So that bug is wrong..

Sure, that bug should probalby be filed.

108. By Daniel Holm

Sheet now fills parent.

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

Now fills window. I'll report that bug. But I don't think we should wait until a fix is released.

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
Victor Thompson (vthompson) wrote :

Ok, feel free to top approve when you think this is ready. You might want to 1) work around the font colors for the remaining items on the sheet and 2) document the SDK bug you file in the code that works around the bug.

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

Lovely, thanks.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'LoginLastFM.qml'
2--- LoginLastFM.qml 2013-07-28 22:18:52 +0000
3+++ LoginLastFM.qml 2013-09-15 20:50:07 +0000
4@@ -29,15 +29,22 @@
5 import "scrobble.js" as Scrobble
6
7 // LastFM login dialog
8-Dialog {
9+DefaultSheet {
10 id: lastfmroot
11 anchors.fill: parent
12
13+ onDoneClicked: PopupUtils.close(lastfmroot)
14+
15 // Dialog data
16 title: i18n.tr("LastFM")
17- text: i18n.tr("Login to be able to scrobble.")
18-
19- Row {
20+
21+ Column {
22+ spacing: units.gu(2)
23+
24+ Label {
25+ text: i18n.tr("Login to be able to scrobble.")
26+ }
27+
28 // Username field
29 TextField {
30 id: usernameField
31@@ -45,11 +52,9 @@
32 hasClearButton: true
33 placeholderText: i18n.tr("Username")
34 text: lastfmusername
35- width: units.gu(30)
36+ width: units.gu(48)
37 }
38- }
39
40- Row {
41 // add password field
42 TextField {
43 id: passField
44@@ -58,81 +63,32 @@
45 placeholderText: i18n.tr("Password")
46 text: lastfmpassword
47 echoMode: TextInput.Password
48- width: units.gu(30)
49+ width: units.gu(48)
50 }
51- }
52
53- Row {
54 // indicate progress of login
55 ActivityIndicator {
56 id: activity
57+ visible: false
58 }
59
60 // item to present login result
61 ListItem.Standard {
62 id: loginstatetext
63- }
64-
65- // Model to send the data
66- XmlListModel {
67- id: lastfmlogin
68- query: "/"
69-
70- function rpcRequest(request,handler) {
71- console.debug("Debug: Starting to send user credentials")
72- var http = new XMLHttpRequest()
73-
74- http.open("POST",Scrobble.scrobble_url,true)
75- http.setRequestHeader("User-Agent", "Music-App/"+appVersion)
76- http.setRequestHeader("Content-type", "text/xml")
77- http.setRequestHeader("Content-length", request.length)
78- http.setRequestHeader("Connection", "close")
79- http.onreadystatechange = function() {
80- if(http.readyState == 4 && http.status == 200) {
81- console.debug("Debug: XmlRpc::rpcRequest.onreadystatechange()")
82- handler(http.responseText)
83- }
84- }
85- http.send(request)
86- }
87-
88- function callHandler(response) {
89- xml = response
90- }
91-
92- function call(cmd,params) {
93- console.debug("Debug: XmlRpc.call(",cmd,params,")")
94- var request = ""
95- request += "<?xml version='1.0'?>"
96- request += "<methodCall>"
97- request += "<methodName>" + cmd + "</methodName>"
98- request += "<params>"
99- for (var i=0; i<params.length; i++) {
100- request += "<param><value>"
101- if (typeof(params[i])=="string") {
102- request += "<string>" + params[i] + "</string>"
103- }
104- if (typeof(params[i])=="number") {
105- request += "<int>" + params[i] + "</int>"
106- }
107- request += "</value></param>"
108- }
109- request += "</params>"
110- request += "</methodCall>"
111- rpcRequest(request,callHandler)
112- }
113- }
114- }
115-
116- // Login button
117- Row {
118+ visible: false
119+ }
120+
121+ // Login button
122 Button {
123 id: loginButton
124- width: units.gu(30)
125- text: "Login"
126- color: "#c94212"
127+ width: units.gu(48)
128+ text: i18n.tr("Login")
129+ enabled: false
130+
131 onClicked: {
132+ activity.visible = true
133 activity.running = !activity.running // change the activity indicator state
134+ loginstatetext.visible = true
135 loginstatetext.text = i18n.tr("Trying to login...")
136 Settings.initialize()
137 console.debug("Debug: Login to LastFM clicked.")
138@@ -140,12 +96,23 @@
139 Settings.setSetting("lastfmusername", usernameField.text) // save lastfm username
140 Settings.setSetting("lastfmpassword", passField.text) // save lastfm password (should be passed by ha hash function)
141 lastfmusername = Settings.getSetting("lastfmusername") // get username again
142- lastfmpassword = Settings.getSetting("lastfmpassword") // get password again
143+ lastfmpassword = Settings.getSetting("lastfmpassword") // get password again, for use during the rest of the session
144 if (usernameField.text.length > 0 && passField.text.length > 0) { // make sure something is acually inputed
145- console.debug("Debug: Sending credentials to authentication function")
146- var signature = Scrobble.authenticate(usernameField.text, passField.text); // pass the data to authenticate
147- //lastfmlogin.model
148- //lastfmlogin.construct()
149+ console.debug("Debug: Sending credentials to authentication function");
150+ var answer = Scrobble.authenticate(usernameField.text, passField.text) // pass credentials to login function
151+
152+ // Print result to user
153+ if (answer == "ok") {
154+ loginstatetext.text = i18n.tr("Login Successful")
155+ activity.running = !activity.running // change the activity indicator state
156+ //loginButton.text = "Log out" // later
157+ Settings.setSetting("lastfmsessionkey",Scrobble.session_key)
158+ }
159+ else {
160+ loginstatetext.text = i18n.tr("Login Failed")
161+ activity.running = !activity.running // change the activity indicator state
162+ }
163+
164 }
165 else {
166 loginstatetext.text = i18n.tr("You forgot to set your username and/or password")
167@@ -153,19 +120,4 @@
168 }
169 }
170 }
171-
172- // cancel Button
173- Row {
174- Button {
175- id: cancelButton
176- width: units.gu(30)
177- text: i18n.tr("Close")
178- onClicked: {
179- PopupUtils.close(lastfmroot)
180- }
181- }
182- }
183 }
184-
185-
186-
187
188=== modified file 'MusicAlbums.qml'
189--- MusicAlbums.qml 2013-09-01 17:50:24 +0000
190+++ MusicAlbums.qml 2013-09-15 20:50:07 +0000
191@@ -31,6 +31,10 @@
192 id: pageStack
193 anchors.fill: parent
194
195+ MusicSettings {
196+ id: musicSettings
197+ }
198+
199 Page {
200 id: mainpage
201 title: i18n.tr("Albums")
202
203=== modified file 'MusicArtists.qml'
204--- MusicArtists.qml 2013-09-01 17:50:24 +0000
205+++ MusicArtists.qml 2013-09-15 20:50:07 +0000
206@@ -31,6 +31,10 @@
207 id: pageStack
208 anchors.fill: parent
209
210+ MusicSettings {
211+ id: musicSettings
212+ }
213+
214 Page {
215 id: mainpage
216 title: i18n.tr("Artists")
217
218=== modified file 'MusicPlaylists.qml'
219--- MusicPlaylists.qml 2013-09-02 21:39:46 +0000
220+++ MusicPlaylists.qml 2013-09-15 20:50:07 +0000
221@@ -165,6 +165,10 @@
222 playlist.forEach(addtoPlaylistModel) // send each item on playlist array to the model to show it
223 }
224
225+ MusicSettings {
226+ id: musicSettings
227+ }
228+
229 // page for the playlists
230 Page {
231 id: listspage
232@@ -247,7 +251,7 @@
233 text: i18n.tr("Settings")
234
235 onTriggered: {
236- console.debug('Debug: Show settings')
237+ console.debug('Debug: Show settings from Playlists')
238 PopupUtils.open(Qt.resolvedUrl("MusicSettings.qml"), mainView,
239 {
240 title: i18n.tr("Settings")
241
242=== modified file 'MusicSettings.qml'
243--- MusicSettings.qml 2013-07-28 22:18:52 +0000
244+++ MusicSettings.qml 2013-09-15 20:50:07 +0000
245@@ -1,6 +1,7 @@
246 /*
247- * Copyright (C) 2013 Victor Thompson <victor.thompson@gmail.com>
248+ * Copyright (C) 2013 Andrew Hayzen <ahayzen@gmail.com>
249 * Daniel Holm <d.holmen@gmail.com>
250+ * Victor Thompson <victor.thompson@gmail.com>
251 *
252 * This program is free software; you can redistribute it and/or modify
253 * it under the terms of the GNU General Public License as published by
254@@ -22,133 +23,182 @@
255 import QtQuick.LocalStorage 2.0
256 import "settings.js" as Settings
257 import "scrobble.js" as Scrobble
258-import "playlists.js" as Playlists
259-import "meta-database.js" as Library
260-
261-Dialog {
262- id: root
263-
264-// Row {
265-// spacing: units.gu(2)
266-// Button {
267-// id: selectdirectory
268-// text: i18n.tr("Select Music folder")
269-// width: units.gu(30)
270-// color: "#c94212"
271-// onClicked: {
272-// folderScannerModel.nameFilters = [""]
273-// console.debug('Debug: Show settings')
274-// pageStack.push(Qt.resolvedUrl("LibraryLoader.qml"))
275-// PopupUtils.close(root)
276-// }
277-// }
278-// }
279-
280- // Shuffle or not
281- Row {
282- spacing: units.gu(2)
283- Label {
284- text: i18n.tr("Shuffle")
285- width: units.gu(20)
286- color: "white"
287- }
288- Switch {
289- id: shuffleSwitch
290- checked: Settings.getSetting("shuffle") === "1"
291- }
292- }
293-
294- // lastfm
295- Row {
296- spacing: units.gu(2)
297- Label {
298- text: i18n.tr("Scrobble to Last.FM")
299- width: units.gu(20)
300- color: "white"
301- }
302- Switch {
303- id: scrobbleSwitch
304- checked: Settings.getSetting("scrobble") === "1"
305- }
306- }
307-
308- Row {
309- spacing: units.gu(2)
310- Button {
311- id: lastfmLogin
312- text: i18n.tr("Login to last.fm")
313- width: units.gu(30)
314- color: "#c94212"
315- enabled: Settings.getSetting("scrobble") === "1" // only if scrobble is activated.
316+
317+ComposerSheet {
318+ id: musicSettings
319+ title: i18n.tr("Settings")
320+ contentsHeight: parent.height;
321+
322+ onCancelClicked: PopupUtils.close(musicSettings)
323+ onConfirmClicked: {
324+ PopupUtils.close(musicSettings)
325+ console.debug("Debug: Save settings")
326+ Settings.initialize()
327+
328+ // Equaliser
329+ // ACTIVATE IN 1.+ Settings.setSetting("eqialiser",equaliser.index)
330+
331+ // snap track
332+ Settings.setSetting("snaptrack",snapSwitch.checked)
333+
334+ // ACCOUNTS
335+ // Last.fm
336+
337+ // MUSIC STREAMING
338+ // Ubuntu one
339+ /* READY THIS LATER IN 1.+
340+ if (ubuntuaccount === activated) {
341+ Settings.setSetting("wifiswitch",wifiSwitch.checked)
342+ }*/
343+
344+
345+ // MOVE TO TOOLBAR
346+ Settings.setSetting("shuffle", shuffleSwitch.checked) // save shuffle state
347+
348+ // -- random = shuffleSwitch.checked // set shuffle state variable
349+ //console.debug("Debug: Shuffle: "+ shuffleSwitch.checked)
350+
351+ // MOVE TO scrobble Settings.setSetting("scrobble", scrobbleSwitch.checked) // save shuffle state
352+ //scrobble = scrobbleSwitch.checked // set scrobble state variable
353+ //console.debug("Debug: Scrobble: "+ scrobbleSwitch.checked)
354+ }
355+
356+ Column {
357+ spacing: units.gu(2)
358+
359+ // Activate in 1.+
360+ ListItem.ItemSelector {
361+ id: equaliser
362+ enabled: false
363+ text: i18n.tr("Equaliser")
364+ model: [i18n.tr("Accoustic"),
365+ i18n.tr("Classical"),
366+ i18n.tr("Electronic"),
367+ i18n.tr("Flat"),
368+ i18n.tr("Hip Hop"),
369+ i18n.tr("Jazz"),
370+ i18n.tr("Metal"),
371+ i18n.tr("Pop"),
372+ i18n.tr("Rock"),
373+ i18n.tr("Custom")]
374+ onDelegateClicked: {
375+ customdebug("Value changed to "+index)
376+ //equaliserChange(index)
377+ }
378+ }
379+
380+ // Snap to current track
381+ Row {
382+ spacing: units.gu(2)
383+ Label {
384+ text: i18n.tr("Snap to current song \nwhen opening toolbar")
385+ color: styleMusic.musicSettings.labelColor
386+ width: units.gu(35)
387+ }
388+ Switch {
389+ id: snapSwitch
390+ checked: Settings.getSetting("snaptrack") === "1"
391+ }
392+ }
393+
394+ // Shuffle or not
395+ // MOVE THIS TO NEW TOOLBAR
396+ Row {
397+ spacing: units.gu(2)
398+ Label {
399+ text: i18n.tr("Shuffle")
400+ color: styleMusic.musicSettings.labelColor
401+ width: units.gu(35)
402+ }
403+ Switch {
404+ id: shuffleSwitch
405+ checked: Settings.getSetting("shuffle") === "1"
406+ }
407+ }
408+
409+ // Accounts
410+ Label {
411+ text: i18n.tr("Accounts")
412+ color: styleMusic.musicSettings.labelColor
413+ }
414+
415+ // lastfm
416+ ListItem.Subtitled {
417+ id: lasftfmProg
418+ text: i18n.tr("Last.fm")
419+ subText: i18n.tr("Login to scrobble and \nimport playlists")
420+ progression: true
421+ enabled: false
422 onClicked: {
423 PopupUtils.open(Qt.resolvedUrl("LoginLastFM.qml"), mainView,
424 {
425 title: i18n.tr("Last.fm")
426 } )
427- }
428- }
429- }
430-
431- // import playlists from lastfm
432- Row {
433- spacing: units.gu(2)
434+ PopupUtils.close(musicSettings)
435+ }
436+ }
437+
438+ // Music Streaming
439+ // Activate in 1.+
440+ Label {
441+ text: i18n.tr("Music Streaming")
442+ color: styleMusic.musicSettings.labelColor
443+ }
444+
445+ Column {
446+ ListItem.Subtitled {
447+ id: musicStreamProg
448+ text: i18n.tr("Ubuntu One")
449+ subText: i18n.tr("Sign in to stream your cloud music")
450+ enabled: false
451+ progression: true
452+ onClicked: {
453+ customdebug("I'm Ron Burgendy...?")
454+ }
455+ }
456+
457+ Row {
458+ spacing: units.gu(20)
459+ Label {
460+ text: i18n.tr("Stream only on Wi-Fi")
461+ color: styleMusic.musicSettings.labelColor
462+ enabled: false // check if account is connected
463+ }
464+ Switch {
465+ id: wifiSwitch
466+ checked: Settings.getSetting("wifiswitch") === "1"
467+ enabled: false // check if account is connected
468+ }
469+ }
470+ }
471+
472+ /* MOVE THIS STUFF
473+ // import playlists from lastfm
474+ Row {
475+ spacing: units.gu(2)
476+ Button {
477+ id: lastfmPlaylists
478+ text: i18n.tr("Import playlists from last.fm")
479+ width: units.gu(30)
480+ color: "#c94212"
481+ enabled: Settings.getSetting("scrobble") === "1" // only if scrobble is activated.
482+ onClicked: {
483+ console.debug("Debug: import playlists from last.fm")
484+ Scrobble.getPlaylists(Settings.getSetting("lastfmusername"))
485+ }
486+ }
487+ } */
488+
489+ // developer button - KILLS YOUR CAT!
490 Button {
491- id: lastfmPlaylists
492- text: i18n.tr("Import playlists from last.fm")
493- width: units.gu(30)
494- color: "#c94212"
495- enabled: Settings.getSetting("scrobble") === "1" // only if scrobble is activated.
496+ text: i18n.tr("Clean everything!")
497+ color: "red"
498+ visible: false
499 onClicked: {
500- console.debug("Debug: import playlists from last.fm")
501- Scrobble.getPlaylists(Settings.getSetting("lastfmusername"))
502+ Settings.reset()
503+ Library.reset()
504+ Playlists.reset()
505 }
506 }
507 }
508-
509- // headphones
510- Row {
511- spacing: units.gu(2)
512- Label {
513- text: i18n.tr("Pause when when headphones are un-plugged.")
514- width: units.gu(20)
515- wrapMode: "WordWrap"
516- color: "white"
517- }
518- Switch {
519- checked: true
520- enabled: false
521- }
522- }
523-
524- // developer button
525- /*Button {
526- text: i18n.tr("Clean everything!")
527- color: "red"
528- onClicked: {
529- Settings.reset()
530- Library.reset()
531- Playlists.reset()
532- }
533- }*/
534-
535- Button {
536- text: i18n.tr("Close")
537- onClicked: {
538- PopupUtils.close(root)
539- console.debug("Debug: Close settings")
540- // push infront the tracks again
541- // set new music dir
542- Settings.initialize()
543- //Settings.setSetting("currentfolder", musicDirField.text) // save music dir
544- Settings.setSetting("shuffle", shuffleSwitch.checked) // save shuffle state
545- Settings.setSetting("scrobble", scrobbleSwitch.checked) // save shuffle state
546- random = shuffleSwitch.checked // set shuffle state variable
547- scrobble = scrobbleSwitch.checked // set scrobble state variable
548- // set function to set and load tracks in new map directly, whithout need of restart
549- // disable fpr now (testing) console.debug("Debug: Set new music dir to: "+musicDirField.text)
550- console.debug("Debug: Shuffle: "+ shuffleSwitch.checked)
551- console.debug("Debug: Scrobble: "+ scrobbleSwitch.checked)
552- }
553- }
554-
555 }
556
557=== modified file 'MusicStart.qml'
558--- MusicStart.qml 2013-08-30 17:21:05 +0000
559+++ MusicStart.qml 2013-09-15 20:50:07 +0000
560@@ -28,97 +28,104 @@
561 import "meta-database.js" as Library
562 import "playlists.js" as Playlists
563
564-
565-Page {
566- id: mainpage
567-
568- tools: ToolbarItems {
569- // Settings dialog
570- ToolbarButton {
571- objectName: "settingsaction"
572- iconSource: Qt.resolvedUrl("images/settings.png")
573- text: i18n.tr("Settings")
574-
575- onTriggered: {
576- console.debug('Debug: Show settings')
577- PopupUtils.open(Qt.resolvedUrl("MusicSettings.qml"), mainView,
578- {
579- title: i18n.tr("Settings")
580- } )
581- }
582- }
583- }
584-
585- title: i18n.tr("Music")
586-
587- ListItem.Standard {
588- id: recentlyPlayed
589- text: "Recently Played"
590- }
591-
592- ListView {
593- id: recentlist
594- width: parent.width
595- anchors.top: recentlyPlayed.bottom
596- //anchors.bottom: genres.top
597- spacing: units.gu(2)
598- height: units.gu(13)
599- // TODO: Update when view counts are collected
600- model: albumModel.model
601- delegate: recentDelegate
602- orientation: ListView.Horizontal
603-
604- Component {
605- id: recentDelegate
606- Item {
607- id: recentItem
608- height: units.gu(13)
609- width: units.gu(13)
610- UbuntuShape {
611- id: recentShape
612- height: recentItem.width
613- width: recentItem.width
614- image: Image {
615- id: icon
616- fillMode: Image.Stretch
617- property string artist: model.artist
618- property string album: model.album
619- property string title: model.title
620- property string cover: model.cover
621- property string length: model.length
622- property string file: model.file
623- property string year: model.year
624- source: cover === "" ? Qt.resolvedUrl("images/cover_default.png") : "image://cover-art-full/"+file
625- }
626- }
627- MouseArea {
628- anchors.fill: parent
629- onClicked: {
630- recentAlbumTracksModel.filterAlbumTracks(album)
631- trackQueue.model.clear()
632- addQueueFromModel(recentAlbumTracksModel)
633- currentModel = recentAlbumTracksModel
634- currentQuery = recentAlbumTracksModel.query
635- currentParam = recentAlbumTracksModel.param
636- var file = trackQueue.model.get(0).file
637- currentIndex = trackQueue.indexOf(file)
638- queueChanged = true
639- player.stop()
640- player.source = Qt.resolvedUrl(file)
641- player.play()
642- nowPlaying.visible = true
643- }
644- }
645- }
646- }
647- }
648-
649- ListItem.Standard {
650- id: genres
651- anchors.top: recentlist.bottom
652- text: "Genres"
653- }
654-
655- // TODO: add music genres. frequency of play? most tracks?
656-
657+PageStack {
658+ id: pageStack
659+
660+ MusicSettings {
661+ id: musicSettings
662+ }
663+
664+ Page {
665+ id: mainpage
666+
667+ tools: ToolbarItems {
668+ // Settings dialog
669+ ToolbarButton {
670+ objectName: "settingsaction"
671+ iconSource: Qt.resolvedUrl("images/settings.png")
672+ text: i18n.tr("Settings")
673+
674+ onTriggered: {
675+ console.debug('Debug: Show settings from start page')
676+ PopupUtils.open(Qt.resolvedUrl("MusicSettings.qml"), mainView,
677+ {
678+ title: i18n.tr("Settings")
679+ } )
680+ }
681+ }
682+ }
683+
684+ title: i18n.tr("Music")
685+
686+ ListItem.Standard {
687+ id: recentlyPlayed
688+ text: "Recently Played"
689+ }
690+
691+ ListView {
692+ id: recentlist
693+ width: parent.width
694+ anchors.top: recentlyPlayed.bottom
695+ //anchors.bottom: genres.top
696+ spacing: units.gu(2)
697+ height: units.gu(13)
698+ // TODO: Update when view counts are collected
699+ model: albumModel.model
700+ delegate: recentDelegate
701+ orientation: ListView.Horizontal
702+
703+ Component {
704+ id: recentDelegate
705+ Item {
706+ id: recentItem
707+ height: units.gu(13)
708+ width: units.gu(13)
709+ UbuntuShape {
710+ id: recentShape
711+ height: recentItem.width
712+ width: recentItem.width
713+ image: Image {
714+ id: icon
715+ fillMode: Image.Stretch
716+ property string artist: model.artist
717+ property string album: model.album
718+ property string title: model.title
719+ property string cover: model.cover
720+ property string length: model.length
721+ property string file: model.file
722+ property string year: model.year
723+ source: cover === "" ? Qt.resolvedUrl("images/cover_default.png") : "image://cover-art-full/"+file
724+ }
725+ }
726+ MouseArea {
727+ anchors.fill: parent
728+ onClicked: {
729+ recentAlbumTracksModel.filterAlbumTracks(album)
730+ trackQueue.model.clear()
731+ addQueueFromModel(recentAlbumTracksModel)
732+ currentModel = recentAlbumTracksModel
733+ currentQuery = recentAlbumTracksModel.query
734+ currentParam = recentAlbumTracksModel.param
735+ var file = trackQueue.model.get(0).file
736+ currentIndex = trackQueue.indexOf(file)
737+ queueChanged = true
738+ player.stop()
739+ player.source = Qt.resolvedUrl(file)
740+ player.play()
741+ nowPlaying.visible = true
742+ }
743+ }
744+ }
745+ }
746+ }
747+
748+ ListItem.Standard {
749+ id: genres
750+ anchors.top: recentlist.bottom
751+ text: "Genres"
752+ }
753+
754+ // TODO: add music genres. frequency of play? most tracks?
755+
756+ }
757 }
758
759=== modified file 'MusicTracks.qml'
760--- MusicTracks.qml 2013-09-11 12:22:52 +0000
761+++ MusicTracks.qml 2013-09-15 20:50:07 +0000
762@@ -32,6 +32,10 @@
763 id: pageStack
764 anchors.fill: parent
765
766+ MusicSettings {
767+ id: musicSettings
768+ }
769+
770 Page {
771 id: mainpage
772
773@@ -43,7 +47,7 @@
774 text: i18n.tr("Settings")
775
776 onTriggered: {
777- console.debug('Debug: Show settings')
778+ console.debug('Debug: Show settings from tracks')
779 PopupUtils.open(Qt.resolvedUrl("MusicSettings.qml"), mainView,
780 {
781 title: i18n.tr("Settings")
782
783=== modified file 'Style.qml'
784--- Style.qml 2013-09-02 22:53:45 +0000
785+++ Style.qml 2013-09-15 20:50:07 +0000
786@@ -73,4 +73,8 @@
787 property color progressForegroundColor: UbuntuColors.orange;
788 property color progressHandleColor: common.white;
789 }
790+
791+ property QtObject musicSettings: QtObject {
792+ property color labelColor: UbuntuColors.coolGrey;
793+ }
794 }
795
796=== modified file 'music-app.qml'
797--- music-app.qml 2013-09-11 23:35:44 +0000
798+++ music-app.qml 2013-09-15 20:50:07 +0000
799@@ -1,6 +1,7 @@
800 /*
801- * Copyright (C) 2013 Victor Thompson <victor.thompson@gmail.com>
802+ * Copyright (C) 2013 Andrew Hayzen <ahayzen@gmail.com>
803 * Daniel Holm <d.holmen@gmail.com>
804+ * Victor Thompson <victor.thompson@gmail.com>
805 *
806 * This program is free software; you can redistribute it and/or modify
807 * it under the terms of the GNU General Public License as published by
808@@ -74,10 +75,7 @@
809 keywords: i18n.tr("Music Settings")
810 onTriggered: {
811 customdebug('Show settings')
812- PopupUtils.open(Qt.resolvedUrl("MusicSettings.qml"), mainView,
813- {
814- title: i18n.tr("Settings")
815- } )
816+ musicSettings.visible = true
817 }
818 }
819 Action {
820@@ -1026,7 +1024,6 @@
821 MusicaddtoPlaylist {
822 id: addtoPlaylist
823 }
824-
825 // Converts an duration in ms to a formated string ("minutes:seconds")
826 function __durationToString(duration) {
827 var minutes = Math.floor((duration/1000) / 60);

Subscribers

People subscribed via source and target branches

to status/vote changes: