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

reworked buttons

This commit is contained in:
Michael Zanetti
2012-12-02 23:45:26 +01:00
parent 3eedd65c79
commit ec23f2df06
6 changed files with 47 additions and 67 deletions

View File

@@ -7,20 +7,13 @@ Item {
property int margins: defaultFontHeight * 2
property alias content: contentLoader.source
property bool nextEnabled: false
signal back()
signal next()
Loader {
id: contentLoader
anchors {
left: parent.left
top: parent.top
right: parent.right
bottom: backButton.top
margins: root.margins
}
anchors.fill: parent
anchors.margins: root.margins
}
Connections {
@@ -29,30 +22,4 @@ Item {
onDone: root.next()
}
RoundedButton {
id: backButton
text: "<"
height: defaultFontHeight * 4
anchors {
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()
}
}

View File

@@ -33,9 +33,6 @@ Rectangle {
id: stationCreator
height: scene.height
width: scene.width
nextEnabled: rootView.configured
onBack: stationListView.decrementCurrentIndex()
onNext: stationListView.incrementCurrentIndex()
}
@@ -68,4 +65,35 @@ Rectangle {
contentWidth = scene.width
}
}
RoundedButton {
id: backButton
text: "<"
height: defaultFontHeight * 4
width: height
hidden: stationListView.currentIndex == 0
anchors {
left: parent.left
bottom: parent.bottom
margins: defaultFontHeight * 2
}
onClicked: stationListView.decrementCurrentIndex()
}
RoundedButton {
id: nextButton
text: stationListView.currentIndex == 2 ? "+" : ">"
height: defaultFontHeight * 4
//hidden: stationListView.currentIndex == 0 || !rootView.configured // This should work once rootView.configured works
hidden: stationListView.currentIndex != 2
anchors {
right: parent.right
bottom: parent.bottom
margins: defaultFontHeight * 2
}
onClicked: stationListView.incrementCurrentIndex()
}
}

View File

@@ -63,32 +63,7 @@ Item {
text: generator.summary
}
}
Column {
anchors.right: parent.right
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
width: scene.width / 3
spacing: titleText.height * 2
RoundedButton {
id: backButton
text: "<"
height: titleText.height * 3
width: height
onClicked: root.backClicked()
}
RoundedButton {
text: "+"
height: titleText.height * 3
width: height
onClicked: print("TODO: save station")
}
}
}
}

View File

@@ -15,7 +15,9 @@ Item {
Column {
id: upperColumn
anchors.fill: parent
anchors.centerIn: parent
height: parent.height
width: defaultFontHeight * 30
anchors.bottomMargin: defaultFontHeight
spacing: defaultFontHeight
@@ -25,8 +27,8 @@ Item {
}
Row {
width: defaultFontHeight * 30
height: artistInputField.height
width: parent.width
spacing: defaultFontHeight
InputField {
@@ -46,8 +48,8 @@ Item {
}
ArtistView {
height: parent.height - headerText.height - artistInputField.height
width: defaultFontHeight * 30
height: parent.height - headerText.height - artistInputField.height - parent.spacing * 3
width: parent.width
model: artistChartsModel
clip: true
delegateHeight: defaultFontHeight * 6

View File

@@ -45,6 +45,7 @@ Item {
HeaderLabel {
id: headerText
anchors.horizontalCenter: parent.horizontalCenter
text: "Create station by genre..."
}
@@ -52,6 +53,7 @@ Item {
width: defaultFontHeight * 30
height: artistInputField.height
spacing: defaultFontHeight
anchors.horizontalCenter: parent.horizontalCenter
InputField {
id: genreInputField

View File

@@ -7,15 +7,21 @@ Rectangle {
border.color: enabled ? "white" : "grey"
radius: height / 2
color: (buttonMouseArea.containsMouse && enabled) ? "#22ffffff" : "black"
opacity: hidden ? 0 : 1
height: defaultFontHeight * 2
width: height
property string text
property bool enabled: true
property bool hidden: false
signal clicked()
Behavior on opacity {
NumberAnimation { duration: 200 }
}
Behavior on color {
ColorAnimation { duration: 200 }
}