2 import Sailfish.Silica 1.0
3 import net.cirulla.quandoparte 1.0
4 import "StationListPage.js" as Private
8 property variant stationView
9 property string searchPattern
11 target: stationListProxyModel
12 property: "searchPattern"
13 value: stationListPage.searchPattern
16 interactive: !stationListView.flicking
21 text: qsTr("Settings")
22 onClicked: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"))
25 text: qsTr("Show Stations by Name")
26 onClicked: stationListProxyModel.sortingMode = StationListProxyModel.AlphaSorting
27 font.italic: (stationListProxyModel.sortingMode === StationListProxyModel.AlphaSorting)
28 enabled: (stationListProxyModel.sortingMode !== StationListProxyModel.AlphaSorting)
31 text: qsTr("Show Stations by Distance")
32 onClicked: stationListProxyModel.sortingMode = StationListProxyModel.DistanceSorting
33 font.italic: (stationListProxyModel.sortingMode === StationListProxyModel.DistanceSorting)
34 enabled: (stationListProxyModel.sortingMode !== StationListProxyModel.DistanceSorting)
37 text: qsTr("Show Recent Stations")
38 onClicked: stationListProxyModel.sortingMode = StationListProxyModel.RecentUsageSorting
39 font.italic: (stationListProxyModel.sortingMode === StationListProxyModel.RecentUsageSorting)
40 enabled: (stationListProxyModel.sortingMode !== StationListProxyModel.RecentUsageSorting)
47 placeholderText: qsTr("Search station...")
48 inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText
49 onTextChanged: stationListPage.searchPattern = searchField.text
50 width: stationListPage.width
51 EnterKey.onClicked: searchField.focus = false
52 EnterKey.iconSource: "image://theme/icon-m-enter-close"
59 cacheBuffer: 4 * Theme.itemSizeExtraSmall
60 anchors.top: header.bottom
61 anchors.bottom: parent.bottom
62 model: stationListProxyModel
65 contentHeight: Theme.itemSizeExtraSmall
71 margins: Theme.paddingMedium
74 textFormat: Text.StyledText
75 text: model.name ? Private.highlightSearch(model.name, Theme.highlightColor) : ""
76 verticalAlignment: Text.AlignVCenter
80 visible: model.favorite
81 source: "image://theme/icon-m-favorite-selected"
83 verticalCenter: parent.verticalCenter
92 text: model.favorite ? qsTr("Remove from Favorites") : qsTr("Add to Favorites")
94 model.favorite ^= true
95 console.log("Favorite Stations:" + settings.favoriteStations)
99 text: qsTr("Show on the map")
100 onClicked: Qt.openUrlExternally("geo:" + model.latitude + "," + model.longitude)
104 onPressed: searchField.focus = false
105 onClicked: Private.loadStation(model.name, model.code)
107 VerticalScrollDecorator {}