import QtQuick 1.0
import com.nokia.meego 1.0
+import com.nokia.extras 1.0
import "uiconstants.js" as UiConstants
Rectangle {
+ property alias text: label.text
+ property alias options: dialog.model
+ property alias selectedIndex: dialog.selectedIndex
+
+ id: root
width: parent.width
height: screen.currentOrientation == Screen.Landscape ?
UiConstants.HeaderDefaultHeightLandscape :
- UiConstants.HeaderDefaultHeightPortrait
- color: "#071"
+ UiConstants.HeaderDefaultHeightPortrait
+ color: mouse.pressed ? "#060" : "#071"
+
+ TumblerButtonStyle {
+ id: style
+ inverted: true
+ }
+ Item {
+ id: spacer
+ anchors.left: parent.left
+ width: UiConstants.DefaultMargins
+ height: parent.heigth
+ }
+ Label {
+ id: label
+ anchors.left: spacer.right
+ anchors.verticalCenter: parent.verticalCenter
+ font {
+ pixelSize: UiConstants.HeaderFontPixelSize
+ bold: false
+ }
+ color: style.textColor
+ }
+ MouseArea {
+ id: mouse
+ anchors.fill: parent
+ onClicked: dialog.open()
+ }
+
+ Image {
+ id: icon
+
+ anchors { right: (label.text != "") ? parent.right : undefined;
+ rightMargin: UiConstants.DefaultMargins;
+ horizontalCenter: (label.text != "") ? undefined : parent.horizontalCenter;
+ verticalCenter: parent.verticalCenter;
+ }
+ height: label.height
+ source: "image://theme/meegotouch-combobox-indicator" +
+ (style.inverted ? "-inverted" : "") +
+ (root.enabled ? "" : "-disabled") +
+ (mouse.pressed ? "-pressed" : "")
+ }
+ SelectionDialog {
+ id: dialog
+ titleText: qsTr("Show")
+ }
}
PageHeader {
id: header
anchors.top: parent.top
+ text: qsTr("Stations")
+ options: ListModel {
+ id: dialogOptions
+ ListElement {
+ name: QT_TR_NOOP("Stations by Name")
+ }
+ ListElement {
+ name: QT_TR_NOOP("Stations by Distance")
+ }
+ ListElement {
+ name: QT_TR_NOOP("Stations Recently Seen")
+ }
+ }
+ onSelectedIndexChanged: {
+ header.text = dialogOptions.get(selectedIndex).name
+ switch (selectedIndex) {
+ case 0:
+ stationListProxyModel.sortingMode = StationListProxyModel.AlphaSorting
+ break;
+ case 1:
+ stationListProxyModel.sortingMode = StationListProxyModel.DistanceSorting
+ break;
+ case 2:
+ stationListProxyModel.sortingMode = StationListProxyModel.RecentUsageSorting
+ break;
+ }
+ }
}
SearchBar {
id: searchField
Sheet {
id: settingsSheet
- acceptButtonText: "Save"
- rejectButtonText: "Cancel"
+ acceptButtonText: qsTr("Save")
+ rejectButtonText: qsTr("Cancel")
content: Item {
x: 16
y: 16