mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 17:14:00 +02:00
some more work on start by year
This commit is contained in:
@@ -8,9 +8,14 @@ Item {
|
||||
|
||||
signal done(string text)
|
||||
|
||||
function createStation(artist) {
|
||||
mainView.startStationFromArtist(artist)
|
||||
root.done(artist)
|
||||
function createStationFromYear(year) {
|
||||
mainView.startStationFromYear(year)
|
||||
root.done(year)
|
||||
}
|
||||
|
||||
function createStationFromTo(yearFrom, yearTo) {
|
||||
mainView.startStationFromTo(yearFrom, yearTo)
|
||||
root.done(yearFrom + " to " + yearTo)
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -27,53 +32,58 @@ Item {
|
||||
}
|
||||
|
||||
Row {
|
||||
height: artistInputField.height
|
||||
height: yearInputField.height
|
||||
width: parent.width
|
||||
spacing: defaultFontHeight * 0.5
|
||||
|
||||
Text {
|
||||
text: "Year:"
|
||||
color: "white"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
InputField {
|
||||
id: artistInputField
|
||||
id: yearInputField
|
||||
width: parent.width - createFromInputButton.width - parent.spacing
|
||||
|
||||
onAccepted: createStation(text)
|
||||
}
|
||||
|
||||
PushButton {
|
||||
id: createFromInputButton
|
||||
text: "Go!"
|
||||
enabled: artistInputField.text.length > 2
|
||||
onClicked: createStation(artistInputField.text)
|
||||
}
|
||||
}
|
||||
|
||||
// Item {
|
||||
// height: parent.height - headerText.height - artistInputField.height - parent.spacing * 3
|
||||
// width: parent.width
|
||||
// ArtistView {
|
||||
// id: artistView
|
||||
// height: parent.height
|
||||
// width: parent.width
|
||||
// model: artistChartsModel
|
||||
// clip: true
|
||||
// delegateHeight: defaultFontHeight * 6
|
||||
|
||||
// onItemClicked: {
|
||||
// createStation(artistChartsModel.itemFromIndex(index).artistName);
|
||||
// }
|
||||
// }
|
||||
// ScrollBar {
|
||||
// listView: artistView
|
||||
// }
|
||||
// }
|
||||
|
||||
DoubleSlider {
|
||||
id: yearSlider
|
||||
width: parent.width
|
||||
height: defaultFontHeight * 2
|
||||
height: defaultFontHeight * 4
|
||||
min: 1960
|
||||
max: new Date().getFullYear()
|
||||
lowerSliderPos: 1990
|
||||
upperSliderPos: 2010
|
||||
minMaxLabelsVisible: false
|
||||
opacity: yearInputField.text.length > 0 ? 0.3 : 1
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 200 }
|
||||
}
|
||||
}
|
||||
|
||||
PushButton {
|
||||
id: createFromInputButton
|
||||
text: "Go!"
|
||||
enabled: yearInputField.text.length == 0 || (yearInputField.text >= yearSlider.min && yearInputField.text <= yearSlider.max)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
onClicked: {
|
||||
if (yearInputField.text.length > 0) {
|
||||
createStationFromYear(yearInputField.text)
|
||||
} else {
|
||||
createStationFromTo(yearSlider.lowerSliderPos, yearSlider.upperSliderPos)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: move some disabled look/animation to the button itself
|
||||
opacity: enabled ? 1 : 0.3
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 200 }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ Item {
|
||||
anchors.centerIn: parent
|
||||
width: root.width * 9 / 10
|
||||
height: cellHeight
|
||||
interactive: false
|
||||
|
||||
cellWidth: (width - 1) / 3
|
||||
cellHeight: cellWidth //* 10 / 16
|
||||
|
@@ -65,6 +65,7 @@ Item {
|
||||
anchors.centerIn: parent
|
||||
height: defaultFontHeight * 4
|
||||
width: height
|
||||
// count: 12
|
||||
|
||||
opacity: mainView.loading ? 1 : 0
|
||||
running: mainView.loading
|
||||
|
@@ -28,8 +28,8 @@ Item {
|
||||
|
||||
property int steps: root.max - root.min + 1
|
||||
|
||||
property int sliderHeight: root.height
|
||||
property int sliderWidth: root.height / 2
|
||||
property int sliderHeight: root.height / 3
|
||||
property int sliderWidth: sliderHeight / 2
|
||||
}
|
||||
|
||||
Row {
|
||||
@@ -47,7 +47,7 @@ Item {
|
||||
|
||||
Item {
|
||||
id: sliderRect
|
||||
height: root.height
|
||||
height: root.height / 4
|
||||
property int maxWidth: parent.width - (minText.visible ? minText.width : 0) - (maxText.visible ? maxText.width : 0) - parent.spacing * 2
|
||||
width: maxWidth - (maxWidth % priv.steps)
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -64,7 +64,7 @@ Item {
|
||||
|
||||
Rectangle {
|
||||
id: sliderBase
|
||||
height: root.height / 1.5
|
||||
height: parent.height
|
||||
width: parent.width + defaultFontHeight * 1.5
|
||||
color: "white"
|
||||
radius: height / 2
|
||||
@@ -131,7 +131,7 @@ Item {
|
||||
id: lowerSlider
|
||||
height: priv.sliderHeight
|
||||
width: priv.sliderWidth
|
||||
anchors.top: root.top
|
||||
anchors.verticalCenter: sliderBase.verticalCenter
|
||||
radius: height/4
|
||||
border.color: "black"
|
||||
border.width: 2
|
||||
@@ -170,9 +170,9 @@ Item {
|
||||
|
||||
Rectangle {
|
||||
id: upperSlider
|
||||
height: root.height
|
||||
width: height / 2
|
||||
anchors.top: root.top
|
||||
height: priv.sliderHeight
|
||||
width: priv.sliderWidth
|
||||
anchors.verticalCenter: sliderBase.verticalCenter
|
||||
radius: height / 4
|
||||
border.color: "black"
|
||||
border.width: 2
|
||||
|
Reference in New Issue
Block a user