1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-31 17:42:13 +02:00

brainstorming++

This commit is contained in:
Michael Zanetti
2012-11-26 21:43:14 +01:00
parent 5f6bccc44b
commit 24358a1218
3 changed files with 270 additions and 136 deletions

268
data/qml/StationCreator.qml Normal file
View File

@@ -0,0 +1,268 @@
import QtQuick 1.1
import tomahawk 1.0
import "tomahawkimports"
Item {
id: stationCreator
Flickable {
id: flickArea
anchors.fill: parent
contentHeight: mainGrid.height
contentWidth: width
anchors.margins: mainGrid.spacing
clip: true
interactive: false
Behavior on contentY {
NumberAnimation { duration: 200; easing.type: Easing.InOutQuad }
}
function moveDown() {
contentY = contentY + mainGrid.rowHeight + mainGrid.spacing
}
function moveUp() {
contentY = contentY - mainGrid.rowHeight - mainGrid.spacing
}
Grid {
id: mainGrid
width: parent.width
spacing: width * .05
columns: 2
height: rowHeight * 3 + spacing * 2
property int rowHeight: flickArea.height / 2
Item {
height: parent.rowHeight
width: parent.width * 0.7
Text {
id: artistGridLabel
text: "Select an artist..."
anchors { left: parent.left; top: parent.top; right: parent.right }
color: "white"
font.bold: true
}
GridView {
id: gridView
anchors { left: parent.left; top: artistGridLabel.bottom; topMargin: artistGridLabel.height; right: parent.right; bottom: parent.bottom }
model: dummyArtistModel
cellWidth: Math.min(gridView.width / 4 - 1, gridView.height / 2) // -1 to make sure there is space for 4 items even with rounding error
cellHeight: cellWidth
delegate: Item {
height: gridView.cellHeight// * .9
width: height
CoverImage {
artistName: modelData
anchors.fill: parent
showPlayButton: true
onClicked: {
rootView.startStationFromArtist(modelData);
stationListView.incrementCurrentIndex();
}
}
}
}
}
Item {
height: parent.rowHeight
width: parent.width * 0.25
Text {
id: orText
anchors { left: parent.left; right: parent.right;
bottom: artistInputField.top; bottomMargin: height }
text: "...or enter a name:"
color: "white"
font.bold: true
}
InputField {
id: artistInputField
anchors.centerIn: parent
width: parent.width
onAccepted: {
rootView.startStationFromArtist(text)
stationListView.incrementCurrentIndex();
}
}
RoundedButton {
text: ">"
height: orText.height * 3
width: height
anchors { horizontalCenter: artistInputField.horizontalCenter
top: artistInputField.bottom; topMargin: orText.height }
onClicked: artistInputField.accepted(artistInputField.text)
}
}
Item {
height: parent.rowHeight
width: parent.width * 0.7
Text {
id: selectGenreText
anchors { left: parent.left; right: parent.right; top: parent.top}
text: "Select a genre..."
color: "white"
font.bold: true
}
TagCloud {
anchors.fill: parent
anchors.topMargin: selectGenreText.height * 2
model: styleModel//generator.styles()
opacity: echonestStation.configured ? 0 : 1
onTagClicked: {
rootView.startStationFromGenre(item)
stationListView.incrementCurrentIndex();
}
Behavior on opacity {
NumberAnimation { duration: 300 }
}
}
}
Item {
height: parent.rowHeight
width: parent.width * 0.25
Text {
text: "...or enter your style:"
color: "white"
anchors { left: parent.left; right: parent.right;
bottom: genreInputField.top; bottomMargin: height }
font.bold: true
}
InputField {
id: genreInputField
anchors.centerIn: parent
width: parent.width
onAccepted: {
rootView.startStationFromGenre(text)
stationListView.incrementCurrentIndex();
}
}
RoundedButton {
text: ">"
height: orText.height * 3
width: height
anchors { horizontalCenter: genreInputField.horizontalCenter
top: genreInputField.bottom; topMargin: orText.height }
onClicked: genreInputField.accepted(genreInputField.text)
}
}
Item {
height: parent.rowHeight
width: parent.width * 0.7
Text {
id: selectYearText
anchors { left: parent.left; right: parent.right; top: parent.top}
text: "Select a decade..."
color: "white"
font.bold: true
}
Row {
id: yearsRow
width: parent.width
anchors.verticalCenter: parent.verticalCenter
spacing: selectYearText.height
function decadeClicked(decade) {
rootView.startStationFromYear(decade)
stationListView.incrementCurrentIndex();
}
Text { text: "60s"; font.pointSize: 20; color: "white"; MouseArea{ anchors.fill: parent; onClicked: yearsRow.decadeClicked(parent.text)}}
Text { text: "70s"; font.pointSize: 22; color: "white"; MouseArea{ anchors.fill: parent; onClicked: yearsRow.decadeClicked(parent.text)}}
Text { text: "80s"; font.pointSize: 24; color: "white"; MouseArea{ anchors.fill: parent; onClicked: yearsRow.decadeClicked(parent.text)}}
Text { text: "90s"; font.pointSize: 26; color: "white"; MouseArea{ anchors.fill: parent; onClicked: yearsRow.decadeClicked(parent.text)}}
Text { text: "00s"; font.pointSize: 28; color: "white"; MouseArea{ anchors.fill: parent; onClicked: yearsRow.decadeClicked(parent.text)}}
}
}
Item {
height: parent.rowHeight
width: parent.width * 0.25
Text {
text: "...or specify a year:"
color: "white"
anchors { left: parent.left; right: parent.right;
bottom: yearInputField.top; bottomMargin: height }
font.bold: true
}
InputField {
id: yearInputField
anchors.centerIn: parent
width: parent.width
onAccepted: {
rootView.startStationFromYear(text)
stationListView.incrementCurrentIndex();
}
}
RoundedButton {
text: ">"
height: orText.height * 3
width: height
anchors { horizontalCenter: yearInputField.horizontalCenter
top: yearInputField.bottom; topMargin: orText.height }
onClicked: yearInputField.accepted(yearInputField.text)
}
}
}
}
RoundedButton {
anchors {
top: parent.top
right: parent.right
rightMargin: width / 3
}
height: orText.height * 3
width: height * 3
text: "^"
onClicked: flickArea.moveUp()
opacity: flickArea.contentY > 0 ? 1 : 0
Behavior on opacity {
NumberAnimation { duration: 200 }
}
}
RoundedButton {
anchors {
bottom: parent.bottom
right: parent.right
rightMargin: width / 3
}
height: orText.height * 3
width: height * 3
text: "v"
onClicked: flickArea.moveDown()
opacity: flickArea.contentY < mainGrid.rowHeight ? 1 : 0
Behavior on opacity {
NumberAnimation { duration: 200 }
}
}
}

