diff --git a/data/qml/StationView.qml b/data/qml/StationView.qml index 87a444e94..e0e0c9ae7 100644 --- a/data/qml/StationView.qml +++ b/data/qml/StationView.qml @@ -22,14 +22,13 @@ Rectangle { subtitle: generator.summary showSearchField: false showBackButton: stationListView.currentIndex > 0 - showNextButton: dynamicModel.rowCount() > 0 && stationListView.currentIndex < 2 - showSaveButton: stationListView.currentIndex === 2 + showNextButton: stationListView.currentIndex == 2 + nextButtonText: "Save" z: 1 //cover albumcovers that may leave their area onBackPressed: stationListView.decrementCurrentIndex() onNextPressed: stationListView.incrementCurrentIndex() - onSavePressed: print("should save station now") } ListModel { diff --git a/data/qml/tomahawkimports/FlexibleHeader.qml b/data/qml/tomahawkimports/FlexibleHeader.qml index e86f15f1b..7008b7fb7 100644 --- a/data/qml/tomahawkimports/FlexibleHeader.qml +++ b/data/qml/tomahawkimports/FlexibleHeader.qml @@ -29,7 +29,9 @@ Rectangle { property bool showBackButton: false property bool showNextButton: false - property bool showSaveButton: false + + property string backButtonText: "Back" + property string nextButtonText: "Next" // Layout spacing property int spacing: defaultFontHeight * 0.5 @@ -139,34 +141,51 @@ Rectangle { anchors { top: parent.top right: parent.right + rightMargin: -backButton.width - root.spacing - nextButton.width - root.spacing bottom: parent.bottom 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 spacing: root.spacing layoutDirection: Qt.RightToLeft - - - RoundedButton { - height: parent.height * 0.8 - anchors.verticalCenter: parent.verticalCenter - text: "+" - visible: root.showSaveButton - onClicked: root.saveClicked() + Behavior on anchors.rightMargin { + NumberAnimation { duration: 200 } } - RoundedButton { - height: parent.height * 0.8 + + PushButton { + id: nextButton anchors.verticalCenter: parent.verticalCenter - text: ">" - visible: root.showNextButton + text: root.nextButtonText +// visible: root.showNextButton onClicked: root.nextPressed(); } - RoundedButton { + PushButton { + id: backButton anchors.verticalCenter: parent.verticalCenter - height: parent.height * 0.8 - text: "<" - visible: root.showBackButton + text: root.backButtonText +// visible: root.showBackButton onClicked: root.backPressed(); } InputField { diff --git a/data/qml/tomahawkimports/InputField.qml b/data/qml/tomahawkimports/InputField.qml index f95a65286..cb5588dad 100644 --- a/data/qml/tomahawkimports/InputField.qml +++ b/data/qml/tomahawkimports/InputField.qml @@ -38,11 +38,13 @@ Rectangle { anchors.rightMargin: root.spacing height: textInput.height anchors.verticalCenter: parent.verticalCenter + TextInput { id: textInput width: parent.width anchors.centerIn: parent text: root.text + font.pointSize: defaultFontSize onAccepted: root.accepted( text ); onTextChanged: root.text = text; @@ -52,6 +54,7 @@ Rectangle { anchors.centerIn: parent text: root.text.length === 0 ? root.placeholderText : "" color: "lightgray" + font.pointSize: defaultFontSize } } diff --git a/data/qml/tomahawkimports/PushButton.qml b/data/qml/tomahawkimports/PushButton.qml new file mode 100644 index 000000000..4120da824 --- /dev/null +++ b/data/qml/tomahawkimports/PushButton.qml @@ -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() + } +} diff --git a/resources.qrc b/resources.qrc index 5034fb5db..e969179eb 100644 --- a/resources.qrc +++ b/resources.qrc @@ -148,6 +148,7 @@ data/qml/tomahawkimports/Button.qml data/qml/tomahawkimports/DoubleSlider.qml data/qml/tomahawkimports/RoundedButton.qml + data/qml/tomahawkimports/PushButton.qml data/qml/tomahawkimports/CoverFlip.qml data/qml/StationView.qml data/qml/stations/StationCreatorPage1.qml