Commit 3364983d authored by Camilo Higuita's avatar Camilo Higuita

work on the babetable and delegates and building issues

parent 4780dbdd
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtLocation 5.9
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
//import org.kde.kirigami 2.0 as Kirigami
......@@ -74,6 +73,7 @@ ApplicationWindow
{
searchInput.clear()
searchView.clearTable()
searchView.headerTitle = ""
searchView.searchRes = []
currentView = 0
}
......
......@@ -36,5 +36,7 @@
<file>view_models/FolderPickerDelegate.qml</file>
<file>utils/BabeIcon.qml</file>
<file>view_models/TableMenuItem.qml</file>
<file>view_models/BabeScrollBar.qml</file>
<file>assets/bars.gif</file>
</qresource>
</RCC>
......@@ -17,8 +17,6 @@ Player::Player(QObject *parent) : QObject(parent)
this->updater = new QTimer(this);
connect(this->updater, &QTimer::timeout, this, &Player::update);
}
void Player::source(const QString &url)
......
......@@ -8,7 +8,7 @@ function playTrack(track)
player.play()
root.title = root.mainPlaylist.currentTrack.title + " - " +root.mainPlaylist.currentTrack.artist
var artwork = root.mainPlaylist.currentTrack.artwork
// root.mainPlaylist.list.currentItem.playingIndicator = true
root.mainPlaylist.currentArtwork = artwork ? artwork : bae.loadCover(root.mainPlaylist.currentTrack.url)
if(!root.active)
......
......@@ -115,28 +115,7 @@ Pane
}
}
ScrollBar.vertical: ScrollBar
{
id: scrollBar
visible: !bae.isMobile()
size: 0.3
position: 0.2
active: true
background : Rectangle
{
radius: 12
color: bae.backgroundColor()
}
contentItem: Rectangle
{
implicitWidth: 6
implicitHeight: 100
radius: width / 2
color: scrollBar.pressed ? bae.hightlightColor() : bae.darkColor()
}
}
ScrollBar.vertical:BabeScrollBar {}
}
}
import QtQuick 2.9
import QtQuick.Controls 2.2
ScrollBar
{
id: scrollBar
size: 0.3
position: 0.2
active: true
focus: true
visible: !bae.isMobile()
background : Rectangle
{
radius: 12
color: bae.backgroundColor()
}
contentItem: Rectangle
{
implicitWidth: 6
implicitHeight: 100
radius: width / 2
color: scrollBar.pressed ? bae.hightlightColor() : bae.darkColor()
}
}
......@@ -13,8 +13,8 @@ ListView
property bool headerBar: false
property bool trackNumberVisible
property bool quickBtnsVisible : true
property bool quickPlayVisible : true
property bool coverArtVisible : false
property bool trackDuration
property bool trackRating
......@@ -60,6 +60,7 @@ ListView
visible: list.count === 0
}
Rectangle
{
anchors.fill: parent
......@@ -76,6 +77,7 @@ ListView
color: bae.midLightColor()
visible: headerBar
z: 999
RowLayout
{
anchors.fill: parent
......@@ -86,11 +88,21 @@ ListView
visible: headerClose
width: parent.height
height: parent.height
BabeIcon { text: MdiFont.Icon.close }
onClicked: headerClosed()
}
ToolButton
{
id: playAllBtn
Layout.fillHeight: true
width: parent.height
height: parent.height
BabeIcon {text: MdiFont.Icon.playBoxOutline}
onClicked: playAll()
}
Label
{
text: headerTitle || ""
......@@ -121,14 +133,13 @@ ListView
ToolButton
{
id: playAllBtn
id: menuBtn
Layout.fillHeight: true
width: parent.height
height: parent.height
BabeIcon {text: MdiFont.Icon.playBoxOutline}
onClicked: playAll()
BabeIcon {text: MdiFont.Icon.dotsVertical}
onClicked: {}
}
}
......@@ -171,70 +182,47 @@ ListView
id: delegate
width: list.width
number : trackNumberVisible ? true : false
quickBtns : quickBtnsVisible
quickPlay: quickPlayVisible
coverArt : coverArtVisible
trackDurationVisible : list.trackDuration
trackRatingVisible : list.trackRating
Connections
{
target: delegate
onPressAndHold:
{
if(!bae.isMobile())
list.quickPlayTrack(currentIndex)
}
onPressAndHold: if(bae.isMobile()) openItemMenu(index)
onRightClicked: openItemMenu(index)
onClicked:
{
currentIndex = index
if(bae.isMobile())
list.rowClicked(index)
}
onDoubleClicked:
{
if(!bae.isMobile())
list.rowClicked(index)
}
onPlay: list.quickPlayTrack(index)
onMenuClicked:
{
currentRow = index
currentIndex = index
contextMenu.rate = bae.trackRate(list.model.get(currentRow).url)
if(bae.isMobile()) contextMenu.open()
else
contextMenu.popup()
list.rowPressed(index)
}
onPlay: list.quickPlayTrack(index)
}
}
ScrollBar.vertical: ScrollBar
{
id: scrollBar
size: 0.3
position: 0.2
active: true
ScrollBar.vertical:BabeScrollBar {}
background : Rectangle
{
radius: 12
color: bae.backgroundColor()
}
contentItem: Rectangle
{
implicitWidth: 6
implicitHeight: 100
radius: width / 2
color: scrollBar.pressed ? bae.hightlightColor() : bae.darkColor()
}
function openItemMenu(index)
{
currentRow = index
currentIndex = index
contextMenu.rate = bae.trackRate(list.model.get(currentRow).url)
if(bae.isMobile()) contextMenu.open()
else
contextMenu.popup()
list.rowPressed(index)
}
}
......@@ -7,17 +7,21 @@ import "../utils"
ItemDelegate
{
id: delegate
width: parent.width
height: 64
signal play()
signal menuClicked()
signal rightClicked()
property string textColor: bae.foregroundColor()
property bool number : false
property bool quickBtns : false
property bool quickPlay : true
property bool coverArt : false
property bool trackDurationVisible : false
property bool trackRatingVisible: false
// property bool playingIndicator: false
property string trackMood : art
property alias trackRating : trackRating
......@@ -41,143 +45,193 @@ ItemDelegate
acceptedButtons: Qt.RightButton
onClicked:
{
if(!bae.isMobile())
if (mouse.button === Qt.RightButton)
{
menuClicked()
}
if(!bae.isMobile() && mouse.button === Qt.RightButton)
rightClicked()
}
}
contentItem: GridLayout
contentItem: RowLayout
{
id: gridLayout
width: parent.width
rows:2
columns:4
height: delegate.height
width: delegate.width
spacing: 20
ToolButton
Item
{
id: playBtn
visible: coverArt
Layout.fillHeight: true
Layout.row: 1
Layout.column: 1
Layout.rowSpan: 2
visible: quickPlay
BabeIcon { text: MdiFont.Icon.playCircle }
onClicked: delegate.play()
// Layout.fillWidth: true
// height: parent.height
width: parent.height
ToolButton
{
height: delegate.height
width: delegate.height
anchors.verticalCenter: parent.verticalCenter
Image
{
id: artworkCover
anchors.fill: parent
source: (artwork.length>0 && artwork !== "none" && artwork)? "file://"+encodeURIComponent(artwork) : "qrc:/assets/cover.png"
fillMode: Image.PreserveAspectFit
cache: false
antialiasing: true
}
}
}
Label
Item
{
id: trackNumber
visible: number
width: 16
visible: quickPlay
Layout.fillHeight: true
Layout.row: 1
Layout.column: 2
Layout.alignment: Qt.AlignCenter
verticalAlignment: Qt.AlignVCenter
text: track
font.bold: true
elide: Text.ElideRight
// Layout.fillWidth: true
// height: parent.height
width: parent.height
ToolButton
{
id: playBtn
anchors.centerIn: parent
font.pointSize: 10
color: textColor
BabeIcon { text: MdiFont.Icon.playCircle }
onClicked: delegate.play()
}
}
Label
Item
{
id: trackTitle
height: delegate.height
Layout.fillWidth: true
Layout.fillHeight: true
Layout.row: 1
Layout.column: 3
verticalAlignment: Qt.AlignVCenter
text: title
font.bold: true
elide: Text.ElideRight
Layout.fillWidth: true
font.pointSize: 10
color: textColor
Layout.alignment: Qt.AlignVCenter
}
GridLayout
{
anchors.fill: parent
rows:2
columns:3
Label
{
id: trackInfo
Label
{
id: trackNumber
visible: number
width: 16
Layout.fillHeight: true
Layout.row: 1
Layout.column: 1
Layout.alignment: Qt.AlignCenter
verticalAlignment: Qt.AlignVCenter
text: track
font.bold: true
elide: Text.ElideRight
font.pointSize: 10
color: textColor
}
Layout.fillWidth: true
Layout.fillHeight: true
Layout.row: 2
Layout.column: 3
verticalAlignment: Qt.AlignVCenter
text: artist + " | " + album
font.bold: false
elide: Text.ElideRight
font.pointSize: 9
color: textColor
}
Label
{
id: trackTitle
Label
{
id: trackDuration
visible: trackDurationVisible
Layout.fillWidth: true
Layout.fillHeight: true
Layout.row: 1
Layout.column: 4
horizontalAlignment: Qt.AlignRight
verticalAlignment: Qt.AlignVCenter
text: player.transformTime(duration)
font.bold: false
elide: Text.ElideRight
font.pointSize: 8
color: textColor
}
Layout.fillWidth: true
Layout.fillHeight: true
Layout.row: 1
Layout.column: 2
verticalAlignment: Qt.AlignVCenter
text: title
font.bold: true
elide: Text.ElideRight
Label
{
id: trackRating
visible: trackRatingVisible
Layout.fillWidth: true
Layout.fillHeight: true
Layout.row: 2
Layout.column: 4
horizontalAlignment: Qt.AlignRight
verticalAlignment: Qt.AlignVCenter
text: stars
font.bold: false
elide: Text.ElideRight
font.pointSize: 8
color: textColor
}
font.pointSize: 10
color: textColor
Row
{
Layout.column: 5
Layout.row: 1
Layout.rowSpan: 2
Layout.alignment: Qt.AlignRight
visible: quickBtns || menuBtn.visible
}
ToolButton
{
id: menuBtn
visible: bae.isMobile()
BabeIcon { text: MdiFont.Icon.dotsVertical }
onClicked: menuClicked()
}
}
Label
{
id: trackInfo
Layout.fillWidth: true
Layout.fillHeight: true
Layout.row: 2
Layout.column: 2
verticalAlignment: Qt.AlignVCenter
text: artist + " | " + album
font.bold: false
elide: Text.ElideRight
font.pointSize: 9
color: textColor
}
// Item
// {
// Layout.row: 1
// Layout.rowSpan: 2
// Layout.column: 4
// height: 48
// width: height
// Layout.fillWidth: true
// Layout.fillHeight: true
// Layout.alignment: Qt.AlignCenter
// AnimatedImage
// {
// id: animation
// cache: true
// visible: playingIndicator
// height: 22
// width: 22
// horizontalAlignment: Qt.AlignLeft
// verticalAlignment: Qt.AlignVCenter
// source: "qrc:/assets/bars.gif"
// }
// }
Label
{
id: trackDuration
visible: trackDurationVisible
Layout.fillWidth: true
Layout.fillHeight: true
Layout.row: 1
Layout.column: 3
horizontalAlignment: Qt.AlignRight
verticalAlignment: Qt.AlignVCenter
text: player.transformTime(duration)
font.bold: false
elide: Text.ElideRight
font.pointSize: 8
color: textColor
}
Label
{
id: trackRating
visible: trackRatingVisible
Layout.fillWidth: true
Layout.fillHeight: true
Layout.row: 2
Layout.column: 3
horizontalAlignment: Qt.AlignRight
verticalAlignment: Qt.AlignVCenter
text: stars
font.bold: false
elide: Text.ElideRight
font.pointSize: 8
color: textColor
}
}
}
}
function setStars(stars)
......
......@@ -11,7 +11,7 @@ Menu
id: rootMenu
x: parent.width / 2 - width / 2
y: parent.height / 2 - height / 2
modal: true
modal: bae.isMobile()
focus: true
......
......@@ -66,8 +66,9 @@ BabeGrid
width: parent.width
height: parent.height
trackNumberVisible: true
quickBtnsVisible: true
headerBar: true
headerClose: true
onRowClicked:
{
drawer.close()
......@@ -104,6 +105,8 @@ BabeGrid
artistsViewGrid.appendAlbum(tracks)
drawer.close()
}
onHeaderClosed: drawer.close()
}
}
}
......
......@@ -330,9 +330,20 @@ Item
text: "00:00"
color: bae.foregroundColor()
font.pointSize: 8
}
Label
{
id: currentTrackInfo
Layout.row: 1
Layout.column: 2
Layout.fillWidth:true
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Qt.AlignHCenter
text: currentTrack.title + " - " + currentTrack.artist
color: bae.foregroundColor()
font.pointSize: 8
}
Label
{
......@@ -454,9 +465,8 @@ Item
id: list
width: parent.width
height: parent.height
quickBtnsVisible: false
quickPlayVisible: false
coverArtVisible: true
Rectangle
{
anchors.fill: parent
......
......@@ -9,6 +9,7 @@ BabeTable
trackNumberVisible: false
headerBar: true
headerClose: true
holder.message: "No search results!"
function populate(tracks)
{
......
......@@ -9,7 +9,7 @@ BabeTable
trackDuration: true
trackRating: true
headerBar: true
headerTitle: count + " tracks"
function populate()
{
var map = bae.get(Q.Query.allTracks)
......
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