Commit e42238e7 authored by Camilo Higuita's avatar Camilo Higuita

ui and playback improvements

parent d562419d
......@@ -74,18 +74,24 @@ Kirigami.ApplicationWindow
root.width = columnWidth*3
}
ColumnLayout
GridLayout
{
id: playlistLayout
width: parent.width
height: parent.height
columns: 1
rows: 4
rowSpacing: 0
Rectangle
{
id: coverPlay
width: parent.width
Layout.fillWidth: true
Layout.row: 1
height: parent.width < columnWidth ? parent.width : columnWidth
visible: mainPlaylistTable.count>0
FastBlur
{
anchors.fill: coverPlay
......@@ -107,28 +113,28 @@ Kirigami.ApplicationWindow
Slider
{
id: progressBar
width: parent.width
Layout.fillWidth: true
anchors.top: coverPlay.bottom
Layout.row: 3
height: 16
from: 0
to: 1000
value: 0
visible: mainPlaylistTable.count>0
spacing: 0
onMoved:
{
player.seek(player.duration() / 1000 * value);
player.seek(player.duration() / 1000 * value);
}
}
Rectangle
{
id: playbackControls
anchors.top: progressBar.bottom
Layout.fillWidth: true
width: parent.width
Layout.row: 2
height: 48
z: 1
visible: mainPlaylistTable.count>0
RowLayout
{
......@@ -158,14 +164,9 @@ Kirigami.ApplicationWindow
onClicked:
{
if(player.isPaused())
{
Player.resumeTrack()
playIcon.text= MdiFont.Icon.pause
}else
{
Player.pauseTrack()
playIcon.text= MdiFont.Icon.play
}
else Player.pauseTrack()
}
}
......@@ -183,9 +184,10 @@ Kirigami.ApplicationWindow
Rectangle
{
id: mainPlaylist
width: parent.width
height: parent.height-coverPlay.height - playbackControls.height
anchors.top: playbackControls.bottom
Layout.fillWidth: true
Layout.fillHeight: true
Layout.row: 4
BabeTable
{
......@@ -225,25 +227,31 @@ Kirigami.ApplicationWindow
TracksView
{
onRowClicked:
{
appendTrack(model.get(index))
}
onRowClicked: appendTrack(model.get(index))
}
AlbumsView
{
onRowClicked:
{
onRowClicked: appendTrack(track)
onPlayAlbum:
{
appendTrack(track)
mainPlaylistTable.clearTable()
for(var i in tracks)
appendTrack(tracks[i])
Player.playTrack(mainPlaylistTable.model.get(0))
}
}
ArtistsView
{
onRowClicked:
onRowClicked: appendTrack(track)
onPlayAlbum:
{
appendTrack(track)
mainPlaylistTable.clearTable()
for(var i in tracks)
appendTrack(tracks[i])
Player.playTrack(mainPlaylistTable.model.get(0))
}
}
......
......@@ -5,12 +5,15 @@ function playTrack(track)
player.play()
root.title = currentTrack.title + " - " +currentTrack.artist
currentArtwork = con.getAlbumArt(currentTrack.album, currentTrack.artist) || con.getArtistArt(currentTrack.artist)
playIcon.text= MdiFont.Icon.pause
}
function pauseTrack()
{
player.pause()
playIcon.text= MdiFont.Icon.play
}
function resumeTrack()
......
......@@ -12,8 +12,22 @@ Item
width: albumSize
height: parseInt(albumSize+(albumSize*0.4))
DropShadow
{
anchors.fill: card
horizontalOffset: 3
verticalOffset: 3
radius: 8.0
samples: 17
color: "#80000000"
source: card
}
Rectangle
{
id: card
anchors.fill: parent
color: fillColor
radius: borderRadius
......@@ -98,11 +112,11 @@ Item
}
}
MouseArea {
MouseArea
{
anchors.fill: parent
onClicked: {
onClicked:
{
parent.GridView.view.currentIndex = index
console.log(index)
albumClicked(index)
......
import QtQuick.Controls 2.2
import QtQuick 2.9
Page
Pane
{
property int albumSize : 150
property int albumSpacing: 20
property int borderRadius : 4
property alias gridModel: gridModel
property alias grid: grid
signal albumCoverClicked(string album, string artist)
width: 500
height: 400
id: gridPage
ListModel
{
id: gridModel
}
ListModel {id: gridModel}
GridView
{
......@@ -26,7 +25,6 @@ Page
height: parent.height
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 20
cellWidth: albumSize + albumSpacing
cellHeight: parseInt(albumSize+(albumSize*0.6))
......@@ -67,16 +65,13 @@ Page
var album = grid.model.get(index).album
var artist = grid.model.get(index).artist
albumCoverClicked(album, artist)
grid.currentIndex = index
console.log("current index is: ", grid.currentIndex)
}
}
}
ScrollBar.vertical: ScrollBar
{
}
ScrollBar.vertical: ScrollBar{}
}
}
......@@ -33,32 +33,37 @@ ListView
}
Rectangle
GridLayout
{
id:placeHolder
anchors.fill: parent
anchors.centerIn: parent
visible: list.count===0
ColumnLayout
columns: 1
rows: 2
visible: list.count === 0
Rectangle
{
width: parent.width
width:parent.width
height: parent.height
Layout.fillHeight: true
Layout.row: 1
Image
{
id: imageHolder
anchors.centerIn: parent
width: 48
height: 48
Layout.fillWidth: true
source: "qrc:/assets/face.png"
horizontalAlignment: Qt.AlignHCenter
fillMode: Image.PreserveAspectFit
}
HueSaturation
{
anchors.fill: imageHolder
......@@ -66,15 +71,12 @@ ListView
saturation: -1
lightness: 0.3
}
Label
{
id: textHolder
width: parent.width
Layout.fillWidth: true
opacity: 0.3
anchors.top: imageHolder.bottom
opacity: 0.3
text: qsTr("Nothing here...")
padding: 10
font.bold: true
......@@ -82,6 +84,9 @@ ListView
elide: Text.ElideRight
}
}
}
Component
......
......@@ -14,6 +14,7 @@ BabeGrid
borderRadius: 20
signal rowClicked(var track)
signal playAlbum(var tracks)
Drawer
{
......@@ -38,10 +39,29 @@ BabeGrid
{
anchors.fill: parent
ToolButton
{
width: parent.height
height: parent.height
id: playAllBtn
Icon {text: MdiFont.Icon.playBoxOutline}
onClicked:
{
var data = albumsView.gridModel.get(albumsView.grid.currentIndex)
var query = "select * from tracks where album = \""+data.album+"\" and artist = \""+data.artist+"\""
var tracks = con.get(query)
playAlbum(tracks)
drawer.close()
}
}
Label
{
id: albumTitle
width: parent.width - closeBtn.width
width: parent.width - closeBtn.width - playAllBtn.width
height: parent.height
elide: Text.ElideRight
font.pointSize: 12
......@@ -59,11 +79,7 @@ BabeGrid
width: parent.height
height: parent.height
Icon
{
text: MdiFont.Icon.close
}
Icon { text: MdiFont.Icon.close }
onClicked:
{
drawer.close()
......@@ -103,10 +119,9 @@ BabeGrid
}
Component.onCompleted:
{
var map = con.get("select * from albums")
var map = con.get("select * from albums order by album asc")
for(var i in map)
{
gridModel.append(map[i])
......
......@@ -14,6 +14,7 @@ BabeGrid
borderRadius: 20
signal rowClicked(var track)
signal playAlbum(var tracks)
Drawer
{
......@@ -38,10 +39,29 @@ BabeGrid
{
anchors.fill: parent
ToolButton
{
width: parent.height
height: parent.height
id: playAllBtn
Icon {text: MdiFont.Icon.playBoxOutline}
onClicked:
{
var data = artistsView.gridModel.get(artistsView.grid.currentIndex)
var query = "select * from tracks where artist = \""+data.artist+"\""
var tracks = con.get(query)
playAlbum(tracks)
drawer.close()
}
}
Label
{
id: artistTitle
width: parent.width - closeBtn.width
width: parent.width - closeBtn.width - playAllBtn.width
height: parent.height
elide: Text.ElideRight
font.pointSize: 12
......@@ -107,7 +127,7 @@ BabeGrid
Component.onCompleted:
{
var map = con.get("select * from artists")
var map = con.get("select * from artists order by artist asc")
for(var i in map)
{
gridModel.append(map[i])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment