mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 17:14:00 +02:00
some more work on the station config
This commit is contained in:
@@ -33,19 +33,23 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
id: tempoText
|
||||||
text: "Tempo:"
|
text: "Tempo:"
|
||||||
color: "white"
|
color: "white"
|
||||||
}
|
}
|
||||||
DoubleSlider {
|
DoubleSlider {
|
||||||
width: 500
|
width: 500
|
||||||
|
height: tempoText.height
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
id: hotnessText
|
||||||
text: "Hotness:"
|
text: "Hotness:"
|
||||||
color: "white"
|
color: "white"
|
||||||
}
|
}
|
||||||
DoubleSlider {
|
DoubleSlider {
|
||||||
width: 500
|
width: 500
|
||||||
|
height: hotnessText.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@ Item {
|
|||||||
//highlightMoveDuration: 500
|
//highlightMoveDuration: 500
|
||||||
|
|
||||||
model: dynamicModel
|
model: dynamicModel
|
||||||
currentIndex: currentlyPlayedIndex
|
currentIndex: currentlyPlayedIndex >= 0 ? currentlyPlayedIndex : 0
|
||||||
|
|
||||||
property int pathStartX: width / 2
|
property int pathStartX: width / 2
|
||||||
property int pathStartY: height / 2
|
property int pathStartY: height / 2
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick 1.1
|
import QtQuick 1.1
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
id: root
|
||||||
width: 500
|
width: 500
|
||||||
height: 10
|
height: 10
|
||||||
|
|
||||||
@@ -10,27 +11,121 @@ Item {
|
|||||||
property int lowerSliderPos: 25
|
property int lowerSliderPos: 25
|
||||||
property int upperSliderPos: 75
|
property int upperSliderPos: 75
|
||||||
|
|
||||||
Rectangle {
|
Row {
|
||||||
id: lowerSlider
|
anchors.fill: parent
|
||||||
height: parent.height
|
spacing: 10
|
||||||
width: height
|
|
||||||
anchors.top: parent.top
|
|
||||||
x: 10
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Text {
|
||||||
id: upperSlider
|
id: minText
|
||||||
height: parent.height
|
text: min
|
||||||
width: height
|
color: "white"
|
||||||
anchors.top: parent.top
|
}
|
||||||
x: 50
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
height: 4
|
id: sliderRect
|
||||||
color: "white"
|
height: root.height
|
||||||
radius: height / 2
|
width: parent.width - minText.width - maxText.width - parent.spacing * 2
|
||||||
width: parent.width
|
|
||||||
anchors.centerIn: parent
|
function sliderPosToValue( sliderPos ) {
|
||||||
|
var percent = sliderPos * 100 / (sliderRect.width - lowerSlider.width);
|
||||||
|
return Math.floor(percent * (root.max - root.min) / 100) + root.min
|
||||||
|
}
|
||||||
|
|
||||||
|
function valueToSloderPos( value ) {
|
||||||
|
var percent = (value - root.min) * 100 / (root.max - root.min)
|
||||||
|
return percent * (sliderRect.width - lowerSlider.width) / 100
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: sliderBase
|
||||||
|
height: root.height / 5
|
||||||
|
width: parent.width
|
||||||
|
color: "white"
|
||||||
|
radius: height / 2
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: lowerSlider
|
||||||
|
height: root.height
|
||||||
|
width: height
|
||||||
|
anchors.top: root.top
|
||||||
|
radius: height/2
|
||||||
|
border.color: "black"
|
||||||
|
border.width: 2
|
||||||
|
x: sliderRect.valueToSloderPos(root.lowerSliderPos)
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: lowerFloatingRect
|
||||||
|
color: "white"
|
||||||
|
anchors.bottom: lowerSlider.top
|
||||||
|
anchors.bottomMargin: 10
|
||||||
|
visible: lowerSliderMouseArea.pressed
|
||||||
|
width: lowerFloatingText.width * 1.2
|
||||||
|
height: lowerFloatingText.height + height * 1.2
|
||||||
|
x: -(width - lowerSlider.width) / 2
|
||||||
|
radius: height / 4
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: lowerFloatingText
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: sliderRect.sliderPosToValue(lowerSlider.x)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
id: lowerSliderMouseArea
|
||||||
|
anchors.fill: lowerSlider
|
||||||
|
drag.target: lowerSlider
|
||||||
|
drag.axis: "XAxis"
|
||||||
|
drag.minimumX: 0
|
||||||
|
drag.maximumX: upperSlider.x - lowerSlider.width
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: upperSlider
|
||||||
|
height: root.height
|
||||||
|
width: height
|
||||||
|
anchors.top: root.top
|
||||||
|
radius: height/2
|
||||||
|
border.color: "black"
|
||||||
|
border.width: 2
|
||||||
|
x: sliderRect.valueToSloderPos(root.upperSliderPos)
|
||||||
|
Rectangle {
|
||||||
|
id: upperFloatingRect
|
||||||
|
color: "white"
|
||||||
|
anchors.bottom: upperSlider.top
|
||||||
|
anchors.bottomMargin: 10
|
||||||
|
visible: upperSliderMouseArea.pressed
|
||||||
|
width: upperFloatingText.width * 1.2
|
||||||
|
height: upperFloatingText.height + height * 1.2
|
||||||
|
radius: height / 4
|
||||||
|
x: -(width - upperSlider.width) / 2
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: upperFloatingText
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: sliderRect.sliderPosToValue(upperSlider.x)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
id: upperSliderMouseArea
|
||||||
|
anchors.fill: upperSlider
|
||||||
|
onClicked: print("button pressed")
|
||||||
|
drag.target: upperSlider
|
||||||
|
drag.axis: "XAxis"
|
||||||
|
drag.minimumX: lowerSlider.x + lowerSlider.width
|
||||||
|
drag.maximumX: parent.width - upperSlider.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: maxText
|
||||||
|
text: max
|
||||||
|
color: "white"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -45,11 +45,13 @@ bool EchonestStation::configured()
|
|||||||
void EchonestStation::playItem(int row)
|
void EchonestStation::playItem(int row)
|
||||||
{
|
{
|
||||||
QModelIndex index( m_model->index( row, 0) );
|
QModelIndex index( m_model->index( row, 0) );
|
||||||
PlayableItem* item = m_model->itemFromIndex( index );
|
if( index.isValid() ) {
|
||||||
if ( item && !item->query().isNull() )
|
PlayableItem* item = m_model->itemFromIndex( index );
|
||||||
{
|
if ( item && !item->query().isNull() )
|
||||||
m_model->setCurrentIndex( index );
|
{
|
||||||
AudioEngine::instance()->playItem( m_model->playlistInterface(), item->query() );
|
m_model->setCurrentIndex( index );
|
||||||
|
AudioEngine::instance()->playItem( m_model->playlistInterface(), item->query() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user