1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-02 18:33:16 +02:00

Lots of cleanups

Add button capabilities to header
make use of header in stationview
This commit is contained in:
Michael Zanetti
2012-12-16 04:56:14 +01:00
parent 74d375bc50
commit 8894d16c87
18 changed files with 263 additions and 468 deletions

View File

@@ -1,68 +1,127 @@
import QtQuick 1.1
import tomahawk 1.0
import "tomahawkimports"
import "stations"
Rectangle {
id: scene
color: "black"
anchors.fill: parent
state: "list"
Item {
id: root
FlexibleHeader {
id: header
anchors {
left: parent.left
top: parent.top
right: parent.right
}
height: defaultFontHeight * 4
width: parent.width
icon: "../images/station.svg"
title: mainView.title
subtitle: generator.summary
showSearchField: false
showBackButton: stationListView.currentIndex > 0
showNextButton: dynamicModel.rowCount() > 0 && stationListView.currentIndex < 2
showSaveButton: stationListView.currentIndex === 2
signal backClicked()
z: 1 //cover albumcovers that may leave their area
Image {
id: busyIndicator
source: "../images/loading-animation.gif"
anchors.centerIn: parent
height: backButton.height
width: height
visible: mainView.loading
RotationAnimation { target: busyIndicator; from: 360; to: 0; duration: 1500; running: visible; loops: Animation.Infinite }
onBackPressed: stationListView.decrementCurrentIndex()
onNextPressed: stationListView.incrementCurrentIndex()
onSavePressed: print("should save station now")
}
CoverFlip {
id: coverView
anchors.fill: parent
ListModel {
id: modeModel
ListElement { label: "By Artist"; image: "../../images/artist-placeholder-grid.svg"; creatorContent: "stations/CreateByArtist.qml" }
ListElement { label: "By Genre"; image: "../../images/album-placeholder-grid.svg"; creatorContent: "stations/CreateByGenre.qml" }
ListElement { label: "By Year"; image: "image://albumart/foobar"; creatorContent: "year" }
}
VisualItemModel {
id: stationVisualModel
StationCreatorPage1 {
height: scene.height - header.height
width: scene.width
model: modeModel
onItemClicked: {
stationCreator.content = modeModel.get(index).creatorContent
stationListView.incrementCurrentIndex()
}
}
StationCreatorPage2 {
id: stationCreator
height: stationListView.height
width: stationListView.width
onNext: stationListView.incrementCurrentIndex()
}
Item {
id: stationItem
height: stationListView.height
width: stationListView.width
Image {
id: busyIndicator
source: "../images/advanced-settings.svg"
anchors.centerIn: parent
height: defaultFontHeight * 4
width: height
visible: mainView.loading
RotationAnimation { target: busyIndicator; from: 360; to: 0; duration: 1500; running: visible; loops: Animation.Infinite }
}
CoverFlip {
id: coverView
anchors.fill: parent
interactive: false
backgroundColor: scene.color
model: dynamicModel
currentIndex: currentlyPlayedIndex
onItemPlayPauseClicked: {
mainView.playItem(index)
}
onItemClicked: {
mainView.playItem(index)
}
}
}
}
ListView {
id: stationListView
anchors {
left: parent.left
top: header.bottom
right: parent.right
bottom: parent.bottom
}
contentHeight: height
contentWidth: width
orientation: ListView.Horizontal
model: stationVisualModel
interactive: false
highlightMoveDuration: 300
backgroundColor: scene.color
model: dynamicModel
currentIndex: currentlyPlayedIndex
onItemPlayPauseClicked: {
mainView.playItem(index)
onHeightChanged: {
contentHeight = scene.height
}
onItemClicked: {
mainView.playItem(index)
onWidthChanged: {
contentWidth = scene.width
}
}
Item {
anchors { top: parent.top; left: parent.left; bottom: parent.bottom }
anchors.margins: titleText.height * 3
width: scene.width / 2
Column {
anchors { left: parent.left; top: parent.top; right: parent.right }
Text {
id: titleText
color: "white"
font.pointSize: 18
width: parent.width
elide: Text.ElideRight
text: mainView.title
}
Text {
color: "white"
font.pointSize: 14
font.bold: true
width: parent.width
elide: Text.ElideRight
opacity: .8
text: generator.summary
}
}
}
}