1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-17 19:37:09 +02:00

some more testing work for stations

This commit is contained in:
Michael Zanetti
2012-07-28 14:16:49 +02:00
parent 52d5dbaf4d
commit 8e91ab63ca
4 changed files with 97 additions and 42 deletions

View File

@@ -1,5 +1,6 @@
import QtQuick 1.1
import tomahawk 1.0
import "tomahawkimports"
Rectangle {
id: scene
@@ -7,14 +8,84 @@ 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()
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
}
}
}
}
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: {
@@ -26,6 +97,18 @@ Rectangle {
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
}
}
}
StationView {
coverSize: Math.min(scene.height, scene.width) / 2

View File

@@ -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 {

View File

@@ -729,6 +729,7 @@ PlayableModel::finishLoading()
PlayableItem*
PlayableModel::itemFromIndex( const QModelIndex& index ) const
{
Q_ASSERT(index.isValid());
if ( index.isValid() )
{
return static_cast<PlayableItem*>( index.internalPointer() );

View File

@@ -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" ) );