mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-19 04:11:46 +02:00
Station is now a CoverFlow instead of a CoverFlip
This commit is contained in:
@@ -5,13 +5,10 @@ import "../tomahawkimports"
|
||||
Item {
|
||||
id: stationItem
|
||||
|
||||
CoverFlip {
|
||||
CoverFlow {
|
||||
id: coverView
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
height: parent.height
|
||||
width: parent.width
|
||||
interactive: false
|
||||
anchors.fill: parent
|
||||
|
||||
backgroundColor: scene.color
|
||||
|
||||
@@ -25,40 +22,6 @@ Item {
|
||||
onItemClicked: {
|
||||
mainView.playItem(index)
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "empty"; when: mainView.loading
|
||||
PropertyChanges {
|
||||
target: coverView
|
||||
anchors.rightMargin: -coverView.width
|
||||
anchors.topMargin: - coverView.height
|
||||
scale: 0
|
||||
}
|
||||
}
|
||||
]
|
||||
transitions: [
|
||||
Transition {
|
||||
from: "empty"
|
||||
to: "*"
|
||||
NumberAnimation {
|
||||
properties: "anchors.topMargin,anchors.rightMargin,scale"
|
||||
duration: 1000
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
// Behavior on anchors.topMargin {
|
||||
// NumberAnimation { duration: 500 }
|
||||
// }
|
||||
// Behavior on anchors.rightMargin {
|
||||
// NumberAnimation { duration: 500 }
|
||||
// }
|
||||
// Behavior on scale {
|
||||
// NumberAnimation { duration: 500 }
|
||||
// }
|
||||
|
||||
}
|
||||
BusyIndicator {
|
||||
id: busyIndicator
|
||||
|
84
data/qml/tomahawkimports/CoverFlow.qml
Normal file
84
data/qml/tomahawkimports/CoverFlow.qml
Normal file
@@ -0,0 +1,84 @@
|
||||
import QtQuick 1.1
|
||||
import tomahawk 1.0
|
||||
|
||||
ListView {
|
||||
id: coverView
|
||||
|
||||
property color backgroundColor: "black"
|
||||
property int coverSize: height / 2
|
||||
|
||||
// emitted when a cover is clicked
|
||||
signal itemClicked(int index)
|
||||
|
||||
// emitted when a cover is clicked
|
||||
signal itemPlayPauseClicked(int index)
|
||||
|
||||
preferredHighlightBegin: (width / 2) - (coverSize / 4)
|
||||
preferredHighlightEnd: preferredHighlightBegin + coverSize / 2
|
||||
snapMode: ListView.SnapToItem
|
||||
highlightRangeMode: ListView.StrictlyEnforceRange
|
||||
highlightMoveDuration: 200
|
||||
|
||||
property bool itemHovered: false
|
||||
orientation: ListView.Horizontal
|
||||
|
||||
delegate: Item {
|
||||
id: delegateItem
|
||||
height: parent.height
|
||||
width: coverView.coverSize / 2
|
||||
anchors.verticalCenter: ListView.view.verticalCenter
|
||||
|
||||
property real distanceFromLeftEdge: -coverView.contentX + index*width
|
||||
property real distanceFromRightEdge: coverView.contentX + coverView.width - (index+1)*width
|
||||
property real distanceFromEdge: Math.max(distanceFromLeftEdge, distanceFromRightEdge)
|
||||
|
||||
scale: 2 - (distanceFromEdge / (coverView.width))
|
||||
|
||||
property double itemBrightness: (1.3 - (distanceFromEdge / (coverView.width))) - ((coverView.itemHovered && !coverDelegate.containsMouse) ? .4 : 0)
|
||||
property double itemOpacity: coverView.itemHovered && !coverDelegate.containsMouse ? 0.4 : 1
|
||||
property int _origZ
|
||||
|
||||
z: -Math.abs(currentIndex - index)
|
||||
|
||||
CoverImage {
|
||||
id: coverDelegate
|
||||
height: coverView.coverSize / 2
|
||||
width: parent.width
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
showLabels: true
|
||||
showMirror: false
|
||||
artistName: model.artistName
|
||||
trackName: model.trackName
|
||||
artworkId: model.coverID
|
||||
showPlayButton: true
|
||||
currentlyPlaying: isPlaying
|
||||
smooth: true
|
||||
|
||||
itemBrightness: coverDelegate.containsMouse ? 1 : parent.itemBrightness * (coverView.itemHovered ? .5 : 1)
|
||||
opacity: parent.itemOpacity
|
||||
z: coverView.width - x
|
||||
|
||||
onPlayClicked: {
|
||||
console.log("***************")
|
||||
coverView.itemPlayPauseClicked(index)
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
coverView.itemClicked(index)
|
||||
}
|
||||
|
||||
onContainsMouseChanged: {
|
||||
if (containsMouse) {
|
||||
delegateItem._origZ = delegateItem.z;
|
||||
coverView.itemHovered = true
|
||||
} else {
|
||||
coverView.itemHovered = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -101,6 +101,7 @@
|
||||
<file>data/qml/tomahawkimports/RoundedButton.qml</file>
|
||||
<file>data/qml/tomahawkimports/PushButton.qml</file>
|
||||
<file>data/qml/tomahawkimports/CoverFlip.qml</file>
|
||||
<file>data/qml/tomahawkimports/CoverFlow.qml</file>
|
||||
<file>data/qml/tomahawkimports/BusyIndicator.qml</file>
|
||||
<file>data/qml/tomahawkimports/InputBubble.qml</file>
|
||||
<file>data/qml/StationView.qml</file>
|
||||
|
Reference in New Issue
Block a user