Merge lp:~vthompson/music-app/remix-do-not-switch-to-full-view into lp:music-app/trusty

Proposed by Victor Thompson
Status: Superseded
Proposed branch: lp:~vthompson/music-app/remix-do-not-switch-to-full-view
Merge into: lp:music-app/trusty
Diff against target: 4405 lines (+1477/-1625) (has conflicts)
24 files modified
MusicAlbums.qml (+21/-123)
MusicArtists.qml (+3/-2)
MusicNowPlaying.qml (+323/-26)
MusicPlaylists.qml (+3/-2)
MusicSettings.qml (+0/-11)
MusicToolbar.qml (+169/-951)
MusicTracks.qml (+3/-2)
MusicaddtoPlaylist.qml (+0/-1)
Player.qml (+5/-1)
Style.qml (+2/-2)
com.ubuntu.music_music.desktop.in.in (+3/-0)
common/AlbumsPage.qml (+0/-2)
common/BlurredBackground.qml (+11/-9)
common/Card.qml (+157/-0)
common/CardView.qml (+41/-0)
common/ColumnFlow.qml (+159/-0)
common/MusicPage.qml (+4/-0)
common/MusicRow.qml (+7/-4)
common/SongsPage.qml (+142/-119)
music-app.qml (+24/-30)
po/com.ubuntu.music.pot (+69/-59)
po/pt_BR.po (+172/-154)
tests/autopilot/music_app/__init__.py (+99/-81)
tests/autopilot/music_app/tests/test_music.py (+60/-46)
Text conflict in po/pt_BR.po
To merge this branch: bzr merge lp:~vthompson/music-app/remix-do-not-switch-to-full-view
Reviewer Review Type Date Requested Status
Music App Developers Pending
Review via email: mp+237712@code.launchpad.net

This proposal has been superseded by a proposal from 2014-10-09.

Commit message

Do not switch to full view if clicking a song in the queue.

Description of the change

Commit #656 had a regression in that when an item in the queue is clicked, the view now switches to the Now Playing full view. This is incorrect, it should stay at the current view.

To post a comment you must log in.

Unmerged revisions

657. By Victor Thompson

Do not switch to full view if clicking a song in the queue.

656. By Andrew Hayzen

* From the toolbar always jump to full view (eg if toolbar is selected in queue view jump to full).

Approved by Ubuntu Phone Apps Jenkins Bot, Victor Thompson.

655. By Andrew Hayzen

* Remove legacy toolbar code
* Make full (non listview) now playing default
* Fix header disappearing in full now playing.

Approved by Victor Thompson, Ubuntu Phone Apps Jenkins Bot.

654. By Victor Thompson

* Use model.art property in AlbumsPage. Fixes: https://bugs.launchpad.net/bugs/1378157.

Approved by Andrew Hayzen, Ubuntu Phone Apps Jenkins Bot.

653. By Andrew Hayzen

* Add CardView and Card
* Implement in Albums tab.

Approved by Victor Thompson, Ubuntu Phone Apps Jenkins Bot.

652. By Victor Thompson

* Make the Ubuntu Slider leftColor UbuntuColors.blue.

Approved by Andrew Hayzen, Ubuntu Phone Apps Jenkins Bot.

651. By Victor Thompson

* Fix elide in Songs Page header
* Fix elide in MusicRow for Songs Page items.

Approved by Andrew Hayzen, Ubuntu Phone Apps Jenkins Bot.

650. By Victor Thompson

Used new desktop entries to show a fake application page during the startup. Fixes: https://bugs.launchpad.net/bugs/1377638.

Approved by Andrew Hayzen, Ubuntu Phone Apps Jenkins Bot.

649. By Launchpad Translations on behalf of music-app-dev

Launchpad automatic translations update.

648. By Victor Thompson

Initial Now Playing toggle.

