1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-03 02:42:52 +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 int margins: defaultFontHeight * 2
property alias content: contentLoader.source property alias content: contentLoader.source
property bool nextEnabled: false
signal back()
signal next() signal next()
Loader { Loader {
id: contentLoader id: contentLoader
anchors { anchors.fill: parent
left: parent.left anchors.margins: root.margins
top: parent.top
right: parent.right
bottom: backButton.top
margins: root.margins
}
} }
Connections { Connections {
@@ -29,30 +22,4 @@ Item {
onDone: root.next() 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 id: stationCreator
height: scene.height height: scene.height
width: scene.width width: scene.width
nextEnabled: rootView.configured
onBack: stationListView.decrementCurrentIndex()
onNext: stationListView.incrementCurrentIndex() onNext: stationListView.incrementCurrentIndex()
} }
@@ -68,4 +65,35 @@ Rectangle {
contentWidth = scene.width 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 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 { Column {
id: upperColumn id: upperColumn
anchors.fill: parent anchors.centerIn: parent
height: parent.height
width: defaultFontHeight * 30
anchors.bottomMargin: defaultFontHeight anchors.bottomMargin: defaultFontHeight
spacing: defaultFontHeight spacing: defaultFontHeight
@@ -25,8 +27,8 @@ Item {
} }
Row { Row {
width: defaultFontHeight * 30
height: artistInputField.height height: artistInputField.height
width: parent.width
spacing: defaultFontHeight spacing: defaultFontHeight
InputField { InputField {
@@ -46,8 +48,8 @@ Item {
} }
ArtistView { ArtistView {
height: parent.height - headerText.height - artistInputField.height height: parent.height - headerText.height - artistInputField.height - parent.spacing * 3
width: defaultFontHeight * 30 width: parent.width
model: artistChartsModel model: artistChartsModel
clip: true clip: true
delegateHeight: defaultFontHeight * 6 delegateHeight: defaultFontHeight * 6

View File

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

View File

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