View File

@@ -48,144 +48,9 @@ Rectangle {
id: stationVisualModel
Item {
StationCreator {
height: scene.height
width: scene.width
Grid {
anchors.fill: parent
anchors.margins: spacing
spacing: width * .05
columns: 2
property int rowHeight: height / 2
Item {
height: parent.rowHeight
width: parent.width * 0.7
Text {
id: artistGridLabel
text: "Select an artist..."
anchors { left: parent.left; top: parent.top; right: parent.right }
color: "white"
font.bold: true
}
GridView {
id: gridView
anchors { left: parent.left; top: artistGridLabel.bottom; topMargin: artistGridLabel.height; right: parent.right; bottom: parent.bottom }
model: dummyArtistModel
cellWidth: Math.min(gridView.width / 4 - 1, gridView.height / 2) // -1 to make sure there is space for 4 items even with rounding error
cellHeight: cellWidth
delegate: Item {
height: gridView.cellHeight// * .9
width: height
CoverImage {
artistName: modelData
anchors.fill: parent
showPlayButton: true
onClicked: {
rootView.startStationFromArtist(modelData);
stationListView.incrementCurrentIndex();
}
}
}
}
}
Item {
height: parent.rowHeight
width: parent.width * 0.25
Text {
id: orText
anchors { left: parent.left; right: parent.right;
bottom: artistInputField.top; bottomMargin: height }
text: "...or enter a name:"
color: "white"
font.bold: true
}
InputField {
id: artistInputField
anchors.centerIn: parent
width: parent.width
onAccepted: {
rootView.startStationFromArtist(text)
stationListView.incrementCurrentIndex();
}
}
RoundedButton {
text: ">"
height: orText.height * 3
width: height
anchors { horizontalCenter: artistInputField.horizontalCenter
top: artistInputField.bottom; topMargin: orText.height }
onClicked: artistInputField.accepted(artistInputField.text)
}
}
Item {
height: parent.rowHeight
width: parent.width * 0.7
Text {
id: selectGenreText
anchors { left: parent.left; right: parent.right; top: parent.top}
text: "Select a genre..."
color: "white"
font.bold: true
}
TagCloud {
anchors.fill: parent
anchors.topMargin: selectGenreText.height * 2
model: styleModel//generator.styles()
opacity: echonestStation.configured ? 0 : 1
onTagClicked: {
rootView.startStationFromGenre(item)
stationListView.incrementCurrentIndex();
}
Behavior on opacity {
NumberAnimation { duration: 300 }
}
}
}
Item {
height: parent.rowHeight
width: parent.width * 0.25
Text {
text: "...or enter your style:"
color: "white"
anchors { left: parent.left; right: parent.right;
bottom: genreInputField.top; bottomMargin: height }
font.bold: true
}
InputField {
id: genreInputField
anchors.centerIn: parent
width: parent.width
onAccepted: {
rootView.startStationFromGenre(text)
stationListView.incrementCurrentIndex();
}
}
RoundedButton {
text: ">"
height: orText.height * 3
width: height
anchors { horizontalCenter: genreInputField.horizontalCenter
top: genreInputField.bottom; topMargin: orText.height }
onClicked: genreInputField.accepted(genreInputField.text)
}
}
}
}
StationView {

View File

@@ -173,5 +173,6 @@
<file>data/qml/tomahawkimports/DoubleSlider.qml</file>
<file>data/qml/CoverFlip.qml</file>
<file>data/qml/tomahawkimports/RoundedButton.qml</file>
<file>data/qml/StationCreator.qml</file>
</qresource>
</RCC>