mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 07:36:48 +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
|
||||
|
@@ -114,6 +114,8 @@ public:
|
||||
virtual bool startFromTrack( const Tomahawk::query_ptr& query ) = 0;
|
||||
virtual bool startFromArtist( const Tomahawk::artist_ptr& artist ) = 0;
|
||||
virtual bool startFromGenre( const QString& genre ) = 0;
|
||||
virtual bool startFromYear( int year ) = 0;
|
||||
virtual bool startFromTo( int yearFrom, int yearTo) = 0;
|
||||
|
||||
signals:
|
||||
void error( const QString& title, const QString& body);
|
||||
|
@@ -309,6 +309,18 @@ EchonestGenerator::startFromGenre( const QString& genre )
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EchonestGenerator::startFromYear(int year)
|
||||
{
|
||||
//TODO: libechonest doesn't support filtering for year yet...
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EchonestGenerator::startFromTo(int yearFrom, int yearTo)
|
||||
{
|
||||
//TODO: libechonest doesn't support filtering for year yet...
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EchonestGenerator::doGenerate( const Echonest::DynamicPlaylist::PlaylistParams& paramsIn )
|
||||
|
@@ -83,6 +83,8 @@ public:
|
||||
virtual bool startFromTrack( const Tomahawk::query_ptr& query );
|
||||
virtual bool startFromArtist( const Tomahawk::artist_ptr& artist );
|
||||
virtual bool startFromGenre( const QString& genre );
|
||||
virtual bool startFromYear( int year );
|
||||
virtual bool startFromTo( int yearFrom, int yearTo );
|
||||
|
||||
static QStringList styles();
|
||||
static QStringList moods();
|
||||
|
@@ -168,6 +168,26 @@ void DynamicQmlWidget::startStationFromGenre(const QString &genre)
|
||||
emit configuredChanged();
|
||||
}
|
||||
|
||||
void DynamicQmlWidget::startStationFromYear(int year)
|
||||
{
|
||||
tDebug() << "should start startion from year" << year;
|
||||
m_model->clear();
|
||||
m_playNextResolved = true;
|
||||
m_playlist->generator()->startFromYear( year );
|
||||
emit loadingChanged();
|
||||
emit configuredChanged();
|
||||
}
|
||||
|
||||
void DynamicQmlWidget::startStationFromTo(int yearFrom, int yearTo)
|
||||
{
|
||||
tDebug() << "should start startion from years" << yearFrom << "to" << yearTo;
|
||||
m_model->clear();
|
||||
m_playNextResolved = true;
|
||||
m_playlist->generator()->startFromTo( yearFrom, yearTo );
|
||||
emit loadingChanged();
|
||||
emit configuredChanged();
|
||||
}
|
||||
|
||||
void DynamicQmlWidget::currentIndexChanged()
|
||||
{
|
||||
tDebug() << "current index is" << m_model->currentItem().row();
|
||||
|
@@ -74,6 +74,8 @@ public slots:
|
||||
void pause();
|
||||
void startStationFromArtist(const QString &artist);
|
||||
void startStationFromGenre(const QString &genre);
|
||||
void startStationFromYear(int year);
|
||||
void startStationFromTo(int yearFrom, int yearTo);
|
||||
|
||||
private slots:
|
||||
void currentIndexChanged();
|
||||
|
Reference in New Issue
Block a user