Commit dc97e0bb authored by Camilo Higuita's avatar Camilo Higuita

return mini mode and playlist-mode and fix delegate size in mobile

parent 5fde3603
......@@ -402,7 +402,7 @@ bool Babe::isMobile()
return BAE::isMobile();
}
int Babe::screenGeometry(QString &side)
int Babe::screenGeometry(QString side)
{
side = side.toLower();
auto geo = QApplication::desktop()->screenGeometry();
......@@ -414,7 +414,7 @@ int Babe::screenGeometry(QString &side)
else return 0;
}
int Babe::cursorPos(QString &axis)
int Babe::cursorPos(QString axis)
{
axis = axis.toLower();
auto pos = QCursor::pos();
......
......@@ -84,8 +84,8 @@ public:
Q_INVOKABLE static QString babeColor();
Q_INVOKABLE static bool isMobile();
Q_INVOKABLE static int screenGeometry(QString &side);
Q_INVOKABLE static int cursorPos(QString &axis);
Q_INVOKABLE static int screenGeometry(QString side);
Q_INVOKABLE static int cursorPos(QString axis);
Q_INVOKABLE static QString moodColor(const int &pos);
......
......@@ -16,7 +16,9 @@ Kirigami.ApplicationWindow
{
id: root
visible: true
width: isMobile ? 800 : 400
width: !isMobile ? bae.screenGeometry("width")*0.45 : 400
minimumWidth: !isMobile ? columnWidth : 0
minimumHeight: !isMobile ? columnWidth : 0
height: 500
title: qsTr("Babe")
wideScreen: root.width > coverSize
......@@ -24,9 +26,11 @@ Kirigami.ApplicationWindow
// property int columnWidth: Kirigami.Units.gridUnit * 13
readonly property bool isMobile: bae.isMobile()
readonly property int maxW : root.maximumWidth
readonly property int maxH : root.maximumHeight
property int columnWidth: Kirigami.Units.gridUnit * 20
property int coverSize: columnWidth*0.6
property int coverSize: columnWidth*0.65
// property int columnWidth: Math.sqrt(root.width*root.height)*0.4
property int currentView : 0
property int toolBarIconSize: isMobile ? 24 : 22
......
......@@ -23,7 +23,7 @@ Item
DropShadow
{
anchors.fill: card
horizontalOffset: 3
horizontalOffset: 0
verticalOffset: 3
radius: 8.0
samples: 17
......
......@@ -59,7 +59,7 @@ ListView
Keys.onReturnPressed: rowClicked(currentIndex)
Keys.onEnterPressed: quickPlayTrack(currentIndex)
boundsBehavior: isMobile? Flickable.StopAtBounds : Flickable.DragAndOvershootBounds
boundsBehavior: !isMobile? Flickable.StopAtBounds : Flickable.DragAndOvershootBounds
flickableDirection: Flickable.AutoFlickDirection
snapMode: ListView.SnapToItem
......
......@@ -55,7 +55,7 @@ ItemDelegate
color:
{
if(trackMood.length > 0)
trackMood
Qt.lighter(trackMood)
else
index % 2 === 0 ? bae.midColor() : "transparent"
}
......@@ -77,7 +77,7 @@ ItemDelegate
{
id: gridLayout
anchors.fill: parent
spacing: 20
spacing: 0
Item
{
......@@ -137,7 +137,7 @@ ItemDelegate
Layout.fillHeight: true
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
Layout.alignment: Qt.AlignLeft
Layout.margins: 15
anchors.verticalCenter: parent.verticalCenter
......@@ -256,7 +256,7 @@ ItemDelegate
Layout.column: 3
horizontalAlignment: Qt.AlignRight
verticalAlignment: Qt.AlignVCenter
font.family: "Material Design Icons"
font.family: "Material Design Icons"
text: setStars(stars)
font.bold: false
elide: Text.ElideRight
......
......@@ -78,7 +78,7 @@ Item
FastBlur
{
width: mainPlaylistRoot.width
height: mainPlaylist.y
height: mainPlaylistItem.y
source: artwork
radius: 100
transparentBorder: true
......@@ -99,11 +99,43 @@ Item
anchors.fill: parent
onDoubleClicked:
{
var query = Q.GET.albumTracks_.arg(currentTrack.album)
query = query.arg(currentTrack.artist)
// var query = Q.GET.albumTracks_.arg(currentTrack.album)
// query = query.arg(currentTrack.artist)
var tracks = bae.get(query)
coverDoubleClicked(tracks)
// var tracks = bae.get(query)
// coverDoubleClicked(tracks)
if(!isMobile)
{
if(root.header.visible)
{
root.maximumWidth = columnWidth
root.minimumWidth = artwork.width
root.maximumHeight = mainPlaylistItem.y
root.minimumHeight = mainPlaylistItem.y
root.header.visible = false
root.footer.visible = false
infoBtn.visible = false
menuBtn.visible = false
}else
{
cover.y = 0
root.maximumWidth = bae.screenGeometry("width")
root.minimumWidth = columnWidth
root.maximumHeight = bae.screenGeometry("height")
root.minimumHeight = columnWidth
root.width = columnWidth
root.height = 700
root.header.visible = true
root.footer.visible = true
infoBtn.visible = true
menuBtn.visible = true
}
}
}
onPressAndHold:
......@@ -192,49 +224,39 @@ Item
{
cover.visible = false
playbackControls.y = 0
}else cover.visible = true
}else
{
cover.visible = true
// playbackControls.y = coverSize
}
}
}
RowLayout
{
width: parent.width
height: parent.height
anchors.fill: parent
Row
BabeButton
{
id: infoBtn
Layout.alignment: Qt.AlignLeft
BabeButton
iconName: stackView.currentItem === list ? "documentinfo" : "arrow-left"
iconSize: playbackIconSize
onClicked:
{
id: infoBtn
iconName: stackView.currentItem === list ? "documentinfo" : "arrow-left"
iconSize: playbackIconSize
onClicked:
if(stackView.currentItem !== list)
{
if(stackView.currentItem !== list)
{
stackView.pop(list)
cover.visible = true
}
else
{
cover.visible = false
stackView.push(infoView)
}
stackView.pop(list)
cover.visible = true
}
else
{
cover.visible = false
stackView.push(infoView)
}
}
}
Row
{
Layout.alignment: Qt.AlignCenter
......@@ -292,19 +314,19 @@ Item
}
}
Row
BabeButton
{
id: menuBtn
Layout.alignment: Qt.AlignRight
BabeButton
{
id: menuBtn
iconName: /*"application-menu"*/ "overflow-menu"
iconSize: playbackIconSize
iconName: /*"application-menu"*/ "overflow-menu"
iconSize: playbackIconSize
onClicked: root.isMobile ? playlistMenu.open() : playlistMenu.popup()
}
onClicked: root.isMobile ? playlistMenu.open() : playlistMenu.popup()
}
}
}
......@@ -432,7 +454,7 @@ Item
Item
{
id: mainPlaylist
id: mainPlaylistItem
Layout.row: 4
Layout.column: 1
Layout.fillWidth: true
......
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