Approved by Ubuntu Phone Apps Jenkins Bot, Andrew Hayzen.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'MusicAlbums.qml'
--- MusicAlbums.qml 2014-09-20 15:41:33 +0000
+++ MusicAlbums.qml 2014-10-09 02:19:53 +0000
@@ -19,37 +19,17 @@
1919
20import QtQuick 2.320import QtQuick 2.3
21import Ubuntu.Components 1.121import Ubuntu.Components 1.1
22import Ubuntu.Components.Popups 1.0
23import Ubuntu.MediaScanner 0.122import Ubuntu.MediaScanner 0.1
24import Ubuntu.Thumbnailer 0.1
25import QtMultimedia 5.0
26import QtQuick.LocalStorage 2.0
27import QtGraphicalEffects 1.0
28import "settings.js" as Settings
29import "playlists.js" as Playlists
30import "common"23import "common"
3124
25
32MusicPage {26MusicPage {
33 id: mainpage27 id: albumsPage
34 objectName: "albumsPage"28 objectName: "albumsPage"
35 title: i18n.tr("Albums")29 title: i18n.tr("Albums")
3630
37 // TODO: This ListView is empty and causes the header to get painted with the desired background color because the31 CardView {
38 // page is now vertically flickable.32 id: albumCardView
39 ListView {
40 anchors.fill: parent
41 anchors.bottomMargin: musicToolbar.mouseAreaOffset + musicToolbar.minimizedHeight
42 }
43
44 GridView {
45 id: albumlist
46 anchors.fill: parent
47 anchors.leftMargin: units.gu(1)
48 anchors.top: parent.top
49 anchors.topMargin: mainView.header.height + units.gu(1)
50 anchors.bottomMargin: units.gu(1)
51 cellHeight: height/3
52 cellWidth: height/3
53 model: SortFilterModel {33 model: SortFilterModel {
54 id: albumsModelFilter34 id: albumsModelFilter
55 property alias rowCount: albumsModel.rowCount35 property alias rowCount: albumsModel.rowCount
@@ -60,106 +40,24 @@
60 sort.property: "title"40 sort.property: "title"
61 sort.order: Qt.AscendingOrder41 sort.order: Qt.AscendingOrder
62 }42 }
6343 delegate: Card {
64 delegate: albumDelegate44 id: albumCard
65 flow: GridView.TopToBottom45 imageSource: model.art
6646 objectName: "albumsPageGridItem" + index
67 Component {47 primaryText: model.title
68 id: albumDelegate48 secondaryText: model.artist
69 Item {49
70 property string artist: model.artist50 onClicked: {
71 property string album: model.title51 songsPage.album = model.title;
72 property var covers: [{art: model.art}]52 songsPage.covers = [{art: model.art}]
7353 songsPage.genre = undefined
74 id: albumItem54 songsPage.isAlbum = true
75 height: albumlist.cellHeight - units.gu(1)55 songsPage.line1 = model.artist
76 objectName: "albumsPageGridItem" + index56 songsPage.line2 = model.title
77 width: albumlist.cellHeight - units.gu(1)57 songsPage.title = i18n.tr("Album")
78 anchors.margins: units.gu(1)58
7959 mainPageStack.push(songsPage)
80 CoverRow {
81 id: albumShape
82 anchors {
83 top: parent.top
84 left: parent.left
85 verticalCenter: parent.verticalCenter
86 }
87 count: albumItem.covers.length
88 size: albumItem.width
89 covers: albumItem.covers
90 spacing: units.gu(2)
91 }
92 Item { // Background so can see text in current state
93 id: albumBg
94 anchors {
95 bottom: parent.bottom
96 left: parent.left
97 right: parent.right
98 }
99 height: units.gu(6)
100 clip: true
101 UbuntuShape{
102 anchors {
103 bottom: parent.bottom
104 left: parent.left
105 right: parent.right
106 }
107 height: albumShape.height
108 radius: "medium"
109 color: styleMusic.common.black
110 opacity: 0.6
111 }
112 }
113 Label {
114 id: albumArtist
115 objectName: "albums-albumartist"
116 anchors.bottom: parent.bottom
117 anchors.bottomMargin: units.gu(1)
118 anchors.left: parent.left
119 anchors.leftMargin: units.gu(1)
120 anchors.right: parent.right
121 anchors.rightMargin: units.gu(1)
122 color: styleMusic.common.white
123 elide: Text.ElideRight
124 text: model.artist
125 fontSize: "x-small"
126 }
127 Label {
128 id: albumLabel
129 anchors.bottom: parent.bottom
130 anchors.bottomMargin: units.gu(3)
131 anchors.left: parent.left
132 anchors.leftMargin: units.gu(1)
133 anchors.right: parent.right
134 anchors.rightMargin: units.gu(1)
135 color: styleMusic.common.white
136 elide: Text.ElideRight
137 text: model.title
138 fontSize: "small"
139 font.weight: Font.DemiBold
140 }
141
142
143 MouseArea {
144 anchors.fill: parent
145 onClicked: {
146 songsPage.album = model.title;
147 songsPage.covers = [{art: model.art}]
148 songsPage.genre = undefined
149 songsPage.isAlbum = true
150 songsPage.line1 = model.artist
151 songsPage.line2 = model.title
152 songsPage.title = i18n.tr("Album")
153
154 mainPageStack.push(songsPage)
155 }
156
157 // TODO: If http://pad.lv/1354753 is fixed to expose whether the Shape should appear pressed, update this as well.
158 onPressedChanged: albumShape.pressed = pressed
159 }
160 }60 }
161 }61 }
162 }62 }
163}63}
164
165
16664
=== modified file 'MusicArtists.qml'
--- MusicArtists.qml 2014-09-20 15:41:33 +0000
+++ MusicArtists.qml 2014-10-09 02:19:53 +0000
@@ -38,8 +38,9 @@
3838
39 ListView {39 ListView {
40 id: artistlist40 id: artistlist
41 anchors.fill: parent41 anchors {
42 anchors.bottomMargin: musicToolbar.mouseAreaOffset + musicToolbar.minimizedHeight42 fill: parent
43 }
43 model: ArtistsModel {44 model: ArtistsModel {
44 id: artistsModel45 id: artistsModel
45 albumArtists: true46 albumArtists: true
4647
=== modified file 'MusicNowPlaying.qml'
--- MusicNowPlaying.qml 2014-09-20 15:41:33 +0000
+++ MusicNowPlaying.qml 2014-10-09 02:19:53 +0000
@@ -17,7 +17,6 @@
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */18 */
1919
20
21import QtMultimedia 5.020import QtMultimedia 5.0
22import QtQuick 2.321import QtQuick 2.3
23import QtQuick.LocalStorage 2.022import QtQuick.LocalStorage 2.0
@@ -29,23 +28,36 @@
2928
30MusicPage {29MusicPage {
31 id: nowPlaying30 id: nowPlaying
31 flickable: isListView ? queuelist : null // Ensures that the header is shown in fullview
32 objectName: "nowPlayingPage"32 objectName: "nowPlayingPage"
33 title: i18n.tr("Now Playing")33 title: i18n.tr("Now Playing")
34 visible: false34 visible: false
3535
36 property int ensureVisibleIndex: 0 // ensure first index is visible at startup36 property int ensureVisibleIndex: 0 // ensure first index is visible at startup
3737 property bool isListView: false
38 Rectangle {38
39 anchors.fill: parent39 head.backAction: Action {
40 color: styleMusic.nowPlaying.backgroundColor40 iconName: "back";
41 opacity: 0.75 // change later41 objectName: "backButton"
42 MouseArea { // Block events to lower layers42 onTriggered: {
43 anchors.fill: parent43 mainPageStack.pop();
44
45 while (mainPageStack.depth > 1) { // jump back to the tab layer if via SongsPage
46 mainPageStack.pop();
47 }
44 }48 }
45 }49 }
4650
47 Component.onCompleted: {51 head {
48 onToolbarShownChanged.connect(jumpToCurrent)52 actions: [
53 Action {
54 objectName: "toggleView"
55 iconName: "media-playlist"
56 onTriggered: {
57 isListView = !isListView
58 }
59 }
60 ]
49 }61 }
5062
51 Connections {63 Connections {
@@ -59,9 +71,10 @@
5971
60 customdebug("MusicQueue update currentIndex: " + player.source);72 customdebug("MusicQueue update currentIndex: " + player.source);
6173
62 // Always jump to current track74 // TODO: Never jump to track? Or only jump to track in queue view?
63 nowPlaying.jumpToCurrent(musicToolbar.opened, nowPlaying, musicToolbar.currentTab)75 if (isListView) {
6476 nowPlaying.jumpToCurrent(musicToolbar.opened, nowPlaying, musicToolbar.currentTab)
77 }
65 }78 }
66 }79 }
6780
@@ -77,17 +90,307 @@
7790
78 function positionAt(index) {91 function positionAt(index) {
79 queuelist.positionViewAtIndex(index, ListView.Beginning);92 queuelist.positionViewAtIndex(index, ListView.Beginning);
80 queuelist.contentY -= header.height;93 }
94
95 Rectangle {
96 id: fullview
97 anchors.fill: parent
98 color: "transparent"
99 visible: !isListView
100
101 BlurredBackground {
102 id: blurredBackground
103 anchors.top: parent.top
104 anchors.topMargin: mainView.header.height
105 height: units.gu(27)
106 art: albumImage.source
107
108 Image {
109 id: albumImage
110 anchors.centerIn: parent
111 width: units.gu(18)
112 height: width
113 smooth: true
114 source: player.currentMetaArt === "" ?
115 decodeURIComponent("image://albumart/artist=" +
116 player.currentMetaArtist +
117 "&album=" + player.currentMetaAlbum)
118 : player.currentMetaArt
119 }
120 }
121
122 /* Full toolbar */
123 Item {
124 id: musicToolbarFullContainer
125 anchors.top: blurredBackground.bottom
126 anchors.topMargin: units.gu(4)
127 width: blurredBackground.width
128
129 /* Column for labels in wideAspect */
130 Column {
131 id: nowPlayingWideAspectLabels
132 spacing: units.gu(1)
133 anchors {
134 left: parent.left
135 leftMargin: units.gu(2)
136 right: parent.right
137 rightMargin: units.gu(2)
138 }
139
140 /* Title of track */
141 Label {
142 id: nowPlayingWideAspectTitle
143 anchors {
144 left: parent.left
145 leftMargin: units.gu(1)
146 right: parent.right
147 rightMargin: units.gu(1)
148 }
149 color: styleMusic.playerControls.labelColor
150 elide: Text.ElideRight
151 fontSize: "x-large"
152 objectName: "playercontroltitle"
153 text: trackQueue.model.count === 0 ? "" : player.currentMetaTitle === "" ? player.currentMetaFile : player.currentMetaTitle
154 }
155
156 /* Artist of track */
157 Label {
158 id: nowPlayingWideAspectArtist
159 anchors {
160 left: parent.left
161 leftMargin: units.gu(1)
162 right: parent.right
163 rightMargin: units.gu(1)
164 }
165 color: styleMusic.nowPlaying.labelSecondaryColor
166 elide: Text.ElideRight
167 fontSize: "small"
168 text: trackQueue.model.count === 0 ? "" : player.currentMetaArtist
169 }
170 }
171
172 /* Progress bar component */
173 MouseArea {
174 id: musicToolbarFullProgressContainer
175 anchors.left: parent.left
176 anchors.leftMargin: units.gu(3)
177 anchors.right: parent.right
178 anchors.rightMargin: units.gu(3)
179 anchors.top: nowPlayingWideAspectLabels.bottom
180 anchors.topMargin: units.gu(3)
181 height: units.gu(3)
182 width: parent.width
183
184 /* Position label */
185 Label {
186 id: musicToolbarFullPositionLabel
187 anchors.top: progressSliderMusic.bottom
188 anchors.topMargin: units.gu(-2)
189 anchors.left: parent.left
190 color: styleMusic.nowPlaying.labelSecondaryColor
191 fontSize: "small"
192 height: parent.height
193 horizontalAlignment: Text.AlignHCenter
194 text: durationToString(player.position)
195 verticalAlignment: Text.AlignVCenter
196 width: units.gu(3)
197 }
198
199 Slider {
200 id: progressSliderMusic
201 anchors.left: parent.left
202 anchors.right: parent.right
203 objectName: "progressSliderShape"
204 function formatValue(v) { return durationToString(v) }
205
206 property bool seeking: false
207
208 onSeekingChanged: {
209 if (seeking === false) {
210 musicToolbarFullPositionLabel.text = durationToString(player.position)
211 }
212 }
213
214 Component.onCompleted: {
215 Theme.palette.selected.foreground = UbuntuColors.blue
216 }
217
218 onPressedChanged: {
219 seeking = pressed
220 if (!pressed) {
221 player.seek(value)
222 }
223 }
224
225 Connections {
226 target: player
227 onDurationChanged: {
228 musicToolbarFullDurationLabel.text = durationToString(player.duration)
229 progressSliderMusic.maximumValue = player.duration
230 }
231 onPositionChanged: {
232 if (progressSliderMusic.seeking === false) {
233 progressSliderMusic.value = player.position
234 musicToolbarFullPositionLabel.text = durationToString(player.position)
235 musicToolbarFullDurationLabel.text = durationToString(player.duration)
236 }
237 }
238 onStopped: {
239 musicToolbarFullPositionLabel.text = durationToString(0);
240 musicToolbarFullDurationLabel.text = durationToString(0);
241 }
242 }
243 }
244
245 /* Duration label */
246 Label {
247 id: musicToolbarFullDurationLabel
248 anchors.top: progressSliderMusic.bottom
249 anchors.topMargin: units.gu(-2)
250 anchors.right: parent.right
251 color: styleMusic.nowPlaying.labelSecondaryColor
252 fontSize: "small"
253 height: parent.height
254 horizontalAlignment: Text.AlignHCenter
255 text: durationToString(player.duration)
256 verticalAlignment: Text.AlignVCenter
257 width: units.gu(3)
258 }
259 }
260
261 /* Repeat button */
262 MouseArea {
263 id: nowPlayingRepeatButton
264 anchors.right: nowPlayingPreviousButton.left
265 anchors.rightMargin: units.gu(1)
266 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
267 height: units.gu(6)
268 opacity: player.repeat && !emptyPage.noMusic ? 1 : .4
269 width: height
270 onClicked: player.repeat = !player.repeat
271
272 Icon {
273 id: repeatIcon
274 height: units.gu(3)
275 width: height
276 anchors.verticalCenter: parent.verticalCenter
277 anchors.horizontalCenter: parent.horizontalCenter
278 color: "white"
279 name: "media-playlist-repeat"
280 objectName: "repeatShape"
281 opacity: player.repeat && !emptyPage.noMusic ? 1 : .4
282 }
283 }
284
285 /* Previous button */
286 MouseArea {
287 id: nowPlayingPreviousButton
288 anchors.right: nowPlayingPlayButton.left
289 anchors.rightMargin: units.gu(1)
290 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
291 height: units.gu(6)
292 opacity: trackQueue.model.count === 0 ? .4 : 1
293 width: height
294 onClicked: player.previousSong()
295
296 Icon {
297 id: nowPlayingPreviousIndicator
298 height: units.gu(3)
299 width: height
300 anchors.verticalCenter: parent.verticalCenter
301 anchors.horizontalCenter: parent.horizontalCenter
302 color: "white"
303 name: "media-skip-backward"
304 objectName: "previousShape"
305 opacity: 1
306 }
307 }
308
309 /* Play/Pause button */
310 MouseArea {
311 id: nowPlayingPlayButton
312 anchors.horizontalCenter: parent.horizontalCenter
313 anchors.top: musicToolbarFullProgressContainer.bottom
314 anchors.topMargin: units.gu(2)
315 height: units.gu(12)
316 width: height
317 onClicked: player.toggle()
318
319 Icon {
320 id: nowPlayingPlayIndicator
321 height: units.gu(6)
322 width: height
323 anchors.verticalCenter: parent.verticalCenter
324 anchors.horizontalCenter: parent.horizontalCenter
325 opacity: emptyPage.noMusic ? .4 : 1
326 color: "white"
327 name: player.playbackState === MediaPlayer.PlayingState ? "media-playback-pause" : "media-playback-start"
328 objectName: "playShape"
329 }
330 }
331
332 /* Next button */
333 MouseArea {
334 id: nowPlayingNextButton
335 anchors.left: nowPlayingPlayButton.right
336 anchors.leftMargin: units.gu(1)
337 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
338 height: units.gu(6)
339 opacity: trackQueue.model.count === 0 ? .4 : 1
340 width: height
341 onClicked: player.nextSong()
342
343 Icon {
344 id: nowPlayingNextIndicator
345 height: units.gu(3)
346 width: height
347 anchors.verticalCenter: parent.verticalCenter
348 anchors.horizontalCenter: parent.horizontalCenter
349 color: "white"
350 name: "media-skip-forward"
351 objectName: "forwardShape"
352 opacity: 1
353 }
354 }
355
356 /* Shuffle button */
357 MouseArea {
358 id: nowPlayingShuffleButton
359 anchors.left: nowPlayingNextButton.right
360 anchors.leftMargin: units.gu(1)
361 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
362 height: units.gu(6)
363 opacity: player.shuffle && !emptyPage.noMusic ? 1 : .4
364 width: height
365 onClicked: player.shuffle = !player.shuffle
366
367 Icon {
368 id: shuffleIcon
369 height: units.gu(3)
370 width: height
371 anchors.verticalCenter: parent.verticalCenter
372 anchors.horizontalCenter: parent.horizontalCenter
373 color: "white"
374 name: "media-playlist-shuffle"
375 objectName: "shuffleShape"
376 opacity: player.shuffle && !emptyPage.noMusic ? 1 : .4
377 }
378 }
379 }
81 }380 }
82381
83 ListView {382 ListView {
84 id: queuelist383 id: queuelist
85 objectName: "nowPlayingQueueList"384 anchors {
86 anchors.fill: parent385 fill: parent
87 anchors.bottomMargin: musicToolbar.mouseAreaOffset + musicToolbar.minimizedHeight386 }
88 delegate: queueDelegate387 delegate: queueDelegate
388 footer: Item {
389 height: mainView.height - (styleMusic.common.expandHeight + queuelist.currentHeight) + units.gu(8)
390 }
391 highlightFollowsCurrentItem: false
89 model: trackQueue.model392 model: trackQueue.model
90 highlightFollowsCurrentItem: false393 objectName: "nowPlayingQueueList"
91 state: "normal"394 state: "normal"
92 states: [395 states: [
93 State {396 State {
@@ -105,9 +408,7 @@
105 }408 }
106 }409 }
107 ]410 ]
108 footer: Item {411 visible: isListView
109 height: mainView.height - (styleMusic.common.expandHeight + queuelist.currentHeight) + units.gu(8)
110 }
111412
112 property int normalHeight: units.gu(12)413 property int normalHeight: units.gu(12)
113 property int currentHeight: units.gu(40)414 property int currentHeight: units.gu(40)
@@ -117,10 +418,6 @@
117 customdebug("Queue: Now has: " + queuelist.count + " tracks")418 customdebug("Queue: Now has: " + queuelist.count + " tracks")
118 }419 }
119420
120 onMovementStarted: {
121 musicToolbar.hideToolbar();
122 }
123
124 Component {421 Component {
125 id: queueDelegate422 id: queueDelegate
126 ListItemWithActions {423 ListItemWithActions {
@@ -218,7 +515,7 @@
218 ? queuelist.currentHeight515 ? queuelist.currentHeight
219 : mainView.width - (trackImage.anchors.leftMargin * 2))516 : mainView.width - (trackImage.anchors.leftMargin * 2))
220 : queuelist.normalHeight) - units.gu(2)517 : queuelist.normalHeight) - units.gu(2)
221 covers: [{art: model.art}]518 covers: [{art: model.art, album: model.album, author: model.author}]
222519
223 spacing: units.gu(2)520 spacing: units.gu(2)
224521
225522
=== modified file 'MusicPlaylists.qml'
--- MusicPlaylists.qml 2014-09-20 10:50:45 +0000
+++ MusicPlaylists.qml 2014-10-09 02:19:53 +0000
@@ -116,8 +116,9 @@
116 ListView {116 ListView {
117 id: playlistslist117 id: playlistslist
118 objectName: "playlistsListView"118 objectName: "playlistsListView"
119 anchors.fill: parent119 anchors {
120 anchors.bottomMargin: musicToolbar.mouseAreaOffset + musicToolbar.minimizedHeight120 fill: parent
121 }
121 model: playlistModel.model122 model: playlistModel.model
122 delegate: playlistDelegate123 delegate: playlistDelegate
123 onCountChanged: {124 onCountChanged: {
124125
=== modified file 'MusicSettings.qml'
--- MusicSettings.qml 2014-09-20 10:50:45 +0000
+++ MusicSettings.qml 2014-10-09 02:19:53 +0000
@@ -30,17 +30,6 @@
30 title: i18n.tr("Settings")30 title: i18n.tr("Settings")
31 contentsHeight: parent.height;31 contentsHeight: parent.height;
3232
33 onVisibleChanged: {
34 if (visible === true)
35 {
36 musicToolbar.disableToolbar()
37 }
38 else
39 {
40 musicToolbar.enableToolbar()
41 }
42 }
43
44 onCancelClicked: PopupUtils.close(musicSettings)33 onCancelClicked: PopupUtils.close(musicSettings)
45 onConfirmClicked: {34 onConfirmClicked: {
46 PopupUtils.close(musicSettings)35 PopupUtils.close(musicSettings)
4736
=== modified file 'MusicToolbar.qml'
--- MusicToolbar.qml 2014-09-23 20:45:41 +0000
+++ MusicToolbar.qml 2014-10-09 02:19:53 +0000
@@ -35,59 +35,13 @@
35 property var currentPage: null35 property var currentPage: null
36 property var currentSheet: []36 property var currentSheet: []
37 property var currentTab: null37 property var currentTab: null
38 property var previousPage: null
3938
40 // Properties and signals for the toolbar39 // Properties and signals for the toolbar
41 property var cachedStates: []
42 property bool shown: false
43 property int transitionDuration: 100
44
45 property alias currentHeight: musicToolbarPanel.height40 property alias currentHeight: musicToolbarPanel.height
46 property alias minimizedHeight: musicToolbarPanel.minimizedHeight
47 property alias expandedHeight: musicToolbarPanel.expandedHeight
48 property alias fullHeight: musicToolbarPanel.fullHeight
49 property alias mouseAreaOffset: musicToolbarPanel.hintSize
50
51 property alias animating: musicToolbarPanel.animating
52 property alias opened: musicToolbarPanel.opened41 property alias opened: musicToolbarPanel.opened
5342
54 // Alias for autopilot
55 property alias currentMode: musicToolbarPanel.currentMode
56
57 Connections {
58 id: pageStackConn
59 target: mainPageStack
60
61 onCurrentPageChanged: {
62 previousPage = currentPage;
63
64 // If going back from nowPlaying jump back to tabs
65 if (previousPage === nowPlaying && mainPageStack.currentPage !== nowPlaying) {
66 while (mainPageStack.depth > 1) {
67 mainPageStack.pop(mainPageStack.currentPage)
68 }
69 }
70 }
71 }
72
73 /* Helper functions */43 /* Helper functions */
7444
75 // Disable the toolbar for this page/view (eg a dialog)
76 function disableToolbar()
77 {
78 cachedStates.push(state);
79 musicToolbarPanel.state = "hidden";
80 }
81
82 // Enable the toolbar (run when closing a page that disabled it)
83 function enableToolbar()
84 {
85 if (cachedStates.length > 0)
86 {
87 musicToolbarPanel.state = cachedStates.pop();
88 }
89 }
90
91 // Back button has been pressed, jump up pageStack or back to parent page45 // Back button has been pressed, jump up pageStack or back to parent page
92 function goBack()46 function goBack()
93 {47 {
@@ -98,18 +52,6 @@
98 else if (mainPageStack !== null && mainPageStack.depth > 1) {52 else if (mainPageStack !== null && mainPageStack.depth > 1) {
99 mainPageStack.pop(currentPage)53 mainPageStack.pop(currentPage)
100 }54 }
101
102 startAutohideTimer()
103 }
104
105 // Hide the toolbar
106 function hideToolbar()
107 {
108 if (!wideAspect) {
109 musicToolbarPanel.close();
110 }
111
112 toolbarAutoHideTimer.stop(); // cancel any autohide
113 }55 }
11456
115 // Remove sheet as it has been closed57 // Remove sheet as it has been closed
@@ -126,8 +68,6 @@
126 function setPage(childPage)68 function setPage(childPage)
127 {69 {
128 currentPage = childPage;70 currentPage = childPage;
129 // note: If pageStack tracking is needed readd here
130 //currentPageStack = pageStack === undefined ? null : pageStack;
131 }71 }
13272
133 // Set the current sheet (overrides page)73 // Set the current sheet (overrides page)
@@ -135,32 +75,6 @@
135 currentSheet.push(sheet)75 currentSheet.push(sheet)
136 }76 }
13777
138 // Show the toolbar
139 function showToolbar()
140 {
141 startAutohideTimer(); // always attempt to autohide toolbar
142
143 if (!musicToolbarPanel.opened) {
144 musicToolbarPanel.open();
145 }
146 }
147
148 // Start the autohidetimer
149 function startAutohideTimer()
150 {
151 toolbarAutoHideTimer.restart();
152 }
153
154 Connections {
155 target: mainView
156 onWideAspectChanged: {
157 // Force toolbar to show if in wideAspect
158 if (wideAspect && !opened) {
159 showToolbar();
160 }
161 }
162 }
163
164 Panel {78 Panel {
165 id: musicToolbarPanel79 id: musicToolbarPanel
166 anchors {80 anchors {
@@ -168,543 +82,9 @@
168 right: parent.right82 right: parent.right
169 bottom: parent.bottom83 bottom: parent.bottom
170 }84 }
171 height: currentMode === "full" ? fullHeight : expandedHeight85 height: units.gu(7.25)
172 locked: wideAspect86 locked: true
17387 opened: true
174 __closeOnContentsClicks: false // TODO: fix bug 1295720
175
176 // The current mode of the controls
177 property string currentMode: wideAspect || (currentPage === nowPlaying)
178 ? "full" : "expanded"
179
180 // Properties for the different heights
181 property int minimizedHeight: units.gu(0.5)
182 property int expandedHeight: units.gu(8)
183 property int fullHeight: units.gu(11)
184
185 onCurrentModeChanged: {
186 musicToolbarFullProgressMouseArea.enabled = currentMode === "full"
187 }
188
189 onOpenedChanged: {
190 onToolbarShownChanged(opened, currentPage, currentTab);
191
192 if (opened) {
193 startAutohideTimer();
194 }
195 }
196
197 /* Full toolbar */
198 Rectangle {
199 id: musicToolbarFullContainer
200 anchors {
201 fill: parent
202 }
203 color: styleMusic.toolbar.fullBackgroundColor
204 visible: musicToolbarPanel.currentMode === "full"
205
206 /* Buttons component */
207 Rectangle {
208 id: musicToolbarFullButtonsContainer
209 anchors.left: parent.left
210 anchors.top: musicToolbarFullProgressContainer.bottom
211 color: "transparent"
212 height: parent.height - musicToolbarFullProgressContainer.height
213 width: parent.width
214
215 /* Column for labels in wideAspect */
216 Column {
217 id: nowPlayingWideAspectLabels
218 anchors {
219 left: parent.left
220 leftMargin: units.gu(1)
221 right: nowPlayingRepeatButton.left
222 rightMargin: units.gu(1)
223 verticalCenter: parent.verticalCenter
224 }
225 visible: wideAspect
226
227 /* Clicking in the area shows the queue */
228 function trigger() {
229 if (trackQueue.model.count !== 0 && currentPage !== nowPlaying) {
230 tabs.pushNowPlaying();
231 }
232 else if (currentPage === nowPlaying) {
233 musicToolbar.goBack();
234 }
235 }
236
237 /* Title of track */
238 Label {
239 id: nowPlayingWideAspectTitle
240 anchors {
241 left: parent.left
242 leftMargin: units.gu(1)
243 right: parent.right
244 rightMargin: units.gu(1)
245 }
246 color: styleMusic.playerControls.labelColor
247 elide: Text.ElideRight
248 fontSize: "medium"
249 objectName: "playercontroltitle"
250 text: trackQueue.model.count === 0 ? "" : player.currentMetaTitle === "" ? player.currentMetaFile : player.currentMetaTitle
251 }
252
253 /* Artist of track */
254 Label {
255 id: nowPlayingWideAspectArtist
256 anchors {
257 left: parent.left
258 leftMargin: units.gu(1)
259 right: parent.right
260 rightMargin: units.gu(1)
261 }
262 color: styleMusic.playerControls.labelColor
263 elide: Text.ElideRight
264 fontSize: "small"
265 text: trackQueue.model.count === 0 ? "" : player.currentMetaArtist
266 }
267
268 /* Album of track */
269 Label {
270 id: nowPlayingWideAspectAlbum
271 anchors {
272 left: parent.left
273 leftMargin: units.gu(1)
274 right: parent.right
275 rightMargin: units.gu(1)
276 }
277 color: styleMusic.playerControls.labelColor
278 elide: Text.ElideRight
279 fontSize: "small"
280 text: trackQueue.model.count === 0 ? "" : player.currentMetaAlbum
281 }
282 }
283
284 /* Repeat button */
285 Item {
286 id: nowPlayingRepeatButton
287 objectName: "repeatShape"
288 anchors.right: nowPlayingPreviousButton.left
289 anchors.rightMargin: units.gu(1)
290 anchors.verticalCenter: parent.verticalCenter
291 height: units.gu(6)
292 opacity: player.repeat && !emptyPage.noMusic ? 1 : .4
293 width: height
294
295 function trigger() {
296 if (emptyPage.noMusic) {
297 return;
298 }
299
300 // Invert repeat settings
301 player.repeat = !player.repeat
302 }
303
304 Image {
305 id: repeatIcon
306 height: units.gu(3)
307 width: height
308 anchors.verticalCenter: parent.verticalCenter
309 anchors.horizontalCenter: parent.horizontalCenter
310 source: Qt.resolvedUrl("images/media-playlist-repeat.svg")
311 verticalAlignment: Text.AlignVCenter
312 opacity: player.repeat && !emptyPage.noMusic ? 1 : .4
313 }
314 }
315
316 /* Previous button */
317 Item {
318 id: nowPlayingPreviousButton
319 anchors.right: nowPlayingPlayButton.left
320 anchors.rightMargin: units.gu(1)
321 anchors.verticalCenter: parent.verticalCenter
322 height: units.gu(6)
323 objectName: "previousShape"
324 opacity: trackQueue.model.count === 0 ? .4 : 1
325 width: height
326
327 function trigger() {
328 if (trackQueue.model.count === 0) {
329 return;
330 }
331
332 player.previousSong()
333 }
334
335 Image {
336 id: nowPlayingPreviousIndicator
337 height: units.gu(3)
338 width: height
339 anchors.horizontalCenter: parent.horizontalCenter
340 anchors.verticalCenter: parent.verticalCenter
341 source: Qt.resolvedUrl("images/media-skip-backward.svg")
342 opacity: 1
343 }
344 }
345
346 /* Play/Pause button */
347 Rectangle {
348 id: nowPlayingPlayButton
349 anchors.horizontalCenter: parent.horizontalCenter
350 anchors.verticalCenter: parent.verticalCenter
351 antialiasing: true
352 color: styleMusic.toolbar.fullOuterPlayCircleColor
353 height: units.gu(12)
354 radius: height / 2
355 width: height
356
357 // draws the outter shadow/highlight
358 Rectangle {
359 id: sourceOutterFull
360 anchors { fill: parent; margins: -units.gu(0.1) }
361 radius: (width / 2)
362 antialiasing: true
363 gradient: Gradient {
364 GradientStop { position: 0.0; color: "black" }
365 GradientStop { position: 0.5; color: "transparent" }
366 GradientStop { position: 1.0; color: UbuntuColors.warmGrey }
367 }
368
369 Rectangle {
370 anchors.horizontalCenter: parent.horizontalCenter
371 anchors.verticalCenter: parent.verticalCenter
372 antialiasing: true
373 color: styleMusic.toolbar.fullOuterPlayCircleColor
374 height: nowPlayingPlayButton.height - units.gu(.1)
375 radius: height / 2
376 width: height
377
378 Rectangle {
379 id: nowPlayingPlayButtonInner
380 anchors.horizontalCenter: parent.horizontalCenter
381 anchors.verticalCenter: parent.verticalCenter
382 antialiasing: true
383 color: styleMusic.toolbar.fullInnerPlayCircleColor
384 height: units.gu(7)
385 radius: height / 2
386 width: height
387
388 // draws the inner shadow/highlight
389 Rectangle {
390 id: sourceInnerFull
391 anchors { fill: parent; margins: -units.gu(0.1) }
392 radius: (width / 2)
393 antialiasing: true
394 gradient: Gradient {
395 GradientStop { position: 0.0; color: UbuntuColors.warmGrey }
396 GradientStop { position: 0.5; color: "transparent" }
397 GradientStop { position: 1.0; color: "black" }
398 }
399
400 Rectangle {
401 anchors.horizontalCenter: parent.horizontalCenter
402 anchors.verticalCenter: parent.verticalCenter
403 antialiasing: true
404 color: styleMusic.toolbar.fullInnerPlayCircleColor
405 height: nowPlayingPlayButtonInner.height - units.gu(.1)
406 objectName: "playShape"
407 radius: height / 2
408 width: height
409
410 function trigger() {
411 if (emptyPage.noMusic) {
412 return;
413 }
414
415 if (trackQueue.model.count === 0) {
416 playRandomSong();
417 }
418 else {
419 player.toggle();
420 }
421 }
422
423 Image {
424 id: nowPlayingPlayIndicator
425 height: units.gu(6)
426 width: height
427 anchors.horizontalCenter: parent.horizontalCenter
428 anchors.verticalCenter: parent.verticalCenter
429 opacity: emptyPage.noMusic ? .4 : 1
430 source: player.playbackState === MediaPlayer.PlayingState ?
431 Qt.resolvedUrl("images/media-playback-pause.svg") : Qt.resolvedUrl("images/media-playback-start.svg")
432 }
433 }
434 }
435 }
436 }
437 }
438 }
439
440 /* Next button */
441 Item {
442 id: nowPlayingNextButton
443 anchors.left: nowPlayingPlayButton.right
444 anchors.leftMargin: units.gu(1)
445 anchors.verticalCenter: parent.verticalCenter
446 height: units.gu(6)
447 objectName: "forwardShape"
448 opacity: trackQueue.model.count === 0 ? .4 : 1
449 width: height
450
451 function trigger() {
452 if (trackQueue.model.count === 0 || emptyPage.noMusic) {
453 return;
454 }
455
456 player.nextSong()
457 }
458
459 Image {
460 id: nowPlayingNextIndicator
461 height: units.gu(3)
462 width: height
463 anchors.horizontalCenter: parent.horizontalCenter
464 anchors.verticalCenter: parent.verticalCenter
465 source: Qt.resolvedUrl("images/media-skip-forward.svg")
466 opacity: 1
467 }
468 }
469
470 /* Shuffle button */
471 Item {
472 id: nowPlayingShuffleButton
473 objectName: "shuffleShape"
474 anchors.left: nowPlayingNextButton.right
475 anchors.leftMargin: units.gu(1)
476 anchors.verticalCenter: parent.verticalCenter
477 height: units.gu(6)
478 opacity: player.shuffle && !emptyPage.noMusic ? 1 : .4
479 width: height
480
481 function trigger() {
482 if (emptyPage.noMusic) {
483 return;
484 }
485
486 // Invert shuffle settings
487 player.shuffle = !player.shuffle
488 }
489
490 Image {
491 id: shuffleIcon
492 height: units.gu(3)
493 width: height
494 anchors.verticalCenter: parent.verticalCenter
495 anchors.horizontalCenter: parent.horizontalCenter
496 source: Qt.resolvedUrl("images/media-playlist-shuffle.svg")
497 opacity: player.shuffle && !emptyPage.noMusic ? 1 : .4
498 }
499 }
500
501 /* Search button in wideAspect */
502 Item {
503 id: nowPlayingSearchButton
504 objectName: "searchShape"
505 anchors {
506 right: parent.right
507 rightMargin: units.gu(1)
508 verticalCenter: parent.verticalCenter
509 }
510 height: units.gu(6)
511 opacity: !emptyPage.noMusic ? 1 : .4
512 width: height
513 visible: wideAspect
514
515 function trigger() {
516 if (emptyPage.noMusic) {
517 return;
518 }
519
520 if (!searchSheet.sheetVisible) {
521 PopupUtils.open(searchSheet.sheet,
522 mainView, { title: i18n.tr("Search")} )
523 }
524 }
525
526 Image {
527 id: searchIcon
528 anchors {
529 horizontalCenter: parent.horizontalCenter
530 verticalCenter: parent.verticalCenter
531 }
532 height: units.gu(3)
533 opacity: !emptyPage.noMusic ? 1 : .4
534 source: Qt.resolvedUrl("images/search.svg")
535 width: height
536 }
537 }
538 }
539
540 /* Progress bar component */
541 Rectangle {
542 id: musicToolbarFullProgressContainer
543 anchors.left: parent.left
544 anchors.top: parent.top
545 color: styleMusic.toolbar.fullBackgroundColor
546 height: units.gu(3)
547 width: parent.width
548
549 /* Position label */
550 Label {
551 id: musicToolbarFullPositionLabel
552 anchors.left: parent.left
553 anchors.leftMargin: units.gu(2)
554 anchors.top: parent.top
555 color: styleMusic.nowPlaying.labelColor
556 fontSize: "x-small"
557 height: parent.height
558 horizontalAlignment: Text.AlignHCenter
559 text: durationToString(player.position)
560 verticalAlignment: Text.AlignVCenter
561 width: units.gu(3)
562 }
563
564 /* Progress bar */
565 Rectangle {
566 id: musicToolbarFullProgressBarContainer
567 objectName: "progressBarShape"
568 anchors.left: musicToolbarFullPositionLabel.right
569 anchors.leftMargin: units.gu(2)
570 anchors.right: musicToolbarFullDurationLabel.left
571 anchors.rightMargin: units.gu(2)
572 anchors.verticalCenter: parent.verticalCenter
573 color: "transparent"
574 height: units.gu(1);
575 state: trackQueue.model.count === 0 ? "disabled" : "enabled"
576
577 states: [
578 State {
579 name: "disabled"
580 PropertyChanges {
581 target: musicToolbarFullProgressMouseArea
582 enabled: false
583 }
584 PropertyChanges {
585 target: musicToolbarFullProgressTrough
586 visible: false
587 }
588 PropertyChanges {
589 target: musicToolbarFullProgressHandle
590 visible: false
591 }
592 },
593 State {
594 name: "enabled"
595 PropertyChanges {
596 target: musicToolbarFullProgressMouseArea
597 enabled: true
598 }
599 PropertyChanges {
600 target: musicToolbarFullProgressTrough
601 visible: true
602 }
603 PropertyChanges {
604 target: musicToolbarFullProgressHandle
605 visible: true
606 }
607 }
608 ]
609
610 property bool seeking: false
611
612 onSeekingChanged: {
613 if (seeking === false) {
614 musicToolbarFullPositionLabel.text = durationToString(player.position)
615 }
616 }
617
618 Connections {
619 target: player
620 onDurationChanged: {
621 console.debug("Duration changed: " + player.duration)
622 musicToolbarFullDurationLabel.text = durationToString(player.duration)
623 }
624 onPositionChanged: {
625 if (musicToolbarFullProgressBarContainer.seeking === false)
626 {
627 musicToolbarFullPositionLabel.text = durationToString(player.position)
628 musicToolbarFullDurationLabel.text = durationToString(player.duration)
629 musicToolbarFullProgressHandle.x = (player.position / player.duration) * musicToolbarFullProgressBarContainer.width
630 - musicToolbarFullProgressHandle.width / 2;
631 }
632 }
633 onStopped: {
634 musicToolbarFullProgressHandle.x = -musicToolbarFullProgressHandle.width / 2;
635
636 musicToolbarFullPositionLabel.text = durationToString(0);
637 musicToolbarFullDurationLabel.text = durationToString(0);
638 }
639 }
640
641 // Black background behind the progress bar
642 Rectangle {
643 id: musicToolbarFullProgressBackground
644 anchors.verticalCenter: parent.verticalCenter;
645 color: styleMusic.toolbar.fullProgressBackgroundColor;
646 height: parent.height;
647 radius: units.gu(0.5)
648 width: parent.width;
649 }
650
651 // The orange fill of the progress bar
652 Rectangle {
653 id: musicToolbarFullProgressTrough
654 anchors.verticalCenter: parent.verticalCenter;
655 antialiasing: true
656 color: styleMusic.toolbar.fullProgressTroughColor;
657 height: parent.height;
658 radius: units.gu(0.5)
659 width: musicToolbarFullProgressHandle.x + (height / 2); // +radius
660 }
661
662 // The current position (handle) of the progress bar
663 Rectangle {
664 id: musicToolbarFullProgressHandle
665 anchors.verticalCenter: musicToolbarFullProgressBackground.verticalCenter
666 antialiasing: true
667 color: styleMusic.nowPlaying.progressHandleColor
668 height: units.gu(1.5)
669 radius: height / 2
670 width: height
671
672 // On X change update the position string
673 onXChanged: {
674 if (musicToolbarFullProgressBarContainer.seeking) {
675 var fraction = (x + (width / 2)) / parent.width;
676 musicToolbarFullPositionLabel.text = durationToString(fraction * player.duration)
677 }
678 }
679 }
680 }
681
682 /* Duration label */
683 Label {
684 id: musicToolbarFullDurationLabel
685 anchors.right: parent.right
686 anchors.rightMargin: units.gu(2)
687 anchors.top: parent.top
688 color: styleMusic.nowPlaying.labelColor
689 fontSize: "x-small"
690 height: parent.height
691 horizontalAlignment: Text.AlignHCenter
692 text: durationToString(player.duration)
693 verticalAlignment: Text.AlignVCenter
694 width: units.gu(3)
695 }
696
697 /* Border at the bottom */
698 Rectangle {
699 anchors.bottom: parent.bottom
700 anchors.left: parent.left
701 anchors.right: parent.right
702 color: styleMusic.common.white
703 height: units.gu(0.1)
704 opacity: 0.1
705 }
706 }
707 }
70888
709 /* Expanded toolbar */89 /* Expanded toolbar */
710 Rectangle {90 Rectangle {
@@ -713,12 +93,13 @@
713 fill: parent93 fill: parent
714 }94 }
715 color: "transparent"95 color: "transparent"
716 visible: musicToolbarPanel.currentMode === "expanded"
71796
718 Rectangle {97 Rectangle {
719 id: musicToolbarPlayerControls98 id: musicToolbarPlayerControls
720 anchors.fill: parent99 anchors {
721 color: styleMusic.playerControls.backgroundColor100 fill: parent
101 }
102 color: "#000"
722 state: trackQueue.model.count === 0 ? "disabled" : "enabled"103 state: trackQueue.model.count === 0 ? "disabled" : "enabled"
723 states: [104 states: [
724 State {105 State {
@@ -745,39 +126,55 @@
745 }126 }
746 ]127 ]
747128
129 /* Disabled (empty state) controls */
748 Rectangle {130 Rectangle {
749 id: disabledPlayerControlsGroup131 id: disabledPlayerControlsGroup
750 anchors.fill: parent132 anchors {
133 bottom: playerControlsProgressBar.top
134 left: parent.left
135 right: parent.right
136 top: parent.top
137 }
751 color: "transparent"138 color: "transparent"
752 visible: trackQueue.model.count === 0
753139
754 Label {140 Label {
755 id: noSongsInQueueLabel141 id: noSongsInQueueLabel
756 anchors {142 anchors {
757 left: parent.left143 left: parent.left
144 leftMargin: units.gu(2)
758 right: disabledPlayerControlsPlayButton.left145 right: disabledPlayerControlsPlayButton.left
759 margins: units.gu(1)146 rightMargin: units.gu(2)
760 top: parent.top147 verticalCenter: parent.verticalCenter
761 }148 }
762 color: styleMusic.playerControls.labelColor149 color: styleMusic.playerControls.labelColor
763 text: i18n.tr("Tap play to shuffle music")150 text: i18n.tr("Tap to shuffle music")
764 fontSize: "large"151 fontSize: "large"
765 wrapMode: Text.WordWrap152 wrapMode: Text.WordWrap
766 maximumLineCount: 2153 maximumLineCount: 2
767 }154 }
768155
769 Rectangle {156 /* Play/Pause button */
157 Icon {
770 id: disabledPlayerControlsPlayButton158 id: disabledPlayerControlsPlayButton
771 anchors.right: parent.right159 anchors {
772 anchors.rightMargin: units.gu(1)160 right: parent.right
773 anchors.verticalCenter: parent.verticalCenter161 rightMargin: units.gu(3)
774 antialiasing: true162 verticalCenter: parent.verticalCenter
775 color: "#444"163 }
776 height: units.gu(7)164 color: "#FFF"
777 radius: height / 2165 height: units.gu(2.5)
166 name: player.playbackState === MediaPlayer.PlayingState ?
167 "media-playback-pause" : "media-playback-start"
168 objectName: "disabledSmallPlayShape"
778 width: height169 width: height
170 }
779171
780 function trigger() {172 /* Click to shuffle music */
173 MouseArea {
174 anchors {
175 fill: parent
176 }
177 onClicked: {
781 if (emptyPage.noMusic) {178 if (emptyPage.noMusic) {
782 return;179 return;
783 }180 }
@@ -789,230 +186,65 @@
789 player.toggle();186 player.toggle();
790 }187 }
791 }188 }
792
793 // draws the outer shadow/highlight
794 Rectangle {
795 id: disabledSourceOutter
796 anchors { fill: parent; margins: -units.gu(0.1) }
797 radius: (width / 2)
798 antialiasing: true
799 gradient: Gradient {
800 GradientStop { position: 0.0; color: "black" }
801 GradientStop { position: 0.5; color: "transparent" }
802 GradientStop { position: 1.0; color: UbuntuColors.warmGrey }
803 }
804
805 Rectangle {
806 anchors.verticalCenter: parent.verticalCenter
807 anchors.horizontalCenter: parent.horizontalCenter
808 antialiasing: true
809 color: "#444"
810 height: playerControlsPlayButton.height - units.gu(.1)
811 radius: height / 2
812 width: height
813
814 Rectangle {
815 id: disabledPlayerControlsPlayInnerCircle
816 anchors.horizontalCenter: parent.horizontalCenter
817 anchors.verticalCenter: parent.verticalCenter
818 antialiasing: true
819 height: units.gu(4.5)
820 radius: height / 2
821 width: height
822 color: styleMusic.toolbar.fullInnerPlayCircleColor
823
824 // draws the inner shadow/highlight
825 Rectangle {
826 id: disabledSourceInner
827 anchors { fill: parent; margins: -units.gu(0.1) }
828 radius: (width / 2)
829 antialiasing: true
830 gradient: Gradient {
831 GradientStop { position: 0.0; color: UbuntuColors.warmGrey }
832 GradientStop { position: 0.5; color: "transparent" }
833 GradientStop { position: 1.0; color: "black" }
834 }
835
836 Rectangle {
837 anchors.verticalCenter: parent.verticalCenter
838 anchors.horizontalCenter: parent.horizontalCenter
839 antialiasing: true
840 height: playerControlsPlayInnerCircle.height - units.gu(.1)
841 radius: height / 2
842 width: height
843 color: styleMusic.toolbar.fullInnerPlayCircleColor
844
845 Image {
846 id: disabledPlayIndicator
847 height: units.gu(4)
848 width: height
849 anchors.horizontalCenter: parent.horizontalCenter
850 anchors.verticalCenter: parent.verticalCenter
851 opacity: emptyPage.noMusic ? .4 : 1
852 source: player.playbackState === MediaPlayer.PlayingState ?
853 Qt.resolvedUrl("images/media-playback-pause.svg") : Qt.resolvedUrl("images/media-playback-start.svg")
854 }
855 }
856 }
857 }
858 }
859 }
860 }189 }
861 }190 }
862191
192 /* Enabled (queue > 0) controls */
863 Rectangle {193 Rectangle {
864 id: enabledPlayerControlsGroup194 id: enabledPlayerControlsGroup
865 anchors.fill: parent195 anchors {
196 bottom: playerControlsProgressBar.top
197 left: parent.left
198 right: parent.right
199 top: parent.top
200 }
866 color: "transparent"201 color: "transparent"
867 visible: trackQueue.model.count !== 0202
868203 /* Album art in player controls */
869 /* Settings button */204 Image {
870 // TODO: Enable settings when it is practical205 id: playerControlsImage
871 /* Rectangle {206 anchors {
872 id: playerControlsSettings207 bottom: parent.bottom
873 anchors.right: parent.right208 left: parent.left
874 anchors.verticalCenter: parent.verticalCenter209 top: parent.top
875 width: units.gu(6)210 }
876 height: width211 smooth: true
877 color: "transparent"212 source: player.currentMetaArt === "" ?
878213 decodeURIComponent("image://albumart/artist=" +
879 Image {214 player.currentMetaArtist +
880 anchors.horizontalCenter: parent.horizontalCenter215 "&album=" + player.currentMetaAlbum)
881 anchors.verticalCenter: parent.verticalCenter216 : player.currentMetaArt
882 height: units.gu(3)217 width: parent.height
883 source: Qt.resolvedUrl("images/settings.png")218
884 width: height219 onStatusChanged: {
885 }220 if (status === Image.Error) {
886221 source = Qt.resolvedUrl("../images/music-app-cover@30.png")
887 MouseArea {
888 anchors.fill: parent
889 onClicked: {
890 console.debug('Debug: Show settings')
891 PopupUtils.open(Qt.resolvedUrl("MusicSettings.qml"), mainView,
892 {
893 title: i18n.tr("Settings")
894 } )
895 }
896 }
897 } */
898
899 /* Play/Pause button TODO: image and colours needs updating */
900 Rectangle {
901 id: playerControlsPlayButton
902 anchors.right: parent.right
903 anchors.rightMargin: units.gu(1)
904 anchors.verticalCenter: parent.verticalCenter
905 antialiasing: true
906 color: "#444"
907 height: units.gu(7)
908 objectName: "smallPlayShape"
909 radius: height / 2
910 width: height
911
912 function trigger() {
913 if (emptyPage.noMusic) {
914 return;
915 }
916
917 if (trackQueue.model.count === 0) {
918 playRandomSong();
919 }
920 else {
921 player.toggle();
922 }
923 }
924
925 // draws the outer shadow/highlight
926 Rectangle {
927 id: sourceOutter
928 anchors { fill: parent; margins: -units.gu(0.1) }
929 radius: (width / 2)
930 antialiasing: true
931 gradient: Gradient {
932 GradientStop { position: 0.0; color: "black" }
933 GradientStop { position: 0.5; color: "transparent" }
934 GradientStop { position: 1.0; color: UbuntuColors.warmGrey }
935 }
936
937 Rectangle {
938 anchors.verticalCenter: parent.verticalCenter
939 anchors.horizontalCenter: parent.horizontalCenter
940 antialiasing: true
941 color: "#444"
942 height: playerControlsPlayButton.height - units.gu(.1)
943 radius: height / 2
944 width: height
945
946 Rectangle {
947 id: playerControlsPlayInnerCircle
948 anchors.horizontalCenter: parent.horizontalCenter
949 anchors.verticalCenter: parent.verticalCenter
950 antialiasing: true
951 height: units.gu(4.5)
952 radius: height / 2
953 width: height
954 color: styleMusic.toolbar.fullInnerPlayCircleColor
955
956 // draws the inner shadow/highlight
957 Rectangle {
958 id: sourceInner
959 anchors { fill: parent; margins: -units.gu(0.1) }
960 radius: (width / 2)
961 antialiasing: true
962 gradient: Gradient {
963 GradientStop { position: 0.0; color: UbuntuColors.warmGrey }
964 GradientStop { position: 0.5; color: "transparent" }
965 GradientStop { position: 1.0; color: "black" }
966 }
967
968 Rectangle {
969 anchors.verticalCenter: parent.verticalCenter
970 anchors.horizontalCenter: parent.horizontalCenter
971 antialiasing: true
972 height: playerControlsPlayInnerCircle.height - units.gu(.1)
973 radius: height / 2
974 width: height
975 color: styleMusic.toolbar.fullInnerPlayCircleColor
976
977 Image {
978 id: playindicator
979 height: units.gu(4)
980 width: height
981 anchors.horizontalCenter: parent.horizontalCenter
982 anchors.verticalCenter: parent.verticalCenter
983 opacity: emptyPage.noMusic ? .4 : 1
984 source: player.playbackState === MediaPlayer.PlayingState ?
985 Qt.resolvedUrl("images/media-playback-pause.svg") : Qt.resolvedUrl("images/media-playback-start.svg")
986 }
987 }
988 }
989 }
990 }222 }
991 }223 }
992 }224 }
993225
994 /* Container holding the labels for the toolbar */226 /* Column of meta labels */
995 Rectangle {227 Column {
996 id: playerControlLabelContainer228 id: playerControlsLabels
997 anchors.bottom: parent.bottom229 anchors {
998 anchors.left: parent.left230 left: playerControlsImage.right
999 anchors.right: playerControlsPlayButton.left231 leftMargin: units.gu(1.5)
1000 anchors.top: parent.top232 right: playerControlsPlayButton.left
1001 color: "transparent"233 rightMargin: units.gu(1)
234 verticalCenter: parent.verticalCenter
235 }
1002236
1003 /* Title of track */237 /* Title of track */
1004 Label {238 Label {
1005 id: playerControlsTitle239 id: playerControlsTitle
1006 anchors.left: parent.left240 anchors {
1007 anchors.leftMargin: units.gu(1)241 left: parent.left
1008 anchors.right: parent.right242 right: parent.right
1009 anchors.rightMargin: units.gu(1)243 }
1010 anchors.top: parent.top244 color: "#FFF"
1011 anchors.topMargin: units.gu(1)
1012 color: styleMusic.playerControls.labelColor
1013 elide: Text.ElideRight245 elide: Text.ElideRight
1014 fontSize: "medium"246 fontSize: "small"
1015 objectName: "playercontroltitle"247 font.weight: Font.DemiBold
1016 text: player.currentMetaTitle === ""248 text: player.currentMetaTitle === ""
1017 ? player.source : player.currentMetaTitle249 ? player.source : player.currentMetaTitle
1018 }250 }
@@ -1020,119 +252,105 @@
1020 /* Artist of track */252 /* Artist of track */
1021 Label {253 Label {
1022 id: playerControlsArtist254 id: playerControlsArtist
1023 anchors.left: parent.left255 anchors {
1024 anchors.leftMargin: units.gu(1)256 left: parent.left
1025 anchors.right: parent.right257 right: parent.right
1026 anchors.rightMargin: units.gu(1)258 }
1027 anchors.top: playerControlsTitle.bottom259 color: "#FFF"
1028 color: styleMusic.playerControls.labelColor
1029 elide: Text.ElideRight260 elide: Text.ElideRight
1030 fontSize: "small"261 fontSize: "small"
262 opacity: 0.4
1031 text: player.currentMetaArtist263 text: player.currentMetaArtist
1032 }264 }
1033265 }
1034 /* Album of track */266
1035 Label {267 /* Play/Pause button */
1036 id: playerControlsAlbum268 Icon {
1037 anchors.left: parent.left269 id: playerControlsPlayButton
1038 anchors.leftMargin: units.gu(1)270 anchors {
1039 anchors.right: parent.right271 right: parent.right
1040 anchors.rightMargin: units.gu(1)272 rightMargin: units.gu(3)
1041 anchors.top: playerControlsArtist.bottom273 verticalCenter: parent.verticalCenter
1042 color: styleMusic.playerControls.labelColor274 }
1043 elide: Text.ElideRight275 color: "#FFF"
1044 fontSize: "small"276 height: units.gu(2.5)
1045 text: player.currentMetaAlbum277 name: player.playbackState === MediaPlayer.PlayingState ?
1046 }278 "media-playback-pause" : "media-playback-start"
1047 }279 objectName: "playShape"
1048280 width: height
281 }
282
283 MouseArea {
284 anchors {
285 bottom: parent.bottom
286 horizontalCenter: playerControlsPlayButton.horizontalCenter
287 top: parent.top
288 }
289 onClicked: player.toggle()
290 width: units.gu(8)
291
292 Rectangle {
293 anchors {
294 fill: parent
295 }
296 color: "#FFF"
297 opacity: parent.pressed ? 0.1 : 0
298
299 Behavior on opacity {
300 UbuntuNumberAnimation {
301 duration: UbuntuAnimation.FastDuration
302 }
303 }
304 }
305 }
306
307 /* Mouse area to jump to now playing */
1049 Rectangle {308 Rectangle {
1050 anchors.fill: playerControlLabelContainer309 anchors {
310 bottom: parent.bottom
311 left: parent.left
312 right: playerControlsLabels.right
313 top: parent.top
314 }
1051 color: "transparent"315 color: "transparent"
316 objectName: "jumpNowPlaying"
1052 function trigger() {317 function trigger() {
1053 tabs.pushNowPlaying();318 tabs.pushNowPlaying();
1054 }319 }
1055 }320 }
1056 }321 }
1057 }322
1058 }323 /* Object which provides the progress bar when toolbar is minimized */
1059324 Rectangle {
1060 /* Object which provides the progress bar when toolbar is minimized */325 id: playerControlsProgressBar
1061 Rectangle {326 anchors {
1062 id: musicToolbarSmallProgressBackground327 bottom: parent.bottom
1063 anchors {328 left: parent.left
1064 bottom: parent.top329 right: parent.right
1065 left: parent.left330 }
1066 right: parent.right331 color: styleMusic.common.black
1067 }332 height: units.gu(0.25)
1068 color: styleMusic.common.black333
1069 height: musicToolbarPanel.minimizedHeight334 Rectangle {
1070 visible: (!musicToolbarPanel.animating &&335 id: playerControlsProgressBarHint
1071 !musicToolbarPanel.opened)336 anchors {
1072 || musicToolbarPanel.currentMode == "expanded"337 left: parent.left
1073338 top: parent.top
1074 Rectangle {339 }
1075 id: musicToolbarSmallProgressHint340 color: UbuntuColors.blue
1076 anchors.left: parent.left341 height: parent.height
1077 anchors.top: parent.top342 width: 0
1078 color: styleMusic.nowPlaying.progressForegroundColor343
1079 height: parent.height344 Connections {
1080 width: 0345 target: player
1081346 onPositionChanged: {
1082 Connections {347 playerControlsProgressBarHint.width = (player.position / player.duration) * playerControlsProgressBar.width
1083 target: player348 }
1084 onPositionChanged: {349 onStopped: {
1085 musicToolbarSmallProgressHint.width = (player.position / player.duration) * musicToolbarSmallProgressBackground.width350 playerControlsProgressBarHint.width = 0;
1086 }351 }
1087 onStopped: {352 }
1088 musicToolbarSmallProgressHint.width = 0;353 }
1089 }
1090 }
1091 }
1092 }
1093
1094 /* Mouse events for the progress bar
1095 is after musicToolbarMouseArea so that it captures mouse events for dragging */
1096 MouseArea {
1097 id: musicToolbarFullProgressMouseArea
1098 height: units.gu(2)
1099 width: musicToolbarFullProgressBarContainer.width
1100 x: musicToolbarFullProgressBarContainer.x
1101 y: musicToolbarFullProgressBarContainer.y
1102
1103 drag.axis: Drag.XAxis
1104 drag.minimumX: -(musicToolbarFullProgressHandle.width / 2)
1105 drag.maximumX: musicToolbarFullProgressBarContainer.width - (musicToolbarFullProgressHandle.width / 2)
1106 drag.target: musicToolbarFullProgressHandle
1107
1108 onPressed: {
1109 musicToolbarFullProgressBarContainer.seeking = true;
1110
1111 // Jump the handle to the current mouse position
1112 musicToolbarFullProgressHandle.x = mouse.x - (musicToolbarFullProgressHandle.width / 2);
1113 }
1114
1115 onReleased: {
1116 var fraction = mouse.x / musicToolbarFullProgressBarContainer.width;
1117
1118 // Limit the bounds of the fraction
1119 fraction = fraction < 0 ? 0 : fraction
1120 fraction = fraction > 1 ? 1 : fraction
1121
1122 player.seek((fraction) * player.duration);
1123 musicToolbarFullProgressBarContainer.seeking = false;
1124 }
1125 }
1126
1127 // Timer for autohide
1128 Timer {
1129 id: toolbarAutoHideTimer
1130 interval: 5000
1131 repeat: false
1132 running: false
1133 onTriggered: {
1134 if (currentPage !== nowPlaying) { // don't autohide on now playing
1135 hideToolbar();
1136 }354 }
1137 }355 }
1138 }356 }
1139357
=== modified file 'MusicTracks.qml'
--- MusicTracks.qml 2014-09-20 15:41:33 +0000
+++ MusicTracks.qml 2014-10-09 02:19:53 +0000
@@ -36,8 +36,9 @@
3636
37 ListView {37 ListView {
38 id: tracklist38 id: tracklist
39 anchors.fill: parent39 anchors {
40 anchors.bottomMargin: musicToolbar.mouseAreaOffset + musicToolbar.minimizedHeight40 fill: parent
41 }
41 highlightFollowsCurrentItem: false42 highlightFollowsCurrentItem: false
42 objectName: "trackstab-listview"43 objectName: "trackstab-listview"
43 model: SortFilterModel {44 model: SortFilterModel {
4445
=== modified file 'MusicaddtoPlaylist.qml'
--- MusicaddtoPlaylist.qml 2014-09-20 10:50:45 +0000
+++ MusicaddtoPlaylist.qml 2014-10-09 02:19:53 +0000
@@ -65,7 +65,6 @@
65 ListView {65 ListView {
66 id: addtoPlaylistView66 id: addtoPlaylistView
67 anchors {67 anchors {
68 bottomMargin: musicToolbar.mouseAreaOffset + musicToolbar.minimizedHeight
69 fill: parent68 fill: parent
70 }69 }
71 clip: true70 clip: true
7271
=== modified file 'Player.qml'
--- Player.qml 2014-09-20 15:41:33 +0000
+++ Player.qml 2014-10-09 02:19:53 +0000
@@ -187,7 +187,11 @@
187 else {187 else {
188 var obj = trackQueue.model.get(player.currentIndex);188 var obj = trackQueue.model.get(player.currentIndex);
189 currentMetaAlbum = obj.album;189 currentMetaAlbum = obj.album;
190 currentMetaArt = obj.art;190
191 if (obj.art !== undefined) { // FIXME: protect against not art property in playlists
192 currentMetaArt = obj.art;
193 }
194
191 currentMetaArtist = obj.author;195 currentMetaArtist = obj.author;
192 currentMetaFile = obj.filename;196 currentMetaFile = obj.filename;
193 currentMetaTitle = obj.title;197 currentMetaTitle = obj.title;
194198
=== modified file 'Style.qml'
--- Style.qml 2014-09-20 10:50:45 +0000
+++ Style.qml 2014-10-09 02:19:53 +0000
@@ -34,8 +34,8 @@
34 property QtObject common: QtObject {34 property QtObject common: QtObject {
35 property color black: "#000000";35 property color black: "#000000";
36 property color white: "#FFFFFF";36 property color white: "#FFFFFF";
37 property color music: "#333333";37 property color music: "#FFFFFF";
38 property color subtitle: "#666666";38 property color subtitle: "#999999";
39 property color expandedColor: "#000000";39 property color expandedColor: "#000000";
40 property int albumSize: units.gu(10);40 property int albumSize: units.gu(10);
41 property int itemHeight: units.gu(12);41 property int itemHeight: units.gu(12);
4242
=== modified file 'com.ubuntu.music_music.desktop.in.in'
--- com.ubuntu.music_music.desktop.in.in 2014-07-21 14:49:14 +0000
+++ com.ubuntu.music_music.desktop.in.in 2014-10-09 02:19:53 +0000
@@ -9,4 +9,7 @@
9StartupNotify=true9StartupNotify=true
10X-Ubuntu-Touch=true10X-Ubuntu-Touch=true
11X-Ubuntu-Single-Instance=true11X-Ubuntu-Single-Instance=true
12X-Ubuntu-Splash-Show-Header=true
13_X-Ubuntu-Splash-Title=Music
14_X-Ubuntu-Splash-Color=#1e1e23
12X-Ubuntu-Default-Department-ID=sound-video15X-Ubuntu-Default-Department-ID=sound-video
1316
=== modified file 'common/AlbumsPage.qml'
--- common/AlbumsPage.qml 2014-10-07 02:15:06 +0000
+++ common/AlbumsPage.qml 2014-10-09 02:19:53 +0000
@@ -28,7 +28,6 @@
2828
29MusicPage {29MusicPage {
30 id: albumStackPage30 id: albumStackPage
31 anchors.bottomMargin: units.gu(.5)
32 objectName: "albumsArtistPage"31 objectName: "albumsArtistPage"
33 visible: false32 visible: false
3433
@@ -38,7 +37,6 @@
38 ListView {37 ListView {
39 id: albumtrackslist38 id: albumtrackslist
40 anchors {39 anchors {
41 bottomMargin: wideAspect ? musicToolbar.fullHeight : musicToolbar.mouseAreaOffset + musicToolbar.minimizedHeight
42 fill: parent40 fill: parent
43 }41 }
44 delegate: albumTracksDelegate42 delegate: albumTracksDelegate
4543
=== modified file 'common/BlurredBackground.qml'
--- common/BlurredBackground.qml 2014-09-20 15:41:33 +0000
+++ common/BlurredBackground.qml 2014-10-09 02:19:53 +0000
@@ -23,8 +23,14 @@
2323
24// Blurred background24// Blurred background
25Rectangle {25Rectangle {
26 anchors.fill: parent26 width: parent.width
27 property string art: player.currentMetaFile === "" ? Qt.resolvedUrl("../images/music-app-cover@30.png") : player.currentMetaArt27 property string art // : player.currentMetaFile === "" ? Qt.resolvedUrl("../images/music-app-cover@30.png") : player.currentMetaArt
28
29 // dark layer
30 Rectangle {
31 anchors.fill: parent
32 color: "black"
33 }
2834
29 // the album art35 // the album art
30 Image {36 Image {
@@ -32,7 +38,8 @@
32 anchors.horizontalCenter: parent.horizontalCenter38 anchors.horizontalCenter: parent.horizontalCenter
33 anchors.verticalCenter: parent.verticalCenter39 anchors.verticalCenter: parent.verticalCenter
34 source: art // this has to be fixed for the default cover art to work - cant find in this dir40 source: art // this has to be fixed for the default cover art to work - cant find in this dir
35 height: Math.max(parent.height, parent.width)41 fillMode: Image.PreserveAspectCrop
42 height: parent.height
36 width: Math.max(parent.height, parent.width)43 width: Math.max(parent.height, parent.width)
37 visible: false44 visible: false
38 onStatusChanged: {45 onStatusChanged: {
@@ -47,12 +54,7 @@
47 anchors.fill: backgroundImage54 anchors.fill: backgroundImage
48 source: backgroundImage55 source: backgroundImage
49 radius: units.dp(42)56 radius: units.dp(42)
50 }57 opacity: 0.2
51 // transparent white layer
52 Rectangle {
53 anchors.fill: parent
54 color: "white"
55 opacity: 0.7
56 }58 }
57 onArtChanged: {59 onArtChanged: {
58 // TODO: This is a work around for LP:1261078 and LP:1306845. Ideally,60 // TODO: This is a work around for LP:1261078 and LP:1306845. Ideally,
5961
=== added file 'common/Card.qml'
--- common/Card.qml 1970-01-01 00:00:00 +0000
+++ common/Card.qml 2014-10-09 02:19:53 +0000
@@ -0,0 +1,157 @@
1/*
2 * Copyright (C) 2014
3 * Andrew Hayzen <ahayzen@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18import QtQuick 2.3
19import Ubuntu.Components 1.1
20
21
22Rectangle {
23 id: card
24 color: "transparent"
25 height: cardColumn.childrenRect.height + 2 * bg.anchors.margins
26
27 property alias imageSource: image.source
28 property alias primaryText: primaryLabel.text
29 property alias secondaryText: secondaryLabel.text
30
31 signal clicked(var mouse)
32 signal pressAndHold(var mouse)
33
34 /* Animations */
35 Behavior on height {
36 UbuntuNumberAnimation {
37
38 }
39 }
40
41 Behavior on width {
42 UbuntuNumberAnimation {
43
44 }
45 }
46
47 Behavior on x {
48 UbuntuNumberAnimation {
49
50 }
51 }
52
53 Behavior on y {
54 UbuntuNumberAnimation {
55
56 }
57 }
58
59 /* Background for card */
60 Rectangle {
61 id: bg
62 anchors {
63 fill: parent
64 margins: units.gu(1)
65 }
66 color: "#2c2c34"
67 }
68
69 /* Column containing image and labels */
70 Column {
71 id: cardColumn
72 anchors {
73 fill: bg
74 }
75 spacing: units.gu(0.5)
76
77 Image {
78 id: image
79 height: parent.width
80 width: parent.width
81
82 onStatusChanged: {
83 if (status === Image.Error) {
84 source = Qt.resolvedUrl("../images/music-app-cover@30.png")
85 }
86 }
87 }
88
89 Rectangle {
90 color: "transparent"
91 height: units.gu(1)
92 width: units.gu(1)
93 }
94
95 Label {
96 id: primaryLabel
97 anchors {
98 left: parent.left
99 leftMargin: units.gu(1)
100 right: parent.right
101 rightMargin: units.gu(1)
102 }
103 color: "#FFF"
104 elide: Text.ElideRight
105 fontSize: "small"
106 opacity: 1.0
107 wrapMode: Text.WordWrap
108 }
109
110 Label {
111 id: secondaryLabel
112 anchors {
113 left: parent.left
114 leftMargin: units.gu(1)
115 right: parent.right
116 rightMargin: units.gu(1)
117 }
118 color: "#FFF"
119 elide: Text.ElideRight
120 fontSize: "small"
121 opacity: 0.4
122 wrapMode: Text.WordWrap
123 }
124
125 Rectangle {
126 color: "transparent"
127 height: units.gu(1.5)
128 width: units.gu(1)
129 }
130 }
131
132 /* Overlay for when card is pressed */
133 Rectangle {
134 id: overlay
135 anchors {
136 fill: bg
137 }
138 color: "#000"
139 opacity: 0
140
141 Behavior on opacity {
142 UbuntuNumberAnimation {
143
144 }
145 }
146 }
147
148 /* Capture mouse events */
149 MouseArea {
150 anchors {
151 fill: parent
152 }
153 onClicked: card.clicked(mouse)
154 onPressAndHold: card.pressAndHold(mouse)
155 onPressedChanged: overlay.opacity = pressed ? 0.3 : 0
156 }
157}
0158
=== added file 'common/CardView.qml'
--- common/CardView.qml 1970-01-01 00:00:00 +0000
+++ common/CardView.qml 2014-10-09 02:19:53 +0000
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2014
3 * Andrew Hayzen <ahayzen@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18import QtQuick 2.3
19import Ubuntu.Components 1.1
20
21
22Flickable {
23 anchors {
24 fill: parent
25 margins: units.gu(1)
26 }
27
28 // dont use flow.contentHeight as it is inaccurate due to height of labels
29 // changing as they load
30 contentHeight: flow.childrenRect.height
31 contentWidth: width
32
33 property alias delegate: flow.delegate
34 property alias model: flow.model
35
36 ColumnFlow {
37 id: flow
38 columns: parseInt(width / units.gu(15))
39 width: parent.width
40 }
41}
042
=== added file 'common/ColumnFlow.qml'
--- common/ColumnFlow.qml 1970-01-01 00:00:00 +0000
+++ common/ColumnFlow.qml 2014-10-09 02:19:53 +0000
@@ -0,0 +1,159 @@
1/*
2 * Copyright (C) 2014
3 * Andrew Hayzen <ahayzen@gmail.com>
4 * Michael Spencer <sonrisesoftware@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * Upstream location:
19 * https://github.com/iBeliever/ubuntu-ui-extras/blob/master/ColumnFlow.qml
20 */
21
22import QtQuick 2.3
23
24
25Item {
26 id: columnFlow
27 property int columns: 1
28 property bool repeaterCompleted: false
29 property alias model: repeater.model
30 property alias delegate: repeater.delegate
31 property int contentHeight: 0
32
33 onColumnsChanged: reEvalColumns()
34 onModelChanged: reEvalColumns()
35 onWidthChanged: updateWidths()
36
37 function updateWidths() {
38 if (repeaterCompleted) {
39 var count = 0
40
41 //add the first <column> elements
42 for (var i = 0; count < columns && i < columnFlow.children.length; i++) {
43 //print(i, count)
44 if (!columnFlow.children[i] || String(columnFlow.children[i]).indexOf("QQuickRepeater") == 0)
45 //|| !columnFlow.children[i].visible) // CUSTOM - view is invisible at start
46 continue
47
48 columnFlow.children[i].width = width / columns
49
50 count++
51 }
52 }
53 }
54
55 function reEvalColumns() {
56 if (columnFlow.repeaterCompleted === false)
57 return
58
59 if (columns === 0) {
60 contentHeight = 0
61 return
62 }
63
64 var i, j
65 var columnHeights = new Array(columns);
66 var lastItem = new Array(columns)
67 var lastI = -1
68 var count = 0
69
70 //add the first <column> elements
71 for (i = 0; count < columns && i < columnFlow.children.length; i++) {
72 // CUSTOM - ignore if has just been removed
73 if (i === repeater.removeHintIndex && columnFlow.children[i] === repeater.removeHintItem) {
74 continue
75 }
76
77 if (!columnFlow.children[i] || String(columnFlow.children[i]).indexOf("QQuickRepeater") == 0)
78 //|| !columnFlow.children[i].visible) // CUSTOM - view is invisible at start
79 continue
80
81 lastItem[count] = i
82
83 columnHeights[count] = columnFlow.children[i].height
84 columnFlow.children[i].anchors.top = columnFlow.top
85 columnFlow.children[i].anchors.left = (lastI === -1 ? columnFlow.left : columnFlow.children[lastI].right)
86 columnFlow.children[i].anchors.right = undefined
87 columnFlow.children[i].width = columnFlow.width / columns
88
89 lastI = i
90 count++
91 }
92
93 //add the other elements
94 for (i = i; i < columnFlow.children.length; i++) {
95 var highestHeight = Number.MAX_VALUE
96 var newColumn = 0
97
98 // CUSTOM - ignore if has just been removed
99 if (i === repeater.removeHintIndex && columnFlow.children[i] === repeater.removeHintItem) {
100 continue
101 }
102
103 if (!columnFlow.children[i] || String(columnFlow.children[i]).indexOf("QQuickRepeater") == 0)
104 //|| !columnFlow.children[i].visible) // CUSTOM - view is invisible at start
105 continue
106
107 // find the shortest column
108 for (j = 0; j < columns; j++) {
109 if (columnHeights[j] !== null && columnHeights[j] < highestHeight) {
110 newColumn = j
111 highestHeight = columnHeights[j]
112 }
113 }
114
115 // add the element to the shortest column
116 columnFlow.children[i].anchors.top = columnFlow.children[lastItem[newColumn]].bottom
117 columnFlow.children[i].anchors.left = columnFlow.children[lastItem[newColumn]].left
118 columnFlow.children[i].anchors.right = columnFlow.children[lastItem[newColumn]].right
119
120 lastItem[newColumn] = i
121 columnHeights[newColumn] += columnFlow.children[i].height
122 }
123
124 var cHeight = 0
125
126 for (i = 0; i < columnHeights.length; i++) {
127 if (columnHeights[i])
128 cHeight = Math.max(cHeight, columnHeights[i])
129 }
130
131 contentHeight = cHeight
132 updateWidths()
133 }
134
135 Repeater {
136 id: repeater
137 model: columnFlow.model
138 Component.onCompleted: {
139 columnFlow.repeaterCompleted = true
140 columnFlow.reEvalColumns()
141 }
142
143 // Provide a hint of the removed item
144 property int removeHintIndex: -1 // CUSTOM
145 property var removeHintItem // CUSTOM
146
147 onItemAdded: columnFlow.reEvalColumns() // CUSTOM - ms2 models are live
148 onItemRemoved: {
149 removeHintIndex = index
150 removeHintItem = item
151
152 columnFlow.reEvalColumns() // CUSTOM - ms2 models are live
153
154 // Set back to null to allow freeing of memory
155 removeHintIndex = -1
156 removeHintItem = undefined
157 }
158 }
159}
0160
=== modified file 'common/MusicPage.qml'
--- common/MusicPage.qml 2014-08-20 17:35:52 +0000
+++ common/MusicPage.qml 2014-10-09 02:19:53 +0000
@@ -23,6 +23,10 @@
23// generic page for music, could be useful for bottomedge implementation23// generic page for music, could be useful for bottomedge implementation
24Page {24Page {
25 id: thisPage25 id: thisPage
26 anchors {
27 bottomMargin: musicToolbar.visible ? musicToolbar.currentHeight : 0
28 fill: parent
29 }
2630
27 onVisibleChanged: {31 onVisibleChanged: {
28 if (visible) {32 if (visible) {
2933
=== modified file 'common/MusicRow.qml'
--- common/MusicRow.qml 2014-09-20 10:50:45 +0000
+++ common/MusicRow.qml 2014-10-09 02:19:53 +0000
@@ -24,12 +24,13 @@
24Row {24Row {
25 anchors {25 anchors {
26 left: parent.left26 left: parent.left
27 leftMargin: units.gu(1)27 leftMargin: units.gu(2)
28 right: parent.right28 right: parent.right
29 rightMargin: units.gu(1)29 rightMargin: units.gu(2)
30 }30 }
3131
32 property alias covers: coverRow.covers32 property alias covers: coverRow.covers
33 property bool showCovers: true
33 property alias pressed: coverRow.pressed34 property alias pressed: coverRow.pressed
34 property alias column: columnComponent.sourceComponent35 property alias column: columnComponent.sourceComponent
3536
@@ -37,6 +38,7 @@
3738
38 CoverRow {39 CoverRow {
39 id: coverRow40 id: coverRow
41 visible: showCovers
40 anchors {42 anchors {
41 top: parent.top43 top: parent.top
42 topMargin: units.gu(1)44 topMargin: units.gu(1)
@@ -50,9 +52,10 @@
50 id: columnComponent52 id: columnComponent
51 anchors {53 anchors {
52 top: parent.top54 top: parent.top
53 topMargin: units.gu(2)55 topMargin: units.gu(1)
54 }56 }
55 width: parent.width - coverRow.width - parent.spacing57 width: showCovers ? parent.width - coverRow.width - parent.spacing
58 : parent.width - parent.spacing
5659
57 onSourceComponentChanged: {60 onSourceComponentChanged: {
58 for (var i=0; i < item.children.length; i++) {61 for (var i=0; i < item.children.length; i++) {
5962
=== modified file 'common/SongsPage.qml'
--- common/SongsPage.qml 2014-09-20 15:41:33 +0000
+++ common/SongsPage.qml 2014-10-09 02:19:53 +0000
@@ -29,7 +29,6 @@
2929
30MusicPage {30MusicPage {
31 id: songStackPage31 id: songStackPage
32 anchors.bottomMargin: units.gu(.5)
33 objectName: "songsPage"32 objectName: "songsPage"
34 visible: false33 visible: false
3534
@@ -52,7 +51,6 @@
52 ListView {51 ListView {
53 id: albumtrackslist52 id: albumtrackslist
54 anchors {53 anchors {
55 bottomMargin: wideAspect ? musicToolbar.fullHeight : musicToolbar.mouseAreaOffset + musicToolbar.minimizedHeight
56 fill: parent54 fill: parent
57 }55 }
58 delegate: albumTracksDelegate56 delegate: albumTracksDelegate
@@ -61,19 +59,49 @@
61 width: parent.width59 width: parent.width
62 header: ListItem.Standard {60 header: ListItem.Standard {
63 id: albumInfo61 id: albumInfo
64 height: units.gu(22)62 height: albumArtist.visible ? units.gu(33) : units.gu(30)
6563
66 CoverRow {64 BlurredBackground {
65 id: blurredBackground
66 height: parent.height
67 art: albumImage.source
68 }
69
70 Image {
67 id: albumImage71 id: albumImage
68 anchors {72 anchors {
69 top: parent.top73 top: parent.top
70 left: parent.left74 left: parent.left
71 margins: units.gu(1)75 topMargin: units.gu(3)
72 }76 bottomMargin: units.gu(2)
73 count: songStackPage.covers.length77 leftMargin: units.gu(2)
74 size: units.gu(20)78 rightMargin: units.gu(2)
75 covers: songStackPage.covers79 }
76 spacing: units.gu(2)80 width: units.gu(18)
81 height: width
82 smooth: true
83 source: covers.length > 0
84 ? (covers[0].art !== undefined
85 ? covers[0].art
86 : decodeURIComponent("image://albumart/artist=" + covers[0].author + "&album=" + covers[0].album))
87 : Qt.resolvedUrl("../images/music-app-cover@30.png")
88 }
89
90 Label {
91 id: albumLabel
92 wrapMode: Text.NoWrap
93 maximumLineCount: 1
94 fontSize: "x-large"
95 color: styleMusic.common.music
96 anchors {
97 top: albumImage.bottom
98 topMargin: units.gu(1)
99 left: albumImage.left
100 right: parent.right
101 rightMargin: units.gu(2)
102 }
103 elide: Text.ElideRight
104 text: line2
77 }105 }
78106
79 Label {107 Label {
@@ -83,77 +111,115 @@
83 maximumLineCount: 1111 maximumLineCount: 1
84 fontSize: "small"112 fontSize: "small"
85 color: styleMusic.common.subtitle113 color: styleMusic.common.subtitle
86 anchors.left: albumImage.right114 visible: text !== i18n.tr("Playlist") &&
87 anchors.leftMargin: units.gu(1)115 text !== i18n.tr("Genre")
88 anchors.top: parent.top116 anchors {
89 anchors.topMargin: units.gu(1.5)117 top: albumLabel.bottom
90 anchors.right: parent.right118 topMargin: units.gu(0.75)
91 anchors.rightMargin: units.gu(1.5)119 left: albumImage.left
120 right: parent.right
121 rightMargin: units.gu(2)
122 }
92 elide: Text.ElideRight123 elide: Text.ElideRight
93 text: line1124 text: line1
94 }125 }
95 Label {126
96 id: albumLabel
97 wrapMode: Text.NoWrap
98 maximumLineCount: 2
99 fontSize: "medium"
100 color: styleMusic.common.music
101 anchors.left: albumImage.right
102 anchors.leftMargin: units.gu(1)
103 anchors.top: albumArtist.bottom
104 anchors.topMargin: units.gu(0.8)
105 anchors.right: parent.right
106 anchors.rightMargin: units.gu(1.5)
107 elide: Text.ElideRight
108 text: line2
109 }
110 Label {127 Label {
111 id: albumYear128 id: albumYear
112 wrapMode: Text.NoWrap129 wrapMode: Text.NoWrap
113 maximumLineCount: 1130 maximumLineCount: 1
114 fontSize: "x-small"131 fontSize: "small"
115 color: styleMusic.common.subtitle132 color: styleMusic.common.subtitle
116 anchors.left: albumImage.right133 anchors {
117 anchors.leftMargin: units.gu(1)134 top: albumArtist.visible ? albumArtist.bottom
118 anchors.top: albumLabel.bottom135 : albumLabel.bottom
119 anchors.topMargin: units.gu(2)136 topMargin: units.gu(1)
120 anchors.right: parent.right137 left: albumImage.left
121 anchors.rightMargin: units.gu(1.5)138 right: parent.right
139 rightMargin: units.gu(2)
140 }
122 elide: Text.ElideRight141 elide: Text.ElideRight
123 text: isAlbum && line1 !== i18n.tr("Genre") ? year + " | " + i18n.tr("%1 song", "%1 songs", albumtrackslist.count).arg(albumtrackslist.count)142 text: isAlbum && line1 !== i18n.tr("Genre") ? year + " | " + i18n.tr("%1 song", "%1 songs", albumtrackslist.count).arg(albumtrackslist.count)
124 : i18n.tr("%1 song", "%1 songs", albumtrackslist.count).arg(albumtrackslist.count)143 : i18n.tr("%1 song", "%1 songs", albumtrackslist.count).arg(albumtrackslist.count)
125144
126 }145 }
127146
147 // Shuffle
148 Button {
149 id: shuffleRow
150 anchors {
151 bottom: queueAllRow.top
152 bottomMargin: units.gu(2)
153 left: albumImage.right
154 leftMargin: units.gu(2)
155 }
156 strokeColor: UbuntuColors.green
157 height: units.gu(4)
158 width: units.gu(15)
159 Text {
160 anchors {
161 centerIn: parent
162 }
163 color: "white"
164 text: i18n.tr("Shuffle")
165 }
166 MouseArea {
167 anchors.fill: parent
168 onClicked: {
169 shuffleModel(albumtrackslist.model) // play track
170
171 if (isAlbum && songStackPage.line1 !== i18n.tr("Genre")) {
172 Library.addRecent(songStackPage.line2, songStackPage.line1, songStackPage.covers[0], songStackPage.line2, "album")
173 mainView.hasRecent = true
174 recentModel.filterRecent()
175 } else if (songStackPage.line1 === i18n.tr("Playlist")) {
176 Library.addRecent(songStackPage.line2, "Playlist", songStackPage.covers[0], songStackPage.line2, "playlist")
177 mainView.hasRecent = true
178 recentModel.filterRecent()
179 }
180 }
181 }
182 }
183
184 // Queue
185 Button {
186 id: queueAllRow
187 anchors {
188 bottom: playRow.top
189 bottomMargin: units.gu(2)
190 left: albumImage.right
191 leftMargin: units.gu(2)
192 }
193 strokeColor: UbuntuColors.green
194 height: units.gu(4)
195 width: units.gu(15)
196 Text {
197 anchors {
198 centerIn: parent
199 }
200 color: "white"
201 text: i18n.tr("Queue all")
202 }
203 MouseArea {
204 anchors.fill: parent
205 onClicked: {
206 addQueueFromModel(albumtrackslist.model)
207 }
208 }
209 }
210
128 // Play211 // Play
129 Rectangle {212 Button {
130 id: playRow213 id: playRow
131 anchors.top: albumYear.bottom214 anchors {
132 anchors.topMargin: units.gu(1)215 bottom: albumImage.bottom
133 anchors.left: albumImage.right216 left: albumImage.right
134 anchors.leftMargin: units.gu(1)217 leftMargin: units.gu(2)
135 color: "transparent"218 }
219 color: UbuntuColors.green
136 height: units.gu(4)220 height: units.gu(4)
137 width: units.gu(15)221 width: units.gu(15)
138 Icon {222 text: i18n.tr("Play all")
139 id: playTrack
140 objectName: "songspage-playtrack"
141 anchors.verticalCenter: parent.verticalCenter
142 name: "media-playback-start"
143 height: styleMusic.common.expandedItem
144 width: styleMusic.common.expandedItem
145 }
146 Label {
147 anchors.left: playTrack.right
148 anchors.leftMargin: units.gu(0.5)
149 anchors.verticalCenter: parent.verticalCenter
150 fontSize: "small"
151 color: styleMusic.common.subtitle
152 width: parent.width - playTrack.width - units.gu(1)
153 text: i18n.tr("Play all")
154 wrapMode: Text.WordWrap
155 maximumLineCount: 3
156 }
157 MouseArea {223 MouseArea {
158 anchors.fill: parent224 anchors.fill: parent
159 onClicked: {225 onClicked: {
@@ -171,43 +237,6 @@
171 }237 }
172 }238 }
173 }239 }
174
175 // Queue
176 Rectangle {
177 id: queueAllRow
178 anchors.top: playRow.bottom
179 anchors.topMargin: units.gu(1)
180 anchors.left: albumImage.right
181 anchors.leftMargin: units.gu(1)
182 color: "transparent"
183 height: units.gu(4)
184 width: units.gu(15)
185 Icon {
186 id: queueAll
187 objectName: "songspage-queue-all"
188 anchors.verticalCenter: parent.verticalCenter
189 name: "add"
190 height: styleMusic.common.expandedItem
191 width: styleMusic.common.expandedItem
192 }
193 Label {
194 anchors.left: queueAll.right
195 anchors.leftMargin: units.gu(0.5)
196 anchors.verticalCenter: parent.verticalCenter
197 fontSize: "small"
198 color: styleMusic.common.subtitle
199 width: parent.width - queueAll.width - units.gu(1)
200 text: i18n.tr("Add to queue")
201 wrapMode: Text.WordWrap
202 maximumLineCount: 3
203 }
204 MouseArea {
205 anchors.fill: parent
206 onClicked: {
207 addQueueFromModel(albumtrackslist.model)
208 }
209 }
210 }
211 }240 }
212241
213 Component {242 Component {
@@ -219,7 +248,8 @@
219 objectName: "songsPageListItem" + index248 objectName: "songsPageListItem" + index
220 iconFrame: false249 iconFrame: false
221 progression: false250 progression: false
222 height: styleMusic.common.itemHeight251 showDivider: false
252 height: units.gu(6)
223253
224 leftSideAction: songStackPage.line1 === i18n.tr("Playlist")254 leftSideAction: songStackPage.line1 === i18n.tr("Playlist")
225 ? playlistRemoveAction.item : null255 ? playlistRemoveAction.item : null
@@ -272,30 +302,23 @@
272302
273 MusicRow {303 MusicRow {
274 id: musicRow304 id: musicRow
275 covers: model.art !== undefined ? [{art: model.art}] : [{author: model.author, album: model.album}]305 covers: []
306 showCovers: false
276 column: Column {307 column: Column {
277 spacing: units.gu(1)308 Label {
309 id: trackTitle
310 color: styleMusic.common.music
311 fontSize: "small"
312 objectName: "songspage-tracktitle"
313 text: model.title
314 }
315
278 Label {316 Label {
279 id: trackArtist317 id: trackArtist
280 color: styleMusic.common.subtitle318 color: styleMusic.common.subtitle
281 fontSize: "x-small"319 fontSize: "x-small"
282 text: model.author320 text: model.author
283 }321 }
284
285 Label {
286 id: trackTitle
287 color: styleMusic.common.subtitle
288 fontSize: "medium"
289 objectName: "songspage-tracktitle"
290 text: model.title
291 }
292
293 Label {
294 id: trackAlbum
295 color: styleMusic.common.subtitle
296 fontSize: "xx-small"
297 text: model.album
298 }
299 }322 }
300 }323 }
301324
302325
=== modified file 'music-app.qml'
--- music-app.qml 2014-09-23 15:59:28 +0000
+++ music-app.qml 2014-10-09 02:19:53 +0000
@@ -40,18 +40,13 @@
40 id: mainView40 id: mainView
41 useDeprecatedToolbar: false41 useDeprecatedToolbar: false
4242
43 // Use toolbar color for header43 backgroundColor: "#1e1e23"
44 headerColor: styleMusic.toolbar.fullBackgroundColor44 headerColor: "#1e1e23"
45 backgroundColor: styleMusic.toolbar.fullBackgroundColor
4645
47 // Global keyboard shortcuts46 // Global keyboard shortcuts
48 focus: true47 focus: true
49 Keys.onPressed: {48 Keys.onPressed: {
50 if (event.key === Qt.Key_Alt) {49 if(event.key === Qt.Key_Escape) {
51 // On alt key press show toolbar and start autohide timer
52 musicToolbar.showToolbar();
53 }
54 else if(event.key === Qt.Key_Escape) {
55 musicToolbar.goBack(); // Esc Go back50 musicToolbar.goBack(); // Esc Go back
56 }51 }
57 else if(event.modifiers === Qt.AltModifier) {52 else if(event.modifiers === Qt.AltModifier) {
@@ -94,13 +89,11 @@
94 }89 }
95 break;90 break;
96 case Qt.Key_J: // Ctrl+J Jump to playing song91 case Qt.Key_J: // Ctrl+J Jump to playing song
97 nowPlaying.visible = true;92 tabs.pushNowPlaying()
98 nowPlaying.positionAt(player.currentIndex);93 nowPlaying.positionAt(player.currentIndex);
99 musicToolbar.showToolbar();
100 break;94 break;
101 case Qt.Key_N: // Ctrl+N Show now playing95 case Qt.Key_N: // Ctrl+N Show now playing
102 nowPlaying.visible = true;96 tabs.pushNowPlaying()
103 musicToolbar.showToolbar();
104 break;97 break;
105 case Qt.Key_P: // Ctrl+P Toggle playing state98 case Qt.Key_P: // Ctrl+P Toggle playing state
106 player.toggle();99 player.toggle();
@@ -577,12 +570,6 @@
577 if (args.values.url) {570 if (args.values.url) {
578 uriHandler.process(args.values.url, true);571 uriHandler.process(args.values.url, true);
579 }572 }
580
581 // Show toolbar and start timer if there is music
582 if (!emptyPage.noMusic) {
583 musicToolbar.showToolbar();
584 musicToolbar.startAutohideTimer();
585 }
586 }573 }
587574
588 // VARIABLES575 // VARIABLES
@@ -594,11 +581,10 @@
594 property string lastfmpassword581 property string lastfmpassword
595 property string timestamp // used to scrobble582 property string timestamp // used to scrobble
596 property var chosenElement: null583 property var chosenElement: null
597 property bool toolbarShown: musicToolbar.shown584 property bool toolbarShown: musicToolbar.visible
598 property bool selectedAlbum: false585 property bool selectedAlbum: false
599586
600 signal listItemSwiping(int i)587 signal listItemSwiping(int i)
601 signal onToolbarShownChanged(bool shown, var currentPage, var currentTab)
602588
603 property bool wideAspect: width >= units.gu(70) && loadedUI589 property bool wideAspect: width >= units.gu(70) && loadedUI
604 property bool loadedUI: false // property to detect if the UI has finished590 property bool loadedUI: false // property to detect if the UI has finished
@@ -680,8 +666,6 @@
680 // Show the Now Playing page and make sure the track is visible666 // Show the Now Playing page and make sure the track is visible
681 tabs.pushNowPlaying();667 tabs.pushNowPlaying();
682 nowPlaying.ensureVisibleIndex = index;668 nowPlaying.ensureVisibleIndex = index;
683
684 musicToolbar.showToolbar();
685 }669 }
686 else {670 else {
687 player.source = file;671 player.source = file;
@@ -697,10 +681,11 @@
697 }681 }
698682
699 // Show the Now Playing page and make sure the track is visible683 // Show the Now Playing page and make sure the track is visible
700 tabs.pushNowPlaying();684 if (!nowPlaying.isListView) {
685 tabs.pushNowPlaying();
686 }
687
701 nowPlaying.ensureVisibleIndex = index;688 nowPlaying.ensureVisibleIndex = index;
702
703 musicToolbar.showToolbar();
704 }689 }
705690
706 function playRandomSong(shuffle)691 function playRandomSong(shuffle)
@@ -716,6 +701,17 @@
716 trackClicked(allSongsModel, index, true)701 trackClicked(allSongsModel, index, true)
717 }702 }
718703
704 function shuffleModel(model)
705 {
706 var now = new Date();
707 var seed = now.getSeconds();
708 var index = Math.floor(model.count * Math.random(seed));
709
710 player.shuffle = true;
711
712 trackClicked(model, index, true)
713 }
714
719 // Load mediascanner store715 // Load mediascanner store
720 MediaStore {716 MediaStore {
721 id: musicStore717 id: musicStore
@@ -867,10 +863,6 @@
867 id: searchSheet863 id: searchSheet
868 }864 }
869865
870 // Blurred background
871 BlurredBackground {
872 }
873
874 // Popover for tracks, queue and add to playlist, for example866 // Popover for tracks, queue and add to playlist, for example
875 Component {867 Component {
876 id: trackPopoverComponent868 id: trackPopoverComponent
@@ -973,6 +965,7 @@
973965
974 MusicToolbar {966 MusicToolbar {
975 id: musicToolbar967 id: musicToolbar
968 visible: nowPlaying.isListView || !nowPlaying.visible
976 objectName: "musicToolbarObject"969 objectName: "musicToolbarObject"
977 z: 200 // put on top of everything else970 z: 200 // put on top of everything else
978 }971 }
@@ -983,7 +976,6 @@
983 Tabs {976 Tabs {
984 id: tabs977 id: tabs
985 anchors {978 anchors {
986 bottomMargin: wideAspect ? musicToolbar.fullHeight : undefined
987 fill: parent979 fill: parent
988 }980 }
989981
@@ -1110,6 +1102,8 @@
1110 if (mainPageStack.currentPage !== nowPlaying) {1102 if (mainPageStack.currentPage !== nowPlaying) {
1111 mainPageStack.push(nowPlaying);1103 mainPageStack.push(nowPlaying);
1112 }1104 }
1105
1106 nowPlaying.isListView = false; // ensure full view
1113 }1107 }
11141108
1115 Component.onCompleted: musicToolbar.currentTab = selectedTab1109 Component.onCompleted: musicToolbar.currentTab = selectedTab
11161110
=== modified file 'po/com.ubuntu.music.pot'
--- po/com.ubuntu.music.pot 2014-09-23 12:44:36 +0000
+++ po/com.ubuntu.music.pot 2014-10-09 02:19:53 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: music-app\n"9"Project-Id-Version: music-app\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2014-09-23 13:43+0100\n"11"POT-Creation-Date: 2014-10-02 20:40-0500\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -76,7 +76,7 @@
7676
77#: ../MusicArtists.qml:113 ../MusicPlaylists.qml:180 ../MusicStart.qml:37177#: ../MusicArtists.qml:113 ../MusicPlaylists.qml:180 ../MusicStart.qml:371
78#: ../MusicaddtoPlaylist.qml:106 ../common/AlbumsPage.qml:33178#: ../MusicaddtoPlaylist.qml:106 ../common/AlbumsPage.qml:331
79#: ../common/SongsPage.qml:123 ../common/SongsPage.qml:12479#: ../common/SongsPage.qml:138 ../common/SongsPage.qml:139
80#, qt-format80#, qt-format
81msgid "%1 song"81msgid "%1 song"
82msgid_plural "%1 songs"82msgid_plural "%1 songs"
@@ -114,31 +114,32 @@
114msgid "Change"114msgid "Change"
115msgstr ""115msgstr ""
116116
117#: ../MusicPlaylists.qml:96 ../music-app.qml:956117#: ../MusicPlaylists.qml:96 ../music-app.qml:962
118msgid "Playlist already exists"118msgid "Playlist already exists"
119msgstr ""119msgstr ""
120120
121#: ../MusicPlaylists.qml:100 ../music-app.qml:961121#: ../MusicPlaylists.qml:100 ../music-app.qml:967
122msgid "Please type in a name."122msgid "Please type in a name."
123msgstr ""123msgstr ""
124124
125#: ../MusicPlaylists.qml:105 ../music-app.qml:493 ../music-app.qml:967125#: ../MusicPlaylists.qml:105 ../music-app.qml:492 ../music-app.qml:973
126msgid "Cancel"126msgid "Cancel"
127msgstr ""127msgstr ""
128128
129#: ../MusicPlaylists.qml:159 ../MusicPlaylists.qml:163 ../MusicStart.qml:118129#: ../MusicPlaylists.qml:159 ../MusicPlaylists.qml:163 ../MusicStart.qml:118
130#: ../MusicStart.qml:200 ../common/SongsPage.qml:166130#: ../MusicStart.qml:200 ../common/SongsPage.qml:114
131#: ../common/SongsPage.qml:224 ../common/SongsPage.qml:226131#: ../common/SongsPage.qml:171 ../common/SongsPage.qml:228
132#: ../common/SongsPage.qml:244132#: ../common/SongsPage.qml:250 ../common/SongsPage.qml:252
133#: ../common/SongsPage.qml:270
133msgid "Playlist"134msgid "Playlist"
134msgstr ""135msgstr ""
135136
136#: ../MusicSearch.qml:44 ../MusicSearch.qml:75 ../MusicToolbar.qml:519137#: ../MusicSearch.qml:44 ../MusicSearch.qml:75 ../MusicToolbar.qml:522
137#: ../music-app.qml:93 ../music-app.qml:141 ../music-app.qml:147138#: ../music-app.qml:92 ../music-app.qml:140 ../music-app.qml:146
138msgid "Search"139msgid "Search"
139msgstr ""140msgstr ""
140141
141#: ../MusicSettings.qml:30 ../music-app.qml:191142#: ../MusicSettings.qml:30 ../music-app.qml:190
142msgid "Settings"143msgid "Settings"
143msgstr ""144msgstr ""
144145
@@ -224,7 +225,7 @@
224msgid "Clean everything!"225msgid "Clean everything!"
225msgstr ""226msgstr ""
226227
227#: ../MusicStart.qml:35 ../music-app.qml:589 ../music-app.qml:1150228#: ../MusicStart.qml:35 ../music-app.qml:588 ../music-app.qml:1156
228#: com.ubuntu.music_music.desktop.in.in.h:1229#: com.ubuntu.music_music.desktop.in.in.h:1
229msgid "Music"230msgid "Music"
230msgstr ""231msgstr ""
@@ -241,13 +242,14 @@
241msgid "Genres"242msgid "Genres"
242msgstr ""243msgstr ""
243244
244#: ../MusicStart.qml:316 ../MusicStart.qml:318 ../common/SongsPage.qml:123245#: ../MusicStart.qml:316 ../MusicStart.qml:318 ../common/SongsPage.qml:115
245#: ../common/SongsPage.qml:162 ../common/SongsPage.qml:240246#: ../common/SongsPage.qml:138 ../common/SongsPage.qml:167
247#: ../common/SongsPage.qml:224 ../common/SongsPage.qml:266
246msgid "Genre"248msgid "Genre"
247msgstr ""249msgstr ""
248250
249#: ../MusicToolbar.qml:760251#: ../MusicToolbar.qml:767
250msgid "Tap play to shuffle music"252msgid "Tap to shuffle music"
251msgstr ""253msgstr ""
252254
253#: ../MusicTracks.qml:35255#: ../MusicTracks.qml:35
@@ -259,16 +261,16 @@
259msgstr ""261msgstr ""
260262
261#: ../common/AlbumsPage.qml:167 ../common/AlbumsPage.qml:360263#: ../common/AlbumsPage.qml:167 ../common/AlbumsPage.qml:360
262#: ../common/SongsPage.qml:153264#: ../common/SongsPage.qml:218
263msgid "Play all"265msgid "Play all"
264msgstr ""266msgstr ""
265267
266#: ../common/AlbumsPage.qml:211 ../common/AlbumsPage.qml:400268#: ../common/AlbumsPage.qml:211 ../common/AlbumsPage.qml:400
267#: ../common/SongsPage.qml:200 ../music-app.qml:888269#: ../music-app.qml:894
268msgid "Add to queue"270msgid "Add to queue"
269msgstr ""271msgstr ""
270272
271#: ../common/ListItemActions/AddToPlaylist.qml:25 ../music-app.qml:902273#: ../common/ListItemActions/AddToPlaylist.qml:25 ../music-app.qml:908
272msgid "Add to playlist"274msgid "Add to playlist"
273msgstr ""275msgstr ""
274276
@@ -294,6 +296,14 @@
294msgid "Loading..."296msgid "Loading..."
295msgstr ""297msgstr ""
296298
299#: ../common/SongsPage.qml:160
300msgid "Shuffle"
301msgstr ""
302
303#: ../common/SongsPage.qml:197
304msgid "Queue all"
305msgstr ""
306
297#: ../common/SwipeDelete.qml:52 ../common/SwipeDelete.qml:88307#: ../common/SwipeDelete.qml:52 ../common/SwipeDelete.qml:88
298msgid "Clear"308msgid "Clear"
299msgstr ""309msgstr ""
@@ -306,127 +316,127 @@
306msgid "Unknown Artist"316msgid "Unknown Artist"
307msgstr ""317msgstr ""
308318
309#: ../music-app.qml:142319#: ../music-app.qml:141
310msgid "Search Track"320msgid "Search Track"
311msgstr ""321msgstr ""
312322
323#: ../music-app.qml:153
324msgid "Next"
325msgstr ""
326
313#: ../music-app.qml:154327#: ../music-app.qml:154
314msgid "Next"
315msgstr ""
316
317#: ../music-app.qml:155
318msgid "Next Track"328msgid "Next Track"
319msgstr ""329msgstr ""
320330
321#: ../music-app.qml:161331#: ../music-app.qml:160
322msgid "Pause"332msgid "Pause"
323msgstr ""333msgstr ""
324334
325#: ../music-app.qml:161335#: ../music-app.qml:160
326msgid "Play"336msgid "Play"
327msgstr ""337msgstr ""
328338
329#: ../music-app.qml:163339#: ../music-app.qml:162
330msgid "Pause Playback"340msgid "Pause Playback"
331msgstr ""341msgstr ""
332342
333#: ../music-app.qml:163343#: ../music-app.qml:162
334msgid "Continue or start playback"344msgid "Continue or start playback"
335msgstr ""345msgstr ""
336346
347#: ../music-app.qml:167
348msgid "Back"
349msgstr ""
350
337#: ../music-app.qml:168351#: ../music-app.qml:168
338msgid "Back"
339msgstr ""
340
341#: ../music-app.qml:169
342msgid "Go back to last page"352msgid "Go back to last page"
343msgstr ""353msgstr ""
344354
355#: ../music-app.qml:176
356msgid "Previous"
357msgstr ""
358
345#: ../music-app.qml:177359#: ../music-app.qml:177
346msgid "Previous"
347msgstr ""
348
349#: ../music-app.qml:178
350msgid "Previous Track"360msgid "Previous Track"
351msgstr ""361msgstr ""
352362
363#: ../music-app.qml:182
364msgid "Stop"
365msgstr ""
366
353#: ../music-app.qml:183367#: ../music-app.qml:183
354msgid "Stop"
355msgstr ""
356
357#: ../music-app.qml:184
358msgid "Stop Playback"368msgid "Stop Playback"
359msgstr ""369msgstr ""
360370
361#: ../music-app.qml:192371#: ../music-app.qml:191
362msgid "Music Settings"372msgid "Music Settings"
363msgstr ""373msgstr ""
364374
365#. TRANSLATORS: This string represents that the target destination filepath does not start with ~/Music/Imported/375#. TRANSLATORS: This string represents that the target destination filepath does not start with ~/Music/Imported/
366#: ../music-app.qml:338376#: ../music-app.qml:337
367msgid "Filepath must start with"377msgid "Filepath must start with"
368msgstr ""378msgstr ""
369379
370#. TRANSLATORS: This string represents that a blank filepath destination has been used380#. TRANSLATORS: This string represents that a blank filepath destination has been used
371#: ../music-app.qml:364381#: ../music-app.qml:363
372msgid "Filepath must be a file"382msgid "Filepath must be a file"
373msgstr ""383msgstr ""
374384
375#. TRANSLATORS: This string represents that there was failure moving the file to the target destination385#. TRANSLATORS: This string represents that there was failure moving the file to the target destination
376#: ../music-app.qml:370386#: ../music-app.qml:369
377msgid "Failed to move file"387msgid "Failed to move file"
378msgstr ""388msgstr ""
379389
380#: ../music-app.qml:447390#: ../music-app.qml:446
381msgid "Waiting for file(s)..."391msgid "Waiting for file(s)..."
382msgstr ""392msgstr ""
383393
384#: ../music-app.qml:466394#: ../music-app.qml:465
385msgid "OK"395msgid "OK"
386msgstr ""396msgstr ""
387397
388#: ../music-app.qml:479398#: ../music-app.qml:478
389msgid "Imported file not found"399msgid "Imported file not found"
390msgstr ""400msgstr ""
391401
392#: ../music-app.qml:483402#: ../music-app.qml:482
393msgid "Wait"403msgid "Wait"
394msgstr ""404msgstr ""
395405
396#. TRANSLATORS: this refers to a number of songs greater than one. The actual number will be prepended to the string automatically (plural forms are not yet fully supported in usermetrics, the library that displays that string)406#. TRANSLATORS: this refers to a number of songs greater than one. The actual number will be prepended to the string automatically (plural forms are not yet fully supported in usermetrics, the library that displays that string)
407#: ../music-app.qml:503
408msgid "songs played today"
409msgstr ""
410
397#: ../music-app.qml:504411#: ../music-app.qml:504
398msgid "songs played today"
399msgstr ""
400
401#: ../music-app.qml:505
402msgid "No songs played today"412msgid "No songs played today"
403msgstr ""413msgstr ""
404414
405#: ../music-app.qml:613415#: ../music-app.qml:612
406msgid "Debug: "416msgid "Debug: "
407msgstr ""417msgstr ""
408418
409#: ../music-app.qml:925419#: ../music-app.qml:931
410msgid "New Playlist"420msgid "New Playlist"
411msgstr ""421msgstr ""
412422
413#: ../music-app.qml:926423#: ../music-app.qml:932
414msgid "Name your playlist."424msgid "Name your playlist."
415msgstr ""425msgstr ""
416426
417#: ../music-app.qml:930427#: ../music-app.qml:936
418msgid "Name"428msgid "Name"
419msgstr ""429msgstr ""
420430
421#: ../music-app.qml:940431#: ../music-app.qml:946
422msgid "Create"432msgid "Create"
423msgstr ""433msgstr ""
424434
425#: ../music-app.qml:1176435#: ../music-app.qml:1182
426msgid "No music found"436msgid "No music found"
427msgstr ""437msgstr ""
428438
429#: ../music-app.qml:1183439#: ../music-app.qml:1189
430msgid "Please import music"440msgid "Please import music"
431msgstr ""441msgstr ""
432442
433443
=== modified file 'po/pt_BR.po'
--- po/pt_BR.po 2014-10-01 06:25:24 +0000
+++ po/pt_BR.po 2014-10-09 02:19:53 +0000
@@ -1,441 +1,459 @@
1# Brazilian Portuguese translation for music-app1# Brazilian Portuguese translation for music-app
2# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 20132# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014
3# This file is distributed under the same license as the music-app package.3# This file is distributed under the same license as the music-app package.
4# FIRST AUTHOR <EMAIL@ADDRESS>, 2013.4# FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
5#5#
6msgid ""6msgid ""
7msgstr ""7msgstr ""
8"Project-Id-Version: music-app\n"8"Project-Id-Version: music-app\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10<<<<<<< TREE
10"POT-Creation-Date: 2014-09-23 13:43+0100\n"11"POT-Creation-Date: 2014-09-23 13:43+0100\n"
11"PO-Revision-Date: 2014-09-30 17:34+0000\n"12"PO-Revision-Date: 2014-09-30 17:34+0000\n"
12"Last-Translator: Rafael Neri <Unknown>\n"13"Last-Translator: Rafael Neri <Unknown>\n"
14=======
15"POT-Creation-Date: 2014-10-02 20:40-0500\n"
16"PO-Revision-Date: 2014-09-30 18:07+0000\n"
17"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
18>>>>>>> MERGE-SOURCE
13"Language-Team: Brazilian Portuguese <pt_BR@li.org>\n"19"Language-Team: Brazilian Portuguese <pt_BR@li.org>\n"
14"MIME-Version: 1.0\n"20"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"21"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"22"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=2; plural=n > 1;\n"23"Plural-Forms: nplurals=2; plural=n > 1;\n"
24<<<<<<< TREE
18"X-Launchpad-Export-Date: 2014-10-01 06:25+0000\n"25"X-Launchpad-Export-Date: 2014-10-01 06:25+0000\n"
26=======
27"X-Launchpad-Export-Date: 2014-10-05 07:28+0000\n"
28>>>>>>> MERGE-SOURCE
19"X-Generator: Launchpad (build 17196)\n"29"X-Generator: Launchpad (build 17196)\n"
2030
21#: ../LoginLastFM.qml:48 ../MusicSettings.qml:145 ../MusicSettings.qml:15331#: ../LoginLastFM.qml:48 ../MusicSettings.qml:145 ../MusicSettings.qml:153
22msgid "Last.fm"32msgid "Last.fm"
23msgstr "Last.fm"33msgstr ""
2434
25#: ../LoginLastFM.qml:5435#: ../LoginLastFM.qml:54
26msgid "Login to be able to scrobble."36msgid "Login to be able to scrobble."
27msgstr "Faça login para habilitar o scrobble."37msgstr ""
2838
29#: ../LoginLastFM.qml:6239#: ../LoginLastFM.qml:62
30msgid "Username"40msgid "Username"
31msgstr "Usuário"41msgstr ""
3242
33#: ../LoginLastFM.qml:7243#: ../LoginLastFM.qml:72
34msgid "Password"44msgid "Password"
35msgstr "Senha"45msgstr ""
3646
37#: ../LoginLastFM.qml:9447#: ../LoginLastFM.qml:94
38msgid "Login"48msgid "Login"
39msgstr "Login"49msgstr ""
4050
41#: ../LoginLastFM.qml:10151#: ../LoginLastFM.qml:101
42msgid "Trying to login..."52msgid "Trying to login..."
43msgstr "Tentando entrar..."53msgstr ""
4454
45#: ../LoginLastFM.qml:11555#: ../LoginLastFM.qml:115
46msgid "Login Successful"56msgid "Login Successful"
47msgstr "Login realizado com sucesso"57msgstr ""
4858
49#: ../LoginLastFM.qml:12159#: ../LoginLastFM.qml:121
50msgid "Login Failed"60msgid "Login Failed"
51msgstr "Falha no login"61msgstr ""
5262
53#: ../LoginLastFM.qml:12763#: ../LoginLastFM.qml:127
54msgid "You forgot to set your username and/or password"64msgid "You forgot to set your username and/or password"
55msgstr "Você esqueceu de definir seu usuário e/ou senha"65msgstr ""
5666
57#: ../MusicAlbums.qml:35 ../MusicStart.qml:39267#: ../MusicAlbums.qml:35 ../MusicStart.qml:392
58msgid "Albums"68msgid "Albums"
59msgstr "Álbuns"69msgstr ""
6070
61#: ../MusicAlbums.qml:152 ../MusicStart.qml:200 ../MusicStart.qml:45471#: ../MusicAlbums.qml:152 ../MusicStart.qml:200 ../MusicStart.qml:454
62#: ../common/AlbumsPage.qml:26472#: ../common/AlbumsPage.qml:264
63msgid "Album"73msgid "Album"
64msgstr "Álbum"74msgstr ""
6575
66#: ../MusicArtists.qml:3776#: ../MusicArtists.qml:37
67msgid "Artists"77msgid "Artists"
68msgstr "Artistas"78msgstr ""
6979
70#: ../MusicArtists.qml:107 ../common/AlbumsPage.qml:11280#: ../MusicArtists.qml:107 ../common/AlbumsPage.qml:112
71#, qt-format81#, qt-format
72msgid "%1 album"82msgid "%1 album"
73msgid_plural "%1 albums"83msgid_plural "%1 albums"
74msgstr[0] "%1 álbum"84msgstr[0] ""
75msgstr[1] "%1 álbuns"85msgstr[1] ""
7686
77#: ../MusicArtists.qml:113 ../MusicPlaylists.qml:180 ../MusicStart.qml:37187#: ../MusicArtists.qml:113 ../MusicPlaylists.qml:180 ../MusicStart.qml:371
78#: ../MusicaddtoPlaylist.qml:106 ../common/AlbumsPage.qml:33188#: ../MusicaddtoPlaylist.qml:106 ../common/AlbumsPage.qml:331
79#: ../common/SongsPage.qml:123 ../common/SongsPage.qml:12489#: ../common/SongsPage.qml:138 ../common/SongsPage.qml:139
80#, qt-format90#, qt-format
81msgid "%1 song"91msgid "%1 song"
82msgid_plural "%1 songs"92msgid_plural "%1 songs"
83msgstr[0] "%1 música"93msgstr[0] ""
84msgstr[1] "%1 músicas"94msgstr[1] ""
8595
86#: ../MusicArtists.qml:12396#: ../MusicArtists.qml:123
87msgid "Artist"97msgid "Artist"
88msgstr "Artista"98msgstr ""
8999
90#: ../MusicNowPlaying.qml:33100#: ../MusicNowPlaying.qml:33
91msgid "Now Playing"101msgid "Now Playing"
92msgstr "Reproduzindo agora"102msgstr ""
93103
94#. TRANSLATORS: this is the name of the playlists page shown in the tab header.104#. TRANSLATORS: this is the name of the playlists page shown in the tab header.
95#. Remember to keep the translation short to fit the screen width105#. Remember to keep the translation short to fit the screen width
96#: ../MusicPlaylists.qml:38106#: ../MusicPlaylists.qml:38
97msgid "Playlists"107msgid "Playlists"
98msgstr "Listas de reprodução"108msgstr ""
99109
100#: ../MusicPlaylists.qml:48 ../MusicaddtoPlaylist.qml:48110#: ../MusicPlaylists.qml:48 ../MusicaddtoPlaylist.qml:48
101msgid "New playlist"111msgid "New playlist"
102msgstr "Nova lista de reprodução"112msgstr ""
103113
104#. TRANSLATORS: this is a title of a dialog with a prompt to rename a playlist114#. TRANSLATORS: this is a title of a dialog with a prompt to rename a playlist
105#: ../MusicPlaylists.qml:64115#: ../MusicPlaylists.qml:64
106msgid "Change name"116msgid "Change name"
107msgstr "Alterar nome"117msgstr ""
108118
109#: ../MusicPlaylists.qml:65119#: ../MusicPlaylists.qml:65
110msgid "Enter the new name of the playlist."120msgid "Enter the new name of the playlist."
111msgstr "Inserir o novo nome da lista de reprodução."121msgstr ""
112122
113#: ../MusicPlaylists.qml:78123#: ../MusicPlaylists.qml:78
114msgid "Change"124msgid "Change"
115msgstr "Alterar"125msgstr ""
116126
117#: ../MusicPlaylists.qml:96 ../music-app.qml:956127#: ../MusicPlaylists.qml:96 ../music-app.qml:962
118msgid "Playlist already exists"128msgid "Playlist already exists"
119msgstr "Lista de reprodução já existe"129msgstr ""
120130
121#: ../MusicPlaylists.qml:100 ../music-app.qml:961131#: ../MusicPlaylists.qml:100 ../music-app.qml:967
122msgid "Please type in a name."132msgid "Please type in a name."
123msgstr "Por favor, informe um nome."133msgstr ""
124134
125#: ../MusicPlaylists.qml:105 ../music-app.qml:493 ../music-app.qml:967135#: ../MusicPlaylists.qml:105 ../music-app.qml:492 ../music-app.qml:973
126msgid "Cancel"136msgid "Cancel"
127msgstr "Cancelar"137msgstr ""
128138
129#: ../MusicPlaylists.qml:159 ../MusicPlaylists.qml:163 ../MusicStart.qml:118139#: ../MusicPlaylists.qml:159 ../MusicPlaylists.qml:163 ../MusicStart.qml:118
130#: ../MusicStart.qml:200 ../common/SongsPage.qml:166140#: ../MusicStart.qml:200 ../common/SongsPage.qml:114
131#: ../common/SongsPage.qml:224 ../common/SongsPage.qml:226141#: ../common/SongsPage.qml:171 ../common/SongsPage.qml:228
132#: ../common/SongsPage.qml:244142#: ../common/SongsPage.qml:250 ../common/SongsPage.qml:252
143#: ../common/SongsPage.qml:270
133msgid "Playlist"144msgid "Playlist"
134msgstr "Lista de reprodução"145msgstr ""
135146
136#: ../MusicSearch.qml:44 ../MusicSearch.qml:75 ../MusicToolbar.qml:519147#: ../MusicSearch.qml:44 ../MusicSearch.qml:75 ../MusicToolbar.qml:522
137#: ../music-app.qml:93 ../music-app.qml:141 ../music-app.qml:147148#: ../music-app.qml:92 ../music-app.qml:140 ../music-app.qml:146
138msgid "Search"149msgid "Search"
139msgstr "Pesquisar"150msgstr ""
140151
141#: ../MusicSettings.qml:30 ../music-app.qml:191152#: ../MusicSettings.qml:30 ../music-app.qml:190
142msgid "Settings"153msgid "Settings"
143msgstr "Configurações"154msgstr ""
144155
145#: ../MusicSettings.qml:81156#: ../MusicSettings.qml:81
146msgid "Equaliser"157msgid "Equaliser"
147msgstr "Equalizador"158msgstr ""
148159
149#: ../MusicSettings.qml:82160#: ../MusicSettings.qml:82
150msgid "Default"161msgid "Default"
151msgstr "Padrão"162msgstr ""
152163
153#: ../MusicSettings.qml:83164#: ../MusicSettings.qml:83
154msgid "Acoustic"165msgid "Acoustic"
155msgstr "Acústico"166msgstr ""
156167
157#: ../MusicSettings.qml:84168#: ../MusicSettings.qml:84
158msgid "Classical"169msgid "Classical"
159msgstr "Clássica"170msgstr ""
160171
161#: ../MusicSettings.qml:85172#: ../MusicSettings.qml:85
162msgid "Electronic"173msgid "Electronic"
163msgstr "Eletrônica"174msgstr ""
164175
165#: ../MusicSettings.qml:86176#: ../MusicSettings.qml:86
166msgid "Flat"177msgid "Flat"
167msgstr "Flat"178msgstr ""
168179
169#: ../MusicSettings.qml:87180#: ../MusicSettings.qml:87
170msgid "Hip Hop"181msgid "Hip Hop"
171msgstr "Hip Hop"182msgstr ""
172183
173#: ../MusicSettings.qml:88184#: ../MusicSettings.qml:88
174msgid "Jazz"185msgid "Jazz"
175msgstr "Jazz"186msgstr ""
176187
177#: ../MusicSettings.qml:89188#: ../MusicSettings.qml:89
178msgid "Metal"189msgid "Metal"
179msgstr "Metal"190msgstr ""
180191
181#: ../MusicSettings.qml:90192#: ../MusicSettings.qml:90
182msgid "Pop"193msgid "Pop"
183msgstr "Pop"194msgstr ""
184195
185#: ../MusicSettings.qml:91196#: ../MusicSettings.qml:91
186msgid "Rock"197msgid "Rock"
187msgstr "Rock"198msgstr ""
188199
189#: ../MusicSettings.qml:92200#: ../MusicSettings.qml:92
190msgid "Custom"201msgid "Custom"
191msgstr "Personalizado"202msgstr ""
192203
193#: ../MusicSettings.qml:112204#: ../MusicSettings.qml:112
194msgid ""205msgid ""
195"Snap to current song \n"206"Snap to current song \n"
196"when opening toolbar"207"when opening toolbar"
197msgstr ""208msgstr ""
198"Ajustar a música atual \n"
199"quando abrir a barra de ferramentas"
200209
201#: ../MusicSettings.qml:132210#: ../MusicSettings.qml:132
202msgid "Accounts"211msgid "Accounts"
203msgstr "Contas"212msgstr ""
204213
205#: ../MusicSettings.qml:146214#: ../MusicSettings.qml:146
206msgid "Login to scrobble and import playlists"215msgid "Login to scrobble and import playlists"
207msgstr "Fazer login no scrobble e importar as listas de reprodução"216msgstr ""
208217
209#: ../MusicSettings.qml:169218#: ../MusicSettings.qml:169
210msgid "Music Streaming"219msgid "Music Streaming"
211msgstr "Streaming de música"220msgstr ""
212221
213#: ../MusicSettings.qml:179222#: ../MusicSettings.qml:179
214msgid "Ubuntu One"223msgid "Ubuntu One"
215msgstr "Ubuntu One"224msgstr ""
216225
217#: ../MusicSettings.qml:180226#: ../MusicSettings.qml:180
218msgid "Sign in to stream your cloud music"227msgid "Sign in to stream your cloud music"
219msgstr "Fazer login para transmitir suas músicas armazenadas em nuvem"228msgstr ""
220229
221#: ../MusicSettings.qml:196230#: ../MusicSettings.qml:196
222msgid "Stream only on Wi-Fi"231msgid "Stream only on Wi-Fi"
223msgstr "Transmitir apenas através de Wi-Fi"232msgstr ""
224233
225#: ../MusicSettings.qml:230234#: ../MusicSettings.qml:230
226msgid "Clean everything!"235msgid "Clean everything!"
227msgstr "Limpar tudo!"236msgstr ""
228237
229#: ../MusicStart.qml:35 ../music-app.qml:589 ../music-app.qml:1150238#: ../MusicStart.qml:35 ../music-app.qml:588 ../music-app.qml:1156
230#: com.ubuntu.music_music.desktop.in.in.h:1239#: com.ubuntu.music_music.desktop.in.in.h:1
231msgid "Music"240msgid "Music"
232msgstr "Música"241msgstr ""
233242
234#: ../MusicStart.qml:75243#: ../MusicStart.qml:75
235msgid "Recent"244msgid "Recent"
236msgstr "Recente"245msgstr ""
237246
238#: ../MusicStart.qml:103247#: ../MusicStart.qml:103
239msgid "Clear History"248msgid "Clear History"
240msgstr "Limpar histórico"249msgstr ""
241250
242#: ../MusicStart.qml:227251#: ../MusicStart.qml:227
243msgid "Genres"252msgid "Genres"
244msgstr "Gêneros"253msgstr ""
245254
246#: ../MusicStart.qml:316 ../MusicStart.qml:318 ../common/SongsPage.qml:123255#: ../MusicStart.qml:316 ../MusicStart.qml:318 ../common/SongsPage.qml:115
247#: ../common/SongsPage.qml:162 ../common/SongsPage.qml:240256#: ../common/SongsPage.qml:138 ../common/SongsPage.qml:167
257#: ../common/SongsPage.qml:224 ../common/SongsPage.qml:266
248msgid "Genre"258msgid "Genre"
249msgstr "Gênero"259msgstr ""
250260
251#: ../MusicToolbar.qml:760261#: ../MusicToolbar.qml:767
252msgid "Tap play to shuffle music"262msgid "Tap to shuffle music"
253msgstr "Toque em reproduzir para embaralhar músicas"263msgstr ""
254264
255#: ../MusicTracks.qml:35265#: ../MusicTracks.qml:35
256msgid "Songs"266msgid "Songs"
257msgstr "Músicas"267msgstr ""
258268
259#: ../MusicaddtoPlaylist.qml:41269#: ../MusicaddtoPlaylist.qml:41
260msgid "Select playlist"270msgid "Select playlist"
261msgstr "Selecione uma lista de reprodução"271msgstr ""
262272
263#: ../common/AlbumsPage.qml:167 ../common/AlbumsPage.qml:360273#: ../common/AlbumsPage.qml:167 ../common/AlbumsPage.qml:360
264#: ../common/SongsPage.qml:153274#: ../common/SongsPage.qml:218
265msgid "Play all"275msgid "Play all"
266msgstr "Tocar tudo"276msgstr ""
267277
268#: ../common/AlbumsPage.qml:211 ../common/AlbumsPage.qml:400278#: ../common/AlbumsPage.qml:211 ../common/AlbumsPage.qml:400
269#: ../common/SongsPage.qml:200 ../music-app.qml:888279#: ../music-app.qml:894
270msgid "Add to queue"280msgid "Add to queue"
271msgstr "Adicionar à fila"281msgstr ""
272282
273#: ../common/ListItemActions/AddToPlaylist.qml:25 ../music-app.qml:902283#: ../common/ListItemActions/AddToPlaylist.qml:25 ../music-app.qml:908
274msgid "Add to playlist"284msgid "Add to playlist"
275msgstr "Adicionar à lista de reprodução"285msgstr ""
276286
277#: ../common/ListItemActions/AddToQueue.qml:25287#: ../common/ListItemActions/AddToQueue.qml:25
278msgid "Add to Queue"288msgid "Add to Queue"
279msgstr "Adicionar à fila de reprodução"289msgstr ""
280290
281#. TRANSLATORS: this refers to deleting a playlist291#. TRANSLATORS: this refers to deleting a playlist
282#: ../common/ListItemActions/DeletePlaylist.qml:26292#: ../common/ListItemActions/DeletePlaylist.qml:26
283msgid "Delete"293msgid "Delete"
284msgstr "Apagar"294msgstr ""
285295
286#. TRANSLATORS: this refers to editing a playlist296#. TRANSLATORS: this refers to editing a playlist
287#: ../common/ListItemActions/EditPlaylist.qml:26297#: ../common/ListItemActions/EditPlaylist.qml:26
288msgid "Edit"298msgid "Edit"
289msgstr "Editar"299msgstr ""
290300
291#: ../common/ListItemActions/Remove.qml:27301#: ../common/ListItemActions/Remove.qml:27
292msgid "Remove"302msgid "Remove"
293msgstr "Remover"303msgstr ""
294304
295#: ../common/LoadingSpinnerComponent.qml:47305#: ../common/LoadingSpinnerComponent.qml:47
296msgid "Loading..."306msgid "Loading..."
297msgstr "Carregando..."307msgstr ""
308
309#: ../common/SongsPage.qml:160
310msgid "Shuffle"
311msgstr ""
312
313#: ../common/SongsPage.qml:197
314msgid "Queue all"
315msgstr ""
298316
299#: ../common/SwipeDelete.qml:52 ../common/SwipeDelete.qml:88317#: ../common/SwipeDelete.qml:52 ../common/SwipeDelete.qml:88
300msgid "Clear"318msgid "Clear"
301msgstr "Limpar"319msgstr ""
302320
303#: ../meta-database.js:90 ../meta-database.js:92321#: ../meta-database.js:90 ../meta-database.js:92
304msgid "Unknown Album"322msgid "Unknown Album"
305msgstr "Álbum desconhecido"323msgstr ""
306324
307#: ../meta-database.js:91325#: ../meta-database.js:91
308msgid "Unknown Artist"326msgid "Unknown Artist"
309msgstr "Artista desconhecido"327msgstr ""
310328
311#: ../music-app.qml:142329#: ../music-app.qml:141
312msgid "Search Track"330msgid "Search Track"
313msgstr "Pesquisar faixa"331msgstr ""
332
333#: ../music-app.qml:153
334msgid "Next"
335msgstr ""
314336
315#: ../music-app.qml:154337#: ../music-app.qml:154
316msgid "Next"
317msgstr "Próximo"
318
319#: ../music-app.qml:155
320msgid "Next Track"338msgid "Next Track"
321msgstr "Próxima faixa"339msgstr ""
322340
323#: ../music-app.qml:161341#: ../music-app.qml:160
324msgid "Pause"342msgid "Pause"
325msgstr "Pausar"343msgstr ""
326344
327#: ../music-app.qml:161345#: ../music-app.qml:160
328msgid "Play"346msgid "Play"
329msgstr "Tocar"347msgstr ""
330348
331#: ../music-app.qml:163349#: ../music-app.qml:162
332msgid "Pause Playback"350msgid "Pause Playback"
333msgstr "Pausar Reprodução"351msgstr ""
334352
335#: ../music-app.qml:163353#: ../music-app.qml:162
336msgid "Continue or start playback"354msgid "Continue or start playback"
337msgstr "Continuar ou iniciar reprodução"355msgstr ""
356
357#: ../music-app.qml:167
358msgid "Back"
359msgstr ""
338360
339#: ../music-app.qml:168361#: ../music-app.qml:168
340msgid "Back"
341msgstr "Voltar"
342
343#: ../music-app.qml:169
344msgid "Go back to last page"362msgid "Go back to last page"
345msgstr "Voltar para a última página"363msgstr ""
364
365#: ../music-app.qml:176
366msgid "Previous"
367msgstr ""
346368
347#: ../music-app.qml:177369#: ../music-app.qml:177
348msgid "Previous"
349msgstr "Anterior"
350
351#: ../music-app.qml:178
352msgid "Previous Track"370msgid "Previous Track"
353msgstr "Faixa anterior"371msgstr ""
372
373#: ../music-app.qml:182
374msgid "Stop"
375msgstr ""
354376
355#: ../music-app.qml:183377#: ../music-app.qml:183
356msgid "Stop"
357msgstr "Parar"
358
359#: ../music-app.qml:184
360msgid "Stop Playback"378msgid "Stop Playback"
361msgstr "Parar reprodução"379msgstr ""
362380
363#: ../music-app.qml:192381#: ../music-app.qml:191
364msgid "Music Settings"382msgid "Music Settings"
365msgstr "Configurações de Música"383msgstr ""
366384
367#. TRANSLATORS: This string represents that the target destination filepath does not start with ~/Music/Imported/385#. TRANSLATORS: This string represents that the target destination filepath does not start with ~/Music/Imported/
368#: ../music-app.qml:338386#: ../music-app.qml:337
369msgid "Filepath must start with"387msgid "Filepath must start with"
370msgstr "O caminho do arquivo deve começar com"388msgstr "O caminho do arquivo deve começar com"
371389
372#. TRANSLATORS: This string represents that a blank filepath destination has been used390#. TRANSLATORS: This string represents that a blank filepath destination has been used
373#: ../music-app.qml:364391#: ../music-app.qml:363
374msgid "Filepath must be a file"392msgid "Filepath must be a file"
375msgstr "O caminho deve ser de um arquivo"393msgstr ""
376394
377#. TRANSLATORS: This string represents that there was failure moving the file to the target destination395#. TRANSLATORS: This string represents that there was failure moving the file to the target destination
378#: ../music-app.qml:370396#: ../music-app.qml:369
379msgid "Failed to move file"397msgid "Failed to move file"
380msgstr "Falhou ao mover arquivo"398msgstr ""
381399
382#: ../music-app.qml:447400#: ../music-app.qml:446
383msgid "Waiting for file(s)..."401msgid "Waiting for file(s)..."
384msgstr "Aguardando pelo(s) arquivo(s)"402msgstr "Aguardando pelo(s) arquivo(s)"
385403
386#: ../music-app.qml:466404#: ../music-app.qml:465
387msgid "OK"405msgid "OK"
388msgstr "OK"406msgstr ""
389407
390#: ../music-app.qml:479408#: ../music-app.qml:478
391msgid "Imported file not found"409msgid "Imported file not found"
392msgstr "O arquivo importado não foi encontrado"410msgstr ""
393411
394#: ../music-app.qml:483412#: ../music-app.qml:482
395msgid "Wait"413msgid "Wait"
396msgstr "Aguardando"414msgstr ""
397415
398#. TRANSLATORS: this refers to a number of songs greater than one. The actual number will be prepended to the string automatically (plural forms are not yet fully supported in usermetrics, the library that displays that string)416#. TRANSLATORS: this refers to a number of songs greater than one. The actual number will be prepended to the string automatically (plural forms are not yet fully supported in usermetrics, the library that displays that string)
417#: ../music-app.qml:503
418msgid "songs played today"
419msgstr ""
420
399#: ../music-app.qml:504421#: ../music-app.qml:504
400msgid "songs played today"
401msgstr "músicas tocadas hoje"
402
403#: ../music-app.qml:505
404msgid "No songs played today"422msgid "No songs played today"
405msgstr "Nenhuma música tocada hoje"423msgstr ""
406424
407#: ../music-app.qml:613425#: ../music-app.qml:612
408msgid "Debug: "426msgid "Debug: "
409msgstr "Debug: "427msgstr ""
410428
411#: ../music-app.qml:925429#: ../music-app.qml:931
412msgid "New Playlist"430msgid "New Playlist"
413msgstr "Nova lista de reprodução"431msgstr ""
414432
415#: ../music-app.qml:926433#: ../music-app.qml:932
416msgid "Name your playlist."434msgid "Name your playlist."
417msgstr "Nomear sua lista de reprodução."435msgstr ""
418436
419#: ../music-app.qml:930437#: ../music-app.qml:936
420msgid "Name"438msgid "Name"
421msgstr "Nome"439msgstr ""
422440
423#: ../music-app.qml:940441#: ../music-app.qml:946
424msgid "Create"442msgid "Create"
425msgstr "Criar"443msgstr ""
426444
427#: ../music-app.qml:1176445#: ../music-app.qml:1182
428msgid "No music found"446msgid "No music found"
429msgstr "Nenhuma música encontrada"447msgstr ""
430448
431#: ../music-app.qml:1183449#: ../music-app.qml:1189
432msgid "Please import music"450msgid "Please import music"
433msgstr "Por favor, importar músicas"451msgstr ""
434452
435#: com.ubuntu.music_music.desktop.in.in.h:2453#: com.ubuntu.music_music.desktop.in.in.h:2
436msgid "A music application for Ubuntu"454msgid "A music application for Ubuntu"
437msgstr "Aplicativo de musica para o Ubuntu"455msgstr ""
438456
439#: com.ubuntu.music_music.desktop.in.in.h:3457#: com.ubuntu.music_music.desktop.in.in.h:3
440msgid "music;songs;play;tracks;player;tunes;"458msgid "music;songs;play;tracks;player;tunes;"
441msgstr "música;músicas;tocar;faixas;player;tons;"459msgstr ""
442460
=== modified file 'tests/autopilot/music_app/__init__.py'
--- tests/autopilot/music_app/__init__.py 2014-09-25 17:58:55 +0000
+++ tests/autopilot/music_app/__init__.py 2014-10-09 02:19:53 +0000
@@ -21,11 +21,22 @@
21 return func_wrapper21 return func_wrapper
2222
2323
24def ensure_toolbar_visible(func):24def ensure_now_playing_full(func):
25 """Wrapper which ensures the toolbar is shown before clicking"""25 """Wrapper which ensures the now playing is full before clicking"""
26 def func_wrapper(self, *args, **kwargs):26 def func_wrapper(self, *args, **kwargs):
27 if not self.opened:27 if self.isListView:
28 self.show()28 self.click_toggle_view()
29
30 return func(self, *args, **kwargs)
31
32 return func_wrapper
33
34
35def ensure_now_playing_list(func):
36 """Wrapper which ensures the now playing is list before clicking"""
37 def func_wrapper(self, *args, **kwargs):
38 if not self.isListView:
39 self.click_toggle_view()
2940
30 return func(self, *args, **kwargs)41 return func(self, *args, **kwargs)
3142
@@ -221,96 +232,54 @@
221 def __init__(self, *args):232 def __init__(self, *args):
222 super(MusicPage, self).__init__(*args)233 super(MusicPage, self).__init__(*args)
223234
224 def get_count(self):
225 return self.select_single("QQuickListView",
226 objectName="nowPlayingQueueList").count
227
228 def get_track(self, i):
229 return (self.wait_select_single(ListItemWithActions,
230 objectName="nowPlayingListItem" + str(i)))
231
232
233class AlbumsPage(MusicPage):
234 """ Autopilot helper for the albums page """
235 def __init__(self, *args):
236 super(MusicPage, self).__init__(*args)
237
238 self.visible.wait_for(True)
239
240 @click_object
241 def click_artist(self, i):
242 return self.wait_select_single("Standard",
243 objectName="albumsArtistListItem"
244 + str(i))
245
246 def get_artist(self):
247 return self.wait_select_single("Label", objectName="artistLabel").text
248
249
250class SongsPage(MusicPage):
251 """ Autopilot helper for the songs page """
252 def __init__(self, *args):
253 super(MusicPage, self).__init__(*args)
254
255 self.visible.wait_for(True)
256
257 @click_object
258 def click_track(self, i):
259 return self.get_track(i)
260
261 def get_header_artist_label(self):
262 return self.wait_select_single("Label",
263 objectName="songsPageHeaderAlbumArtist")
264
265 def get_track(self, i):
266 return (self.wait_select_single(ListItemWithActions,
267 objectName="songsPageListItem" + str(i)))
268
269
270class MusicToolbar(UbuntuUIToolkitCustomProxyObjectBase):
271 """Autopilot helper for the toolbar
272
273 expanded - refers to things when the toolbar is in its smaller state
274 full - refers to things when the toolbar is in its larger state
275 """
276 def __init__(self, *args):
277 super(MusicToolbar, self).__init__(*args)
278
279 root = self.get_root_instance()235 root = self.get_root_instance()
280 self.player = root.select_single(Player, objectName="player")236 self.player = root.select_single(Player, objectName="player")
281237
282 @ensure_toolbar_visible238 @ensure_now_playing_full
283 @click_object239 @click_object
284 def click_forward_button(self):240 def click_forward_button(self):
285 return self.wait_select_single("*", objectName="forwardShape")241 return self.wait_select_single("*", objectName="forwardShape")
286242
287 @ensure_toolbar_visible243 @ensure_now_playing_full
288 @click_object244 @click_object
289 def click_play_button(self):245 def click_play_button(self):
290 if self.currentMode == "full":246 return self.wait_select_single("*", objectName="playShape")
291 return self.wait_select_single("*", objectName="playShape")
292 else:
293 return self.wait_select_single("*", objectName="smallPlayShape")
294247
295 @ensure_toolbar_visible248 @ensure_now_playing_full
296 @click_object249 @click_object
297 def click_previous_button(self):250 def click_previous_button(self):
298 return self.wait_select_single("*", objectName="previousShape")251 return self.wait_select_single("*", objectName="previousShape")
299252
300 @ensure_toolbar_visible253 @ensure_now_playing_full
301 @click_object254 @click_object
302 def click_repeat_button(self):255 def click_repeat_button(self):
303 return self.wait_select_single("*", objectName="repeatShape")256 return self.wait_select_single("*", objectName="repeatShape")
304257
305 @ensure_toolbar_visible258 @ensure_now_playing_full
306 @click_object259 @click_object
307 def click_shuffle_button(self):260 def click_shuffle_button(self):
308 return self.wait_select_single("*", objectName="shuffleShape")261 return self.wait_select_single("*", objectName="shuffleShape")
309262
310 @ensure_toolbar_visible263 def click_toggle_view(self):
264 self.main_view.get_header().click_action_button("toggleView")
265
266 def get_count(self):
267 return self.select_single("QQuickListView",
268 objectName="nowPlayingQueueList").count
269
270 def go_back(self):
271 """Use custom back button to go back"""
272 self.main_view.get_header().click_custom_back_button()
273
274 @ensure_now_playing_list
275 def get_track(self, i):
276 return (self.wait_select_single(ListItemWithActions,
277 objectName="nowPlayingListItem" + str(i)))
278
279 @ensure_now_playing_full
311 def seek_to(self, percentage):280 def seek_to(self, percentage):
312 progress_bar = self.wait_select_single(281 progress_bar = self.wait_select_single(
313 "*", objectName="progressBarShape")282 "*", objectName="progressSliderShape")
314283
315 x1, y1, width, height = progress_bar.globalRect284 x1, y1, width, height = progress_bar.globalRect
316 y1 += height // 2285 y1 += height // 2
@@ -319,28 +288,77 @@
319288
320 self.pointing_device.drag(x1, y1, x2, y1)289 self.pointing_device.drag(x1, y1, x2, y1)
321290
322 @ensure_toolbar_visible
323 def set_repeat(self, state):291 def set_repeat(self, state):
324 if self.player.repeat != state:292 if self.player.repeat != state:
325 self.click_repeat_button()293 self.click_repeat_button()
326294
327 self.player.repeat.wait_for(state)295 self.player.repeat.wait_for(state)
328296
329 @ensure_toolbar_visible
330 def set_shuffle(self, state):297 def set_shuffle(self, state):
331 if self.player.shuffle != state:298 if self.player.shuffle != state:
332 self.click_shuffle_button()299 self.click_shuffle_button()
333300
334 self.player.shuffle.wait_for(state)301 self.player.shuffle.wait_for(state)
335302
336 def show(self):303
337 self.pointing_device.move_to_object(self)304class AlbumsPage(MusicPage):
338305 """ Autopilot helper for the albums page """
339 x1, y1 = self.pointing_device.position()306 def __init__(self, *args):
340307 super(MusicPage, self).__init__(*args)
341 y1 -= (self.height / 2) + 1 # get position at top of toolbar308
342309 self.visible.wait_for(True)
343 self.pointing_device.drag(x1, y1, x1, y1 - self.fullHeight)310
311 @click_object
312 def click_artist(self, i):
313 return self.wait_select_single("Standard",
314 objectName="albumsArtistListItem"
315 + str(i))
316
317 def get_artist(self):
318 return self.wait_select_single("Label", objectName="artistLabel").text
319
320
321class SongsPage(MusicPage):
322 """ Autopilot helper for the songs page """
323 def __init__(self, *args):
324 super(MusicPage, self).__init__(*args)
325
326 self.visible.wait_for(True)
327
328 @click_object
329 def click_track(self, i):
330 return self.get_track(i)
331
332 def get_header_artist_label(self):
333 return self.wait_select_single("Label",
334 objectName="songsPageHeaderAlbumArtist")
335
336 def get_track(self, i):
337 return (self.wait_select_single(ListItemWithActions,
338 objectName="songsPageListItem" + str(i)))
339
340
341class MusicToolbar(UbuntuUIToolkitCustomProxyObjectBase):
342 """Autopilot helper for the toolbar"""
343 def __init__(self, *args):
344 super(MusicToolbar, self).__init__(*args)
345
346 @click_object
347 def click_play_button(self):
348 return self.wait_select_single("*", objectName="playShape")
349
350 @click_object
351 def click_jump_to_now_playing(self):
352 return self.wait_select_single("*", objectName="jumpNowPlaying")
353
354 def switch_to_now_playing(self):
355 self.click_jump_to_now_playing()
356
357 root = self.get_root_instance()
358 now_playing_page = root.wait_select_single(MusicNowPlaying,
359 objectName="nowPlayingPage")
360
361 now_playing_page.visible.wait_for(True)
344362
345363
346class ListItemWithActions(UbuntuUIToolkitCustomProxyObjectBase):364class ListItemWithActions(UbuntuUIToolkitCustomProxyObjectBase):
347365
=== modified file 'tests/autopilot/music_app/tests/test_music.py'
--- tests/autopilot/music_app/tests/test_music.py 2014-09-23 20:45:41 +0000
+++ tests/autopilot/music_app/tests/test_music.py 2014-10-09 02:19:53 +0000
@@ -91,6 +91,11 @@
91 Eventually(NotEquals(end_tracks_count)))91 Eventually(NotEquals(end_tracks_count)))
92 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))92 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
9393
94 toolbar.switch_to_now_playing() # Switch to the now playing page
95
96 # Re get now playing page as it has changed
97 now_playing_page = self.app.get_now_playing_page()
98
94 # verify song's metadata matches the item added to the Now Playing view99 # verify song's metadata matches the item added to the Now Playing view
95 current_track = now_playing_page.get_track(self.player.currentIndex)100 current_track = now_playing_page.get_track(self.player.currentIndex)
96101
@@ -99,14 +104,14 @@
99 self.assertThat(current_track.get_label_text("titleLabel"),104 self.assertThat(current_track.get_label_text("titleLabel"),
100 Equals(self.tracks[0]["title"]))105 Equals(self.tracks[0]["title"]))
101106
102 # click on close button to close the page107 # click on close button to close the page and now playing page
103 self.app.main_view.go_back()108 now_playing_page.go_back()
104109
105 # click the play button to start playing110 # click the play button (toolbar) to start playing
106 toolbar.click_play_button()111 toolbar.click_play_button()
107 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))112 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
108113
109 # click the play button to stop playing114 # click the play button (toolbar) to stop playing
110 toolbar.click_play_button()115 toolbar.click_play_button()
111 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))116 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
112117
@@ -115,15 +120,15 @@
115120
116 self.app.populate_queue() # populate queue121 self.app.populate_queue() # populate queue
117122
118 toolbar = self.app.get_toolbar()123 now_playing_page = self.app.get_now_playing_page()
119124
120 # check that the player is playing and then select pause125 # check that the player is playing and then select pause
121 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))126 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
122 toolbar.click_play_button()127 now_playing_page.click_play_button()
123128
124 # check that the player is paused and then select play129 # check that the player is paused and then select play
125 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))130 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
126 toolbar.click_play_button()131 now_playing_page.click_play_button()
127132
128 # check that the player is playing133 # check that the player is playing
129 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))134 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
@@ -133,7 +138,7 @@
133138
134 self.app.populate_queue() # populate queue139 self.app.populate_queue() # populate queue
135140
136 toolbar = self.app.get_toolbar()141 now_playing_page = self.app.get_now_playing_page()
137142
138 # save original song data for later143 # save original song data for later
139 org_title = self.player.currentMetaTitle144 org_title = self.player.currentMetaTitle
@@ -144,17 +149,17 @@
144 logger.debug("Original Song %s, %s" % (org_title, org_artist))149 logger.debug("Original Song %s, %s" % (org_title, org_artist))
145150
146 # select pause and check the player has stopped151 # select pause and check the player has stopped
147 toolbar.click_play_button()152 now_playing_page.click_play_button()
148 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))153 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
149154
150 toolbar.set_shuffle(False) # ensure shuffe is off155 now_playing_page.set_shuffle(False) # ensure shuffe is off
151156
152 # goal is to go back and forth and ensure 2 different songs157 # goal is to go back and forth and ensure 2 different songs
153 toolbar.click_forward_button()158 now_playing_page.click_forward_button()
154 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))159 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
155160
156 # select pause and check the player has stopped161 # select pause and check the player has stopped
157 toolbar.click_play_button()162 now_playing_page.click_play_button()
158 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))163 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
159164
160 # ensure different song165 # ensure different song
@@ -166,14 +171,14 @@
166 logger.debug("Next Song %s, %s" % (self.player.currentMetaTitle,171 logger.debug("Next Song %s, %s" % (self.player.currentMetaTitle,
167 self.player.currentMetaArtist))172 self.player.currentMetaArtist))
168173
169 toolbar.seek_to(0) # seek to 0 (start)174 now_playing_page.seek_to(0) # seek to 0 (start)
170175
171 # select previous and ensure the track is playing176 # select previous and ensure the track is playing
172 toolbar.click_previous_button()177 now_playing_page.click_previous_button()
173 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))178 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
174179
175 # select pause and check the player has stopped180 # select pause and check the player has stopped
176 toolbar.click_play_button()181 now_playing_page.click_play_button()
177 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))182 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
178183
179 # ensure we're back to original song184 # ensure we're back to original song
@@ -207,13 +212,13 @@
207 self.assertThat(self.player.source.endswith("mp3"),212 self.assertThat(self.player.source.endswith("mp3"),
208 Equals(True))213 Equals(True))
209214
210 # Start playing the track215 # Start playing the track (click from toolbar)
211 toolbar.click_play_button()216 toolbar.click_play_button()
212217
213 # Check that the track is playing218 # Check that the track is playing
214 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))219 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
215220
216 # Stop playing the track221 # Stop playing the track (click from toolbar)
217 toolbar.click_play_button()222 toolbar.click_play_button()
218223
219 # Check current meta data is correct224 # Check current meta data is correct
@@ -229,15 +234,15 @@
229234
230 # at this point the track is playing and shuffle is enabled235 # at this point the track is playing and shuffle is enabled
231236
232 toolbar = self.app.get_toolbar()237 now_playing_page = self.app.get_now_playing_page()
233238
234 # pause the track if it is playing239 # pause the track if it is playing
235 if self.player.isPlaying:240 if self.player.isPlaying:
236 toolbar.click_play_button()241 now_playing_page.click_play_button()
237242
238 self.player.isPlaying.wait_for(False)243 self.player.isPlaying.wait_for(False)
239244
240 toolbar.set_shuffle(True) # enable shuffle245 now_playing_page.set_shuffle(True) # enable shuffle
241246
242 # save original song metadata247 # save original song metadata
243 org_title = self.player.currentMetaTitle248 org_title = self.player.currentMetaTitle
@@ -256,11 +261,11 @@
256 self.assertThat(count, LessThan(100))261 self.assertThat(count, LessThan(100))
257262
258 # select next track263 # select next track
259 toolbar.click_forward_button()264 now_playing_page.click_forward_button()
260265
261 # pause the track if it is playing266 # pause the track if it is playing
262 if self.player.isPlaying:267 if self.player.isPlaying:
263 toolbar.click_play_button()268 now_playing_page.click_play_button()
264269
265 # check it is paused270 # check it is paused
266 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))271 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
@@ -270,11 +275,11 @@
270275
271 # select previous track while will break if this previous track276 # select previous track while will break if this previous track
272 # is different and therefore a shuffle has occurred277 # is different and therefore a shuffle has occurred
273 toolbar.click_previous_button()278 now_playing_page.click_previous_button()
274279
275 # pause the track if it is playing280 # pause the track if it is playing
276 if self.player.isPlaying:281 if self.player.isPlaying:
277 toolbar.click_play_button()282 now_playing_page.click_play_button()
278283
279 # check it is paused284 # check it is paused
280 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))285 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
@@ -314,6 +319,7 @@
314 """tests navigating to the Albums tab and adding a song to queue"""319 """tests navigating to the Albums tab and adding a song to queue"""
315320
316 now_playing_page = self.app.get_now_playing_page()321 now_playing_page = self.app.get_now_playing_page()
322 toolbar = self.app.get_toolbar()
317323
318 # get number of tracks in queue before queuing a track324 # get number of tracks in queue before queuing a track
319 initial_tracks_count = now_playing_page.get_count()325 initial_tracks_count = now_playing_page.get_count()
@@ -341,6 +347,11 @@
341 # Assert that the song added to the list is not playing347 # Assert that the song added to the list is not playing
342 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))348 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
343349
350 toolbar.switch_to_now_playing() # Switch to the now playing page
351
352 # Re get now playing page as it has changed
353 now_playing_page = self.app.get_now_playing_page()
354
344 # verify song's metadata matches the item added to the Now Playing view355 # verify song's metadata matches the item added to the Now Playing view
345 current_track = now_playing_page.get_track(self.player.currentIndex)356 current_track = now_playing_page.get_track(self.player.currentIndex)
346357
@@ -349,8 +360,8 @@
349 self.assertThat(current_track.get_label_text("titleLabel"),360 self.assertThat(current_track.get_label_text("titleLabel"),
350 Equals(tracks[0]["title"]))361 Equals(tracks[0]["title"]))
351362
352 # click on close button to close songs page363 # click on close button to close nowplaying and songs page
353 self.app.main_view.go_back()364 now_playing_page.go_back()
354365
355 # check that the albums page is now visible366 # check that the albums page is now visible
356 self.assertThat(albums_page.visible, Eventually(Equals(True)))367 self.assertThat(albums_page.visible, Eventually(Equals(True)))
@@ -391,6 +402,7 @@
391 to the queue via the expandable list view item. """402 to the queue via the expandable list view item. """
392403
393 now_playing_page = self.app.get_now_playing_page()404 now_playing_page = self.app.get_now_playing_page()
405 toolbar = self.app.get_toolbar()
394406
395 # get number of tracks in queue before queuing a track407 # get number of tracks in queue before queuing a track
396 initial_tracks_count = now_playing_page.get_count()408 initial_tracks_count = now_playing_page.get_count()
@@ -413,6 +425,11 @@
413 Eventually(NotEquals(now_playing_page.get_count())))425 Eventually(NotEquals(now_playing_page.get_count())))
414 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))426 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
415427
428 toolbar.switch_to_now_playing() # Switch to the now playing page
429
430 # Re get now playing page as it has changed
431 now_playing_page = self.app.get_now_playing_page()
432
416 # verify song's metadata matches the item added to the Now Playing view433 # verify song's metadata matches the item added to the Now Playing view
417 current_track = now_playing_page.get_track(self.player.currentIndex)434 current_track = now_playing_page.get_track(self.player.currentIndex)
418435
@@ -552,14 +569,13 @@
552 self.app.populate_queue() # populate queue569 self.app.populate_queue() # populate queue
553570
554 now_playing_page = self.app.get_now_playing_page()571 now_playing_page = self.app.get_now_playing_page()
555 toolbar = self.app.get_toolbar()
556572
557 toolbar.set_shuffle(False)573 now_playing_page.set_shuffle(False)
558 toolbar.set_repeat(False)574 now_playing_page.set_repeat(False)
559575
560 # Skip through all songs in queue, stopping on last one.576 # Skip through all songs in queue, stopping on last one.
561 for count in range(0, now_playing_page.get_count() - 1):577 for count in range(0, now_playing_page.get_count() - 1):
562 toolbar.click_forward_button()578 now_playing_page.click_forward_button()
563579
564 # When the last song ends, playback should stop580 # When the last song ends, playback should stop
565 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))581 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
@@ -570,14 +586,13 @@
570 self.app.populate_queue() # populate queue586 self.app.populate_queue() # populate queue
571587
572 now_playing_page = self.app.get_now_playing_page()588 now_playing_page = self.app.get_now_playing_page()
573 toolbar = self.app.get_toolbar()
574589
575 toolbar.set_shuffle(False)590 now_playing_page.set_shuffle(False)
576 toolbar.set_repeat(True)591 now_playing_page.set_repeat(True)
577592
578 # Skip through all songs in queue, stopping on last one.593 # Skip through all songs in queue, stopping on last one.
579 for count in range(0, now_playing_page.get_count() - 1):594 for count in range(0, now_playing_page.get_count() - 1):
580 toolbar.click_forward_button()595 now_playing_page.click_forward_button()
581596
582 # Make sure we loop back to first song after last song ends597 # Make sure we loop back to first song after last song ends
583 self.assertThat(self.player.currentMetaTitle,598 self.assertThat(self.player.currentMetaTitle,
@@ -590,14 +605,13 @@
590 self.app.populate_queue() # populate queue605 self.app.populate_queue() # populate queue
591606
592 now_playing_page = self.app.get_now_playing_page()607 now_playing_page = self.app.get_now_playing_page()
593 toolbar = self.app.get_toolbar()
594608
595 toolbar.set_shuffle(False)609 now_playing_page.set_shuffle(False)
596 toolbar.set_repeat(True)610 now_playing_page.set_repeat(True)
597611
598 # Skip through all songs in queue, INCLUDING last one.612 # Skip through all songs in queue, INCLUDING last one.
599 for count in range(0, now_playing_page.get_count() - 1):613 for count in range(0, now_playing_page.get_count() - 1):
600 toolbar.click_forward_button()614 now_playing_page.click_forward_button()
601615
602 # Make sure we loop back to first song after last song ends616 # Make sure we loop back to first song after last song ends
603 self.assertThat(self.player.currentMetaTitle,617 self.assertThat(self.player.currentMetaTitle,
@@ -609,19 +623,19 @@
609623
610 self.app.populate_queue() # populate queue624 self.app.populate_queue() # populate queue
611625
612 toolbar = self.app.get_toolbar()626 now_playing_page = self.app.get_now_playing_page()
613627
614 toolbar.set_shuffle(False)628 now_playing_page.set_shuffle(False)
615 toolbar.set_repeat(True)629 now_playing_page.set_repeat(True)
616630
617 initial_song = self.player.currentMetaTitle631 initial_song = self.player.currentMetaTitle
618 toolbar.click_previous_button()632 now_playing_page.click_previous_button()
619633
620 # If we're far enough into a song, pressing prev just takes us to the634 # If we're far enough into a song, pressing prev just takes us to the
621 # beginning of that track. In that case, hit prev again to actually635 # beginning of that track. In that case, hit prev again to actually
622 # skip over the track.636 # skip over the track.
623 if self.player.currentMetaTitle == initial_song:637 if self.player.currentMetaTitle == initial_song:
624 toolbar.click_previous_button()638 now_playing_page.click_previous_button()
625639
626 self.assertThat(self.player.currentMetaTitle,640 self.assertThat(self.player.currentMetaTitle,
627 Eventually(Equals(self.tracks[-1]["title"])))641 Eventually(Equals(self.tracks[-1]["title"])))
@@ -632,17 +646,17 @@
632646
633 self.app.populate_queue() # populate queue647 self.app.populate_queue() # populate queue
634648
635 toolbar = self.app.get_toolbar()649 now_playing_page = self.app.get_now_playing_page()
636650
637 self.player.isPlaying.wait_for(True) # ensure the track is playing651 self.player.isPlaying.wait_for(True) # ensure the track is playing
638 self.player.position.wait_for(GreaterThan(5000)) # wait until > 5s652 self.player.position.wait_for(GreaterThan(5000)) # wait until > 5s
639653
640 toolbar.click_play_button() # pause the track654 now_playing_page.click_play_button() # pause the track
641 self.player.isPlaying.wait_for(False) # ensure the track has paused655 self.player.isPlaying.wait_for(False) # ensure the track has paused
642656
643 source = self.player.source # store current source657 source = self.player.source # store current source
644658
645 toolbar.click_previous_button() # click previous659 now_playing_page.click_previous_button() # click previous
646660
647 self.player.position.wait_for(LessThan(5000)) # wait until < 5s661 self.player.position.wait_for(LessThan(5000)) # wait until < 5s
648662

Subscribers

People subscribed via source and target branches

to status/vote changes: