Commit 056ad64b authored by Camilo Higuita's avatar Camilo Higuita

difference inputs from touch to mouse and fixes

parent 1d9492fd
......@@ -162,6 +162,12 @@ ApplicationWindow
{
id: tracksView
onRowClicked: Player.appendTrack(model.get(index))
onPlayTrack:
{
Player.appendTrack(model.get(index))
Player.playAt(mainPlaylist.list.count-1)
currentView = 0
}
}
AlbumsView
......@@ -170,6 +176,12 @@ ApplicationWindow
onRowClicked: Player.appendTrack(track)
onPlayAlbum: Player.playAlbum(tracks)
onAppendAlbum: Player.appendAlbum(tracks)
onPlayTrack:
{
Player.appendTrack(track)
Player.playAt(mainPlaylist.list.count-1)
currentView = 0
}
}
ArtistsView
......@@ -178,6 +190,12 @@ ApplicationWindow
onRowClicked: Player.appendTrack(track)
onPlayAlbum: Player.playAlbum(tracks)
onAppendAlbum: Player.appendAlbum(tracks)
onPlayTrack:
{
Player.appendTrack(track)
Player.playAt(mainPlaylist.list.count-1)
currentView = 0
}
}
PlaylistsView {}
......
......@@ -67,6 +67,14 @@ function shuffle()
return pos
}
function playAt(index)
{
if(index < root.mainPlaylist.list.count)
{
root.mainPlaylist.list.currentIndex = index
playTrack(root.mainPlaylist.list.model.get(index))
}
}
function appendTrack(track)
{
......
......@@ -8,9 +8,12 @@ ListView
property int currentRow : -1
property bool trackNumberVisible
property bool quickBtnsVisible : true
property alias holder : holder
signal rowClicked(int index)
signal rowPressed(int index)
signal playTrack(int index)
signal queueTrack(int index)
width: 320
height: 480
......@@ -124,21 +127,31 @@ ListView
{
id: delegate
width: list.width
numberVisible : trackNumberVisible ? true : false
number : trackNumberVisible ? true : false
quickBtns : quickBtnsVisible
Connections
{
target: delegate
onPressAndHold:
{
currentRow = index
contextMenu.open()
list.rowPressed(index)
}
onClicked:
{
list.rowClicked(index)
currentIndex = index
}
onPlayTrack: list.playTrack(index)
onQueueTrack: list.queueTrack(index)
onMenuClicked:
{
currentRow = index
contextMenu.open()
list.rowPressed(index)
}
}
}
......
import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
import "../utils/Icons.js" as MdiFont
import "../utils"
ItemDelegate
{
id: delegate
signal rowSelected(int index)
property string textColor: util.foregroundColor()
property bool numberVisible : false
signal playTrack()
signal queueTrack()
signal menuClicked()
property string textColor: util.foregroundColor()
property bool number : false
property bool quickBtns : false
checkable: true
MouseArea
{
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked:
{
if(Qt.platform.os === "linux")
if (mouse.button == Qt.RightButton)
menuClicked()
}
}
contentItem: GridLayout
{
id: gridLayout
width: parent.width
rows:2
columns:3
Label
{
id: trackNumber
visible: numberVisible
visible: number
width: 16
Layout.fillHeight: true
Layout.row: 1
Layout.column: 1
Layout.rowSpan: 2
Layout.alignment: Qt.AlignLeft
Layout.alignment: Qt.AlignCenter
text: track
font.bold: true
......@@ -33,7 +53,6 @@ property string textColor: util.foregroundColor()
font.pointSize: 10
color: textColor
}
......@@ -71,5 +90,40 @@ property string textColor: util.foregroundColor()
color: textColor
}
Row
{
Layout.column: 3
Layout.row: 1
Layout.rowSpan: 2
Layout.alignment: Qt.AlignRight
visible: quickBtns || menuBtn.visible
ToolButton
{
id: queueBtn
visible: Qt.platform.os === "android"
Icon { text: MdiFont.Icon.clock }
onClicked: queueTrack()
}
ToolButton
{
id: playBtn
Icon { text: MdiFont.Icon.playCircle }
onClicked: playTrack()
}
ToolButton
{
id: menuBtn
visible: Qt.platform.os === "android"
Icon { text: MdiFont.Icon.dotsVertical }
onClicked: menuClicked()
}
}
}
}
......@@ -15,6 +15,8 @@ BabeGrid
signal rowClicked(var track)
signal playAlbum(var tracks)
signal playTrack(var track)
signal queueTrack(var track)
signal appendAlbum(var tracks)
Drawer
......@@ -131,6 +133,18 @@ BabeGrid
albumsViewGrid.rowClicked(model.get(index))
drawer.close()
}
onPlayTrack:
{
albumsViewGrid.playTrack(model.get(index))
drawer.close()
}
onQueueTrack:
{
albumsViewGrid.queueTrack(model.get(index))
drawer.close()
}
}
}
......
......@@ -15,6 +15,8 @@ BabeGrid
signal rowClicked(var track)
signal playAlbum(var tracks)
signal playTrack(var track)
signal queueTrack(var track)
signal appendAlbum(var tracks)
Drawer
......@@ -119,11 +121,25 @@ BabeGrid
width: parent.width
height: parent.height - titleBar.height
trackNumberVisible: true
quickBtnsVisible: true
onRowClicked:
{
artistsViewGrid.rowClicked(model.get(index))
drawer.close()
}
onPlayTrack:
{
artistsViewGrid.playTrack(model.get(index))
drawer.close()
}
onQueueTrack:
{
artistsViewGrid.queueTrack(model.get(index))
drawer.close()
}
}
}
}
......
......@@ -210,6 +210,7 @@ Item
id: list
width: parent.width
height: parent.height
quickBtnsVisible: false
onRowClicked: Player.playTrack(model.get(index))
holder.message: "Empty playlist..."
Component.onCompleted:
......
......@@ -14,6 +14,7 @@ BabeTable
tracksViewTable.model.append(map[i])
}
Component.onCompleted: populate()
}
......
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