From ec23f2df06e8fe754f3a4e385983fea9135701d6 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Sun, 2 Dec 2012 23:45:26 +0100 Subject: [PATCH] reworked buttons --- data/qml/StationCreatorPage2.qml | 37 ++-------------------- data/qml/StationScene.qml | 34 ++++++++++++++++++-- data/qml/StationView.qml | 25 --------------- data/qml/stations/CreateByArtist.qml | 10 +++--- data/qml/stations/CreateByGenre.qml | 2 ++ data/qml/tomahawkimports/RoundedButton.qml | 6 ++++ 6 files changed, 47 insertions(+), 67 deletions(-) diff --git a/data/qml/StationCreatorPage2.qml b/data/qml/StationCreatorPage2.qml index e8582719a..0a7a99c8a 100644 --- a/data/qml/StationCreatorPage2.qml +++ b/data/qml/StationCreatorPage2.qml @@ -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() - } } diff --git a/data/qml/StationScene.qml b/data/qml/StationScene.qml index 668e35fb3..e04e3f7b7 100644 --- a/data/qml/StationScene.qml +++ b/data/qml/StationScene.qml @@ -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() + } + } diff --git a/data/qml/StationView.qml b/data/qml/StationView.qml index 17d925bd2..82d43b613 100644 --- a/data/qml/StationView.qml +++ b/data/qml/StationView.qml @@ -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") - - } - } } - } diff --git a/data/qml/stations/CreateByArtist.qml b/data/qml/stations/CreateByArtist.qml index a03c9c1b3..bda53dc77 100644 --- a/data/qml/stations/CreateByArtist.qml +++ b/data/qml/stations/CreateByArtist.qml @@ -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 diff --git a/data/qml/stations/CreateByGenre.qml b/data/qml/stations/CreateByGenre.qml index 0d64ac3a9..0872fdf79 100644 --- a/data/qml/stations/CreateByGenre.qml +++ b/data/qml/stations/CreateByGenre.qml @@ -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 diff --git a/data/qml/tomahawkimports/RoundedButton.qml b/data/qml/tomahawkimports/RoundedButton.qml index 89e2e6bdc..790afe227 100644 --- a/data/qml/tomahawkimports/RoundedButton.qml +++ b/data/qml/tomahawkimports/RoundedButton.qml @@ -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 } }