mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-09-02 18:33:16 +02:00
more qml work
This commit is contained in:
@@ -7,26 +7,29 @@ PathView {
|
|||||||
|
|
||||||
// The start coordinates for the covers
|
// The start coordinates for the covers
|
||||||
// Default is left, centered in height
|
// Default is left, centered in height
|
||||||
property int pathStartX: coverSize
|
property int pathStartX: 0
|
||||||
property int pathStartY: height / 2
|
property int pathStartY: height / 2
|
||||||
|
|
||||||
// The size of the covers in the path
|
// The size of the covers in the path
|
||||||
property int coverSize: 100
|
property int coverSize: 100
|
||||||
|
|
||||||
|
property color backgroundColor: "black"
|
||||||
|
|
||||||
// emitted when a cover is clicked
|
// emitted when a cover is clicked
|
||||||
signal itemClicked(int index)
|
signal itemClicked(int index)
|
||||||
|
|
||||||
// emitted when a cover is clicked
|
// emitted when a cover is clicked
|
||||||
signal itemPlayPauseClicked(int index)
|
signal itemPlayPauseClicked(int index)
|
||||||
|
|
||||||
preferredHighlightBegin: 0.2 // scene.width / 11000
|
// preferredHighlightBegin: 0.2 // scene.width / 11000
|
||||||
preferredHighlightEnd: preferredHighlightBegin
|
// preferredHighlightEnd: preferredHighlightBegin
|
||||||
pathItemCount: 5
|
pathItemCount: 5
|
||||||
//highlightMoveDuration: 500
|
//highlightMoveDuration: 500
|
||||||
|
|
||||||
delegate: CoverImage {
|
delegate: CoverImage {
|
||||||
height: root.coverSize
|
height: root.coverSize
|
||||||
width: root.coverSize
|
width: root.coverSize
|
||||||
|
backgroundColor: coverView.backgroundColor
|
||||||
|
|
||||||
showLabels: true
|
showLabels: true
|
||||||
showMirror: true
|
showMirror: true
|
||||||
@@ -34,7 +37,7 @@ PathView {
|
|||||||
trackName: model.trackName
|
trackName: model.trackName
|
||||||
artworkId: model.coverID
|
artworkId: model.coverID
|
||||||
showPlayButton: true
|
showPlayButton: true
|
||||||
currentyPlayed: mode.itemFromIndex(index).isPlaying
|
currentlyPlaying: isPlaying
|
||||||
|
|
||||||
scale: PathView.itemScale
|
scale: PathView.itemScale
|
||||||
itemBrightness: PathView.itemBrightness
|
itemBrightness: PathView.itemBrightness
|
||||||
@@ -42,6 +45,7 @@ PathView {
|
|||||||
z: -x
|
z: -x
|
||||||
|
|
||||||
onPlayClicked: {
|
onPlayClicked: {
|
||||||
|
console.log("***************")
|
||||||
coverView.itemPlayPauseClicked(index)
|
coverView.itemPlayPauseClicked(index)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +76,7 @@ PathView {
|
|||||||
// // PathAttribute { name: "itemOpacity"; value: 1 }
|
// // PathAttribute { name: "itemOpacity"; value: 1 }
|
||||||
// // PathAttribute { name: "itemBrightness"; value: .5 }
|
// // PathAttribute { name: "itemBrightness"; value: .5 }
|
||||||
// // PathAttribute { name: "itemScale"; value: 0.4 }
|
// // PathAttribute { name: "itemScale"; value: 0.4 }
|
||||||
PathLine { x: root.width; y: 0 }
|
PathLine { x: coverView.width; y: 0 }
|
||||||
PathPercent { value: 1 }
|
PathPercent { value: 1 }
|
||||||
PathAttribute { name: "itemOpacity"; value: 1 }
|
PathAttribute { name: "itemOpacity"; value: 1 }
|
||||||
PathAttribute { name: "itemBrightness"; value: 0 }
|
PathAttribute { name: "itemBrightness"; value: 0 }
|
||||||
|
@@ -10,7 +10,7 @@ Item {
|
|||||||
property bool showPlayButton: false
|
property bool showPlayButton: false
|
||||||
|
|
||||||
// if this is true, the play button will be swapped by a pause button
|
// if this is true, the play button will be swapped by a pause button
|
||||||
property bool currentyPlayed: false
|
property bool currentlyPlaying: false
|
||||||
|
|
||||||
// Should the mirror be painted?
|
// Should the mirror be painted?
|
||||||
property bool showMirror: false
|
property bool showMirror: false
|
||||||
@@ -20,8 +20,6 @@ Item {
|
|||||||
property string trackName
|
property string trackName
|
||||||
property string artworkId
|
property string artworkId
|
||||||
|
|
||||||
onArtworkIdChanged: print("!*!*!*!*!* artworkId", artworkId)
|
|
||||||
|
|
||||||
// The border color for the cover image
|
// The border color for the cover image
|
||||||
property color borderColor: "black"
|
property color borderColor: "black"
|
||||||
// The border width for the cover image
|
// The border width for the cover image
|
||||||
@@ -44,7 +42,10 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
onClicked: root.clicked();
|
onClicked: {
|
||||||
|
print("Cover clicked");
|
||||||
|
root.clicked();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +145,7 @@ Item {
|
|||||||
|
|
||||||
gradient: Gradient {
|
gradient: Gradient {
|
||||||
// TODO: no clue how to get the RGB component of the container rectangle color
|
// TODO: no clue how to get the RGB component of the container rectangle color
|
||||||
// For now the Qt.rgba needs to be manually updated to match the backgroundColor
|
// For now the Qt.rgba needs to be manually updated to match the backgroundColor 454e59
|
||||||
GradientStop { position: 0.0; color: Qt.rgba(0, 0, 0, 1-mirrorBrightness) }
|
GradientStop { position: 0.0; color: Qt.rgba(0, 0, 0, 1-mirrorBrightness) }
|
||||||
GradientStop { position: 0.5; color: backgroundColor }
|
GradientStop { position: 0.5; color: backgroundColor }
|
||||||
}
|
}
|
||||||
@@ -152,12 +153,15 @@ Item {
|
|||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: playButton
|
id: playButton
|
||||||
visible: showPlayButton ? mouseArea.containsMouse : false
|
visible: showPlayButton ? (mouseArea.containsMouse || currentlyPlaying) : false
|
||||||
source: currentyPlayed ? "../images/pause-rest.png" : "../images/play-rest.png"
|
source: currentlyPlaying ? "../images/pause-rest.png" : "../images/play-rest.png"
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: root.playClicked();
|
onClicked: {
|
||||||
|
print("Play button clicked");
|
||||||
|
root.playClicked();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,79 +48,79 @@ Rectangle {
|
|||||||
id: stationVisualModel
|
id: stationVisualModel
|
||||||
|
|
||||||
|
|
||||||
// Column {
|
Column {
|
||||||
// height: scene.height
|
height: scene.height
|
||||||
// width: scene.width
|
width: scene.width
|
||||||
|
|
||||||
// Row {
|
Row {
|
||||||
// height: scene.height / 2
|
height: scene.height / 2
|
||||||
// width: scene.width
|
width: scene.width
|
||||||
// spacing: width * .1
|
spacing: width * .1
|
||||||
|
|
||||||
// Item {
|
Item {
|
||||||
// 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 {
|
GridView {
|
||||||
// id: gridView
|
id: gridView
|
||||||
// anchors.fill: parent
|
anchors.fill: parent
|
||||||
// anchors.margins: cellWidth / 2
|
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
|
cellWidth: gridView.width / 4 - 1 // -1 to make sure there is space for 4 items even with rounding error
|
||||||
// cellHeight: cellWidth
|
cellHeight: cellWidth
|
||||||
|
|
||||||
// delegate: Item {
|
delegate: Item {
|
||||||
// height: gridView.cellHeight * .9
|
height: gridView.cellHeight * .9
|
||||||
// width: height
|
width: height
|
||||||
|
|
||||||
// CoverImage {
|
CoverImage {
|
||||||
// artistName: modelData
|
artistName: modelData
|
||||||
// anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
// onClicked: {
|
onClicked: {
|
||||||
// echonestStation.setMainControl( EchonestStation.StationTypeArtist, modelData );
|
rootView.startStationFromArtist(modelData);
|
||||||
// stationListView.incrementCurrentIndex();
|
stationListView.incrementCurrentIndex();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Row {
|
Row {
|
||||||
// height: scene.height / 2
|
height: scene.height / 2
|
||||||
// width: scene.width * .9
|
width: scene.width * .9
|
||||||
// anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
// spacing: width * .1
|
spacing: width * .1
|
||||||
|
|
||||||
// TagCloud {
|
TagCloud {
|
||||||
// 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
|
||||||
// model: styleModel//generator.styles()
|
model: styleModel//generator.styles()
|
||||||
// opacity: echonestStation.configured ? 0 : 1
|
opacity: echonestStation.configured ? 0 : 1
|
||||||
|
|
||||||
// onTagClicked: {
|
onTagClicked: {
|
||||||
// echonestStation.setMainControl( EchonestStation.StationTypeStyle, item );
|
echonestStation.setMainControl( EchonestStation.StationTypeStyle, item );
|
||||||
// stationListView.incrementCurrentIndex();
|
stationListView.incrementCurrentIndex();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Behavior on opacity {
|
Behavior on opacity {
|
||||||
// NumberAnimation { duration: 300 }
|
NumberAnimation { duration: 300 }
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// Text {
|
Text {
|
||||||
// id: orText
|
id: orText
|
||||||
// text: "or"
|
text: "or"
|
||||||
// color: "white"
|
color: "white"
|
||||||
// anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
// }
|
}
|
||||||
// InputField {
|
InputField {
|
||||||
// anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
// width: (parent.width - orText.width - parent.spacing * 2 ) * 1 / 3
|
width: (parent.width - orText.width - parent.spacing * 2 ) * 1 / 3
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
StationView {
|
StationView {
|
||||||
coverSize: Math.min(scene.height, scene.width) / 2
|
coverSize: Math.min(scene.height, scene.width) / 2
|
||||||
@@ -147,12 +147,7 @@ Rectangle {
|
|||||||
orientation: ListView.Horizontal
|
orientation: ListView.Horizontal
|
||||||
model: stationVisualModel
|
model: stationVisualModel
|
||||||
interactive: false
|
interactive: false
|
||||||
//highlightMoveDuration: 400
|
highlightMoveDuration: 200
|
||||||
|
|
||||||
// currentIndex: 1
|
|
||||||
|
|
||||||
// Component.onCompleted: {
|
|
||||||
// currentIndex = 1
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,8 +11,14 @@ Item {
|
|||||||
|
|
||||||
CoverFlip {
|
CoverFlip {
|
||||||
id: coverView
|
id: coverView
|
||||||
anchors.fill: parent
|
anchors {
|
||||||
anchors.leftMargin: parent.width / 2
|
top: parent.top
|
||||||
|
right: parent.right
|
||||||
|
bottom:parent.bottom
|
||||||
|
}
|
||||||
|
width: parent.width / 2
|
||||||
|
|
||||||
|
backgroundColor: scene.color
|
||||||
|
|
||||||
model: dynamicModel
|
model: dynamicModel
|
||||||
|
|
||||||
@@ -42,7 +48,7 @@ Item {
|
|||||||
font.bold: true
|
font.bold: true
|
||||||
width: parent.width
|
width: parent.width
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: echonestStation.name
|
text: rootView.title
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,6 +47,7 @@ PlayableModel::PlayableModel( QObject* parent, bool loading )
|
|||||||
roleNames.insert( ArtistRole, "artistName" );
|
roleNames.insert( ArtistRole, "artistName" );
|
||||||
roleNames.insert( TrackRole, "trackName" );
|
roleNames.insert( TrackRole, "trackName" );
|
||||||
roleNames.insert( CoverIDRole, "coverID" );
|
roleNames.insert( CoverIDRole, "coverID" );
|
||||||
|
roleNames.insert( IsPlayingRole, "isPlaying" );
|
||||||
setRoleNames( roleNames );
|
setRoleNames( roleNames );
|
||||||
|
|
||||||
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlaybackStarted( Tomahawk::result_ptr ) ), Qt::DirectConnection );
|
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlaybackStarted( Tomahawk::result_ptr ) ), Qt::DirectConnection );
|
||||||
@@ -282,6 +283,10 @@ PlayableModel::data( const QModelIndex& index, int role ) const
|
|||||||
{
|
{
|
||||||
return QVariant( columnAlignment( index.column() ) );
|
return QVariant( columnAlignment( index.column() ) );
|
||||||
}
|
}
|
||||||
|
else if ( role == IsPlayingRole )
|
||||||
|
{
|
||||||
|
return entry->isPlaying();
|
||||||
|
}
|
||||||
|
|
||||||
int column = index.column();
|
int column = index.column();
|
||||||
if ( role < CoverIDRole && role >= Qt::UserRole )
|
if ( role < CoverIDRole && role >= Qt::UserRole )
|
||||||
|
@@ -70,7 +70,8 @@ public:
|
|||||||
OriginRole,
|
OriginRole,
|
||||||
ScoreRole,
|
ScoreRole,
|
||||||
NameRole,
|
NameRole,
|
||||||
CoverIDRole
|
CoverIDRole,
|
||||||
|
IsPlayingRole
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -429,6 +429,7 @@ EchonestGenerator::dynamicFetched()
|
|||||||
Q_ASSERT( qobject_cast< QNetworkReply* >( sender() ) );
|
Q_ASSERT( qobject_cast< QNetworkReply* >( sender() ) );
|
||||||
QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() );
|
QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() );
|
||||||
|
|
||||||
|
tDebug() << "dynamicFetched";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Echonest::DynamicPlaylist::FetchPair fetched = m_dynPlaylist->parseNext( reply );
|
Echonest::DynamicPlaylist::FetchPair fetched = m_dynPlaylist->parseNext( reply );
|
||||||
|
@@ -66,8 +66,6 @@ DynamicQmlWidget::DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* pa
|
|||||||
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), this, SLOT( trackStarted() ) );
|
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), this, SLOT( trackStarted() ) );
|
||||||
connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::playlistinterface_ptr ) ), this, SLOT( playlistChanged( Tomahawk::playlistinterface_ptr ) ) );
|
connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::playlistinterface_ptr ) ), this, SLOT( playlistChanged( Tomahawk::playlistinterface_ptr ) ) );
|
||||||
|
|
||||||
// Initially seed the playlist
|
|
||||||
m_playlist->generator()->startFromArtist( Artist::get( "Eminem" , false ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -117,7 +115,7 @@ playlist_ptr DynamicQmlWidget::playlist() const
|
|||||||
|
|
||||||
void DynamicQmlWidget::playItem(int index)
|
void DynamicQmlWidget::playItem(int index)
|
||||||
{
|
{
|
||||||
qDebug() << "playItem called for cover" << index;
|
tDebug() << "playItem called for cover" << index;
|
||||||
AudioEngine::instance()->playItem( m_proxyModel->playlistInterface(), m_proxyModel->itemFromIndex( index )->result() );
|
AudioEngine::instance()->playItem( m_proxyModel->playlistInterface(), m_proxyModel->itemFromIndex( index )->result() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,6 +124,12 @@ void DynamicQmlWidget::pause()
|
|||||||
AudioEngine::instance()->pause();
|
AudioEngine::instance()->pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DynamicQmlWidget::startStationFromArtist(const QString &artist)
|
||||||
|
{
|
||||||
|
tDebug() << "should start startion from artist" << artist;
|
||||||
|
m_playlist->generator()->startFromArtist(Artist::get(artist));
|
||||||
|
}
|
||||||
|
|
||||||
void DynamicQmlWidget::currentItemChanged( const QPersistentModelIndex ¤tIndex )
|
void DynamicQmlWidget::currentItemChanged( const QPersistentModelIndex ¤tIndex )
|
||||||
{
|
{
|
||||||
rootContext()->setContextProperty( "currentlyPlayedIndex", m_proxyModel->mapFromSource( currentIndex ).row() );
|
rootContext()->setContextProperty( "currentlyPlayedIndex", m_proxyModel->mapFromSource( currentIndex ).row() );
|
||||||
@@ -134,7 +138,6 @@ void DynamicQmlWidget::currentItemChanged( const QPersistentModelIndex ¤tI
|
|||||||
void
|
void
|
||||||
DynamicQmlWidget::tracksGenerated( const QList< query_ptr >& queries )
|
DynamicQmlWidget::tracksGenerated( const QList< query_ptr >& queries )
|
||||||
{
|
{
|
||||||
qDebug() << queries.count() << "tracks generated";
|
|
||||||
m_model->tracksGenerated( queries, queries.count() );
|
m_model->tracksGenerated( queries, queries.count() );
|
||||||
m_playlist->resolve();
|
m_playlist->resolve();
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,10 @@ class DynamicModel;
|
|||||||
|
|
||||||
class DynamicQmlWidget : public QDeclarativeView, public Tomahawk::ViewPage
|
class DynamicQmlWidget : public QDeclarativeView, public Tomahawk::ViewPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_PROPERTY(QString title READ title)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* parent = 0 );
|
explicit DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* parent = 0 );
|
||||||
virtual ~DynamicQmlWidget();
|
virtual ~DynamicQmlWidget();
|
||||||
@@ -57,6 +60,7 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void playItem(int index);
|
void playItem(int index);
|
||||||
void pause();
|
void pause();
|
||||||
|
void startStationFromArtist(const QString &artist);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void currentItemChanged( const QPersistentModelIndex ¤tIndex );
|
void currentItemChanged( const QPersistentModelIndex ¤tIndex );
|
||||||
|
Reference in New Issue
Block a user