diff --git a/data/qml/StationScene.qml b/data/qml/StationScene.qml index dcee6688a..d82997ee0 100644 --- a/data/qml/StationScene.qml +++ b/data/qml/StationScene.qml @@ -1,5 +1,6 @@ import QtQuick 1.1 import tomahawk 1.0 +import "tomahawkimports" Rectangle { id: scene @@ -7,23 +8,105 @@ Rectangle { anchors.fill: parent state: echonestStation.configured ? "list" : "configure" + ListModel { + id: styleModel + ListElement { modelData: "acoustic" } + ListElement { modelData: "alternative" } + ListElement { modelData: "alternative rock" } + ListElement { modelData: "classic" } + ListElement { modelData: "folk" } + ListElement { modelData: "indie" } + ListElement { modelData: "pop" } + ListElement { modelData: "rock" } + ListElement { modelData: "hip-hop" } + ListElement { modelData: "punk" } + ListElement { modelData: "grunge" } + ListElement { modelData: "indie" } + ListElement { modelData: "electronic" } + ListElement { modelData: "country" } + ListElement { modelData: "jazz" } + ListElement { modelData: "psychodelic" } + ListElement { modelData: "soundtrack" } + ListElement { modelData: "reggae" } + ListElement { modelData: "house" } + ListElement { modelData: "drum and base" } + } + + ListModel { + id: dummyArtistModel + ListElement { modelData: "Pink Floyd" } + ListElement { modelData: "Tool" } + ListElement { modelData: "Cake" } + ListElement { modelData: "Metallica" } + ListElement { modelData: "Red Hot Chili Peppers" } + ListElement { modelData: "Korn" } + ListElement { modelData: "Prodigy" } + ListElement { modelData: "Otto Waalkes" } + } VisualItemModel { id: stationVisualModel - TagCloud { + + Column { height: scene.height width: scene.width - model: generator.styles() - opacity: echonestStation.configured ? 0 : 1 - onTagClicked: { - echonestStation.setMainControl( item ); - stationListView.incrementCurrentIndex(); + Row { + height: scene.height / 2 + width: scene.width + spacing: width * .1 + + GridView { + id: gridView + height: parent.height + width: (parent.width - orText.width - parent.spacing * 2 ) * 2 / 3 + model: dummyArtistModel + + delegate: Item { + height: gridView.height / 3; + width: height + + CoverImage { + artistName: modelData + anchors.fill: parent + } + } + } + } - Behavior on opacity { - NumberAnimation { duration: 300 } + Row { + height: scene.height / 2 + width: scene.width * .9 + anchors.horizontalCenter: parent.horizontalCenter + spacing: width * .1 + + TagCloud { + height: parent.height + width: (parent.width - orText.width - parent.spacing * 2 ) * 2 / 3 + model: styleModel//generator.styles() + opacity: echonestStation.configured ? 0 : 1 + + onTagClicked: { + echonestStation.setMainControl( item ); + stationListView.incrementCurrentIndex(); + } + + Behavior on opacity { + NumberAnimation { duration: 300 } + } + } + Text { + id: orText + text: "or" + color: "white" + anchors.verticalCenter: parent.verticalCenter + } + InputField { + anchors.verticalCenter: parent.verticalCenter + width: (parent.width - orText.width - parent.spacing * 2 ) * 1 / 3 + } } } diff --git a/data/qml/TagCloud.qml b/data/qml/TagCloud.qml index 3226b5293..e6d81ee42 100644 --- a/data/qml/TagCloud.qml +++ b/data/qml/TagCloud.qml @@ -15,43 +15,25 @@ Item { Flow { anchors.centerIn: parent - width: parent.width - 100 - //model: controlModel + width: parent.width spacing: 3 - Timer { - interval: 5000 - running: false - repeat: true - - onTriggered: { - for(var i = 0; i < cloudRepeater.count; i++) { - var item = cloudRepeater.itemAt(i); - if(item.itemScale > 0.6) { - item.itemScale = Math.random(); - } else { - item.itemScale = Math.random(); - } - } - } - } - Repeater { id: cloudRepeater model: tagCloud.model delegate: Item { id: cloudItem - width: delegateText.width * scale - height: 28 - property double itemScale: Math.random() + width: delegateText.width * 1.1 + height: delegateText.height + property double itemScale: Math.random() + .3 scale: itemScale Text { id: delegateText color: "white" //text: controlModel.controlAt( index ).summary text: modelData - font.pixelSize: 28 + font.pointSize: 16 anchors.verticalCenter: parent.verticalCenter anchors.verticalCenterOffset: tagCloud.randomNumber(0, 15) } @@ -60,16 +42,6 @@ Item { anchors.fill: parent onClicked: tagCloud.tagClicked( modelData ) - onMousePositionChanged: { - cloudItem.scale = 1; - delegateTimer.restart(); - } - } - Timer { - id: delegateTimer - interval: 3000 - repeat: false - onTriggered: cloudItem.scale = cloudItem.itemScale } Behavior on scale { diff --git a/src/libtomahawk/playlist/PlayableModel.cpp b/src/libtomahawk/playlist/PlayableModel.cpp index ca7bf828f..5bdadf23c 100644 --- a/src/libtomahawk/playlist/PlayableModel.cpp +++ b/src/libtomahawk/playlist/PlayableModel.cpp @@ -729,6 +729,7 @@ PlayableModel::finishLoading() PlayableItem* PlayableModel::itemFromIndex( const QModelIndex& index ) const { + Q_ASSERT(index.isValid()); if ( index.isValid() ) { return static_cast( index.internalPointer() ); diff --git a/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp b/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp index f987d5ec7..ce421a8d9 100644 --- a/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp +++ b/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp @@ -60,7 +60,6 @@ DynamicQmlWidget::DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* pa rootContext()->setContextProperty( "echonestStation", station); rootContext()->setContextProperty( "dynamicModel", m_proxyModel ); rootContext()->setContextProperty( "generator", m_playlist->generator().data() ); - currentItemChanged( m_model->currentItem() ); setSource( QUrl( "qrc" RESPATH "qml/StationScene.qml" ) );