diff --git a/data/qml/StationCreatorPage2.qml b/data/qml/StationCreatorPage2.qml
index 8a23569f2..e8582719a 100644
--- a/data/qml/StationCreatorPage2.qml
+++ b/data/qml/StationCreatorPage2.qml
@@ -6,8 +6,8 @@ Item {
id: root
property int margins: defaultFontHeight * 2
-
property alias content: contentLoader.source
+ property bool nextEnabled: false
signal back()
signal next()
@@ -34,11 +34,25 @@ Item {
text: "<"
height: defaultFontHeight * 4
anchors {
- left:parent.left
+ left: parent.left
bottom: parent.bottom
margins: root.margins
}
onClicked: root.back()
}
+
+ RoundedButton {
+ id: nextButton
+ text: ">"
+ height: defaultFontHeight * 4
+ visible: root.nextEnabled
+ anchors {
+ right: parent.right
+ bottom: parent.bottom
+ margins: root.margins
+ }
+
+ onClicked: root.next()
+ }
}
diff --git a/data/qml/StationScene.qml b/data/qml/StationScene.qml
index 34a758abf..668e35fb3 100644
--- a/data/qml/StationScene.qml
+++ b/data/qml/StationScene.qml
@@ -11,34 +11,10 @@ Rectangle {
ListModel {
id: modeModel
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 Genre"; image: "../images/album-placeholder-grid.png"; creatorContent: "stations/CreateByGenre.qml" }
ListElement { label: "By Year"; image: "image://albumart/foobar"; creatorContent: "year" }
}
- 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" }
- }
-
VisualItemModel {
id: stationVisualModel
@@ -57,6 +33,7 @@ Rectangle {
id: stationCreator
height: scene.height
width: scene.width
+ nextEnabled: rootView.configured
onBack: stationListView.decrementCurrentIndex()
diff --git a/data/qml/stations/CreateByArtist.qml b/data/qml/stations/CreateByArtist.qml
index 2631a02a4..a03c9c1b3 100644
--- a/data/qml/stations/CreateByArtist.qml
+++ b/data/qml/stations/CreateByArtist.qml
@@ -8,16 +8,9 @@ Item {
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" }
+ function createStation(artist) {
+ mainView.startStationFromArtist(artist)
+ root.done()
}
Column {
@@ -39,12 +32,16 @@ Item {
InputField {
id: artistInputField
width: parent.width - createFromInputButton.width - parent.spacing
+
+ onAccepted: createStation(text)
}
RoundedButton {
id: createFromInputButton
text: ">"
height: artistInputField.height
+ enabled: artistInputField.text.length > 2
+ onClicked: createStation(artistInputField.text)
}
}
@@ -56,8 +53,7 @@ Item {
delegateHeight: defaultFontHeight * 6
onItemClicked: {
- mainView.startStationFromArtist(artistChartsModel.itemFromIndex(index).artistName)
- root.done()
+ createStation(artistChartsModel.itemFromIndex(index).artistName);
}
}
}
diff --git a/data/qml/stations/CreateByGenre.qml b/data/qml/stations/CreateByGenre.qml
new file mode 100644
index 000000000..98f3fea80
--- /dev/null
+++ b/data/qml/stations/CreateByGenre.qml
@@ -0,0 +1,86 @@
+import QtQuick 1.1
+import tomahawk 1.0
+import "../tomahawkimports"
+
+Item {
+ id: root
+ anchors.fill: parent
+
+ signal done()
+
+ function createStation(genre) {
+ mainView.startStationFromArtist(genre)
+ root.done()
+ }
+
+ 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" }
+ }
+
+ Column {
+ id: upperColumn
+ anchors.fill: parent
+ anchors.bottomMargin: defaultFontHeight
+ spacing: defaultFontHeight
+
+ HeaderLabel {
+ id: headerText
+ text: "Create station by genre..."
+ }
+
+ Row {
+ width: defaultFontHeight * 30
+ height: artistInputField.height
+ spacing: defaultFontHeight
+
+ InputField {
+ id: genreInputField
+ width: parent.width - createFromInputButton.width - parent.spacing
+
+ onAccepted: createStation(text);
+ }
+
+ RoundedButton {
+ id: createFromInputButton
+ text: ">"
+ height: genreInputField.height
+ enabled: genreInputField.text.length > 2
+ onClicked: createStation(genreInputField.text)
+ }
+ }
+
+ Item {
+ height: parent.height - headerText.height - genreInputField.height
+ width: parent.width
+ TagCloud {
+ anchors.fill: parent
+ anchors.margins: parent.width / 6
+ model: styleModel
+
+ onTagClicked: {
+ root.createStation(tag);
+ }
+ }
+ }
+ }
+}
diff --git a/data/qml/tomahawkimports/InputField.qml b/data/qml/tomahawkimports/InputField.qml
index c50843639..e982aa440 100644
--- a/data/qml/tomahawkimports/InputField.qml
+++ b/data/qml/tomahawkimports/InputField.qml
@@ -6,7 +6,7 @@ Rectangle {
border.color: "black"
border.width: 2
- height: textInput.height + 4
+ height: textInput.height * 1.2
width: 300
property alias text: textInput.text
@@ -15,7 +15,7 @@ Rectangle {
TextInput {
id: textInput
- width: parent.width
+ width: parent.width - defaultFontHeight
anchors.centerIn: parent
onAccepted: root.accepted( text );
diff --git a/data/qml/tomahawkimports/RoundedButton.qml b/data/qml/tomahawkimports/RoundedButton.qml
index c55d84ec9..89e2e6bdc 100644
--- a/data/qml/tomahawkimports/RoundedButton.qml
+++ b/data/qml/tomahawkimports/RoundedButton.qml
@@ -2,15 +2,17 @@ import QtQuick 1.1
import tomahawk 1.0
Rectangle {
+ id: root
border.width: 4
- border.color: "white"
+ border.color: enabled ? "white" : "grey"
radius: height / 2
- color: buttonMouseArea.containsMouse ? "#22ffffff" : "black"
+ color: (buttonMouseArea.containsMouse && enabled) ? "#22ffffff" : "black"
height: defaultFontHeight * 2
width: height
property string text
+ property bool enabled: true
signal clicked()
@@ -21,7 +23,7 @@ Rectangle {
Text {
anchors.centerIn: parent
text: parent.text
- color: "white"
+ color: root.border.color
font.pixelSize: parent.height * .75
font.bold: true
}
@@ -29,6 +31,7 @@ Rectangle {
id: buttonMouseArea
anchors.fill: parent
hoverEnabled: true
+ enabled: root.enabled
onClicked: parent.clicked()
}
}
diff --git a/data/qml/TagCloud.qml b/data/qml/tomahawkimports/TagCloud.qml
similarity index 98%
rename from data/qml/TagCloud.qml
rename to data/qml/tomahawkimports/TagCloud.qml
index 5f025bbff..ba3de03aa 100644
--- a/data/qml/TagCloud.qml
+++ b/data/qml/tomahawkimports/TagCloud.qml
@@ -6,7 +6,7 @@ Item {
property variant model: 10
- signal tagClicked( string item )
+ signal tagClicked( string tag )
function randomNumber(min, max) {
var date = new Date();
diff --git a/resources.qrc b/resources.qrc
index 3336bf74e..bd5e578d4 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/TagCloud.qml
data/qml/StationConfig.qml
data/qml/StationView.qml
data/qml/tomahawkimports/InputField.qml
@@ -180,5 +179,7 @@
data/qml/tomahawkimports/CoverImage.qml
data/qml/tomahawkimports/ArtistView.qml
data/qml/tomahawkimports/HeaderLabel.qml
+ data/qml/stations/CreateByGenre.qml
+ data/qml/tomahawkimports/TagCloud.qml
diff --git a/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp b/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp
index 421042600..8a2f3583c 100644
--- a/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp
+++ b/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.cpp
@@ -112,6 +112,11 @@ bool DynamicQmlWidget::loading()
return m_model->isLoading();
}
+bool DynamicQmlWidget::configured()
+{
+ return !m_playlist->generator()->controls().isEmpty();
+}
+
void DynamicQmlWidget::playItem(int index)
{
tDebug() << "playItem called for cover" << index;
@@ -125,7 +130,9 @@ void DynamicQmlWidget::pause()
void DynamicQmlWidget::startStationFromArtist(const QString &artist)
{
+ m_model->clear();
m_playlist->generator()->startFromArtist(Artist::get(artist));
+ emit configuredChanged();
}
void DynamicQmlWidget::startStationFromGenre(const QString &genre)
@@ -133,6 +140,7 @@ void DynamicQmlWidget::startStationFromGenre(const QString &genre)
tDebug() << "should start startion from genre" << genre;
m_model->clear();
m_playlist->generator()->startFromGenre( genre );
+ emit configuredChanged();
}
void DynamicQmlWidget::currentIndexChanged( const QPersistentModelIndex ¤tIndex )
diff --git a/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.h b/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.h
index d9ad662fe..0d0cd0c32 100644
--- a/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.h
+++ b/src/libtomahawk/playlist/dynamic/widgets/DynamicQmlWidget.h
@@ -39,6 +39,7 @@ class DynamicQmlWidget : public DeclarativeView, public Tomahawk::ViewPage
Q_PROPERTY(QString title READ title)
Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged)
+ Q_PROPERTY(bool configured READ configured NOTIFY configuredChanged)
public:
explicit DynamicQmlWidget( const dynplaylist_ptr& playlist, QWidget* parent = 0 );
@@ -60,9 +61,11 @@ public:
playlist_ptr playlist() const;
bool loading();
+ bool configured();
signals:
void loadingChanged();
+ void configuredChanged();
public slots:
void playItem(int index);