Commit a5e8ba0c authored by Camilo Higuita's avatar Camilo Higuita

move playlistsview to kirigami pagerow

parent d5ff8b47
......@@ -98,19 +98,19 @@ SOURCES += main.cpp \
pulpo/services/musicbrainzService.cpp \
pulpo/services/geniusService.cpp \
pulpo/services/lyricwikiaService.cpp \
taglib/ape/apefile.cpp \
taglib/ape/apefooter.cpp \
taglib/ape/apeitem.cpp \
taglib/ape/apeproperties.cpp \
taglib/ape/apetag.cpp \
taglib/asf/asfattribute.cpp \
taglib/asf/asffile.cpp \
taglib/asf/asfpicture.cpp \
taglib/asf/asfproperties.cpp \
taglib/asf/asftag.cpp \
taglib/flac/flacfile.cpp \
taglib/flac/flacmetadatablock.cpp \
taglib/flac/flacpicture.cpp \
taglib/ape/apefile.cpp \
taglib/ape/apefooter.cpp \
taglib/ape/apeitem.cpp \
taglib/ape/apeproperties.cpp \
taglib/ape/apetag.cpp \
taglib/asf/asfattribute.cpp \
taglib/asf/asffile.cpp \
taglib/asf/asfpicture.cpp \
taglib/asf/asfproperties.cpp \
taglib/asf/asftag.cpp \
taglib/flac/flacfile.cpp \
taglib/flac/flacmetadatablock.cpp \
taglib/flac/flacpicture.cpp \
taglib/flac/flacproperties.cpp \
taglib/flac/flacunknownmetadatablock.cpp \
taglib/it/itfile.cpp \
......@@ -200,7 +200,7 @@ SOURCES += main.cpp \
RESOURCES += qml.qrc \
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
......
......@@ -19,12 +19,13 @@ Kirigami.ApplicationWindow
width: 400
height: 500
title: qsTr("Babe")
wideScreen: root.width > coverSize
// property int columnWidth: Kirigami.Units.gridUnit * 13
readonly property bool isMobile: bae.isMobile()
property int columnWidth: Kirigami.Units.gridUnit * 22
property int columnWidth: Kirigami.Units.gridUnit * 20
property int coverSize: columnWidth*0.6
// property int columnWidth: Math.sqrt(root.width*root.height)*0.4
property int currentView : 0
......@@ -34,6 +35,8 @@ Kirigami.ApplicationWindow
pageStack.defaultColumnWidth: columnWidth
pageStack.initialPage: [mainPlaylist, views]
pageStack.interactive: isMobile
pageStack.separatorVisible: pageStack.wideMode
// overlay.modal: Rectangle
// {
// color: "transparent"
......@@ -68,7 +71,8 @@ Kirigami.ApplicationWindow
searchView.populate(searchView.searchRes)
}
// albumsView.filter(res)
currentView = 5
currentView = 4
pageStack.currentIndex = 1
}
}
......@@ -154,7 +158,22 @@ Kirigami.ApplicationWindow
id: searchBox
width: parent.width
height: 48
color: bae.midLightColor()
color: searchInput.activeFocus ? bae.midColor() : bae.midLightColor()
Kirigami.Separator
{
Rectangle
{
anchors.fill: parent
color: Kirigami.Theme.viewFocusColor
}
anchors
{
left: parent.left
right: parent.right
top: parent.top
}
}
TextInput
{
......@@ -181,10 +200,16 @@ Kirigami.ApplicationWindow
BabeButton
{
id: searchBtn
anchors.centerIn: parent
visible: !(searchInput.focus || searchInput.text)
id: searchBtn
iconName: "edit-find" //"search"
onClicked:
{
searchInput.forceActiveFocus()
}
}
......@@ -221,14 +246,7 @@ Kirigami.ApplicationWindow
z: -999
}
Component.onCompleted:
{
if(!isMobile)
root.width = columnWidth*3
}
SettingsView
SettingsView
{
id: settingsDrawer
onIconSizeChanged: toolBarIconSize = (size === 24 && isMobile) ? 24 : 22
......@@ -248,11 +266,10 @@ Kirigami.ApplicationWindow
}
Page
Page
{
id: views
width: parent.width
height: parent.height
anchors.fill: parent
clip: true
// transform: Translate {
......@@ -368,4 +385,49 @@ Kirigami.ApplicationWindow
}
}
}
/*animations*/
pageStack.layers.popEnter: Transition {
PauseAnimation {
duration: Kirigami.Units.longDuration
}
}
pageStack.layers.popExit: Transition {
YAnimator {
from: 0
to: pageStack.layers.height
duration: Kirigami.Units.longDuration
easing.type: Easing.OutCubic
}
}
pageStack.layers.pushEnter: Transition {
YAnimator {
from: pageStack.layers.height
to: 0
duration: Kirigami.Units.longDuration
easing.type: Easing.OutCubic
}
}
pageStack.layers.pushExit: Transition {
PauseAnimation {
duration: Kirigami.Units.longDuration
}
}
pageStack.layers.replaceEnter: Transition {
YAnimator {
from: pageStack.layers.width
to: 0
duration: Kirigami.Units.longDuration
easing.type: Easing.OutCubic
}
}
pageStack.layers.replaceExit: Transition {
PauseAnimation {
duration: Kirigami.Units.longDuration
}
}
}
......@@ -42,7 +42,7 @@
<file>widgets/InfoView/LyricsView.qml</file>
<file>widgets/PlaylistsView/PlaylistsViewModel.qml</file>
<file>widgets/PlaylistsView/AddPlaylistDialog.qml</file>
<file>view_models/Props.qml</file>
<file>view_models/BabeButton.qml</file>
<file>utils/Props.js</file>
</qresource>
</RCC>
......@@ -93,7 +93,7 @@ function playAt(index)
function quickPlay(track)
{
root.pageStack.currentIndex = 1
root.pageStack.currentIndex = 0
appendTrack(track)
playAt(root.mainPlaylist.list.count-1)
......@@ -181,7 +181,7 @@ function cleanPlaylist()
function playAll(tracks)
{
root.mainPlaylist.list.clearTable()
root.pageStack.currentIndex = 1
root.pageStack.currentIndex = 0
for(var i = 0; i< tracks.length; i++)
appendTrack(tracks[i])
......
.pragma library
......@@ -44,7 +44,7 @@ Item
Row
{
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
Image
{
id: img
......
......@@ -4,10 +4,18 @@ import ".."
Pane
{
id: gridPage
property int albumSize : 150
padding: 20
property int hintSize : Math.sqrt(root.width*root.height)*0.25
property int albumSize:
{
if(hintSize > 150)
150
else if (hintSize < 100)
100
else
hintSize
}
property int albumSpacing: 20
property int borderRadius : 4
property alias gridModel: gridModel
......@@ -47,6 +55,7 @@ Pane
GridView
{
id: grid
MouseArea
{
anchors.fill: parent
......@@ -58,7 +67,6 @@ Pane
height: parent.height
anchors.horizontalCenter: parent.horizontalCenter
cellWidth: albumSize + albumSpacing
cellHeight: parseInt(albumSize+(albumSize*0.6))
......
import QtQuick 2.0
Item {
}
......@@ -6,22 +6,23 @@ import "../view_models/BabeGrid"
import "../view_models/BabeTable"
import "../db/Queries.js" as Q
import org.kde.kirigami 2.2 as Kirigami
BabeGrid
{
id: albumsViewGrid
visible: true
property int hintSize : Math.sqrt(root.width*root.height)*0.25
albumSize:
{
if(hintSize>200)
200
else if (hintSize < 150)
root.isMobile && hintSize < 120 ? 120 : 150
else
hintSize
}
// property int hintSize : Math.sqrt(root.width*root.height)*0.25
// albumSize:
// {
// if(hintSize > 150)
// 150
// else if (hintSize < 100)
// root.isMobile && hintSize < 100 ? 100 : 130
// else
// hintSize
// }
signal rowClicked(var track)
signal playAlbum(var tracks)
......@@ -29,10 +30,10 @@ BabeGrid
signal queueTrack(var track)
signal appendAlbum(var tracks)
transform: Translate
{
y: (drawer.position * albumsViewGrid.height * 0.33)*-1
}
// transform: Translate
// {
// y: (drawer.position * albumsViewGrid.height * 0.33)*-1
// }
onBgClicked: if(drawer.visible) drawer.close()
onFocusChanged: drawer.close()
......@@ -56,6 +57,21 @@ BabeGrid
anchors.fill: parent
z: -999
color: bae.altColor()
Kirigami.Separator
{
Rectangle
{
anchors.fill: parent
color: Kirigami.Theme.viewFocusColor
}
anchors
{
left: parent.left
right: parent.right
top: parent.top
}
}
}
Column
......
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.2 as Kirigami
import "../view_models/BabeGrid"
import "../view_models/BabeTable"
......@@ -11,17 +12,7 @@ BabeGrid
{
id:artistsViewGrid
visible: true
property int hintSize : Math.sqrt(root.width*root.height)*0.25
albumSize:
{
if(hintSize>200)
200
else if (hintSize<150)
root.isMobile && hintSize < 120 ? 120 : 150
else
hintSize
}
signal rowClicked(var track)
signal playAlbum(var tracks)
......@@ -29,10 +20,10 @@ BabeGrid
signal queueTrack(var track)
signal appendAlbum(var tracks)
transform: Translate
{
y: (drawer.position * artistsViewGrid.height * 0.33)*-1
}
// transform: Translate
// {
// y: (drawer.position * artistsViewGrid.height * 0.33)*-1
// }
onBgClicked: if(drawer.visible) drawer.close()
onFocusChanged: drawer.close()
......@@ -54,6 +45,21 @@ BabeGrid
anchors.fill: parent
z: -999
color: bae.altColor()
Kirigami.Separator
{
Rectangle
{
anchors.fill: parent
color: Kirigami.Theme.viewFocusColor
}
anchors
{
left: parent.left
right: parent.right
top: parent.top
}
}
}
Column
......
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.2 as Kirigami
import "../utils"
import "../view_models"
......@@ -29,6 +30,22 @@ ToolBar
{
anchors.fill: parent
color: backgroundColor
Kirigami.Separator
{
Rectangle
{
anchors.fill: parent
color: Kirigami.Theme.viewFocusColor
}
anchors
{
left: parent.left
right: parent.right
bottom: parent.bottom
}
}
}
RowLayout
......@@ -43,7 +60,7 @@ ToolBar
{
id: playlistView
iconName: /*"headphones"*/ "media-optical-audio"
iconColor: pageStack.currentItem === mainPlaylist ? accentColor : textColor
iconColor: pageStack.currentIndex === 0 ? accentColor : textColor
iconSize: size
onClicked: playlistViewClicked()
......@@ -64,7 +81,7 @@ ToolBar
{
id: tracksView
iconName: /*"musicnote"*/ "filename-filetype-amarok"
iconColor: currentIndex === 0? accentColor : textColor
iconColor: currentIndex === 0? accentColor : textColor
iconSize: size
onClicked: tracksViewClicked()
......@@ -79,7 +96,7 @@ ToolBar
{
id: albumsView
iconName: /*"album" */ "media-album-cover"
iconColor: currentIndex === 1? accentColor : textColor
iconColor: currentIndex === 1? accentColor : textColor
iconSize: size
onClicked: albumsViewClicked()
......@@ -95,7 +112,7 @@ ToolBar
id: artistsView
iconName: /*"artist" */ "view-media-artist"
iconColor: currentIndex === 2? accentColor : textColor
iconColor: currentIndex === 2? accentColor : textColor
iconSize: size
onClicked: artistsViewClicked()
......@@ -111,7 +128,7 @@ ToolBar
id: playlistsView
iconName: /*"library-music"*/ "view-media-playlist"
iconColor: currentIndex === 3? accentColor : textColor
iconColor: currentIndex === 3? accentColor : textColor
iconSize: size
onClicked: playlistsViewClicked()
......
......@@ -2,6 +2,7 @@ import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import org.kde.kirigami 2.2 as Kirigami
import "../InfoView"
......@@ -143,7 +144,7 @@ Item
anchors.fill: parent
color: bae.midLightColor()
opacity: 0.8
z: -999
z: -999
}
// onYChanged:
// {
......@@ -433,6 +434,8 @@ Item
Layout.fillWidth: true
Layout.fillHeight: true
anchors.top: slideBar.bottom
// anchors.bottom: mainPlaylistRoot.searchBox
StackView
{
......@@ -498,6 +501,7 @@ Item
anchors.fill: parent
color: bae.altColor()
z: -999
}
onRowClicked: Player.playTrack(model.get(index))
......
import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
import org.kde.kirigami 2.2 as Kirigami
import "../../view_models/BabeTable"
import "../../view_models"
Item
{
// transform: Translate
// {
// x: (playlistViewDrawer.position * playlistViewRoot.width * 0.33)*-1
// }
Kirigami.PageRow
{
id: playlistViewRoot
signal rowClicked(var track)
signal quickPlayTrack(var track)
// transform: Translate
// {
// x: (playlistViewDrawer.position * playlistViewRoot.width * 0.33)*-1
// }
Drawer
separatorVisible: wideMode
initialPage:[playlistList, playlistViewDrawer]
defaultColumnWidth: Kirigami.Units.gridUnit * 15
Page
{
id: playlistList
ColumnLayout
{
anchors.fill: parent
spacing: 0
Layout.margins: 0
PlaylistsViewModel
{
id: playlistViewModel
Layout.fillHeight: true
Layout.fillWidth: true
}
ColorTagsBar
{
Layout.fillWidth: true
height: 32
recSize: 22
Rectangle
{
anchors.fill: parent
z: -999
color:bae.midColor()
}
// onColorClicked: moodIt(color)
}
}
}
Page
{
id: playlistViewDrawer
anchors.fill: parent
// y: root.header.height
// height: parent.height - root.header.height - root.footer.height
// width: root.isMobile ? parent.width : parent.width* 0.7
// edge: Qt.RightEdge
// interactive: true
// focus: true
// modal: isMobile
y: root.header.height
height: parent.height - root.header.height - root.footer.height
width: root.isMobile ? parent.width : parent.width* 0.7
edge: Qt.RightEdge
interactive: true
focus: true
modal: isMobile
// modal: !root.wideScreen
// onModalChanged: drawerOpen = !modal
background: Rectangle
{
......@@ -45,10 +91,12 @@ Item
trackRating: true
trackDuration: true
headerBar: true
headerClose: true
headerClose: !playlistViewRoot.wideMode
headerTitle: playlistViewModel.model.get(playlistViewModel.currentIndex).playlist
onHeaderClosed: playlistViewDrawer.close()
onHeaderClosed: if(!playlistViewRoot.wideMode)
playlistViewRoot.currentIndex = 0
Connections
{
......@@ -56,47 +104,17 @@ Item
onRowClicked: playlistViewRoot.rowClicked(filterList.model.get(index))
onQuickPlayTrack:
{
playlistViewDrawer.close()
// playlistViewDrawer.close()
playlistViewRoot.quickPlayTrack(filterList.model.get(index))
}
// onPlayAll: Player.playAll(bae.get(Q.Query.allTracks))
// onAppendAll: Player.appendAll(bae.get(Q.Query.allTracks))
// onPlayAll: Player.playAll(bae.get(Q.Query.allTracks))
// onAppendAll: Player.appendAll(bae.get(Q.Query.allTracks))
}
}
}
ColumnLayout
{
anchors.fill: parent
spacing: 0
Layout.margins: 0
PlaylistsViewModel
{
id: playlistViewModel
Layout.fillHeight: true
Layout.fillWidth: true
}
ColorTagsBar
{
Layout.fillWidth: true
height: 32
recSize: 22
Rectangle
{