diff --git a/data/qml/GridView.qml b/data/qml/GridView.qml
index a1a4e7508..cbef90a03 100644
--- a/data/qml/GridView.qml
+++ b/data/qml/GridView.qml
@@ -1,6 +1,6 @@
import QtQuick 1.1
//import tomahawk 1.0
-//import "tomahawkimports"
+import "tomahawkimports"
Rectangle {
anchors.fill: parent
diff --git a/data/qml/StationCreatorPage1.qml b/data/qml/StationCreatorPage1.qml
index e7c8540ee..ee233590d 100644
--- a/data/qml/StationCreatorPage1.qml
+++ b/data/qml/StationCreatorPage1.qml
@@ -10,13 +10,12 @@ Item {
signal itemClicked(int index)
- Text {
+ HeaderLabel {
text: "Listen to radio..."
- color: "white"
anchors {
left: parent.left
top: parent.top
- margins: height * 2
+ margins: defaultFontHeight * 2
}
}
diff --git a/data/qml/StationCreatorPage2.qml b/data/qml/StationCreatorPage2.qml
new file mode 100644
index 000000000..8a23569f2
--- /dev/null
+++ b/data/qml/StationCreatorPage2.qml
@@ -0,0 +1,44 @@
+import QtQuick 1.1
+import tomahawk 1.0
+import "tomahawkimports"
+
+Item {
+ id: root
+
+ property int margins: defaultFontHeight * 2
+
+ property alias content: contentLoader.source
+
+ signal back()
+ signal next()
+
+ Loader {
+ id: contentLoader
+ anchors {
+ left: parent.left
+ top: parent.top
+ right: parent.right
+ bottom: backButton.top
+ margins: root.margins
+ }
+ }
+
+ Connections {
+ target: contentLoader.item
+
+ onDone: root.next()
+ }
+
+ RoundedButton {
+ id: backButton
+ text: "<"
+ height: defaultFontHeight * 4
+ anchors {
+ left:parent.left
+ bottom: parent.bottom
+ margins: root.margins
+ }
+
+ onClicked: root.back()
+ }
+}
diff --git a/data/qml/StationScene.qml b/data/qml/StationScene.qml
index 8cadffccd..34a758abf 100644
--- a/data/qml/StationScene.qml
+++ b/data/qml/StationScene.qml
@@ -10,9 +10,9 @@ Rectangle {
ListModel {
id: modeModel
- ListElement { label: "By Artist"; image: "../images/artist-placeholder-grid.png"; creatorState: "artist" }
- ListElement { label: "By Genre"; image: "../images/album-placeholder-grid.png"; creatorState: "genre" }
- ListElement { label: "By Year"; image: "image://albumart/foobar"; creatorState: "year" }
+ ListElement { label: "By Artist"; image: "../images/artist-placeholder-grid.png"; creatorContent: "stations/CreateByArtist.qml" }
+ ListElement { label: "By Genre"; image: "../images/album-placeholder-grid.png"; creatorContent: "genre" }
+ ListElement { label: "By Year"; image: "image://albumart/foobar"; creatorContent: "year" }
}
ListModel {
@@ -39,18 +39,6 @@ Rectangle {
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
@@ -60,12 +48,12 @@ Rectangle {
model: modeModel
onItemClicked: {
- stationCreator.state = modeModel.get(index).creatorState
+ stationCreator.content = modeModel.get(index).creatorContent
stationListView.incrementCurrentIndex()
}
}
- StationCreator {
+ StationCreatorPage2 {
id: stationCreator
height: scene.height
width: scene.width
diff --git a/data/qml/stations/CreateByArtist.qml b/data/qml/stations/CreateByArtist.qml
new file mode 100644
index 000000000..1457ab502
--- /dev/null
+++ b/data/qml/stations/CreateByArtist.qml
@@ -0,0 +1,63 @@
+import QtQuick 1.1
+import tomahawk 1.0
+import "../tomahawkimports"
+
+Item {
+ id: root
+ anchors.fill: parent
+
+ signal done()
+
+ 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" }
+ }
+
+ Column {
+ id: upperColumn
+ anchors.fill: parent
+ anchors.bottomMargin: defaultFontHeight
+ spacing: defaultFontHeight
+
+ HeaderLabel {
+ id: headerText
+ text: "Create station by artist..."
+ }
+
+ Row {
+ width: defaultFontHeight * 15
+ height: artistInputField.height
+ spacing: defaultFontHeight
+
+ InputField {
+ id: artistInputField
+ width: parent.width - createFromInputButton.width - parent.spacing
+ }
+
+ RoundedButton {
+ id: createFromInputButton
+ text: ">"
+ height: artistInputField.height
+ }
+ }
+
+ ArtistView {
+ height: parent.height - headerText.height - artistInputField.height
+ width: defaultFontHeight * 15
+ model: artistChartsModel
+ clip: true
+
+ onItemClicked: {
+ mainView.startStationFromArtist(artistChartsModel.itemFromIndex(index).artistName)
+ root.done()
+ }
+ }
+ }
+}
diff --git a/data/qml/tomahawkimports/ArtistView.qml b/data/qml/tomahawkimports/ArtistView.qml
new file mode 100644
index 000000000..1262cb937
--- /dev/null
+++ b/data/qml/tomahawkimports/ArtistView.qml
@@ -0,0 +1,44 @@
+import QtQuick 1.1
+import tomahawk 1.0
+
+ListView {
+ id: root
+
+ signal itemClicked(int index)
+
+ delegate: Item {
+ width: parent.width
+ height: defaultFontHeight * 3
+
+ Rectangle {
+ anchors.fill: parent
+ radius: defaultFontHeight / 2
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#00FFFFFF" }
+ GradientStop { position: 1.0; color: "#55FFFFFF" }
+ }
+ }
+
+ Row {
+ anchors.fill: parent
+ spacing: defaultFontHeight
+
+ CoverImage {
+ height: parent.height
+ width: height
+ showLabels: false
+ artworkId: model.coverID
+ }
+ Text {
+ text: model.artistName
+ color: "white"
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: root.itemClicked(index)
+ }
+ }
+}
diff --git a/data/qml/CoverImage.qml b/data/qml/tomahawkimports/CoverImage.qml
similarity index 98%
rename from data/qml/CoverImage.qml
rename to data/qml/tomahawkimports/CoverImage.qml
index 587171619..fd8a9af7d 100644
--- a/data/qml/CoverImage.qml
+++ b/data/qml/tomahawkimports/CoverImage.qml
@@ -171,7 +171,7 @@ Item {
Image {
id: playButton
visible: showPlayButton ? (mouseArea.containsMouse || currentlyPlaying) : false
- source: currentlyPlaying ? "../images/pause-rest.png" : "../images/play-rest.png"
+ source: currentlyPlaying ? "../../images/pause-rest.png" : "../../images/play-rest.png"
anchors.centerIn: parent
height: mirroredCover.height / 5
width: height
diff --git a/data/qml/tomahawkimports/HeaderLabel.qml b/data/qml/tomahawkimports/HeaderLabel.qml
new file mode 100644
index 000000000..ebffedbd4
--- /dev/null
+++ b/data/qml/tomahawkimports/HeaderLabel.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.1
+
+Text {
+ color: "white"
+ font.pointSize: defaultFontSize + 5
+ font.bold: true
+}
diff --git a/data/qml/tomahawkimports/RoundedButton.qml b/data/qml/tomahawkimports/RoundedButton.qml
index 2d5db43a4..c55d84ec9 100644
--- a/data/qml/tomahawkimports/RoundedButton.qml
+++ b/data/qml/tomahawkimports/RoundedButton.qml
@@ -7,6 +7,9 @@ Rectangle {
radius: height / 2
color: buttonMouseArea.containsMouse ? "#22ffffff" : "black"
+ height: defaultFontHeight * 2
+ width: height
+
property string text
signal clicked()
diff --git a/resources.qrc b/resources.qrc
index 86bfefb5a..3336bf74e 100644
--- a/resources.qrc
+++ b/resources.qrc
@@ -164,7 +164,6 @@
data/images/delete.png
data/images/ok.png
data/qml/StationScene.qml
- data/qml/CoverImage.qml
data/qml/TagCloud.qml
data/qml/StationConfig.qml
data/qml/StationView.qml
@@ -176,5 +175,10 @@
data/qml/StationCreator.qml
data/qml/StationCreatorPage1.qml
data/qml/GridView.qml
+ data/qml/StationCreatorPage2.qml
+ data/qml/stations/CreateByArtist.qml
+ data/qml/tomahawkimports/CoverImage.qml
+ data/qml/tomahawkimports/ArtistView.qml
+ data/qml/tomahawkimports/HeaderLabel.qml
diff --git a/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp b/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp
index 376d4cfe4..421042600 100644
--- a/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp
+++ b/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp
@@ -42,6 +42,7 @@ DynamicQmlWidget::DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* pa
qmlRegisterUncreatableType("tomahawk", 1, 0, "Generator", "you cannot create it on your own - should be set in context");
rootContext()->setContextProperty( "dynamicModel", m_proxyModel );
+ rootContext()->setContextProperty( "artistChartsModel", m_artistChartsModel );
rootContext()->setContextProperty( "generator", m_playlist->generator().data() );
setSource( QUrl( "qrc" RESPATH "qml/StationScene.qml" ) );
@@ -238,11 +239,5 @@ DynamicQmlWidget::onArtistCharts( const QList< Tomahawk::artist_ptr >& artists )
m_artistChartsModel->clear();
m_artistChartsModel->appendArtists( artists );
- int i = 0;
- foreach ( const artist_ptr& artist, artists )
- {
- tDebug() << "Found artist in chart:" << artist->name() << QString::number( ++i );
- }
}
-
}
diff --git a/src/libtomahawk/widgets/DeclarativeView.cpp b/src/libtomahawk/widgets/DeclarativeView.cpp
index 70ecbd4ad..646a16fdf 100644
--- a/src/libtomahawk/widgets/DeclarativeView.cpp
+++ b/src/libtomahawk/widgets/DeclarativeView.cpp
@@ -19,6 +19,7 @@
#include "DeclarativeView.h"
#include "playlist/PlayableItem.h"
#include "DeclarativeCoverArtProvider.h"
+#include "utils/TomahawkUtilsGui.h"
#include
#include
@@ -35,13 +36,16 @@ DeclarativeView::DeclarativeView( QWidget *parent ):
setResizeMode( QDeclarativeView::SizeRootObjectToView );
// This types seem to be needed everywhere anyways, lets the register here
- qmlRegisterUncreatableType( "tomahawk", 1, 0, "PlayableItem", "bla" );
+ qmlRegisterType( "tomahawk", 1, 0, "PlayableItem");
// QML image providers will be deleted by the view
engine()->addImageProvider( "albumart", new DeclarativeCoverArtProvider() );
// Register the view itself to make it easy to invoke the view's slots from QML
rootContext()->setContextProperty( "mainView", this );
+
+ rootContext()->setContextProperty( "defaultFontSize", TomahawkUtils::defaultFontSize() );
+ rootContext()->setContextProperty( "defaultFontHeight", TomahawkUtils::defaultFontHeight() );
}
DeclarativeView::~DeclarativeView()
diff --git a/src/libtomahawk/widgets/DeclarativeView.h b/src/libtomahawk/widgets/DeclarativeView.h
index 59ae070b5..06e36e790 100644
--- a/src/libtomahawk/widgets/DeclarativeView.h
+++ b/src/libtomahawk/widgets/DeclarativeView.h
@@ -35,6 +35,8 @@ class QAbstractItemModel;
*
* Set context properties:
* - mainView: This view, so you can invoke this view's slots from QML
+ * - defaultFontSize: system default font point size
+ * - defaultFontHeight: system default font pixel height
*
* It also registers an albumart image provider. You can access album art
* in QML with the source url "image://albumart/".