mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-31 17:42:13 +02:00
hooked up TagCloud again
made the input fields works
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
@@ -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()
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
86
data/qml/stations/CreateByGenre.qml
Normal file
86
data/qml/stations/CreateByGenre.qml
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -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 );
|
||||
|
@@ -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()
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
@@ -164,7 +164,6 @@
|
||||
<file>data/images/delete.png</file>
|
||||
<file>data/images/ok.png</file>
|
||||
<file>data/qml/StationScene.qml</file>
|
||||
<file>data/qml/TagCloud.qml</file>
|
||||
<file>data/qml/StationConfig.qml</file>
|
||||
<file>data/qml/StationView.qml</file>
|
||||
<file>data/qml/tomahawkimports/InputField.qml</file>
|
||||
@@ -180,5 +179,7 @@
|
||||
<file>data/qml/tomahawkimports/CoverImage.qml</file>
|
||||
<file>data/qml/tomahawkimports/ArtistView.qml</file>
|
||||
<file>data/qml/tomahawkimports/HeaderLabel.qml</file>
|
||||
<file>data/qml/stations/CreateByGenre.qml</file>
|
||||
<file>data/qml/tomahawkimports/TagCloud.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@@ -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 )
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user