mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-09-01 01:51:58 +02:00
reworked buttons
This commit is contained in:
@@ -22,14 +22,13 @@ Rectangle {
|
|||||||
subtitle: generator.summary
|
subtitle: generator.summary
|
||||||
showSearchField: false
|
showSearchField: false
|
||||||
showBackButton: stationListView.currentIndex > 0
|
showBackButton: stationListView.currentIndex > 0
|
||||||
showNextButton: dynamicModel.rowCount() > 0 && stationListView.currentIndex < 2
|
showNextButton: stationListView.currentIndex == 2
|
||||||
showSaveButton: stationListView.currentIndex === 2
|
nextButtonText: "Save"
|
||||||
|
|
||||||
z: 1 //cover albumcovers that may leave their area
|
z: 1 //cover albumcovers that may leave their area
|
||||||
|
|
||||||
onBackPressed: stationListView.decrementCurrentIndex()
|
onBackPressed: stationListView.decrementCurrentIndex()
|
||||||
onNextPressed: stationListView.incrementCurrentIndex()
|
onNextPressed: stationListView.incrementCurrentIndex()
|
||||||
onSavePressed: print("should save station now")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
|
@@ -29,7 +29,9 @@ Rectangle {
|
|||||||
|
|
||||||
property bool showBackButton: false
|
property bool showBackButton: false
|
||||||
property bool showNextButton: false
|
property bool showNextButton: false
|
||||||
property bool showSaveButton: false
|
|
||||||
|
property string backButtonText: "Back"
|
||||||
|
property string nextButtonText: "Next"
|
||||||
|
|
||||||
// Layout spacing
|
// Layout spacing
|
||||||
property int spacing: defaultFontHeight * 0.5
|
property int spacing: defaultFontHeight * 0.5
|
||||||
@@ -139,34 +141,51 @@ Rectangle {
|
|||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
rightMargin: -backButton.width - root.spacing - nextButton.width - root.spacing
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
margins: root.spacing
|
margins: root.spacing
|
||||||
|
|
||||||
|
onRightMarginChanged: print("#+#+#+#+", anchors.rightMargin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "oneVisible"; when: root.showBackButton && !root.showNextButton
|
||||||
|
PropertyChanges {
|
||||||
|
target: rightRow
|
||||||
|
anchors.rightMargin: -nextButton.width
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "bothVisible"; when: root.showBackButton && root.showNextButton
|
||||||
|
PropertyChanges {
|
||||||
|
target: rightRow
|
||||||
|
anchors.rightMargin: root.spacing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
width: childrenRect.width
|
width: childrenRect.width
|
||||||
spacing: root.spacing
|
spacing: root.spacing
|
||||||
layoutDirection: Qt.RightToLeft
|
layoutDirection: Qt.RightToLeft
|
||||||
|
|
||||||
|
Behavior on anchors.rightMargin {
|
||||||
|
NumberAnimation { duration: 200 }
|
||||||
RoundedButton {
|
|
||||||
height: parent.height * 0.8
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
text: "+"
|
|
||||||
visible: root.showSaveButton
|
|
||||||
onClicked: root.saveClicked()
|
|
||||||
}
|
}
|
||||||
RoundedButton {
|
|
||||||
height: parent.height * 0.8
|
PushButton {
|
||||||
|
id: nextButton
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: ">"
|
text: root.nextButtonText
|
||||||
visible: root.showNextButton
|
// visible: root.showNextButton
|
||||||
onClicked: root.nextPressed();
|
onClicked: root.nextPressed();
|
||||||
}
|
}
|
||||||
RoundedButton {
|
PushButton {
|
||||||
|
id: backButton
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
height: parent.height * 0.8
|
text: root.backButtonText
|
||||||
text: "<"
|
// visible: root.showBackButton
|
||||||
visible: root.showBackButton
|
|
||||||
onClicked: root.backPressed();
|
onClicked: root.backPressed();
|
||||||
}
|
}
|
||||||
InputField {
|
InputField {
|
||||||
|
@@ -38,11 +38,13 @@ Rectangle {
|
|||||||
anchors.rightMargin: root.spacing
|
anchors.rightMargin: root.spacing
|
||||||
height: textInput.height
|
height: textInput.height
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
TextInput {
|
TextInput {
|
||||||
id: textInput
|
id: textInput
|
||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: root.text
|
text: root.text
|
||||||
|
font.pointSize: defaultFontSize
|
||||||
|
|
||||||
onAccepted: root.accepted( text );
|
onAccepted: root.accepted( text );
|
||||||
onTextChanged: root.text = text;
|
onTextChanged: root.text = text;
|
||||||
@@ -52,6 +54,7 @@ Rectangle {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: root.text.length === 0 ? root.placeholderText : ""
|
text: root.text.length === 0 ? root.placeholderText : ""
|
||||||
color: "lightgray"
|
color: "lightgray"
|
||||||
|
font.pointSize: defaultFontSize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
35
data/qml/tomahawkimports/PushButton.qml
Normal file
35
data/qml/tomahawkimports/PushButton.qml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import QtQuick 1.1
|
||||||
|
//import tomahawk 1.0
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: root
|
||||||
|
height: buttonText.height * 1.4
|
||||||
|
width: childrenRect.width + (spacing * 2)
|
||||||
|
radius: defaultFontHeight * 0.25
|
||||||
|
border.width: defaultFontHeight * 0.05
|
||||||
|
border.color: "#a7a7a7"
|
||||||
|
|
||||||
|
gradient: Gradient {
|
||||||
|
GradientStop { position: 0.0; color: mouseArea.pressed ? "#040404" : "#fbfbfb" }
|
||||||
|
GradientStop { position: 1.0; color: mouseArea.pressed ? "#8e8f8e" : "#787878" }
|
||||||
|
}
|
||||||
|
|
||||||
|
property int spacing: defaultFontHeight * 0.5
|
||||||
|
property alias text: buttonText.text
|
||||||
|
|
||||||
|
signal clicked()
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: buttonText
|
||||||
|
anchors.centerIn: root
|
||||||
|
font.pointSize: defaultFontSize
|
||||||
|
text: root.text
|
||||||
|
color: mouseArea.pressed ? "white" : "black"
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: mouseArea
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: root.clicked()
|
||||||
|
}
|
||||||
|
}
|
@@ -148,6 +148,7 @@
|
|||||||
<file>data/qml/tomahawkimports/Button.qml</file>
|
<file>data/qml/tomahawkimports/Button.qml</file>
|
||||||
<file>data/qml/tomahawkimports/DoubleSlider.qml</file>
|
<file>data/qml/tomahawkimports/DoubleSlider.qml</file>
|
||||||
<file>data/qml/tomahawkimports/RoundedButton.qml</file>
|
<file>data/qml/tomahawkimports/RoundedButton.qml</file>
|
||||||
|
<file>data/qml/tomahawkimports/PushButton.qml</file>
|
||||||
<file>data/qml/tomahawkimports/CoverFlip.qml</file>
|
<file>data/qml/tomahawkimports/CoverFlip.qml</file>
|
||||||
<file>data/qml/StationView.qml</file>
|
<file>data/qml/StationView.qml</file>
|
||||||
<file>data/qml/stations/StationCreatorPage1.qml</file>
|
<file>data/qml/stations/StationCreatorPage1.qml</file>
|
||||||
|
Reference in New Issue
Block a user