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