mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 08:04:25 +02:00
some more work on start by year
This commit is contained in:
@@ -8,9 +8,14 @@ Item {
|
|||||||
|
|
||||||
signal done(string text)
|
signal done(string text)
|
||||||
|
|
||||||
function createStation(artist) {
|
function createStationFromYear(year) {
|
||||||
mainView.startStationFromArtist(artist)
|
mainView.startStationFromYear(year)
|
||||||
root.done(artist)
|
root.done(year)
|
||||||
|
}
|
||||||
|
|
||||||
|
function createStationFromTo(yearFrom, yearTo) {
|
||||||
|
mainView.startStationFromTo(yearFrom, yearTo)
|
||||||
|
root.done(yearFrom + " to " + yearTo)
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -27,53 +32,58 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
height: artistInputField.height
|
height: yearInputField.height
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: defaultFontHeight * 0.5
|
spacing: defaultFontHeight * 0.5
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Year:"
|
||||||
|
color: "white"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
InputField {
|
InputField {
|
||||||
id: artistInputField
|
id: yearInputField
|
||||||
width: parent.width - createFromInputButton.width - parent.spacing
|
width: parent.width - createFromInputButton.width - parent.spacing
|
||||||
|
|
||||||
onAccepted: createStation(text)
|
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 {
|
DoubleSlider {
|
||||||
|
id: yearSlider
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: defaultFontHeight * 2
|
height: defaultFontHeight * 4
|
||||||
min: 1960
|
min: 1960
|
||||||
max: new Date().getFullYear()
|
max: new Date().getFullYear()
|
||||||
lowerSliderPos: 1990
|
lowerSliderPos: 1990
|
||||||
upperSliderPos: 2010
|
upperSliderPos: 2010
|
||||||
minMaxLabelsVisible: false
|
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
|
anchors.centerIn: parent
|
||||||
width: root.width * 9 / 10
|
width: root.width * 9 / 10
|
||||||
height: cellHeight
|
height: cellHeight
|
||||||
|
interactive: false
|
||||||
|
|
||||||
cellWidth: (width - 1) / 3
|
cellWidth: (width - 1) / 3
|
||||||
cellHeight: cellWidth //* 10 / 16
|
cellHeight: cellWidth //* 10 / 16
|
||||||
|
@@ -65,6 +65,7 @@ Item {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
height: defaultFontHeight * 4
|
height: defaultFontHeight * 4
|
||||||
width: height
|
width: height
|
||||||
|
// count: 12
|
||||||
|
|
||||||
opacity: mainView.loading ? 1 : 0
|
opacity: mainView.loading ? 1 : 0
|
||||||
running: mainView.loading
|
running: mainView.loading
|
||||||
|
@@ -28,8 +28,8 @@ Item {
|
|||||||
|
|
||||||
property int steps: root.max - root.min + 1
|
property int steps: root.max - root.min + 1
|
||||||
|
|
||||||
property int sliderHeight: root.height
|
property int sliderHeight: root.height / 3
|
||||||
property int sliderWidth: root.height / 2
|
property int sliderWidth: sliderHeight / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
@@ -47,7 +47,7 @@ Item {
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: sliderRect
|
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
|
property int maxWidth: parent.width - (minText.visible ? minText.width : 0) - (maxText.visible ? maxText.width : 0) - parent.spacing * 2
|
||||||
width: maxWidth - (maxWidth % priv.steps)
|
width: maxWidth - (maxWidth % priv.steps)
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
@@ -64,7 +64,7 @@ Item {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: sliderBase
|
id: sliderBase
|
||||||
height: root.height / 1.5
|
height: parent.height
|
||||||
width: parent.width + defaultFontHeight * 1.5
|
width: parent.width + defaultFontHeight * 1.5
|
||||||
color: "white"
|
color: "white"
|
||||||
radius: height / 2
|
radius: height / 2
|
||||||
@@ -131,7 +131,7 @@ Item {
|
|||||||
id: lowerSlider
|
id: lowerSlider
|
||||||
height: priv.sliderHeight
|
height: priv.sliderHeight
|
||||||
width: priv.sliderWidth
|
width: priv.sliderWidth
|
||||||
anchors.top: root.top
|
anchors.verticalCenter: sliderBase.verticalCenter
|
||||||
radius: height/4
|
radius: height/4
|
||||||
border.color: "black"
|
border.color: "black"
|
||||||
border.width: 2
|
border.width: 2
|
||||||
@@ -170,9 +170,9 @@ Item {
|
|||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: upperSlider
|
id: upperSlider
|
||||||
height: root.height
|
height: priv.sliderHeight
|
||||||
width: height / 2
|
width: priv.sliderWidth
|
||||||
anchors.top: root.top
|
anchors.verticalCenter: sliderBase.verticalCenter
|
||||||
radius: height / 4
|
radius: height / 4
|
||||||
border.color: "black"
|
border.color: "black"
|
||||||
border.width: 2
|
border.width: 2
|
||||||
|
@@ -114,6 +114,8 @@ public:
|
|||||||
virtual bool startFromTrack( const Tomahawk::query_ptr& query ) = 0;
|
virtual bool startFromTrack( const Tomahawk::query_ptr& query ) = 0;
|
||||||
virtual bool startFromArtist( const Tomahawk::artist_ptr& artist ) = 0;
|
virtual bool startFromArtist( const Tomahawk::artist_ptr& artist ) = 0;
|
||||||
virtual bool startFromGenre( const QString& genre ) = 0;
|
virtual bool startFromGenre( const QString& genre ) = 0;
|
||||||
|
virtual bool startFromYear( int year ) = 0;
|
||||||
|
virtual bool startFromTo( int yearFrom, int yearTo) = 0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void error( const QString& title, const QString& body);
|
void error( const QString& title, const QString& body);
|
||||||
|
@@ -309,6 +309,18 @@ EchonestGenerator::startFromGenre( const QString& genre )
|
|||||||
return true;
|
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
|
void
|
||||||
EchonestGenerator::doGenerate( const Echonest::DynamicPlaylist::PlaylistParams& paramsIn )
|
EchonestGenerator::doGenerate( const Echonest::DynamicPlaylist::PlaylistParams& paramsIn )
|
||||||
|
@@ -83,6 +83,8 @@ public:
|
|||||||
virtual bool startFromTrack( const Tomahawk::query_ptr& query );
|
virtual bool startFromTrack( const Tomahawk::query_ptr& query );
|
||||||
virtual bool startFromArtist( const Tomahawk::artist_ptr& artist );
|
virtual bool startFromArtist( const Tomahawk::artist_ptr& artist );
|
||||||
virtual bool startFromGenre( const QString& genre );
|
virtual bool startFromGenre( const QString& genre );
|
||||||
|
virtual bool startFromYear( int year );
|
||||||
|
virtual bool startFromTo( int yearFrom, int yearTo );
|
||||||
|
|
||||||
static QStringList styles();
|
static QStringList styles();
|
||||||
static QStringList moods();
|
static QStringList moods();
|
||||||
|
@@ -168,6 +168,26 @@ void DynamicQmlWidget::startStationFromGenre(const QString &genre)
|
|||||||
emit configuredChanged();
|
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()
|
void DynamicQmlWidget::currentIndexChanged()
|
||||||
{
|
{
|
||||||
tDebug() << "current index is" << m_model->currentItem().row();
|
tDebug() << "current index is" << m_model->currentItem().row();
|
||||||
|
@@ -74,6 +74,8 @@ public slots:
|
|||||||
void pause();
|
void pause();
|
||||||
void startStationFromArtist(const QString &artist);
|
void startStationFromArtist(const QString &artist);
|
||||||
void startStationFromGenre(const QString &genre);
|
void startStationFromGenre(const QString &genre);
|
||||||
|
void startStationFromYear(int year);
|
||||||
|
void startStationFromTo(int yearFrom, int yearTo);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void currentIndexChanged();
|
void currentIndexChanged();
|
||||||
|
Reference in New Issue
Block a user