1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-25 23:06:23 +02:00

some more work on the stations

This commit is contained in:
Michael Zanetti
2012-07-25 22:05:39 +02:00
parent cdfde7ecc3
commit 52d5dbaf4d
8 changed files with 105 additions and 28 deletions

View File

@@ -40,6 +40,11 @@ Item {
DoubleSlider {
width: 500
height: tempoText.height
min: 0
max: 500
lowerSliderPos: echonestStation.minTempo
upperSliderPos: echonestStation.maxTempo
onValueChanged: echonestStation.setTempo( lowerSliderPos, upperSliderPos )
}
Text {
@@ -50,6 +55,14 @@ Item {
DoubleSlider {
width: 500
height: hotnessText.height
min: 0
max: 100
minLabel: "Less"
maxLabel: "More"
showFloatingLabel: false
lowerSliderPos: echonestStation.minHotttness * 100
upperSliderPos: echonestStation.maxHotttness * 100
onValueChanged: echonestStation.setHotttness( 1.0 * lowerSliderPos / 100, 1.0 * upperSliderPos / 100 )
}
}

View File

@@ -19,7 +19,7 @@ Item {
//highlightMoveDuration: 500
model: dynamicModel
currentIndex: currentlyPlayedIndex >= 0 ? currentlyPlayedIndex : 0
currentIndex: currentlyPlayedIndex
property int pathStartX: width / 2
property int pathStartY: height / 2
@@ -155,21 +155,21 @@ Item {
font.pointSize: 16
width: parent.width
elide: Text.ElideRight
text: coverView.model.itemFromIndex( currentlyPlayedIndex ).name
text: currentlyPlayedIndex > -1 ? coverView.model.itemFromIndex( currentlyPlayedIndex ).name : ""
}
Text {
color: "white"
font.pointSize: 14
width: parent.width
elide: Text.ElideRight
text: coverView.model.itemFromIndex( currentlyPlayedIndex ).artistName
text: currentlyPlayedIndex > -1 ? coverView.model.itemFromIndex( currentlyPlayedIndex ).artistName : ""
}
Text {
color: "white"
font.pointSize: 14
width: parent.width
elide: Text.ElideRight
text: coverView.model.itemFromIndex( currentlyPlayedIndex ).albumName
text: currentlyPlayedIndex > -1 ? coverView.model.itemFromIndex( currentlyPlayedIndex ).albumName : ""
}
}
}

View File

@@ -8,16 +8,27 @@ Item {
property int min: 0
property int max: 100
/** The labels next to the slider
* if empty, min and max values are used
*/
property string minLabel: ""
property string maxLabel: ""
/** Should the floating label indicating the current position be shown? */
property bool showFloatingLabel: true
property int lowerSliderPos: 25
property int upperSliderPos: 75
signal valueChanged()
Row {
anchors.fill: parent
spacing: 10
Text {
id: minText
text: min
text: root.minLabel.length > 0 ? root.minLabel : min
color: "white"
}
@@ -60,7 +71,7 @@ Item {
color: "white"
anchors.bottom: lowerSlider.top
anchors.bottomMargin: 10
visible: lowerSliderMouseArea.pressed
visible: root.showFloatingLabel && lowerSliderMouseArea.pressed
width: lowerFloatingText.width * 1.2
height: lowerFloatingText.height + height * 1.2
x: -(width - lowerSlider.width) / 2
@@ -80,6 +91,10 @@ Item {
drag.axis: "XAxis"
drag.minimumX: 0
drag.maximumX: upperSlider.x - lowerSlider.width
onReleased: {
root.lowerSliderPos = sliderRect.sliderPosToValue( lowerSlider.x );
root.valueChanged();
}
}
Rectangle {
@@ -96,7 +111,7 @@ Item {
color: "white"
anchors.bottom: upperSlider.top
anchors.bottomMargin: 10
visible: upperSliderMouseArea.pressed
visible: root.showFloatingLabel && upperSliderMouseArea.pressed
width: upperFloatingText.width * 1.2
height: upperFloatingText.height + height * 1.2
radius: height / 4
@@ -118,13 +133,18 @@ Item {
drag.axis: "XAxis"
drag.minimumX: lowerSlider.x + lowerSlider.width
drag.maximumX: parent.width - upperSlider.width
onReleased: {
root.upperSliderPos = sliderRect.sliderPosToValue( upperSlider.x );
root.valueChanged();
}
}
}
Text {
id: maxText
text: max
text: root.maxLabel.length > 0 ? root.maxLabel : max
color: "white"
}
}