mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +02:00
add artist mode for stations
This commit is contained in:
@@ -7,6 +7,8 @@ Item {
|
||||
property bool showLabels: true
|
||||
// Should the play button be painted on mouse hover?
|
||||
property bool showPlayButton: false
|
||||
// Should the mirror be painted?
|
||||
property bool showMirror: false
|
||||
|
||||
// Labels & Cover
|
||||
property string artistName
|
||||
@@ -95,7 +97,7 @@ Item {
|
||||
|
||||
Loader {
|
||||
id: mirroredCover
|
||||
sourceComponent: coverImage
|
||||
sourceComponent: parent.showMirror ? coverImage : undefined
|
||||
anchors.fill: parent
|
||||
transform : [
|
||||
Rotation {
|
||||
|
@@ -57,19 +57,31 @@ Rectangle {
|
||||
width: scene.width
|
||||
spacing: width * .1
|
||||
|
||||
GridView {
|
||||
id: gridView
|
||||
Item {
|
||||
height: parent.height
|
||||
width: (parent.width - orText.width - parent.spacing * 2 ) * 2 / 3
|
||||
model: dummyArtistModel
|
||||
GridView {
|
||||
id: gridView
|
||||
anchors.fill: parent
|
||||
anchors.margins: cellWidth / 2
|
||||
model: dummyArtistModel
|
||||
|
||||
delegate: Item {
|
||||
height: gridView.height / 3;
|
||||
width: height
|
||||
cellWidth: gridView.width / 4 - 1 // -1 to make sure there is space for 4 items even with rounding error
|
||||
cellHeight: cellWidth
|
||||
|
||||
CoverImage {
|
||||
artistName: modelData
|
||||
anchors.fill: parent
|
||||
delegate: Item {
|
||||
height: gridView.cellHeight * .9
|
||||
width: height
|
||||
|
||||
CoverImage {
|
||||
artistName: modelData
|
||||
anchors.fill: parent
|
||||
|
||||
onClicked: {
|
||||
echonestStation.setMainControl( EchonestStation.StationTypeArtist, modelData );
|
||||
stationListView.incrementCurrentIndex();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,7 +101,7 @@ Rectangle {
|
||||
opacity: echonestStation.configured ? 0 : 1
|
||||
|
||||
onTagClicked: {
|
||||
echonestStation.setMainControl( item );
|
||||
echonestStation.setMainControl( EchonestStation.StationTypeStyle, item );
|
||||
stationListView.incrementCurrentIndex();
|
||||
}
|
||||
|
||||
|
@@ -29,6 +29,7 @@ Item {
|
||||
width: root.coverSize
|
||||
|
||||
showLabels: false
|
||||
showMirror: true
|
||||
//artistName: model.artistName
|
||||
//trackName: model.trackName
|
||||
artworkId: model.coverID
|
||||
|
@@ -15,7 +15,7 @@ EchonestStation::EchonestStation( PlayableProxyModel *model, dynplaylist_ptr pla
|
||||
, m_model( model )
|
||||
, m_playlist( playlist )
|
||||
{
|
||||
|
||||
connect(m_playlist->generator().data(), SIGNAL(controlAdded(const dyncontrol_ptr&)), SLOT(controlsChanged()));
|
||||
}
|
||||
|
||||
QString EchonestStation::name() const
|
||||
@@ -69,14 +69,18 @@ void EchonestStation::playItem(int row)
|
||||
}
|
||||
}
|
||||
|
||||
void EchonestStation::setMainControl(const QString &type)
|
||||
void EchonestStation::setMainControl( StationType type, const QString &value )
|
||||
{
|
||||
dyncontrol_ptr control = m_playlist->generator()->createControl("echonest");
|
||||
control->setSelectedType("Style");
|
||||
control->setMatch("1");
|
||||
control->setInput(type);
|
||||
dyncontrol_ptr control = m_playlist->generator()->createControl( "echonest" );
|
||||
if ( type == StationTypeStyle ) {
|
||||
control->setSelectedType( "Style" );
|
||||
} else if ( type == StationTypeArtist ) {
|
||||
control->setSelectedType( "Artist" );
|
||||
}
|
||||
control->setMatch( "1" );
|
||||
control->setInput( value );
|
||||
qDebug() << "created control" << control->type() << control->selectedType() << control->match();
|
||||
m_playlist->generator()->generate(20);
|
||||
m_playlist->generator()->generate( 20 );
|
||||
|
||||
emit configurationChanged();
|
||||
}
|
||||
@@ -116,5 +120,10 @@ dyncontrol_ptr EchonestStation::findControl(const QString &selectedType, const Q
|
||||
return dyncontrol_ptr();
|
||||
}
|
||||
|
||||
void EchonestStation::controlsChanged()
|
||||
{
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -9,6 +9,7 @@ namespace Tomahawk
|
||||
class EchonestStation: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_ENUMS(StationType)
|
||||
Q_PROPERTY( QString name READ name WRITE setName NOTIFY nameChanged )
|
||||
Q_PROPERTY( bool configured READ configured NOTIFY configurationChanged )
|
||||
Q_PROPERTY( Tomahawk::DynamicControl* mainControl READ mainControl )
|
||||
@@ -16,6 +17,11 @@ class EchonestStation: public QObject
|
||||
Q_PROPERTY( int maxTempo READ maxTempo NOTIFY configurationChanged )
|
||||
|
||||
public:
|
||||
enum StationType {
|
||||
StationTypeStyle,
|
||||
StationTypeArtist
|
||||
};
|
||||
|
||||
EchonestStation( PlayableProxyModel *model, dynplaylist_ptr playlist, QObject *parent = 0);
|
||||
|
||||
QString name() const;
|
||||
@@ -30,7 +36,7 @@ public:
|
||||
public slots:
|
||||
void playItem( int row );
|
||||
|
||||
void setMainControl(const QString &type);
|
||||
void setMainControl(StationType type, const QString &value);
|
||||
void setTempo( int min, int max );
|
||||
|
||||
signals:
|
||||
@@ -40,6 +46,9 @@ signals:
|
||||
private:
|
||||
dyncontrol_ptr findControl( const QString &selectedType, const QString &match ) const;
|
||||
|
||||
private slots:
|
||||
void controlsChanged();
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
PlayableProxyModel *m_model;
|
||||
|
Reference in New Issue
Block a user