property: "searchPattern"
value: stationListPage.searchPattern
}
- SilicaListView {
- id: stationListView
- clip: true
- width: parent.width
- cacheBuffer: 10
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- model: stationListProxyModel
+ SilicaFlickable {
+ interactive: !stationListView.flicking
+ anchors.fill: parent
+ pressDelay: 0
PullDownMenu {
MenuItem {
- text: qsTr("About Quando Parte")
- onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
+ text: qsTr("Settings")
+ onClicked: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"))
}
MenuItem {
- text: qsTr("Stations by Name")
- onClicked: stationListProxyModel.sortingMode = StationListProxyModel.AlphaSorting
+ text: qsTr("Show Stations by Distance")
+ onClicked: stationListProxyModel.sortingMode = StationListProxyModel.DistanceSorting
+ enabled: (stationListProxyModel.sortingMode !== StationListProxyModel.DistanceSorting)
}
MenuItem {
- text: qsTr("Stations by Distance")
- onClicked: stationListProxyModel.sortingMode = StationListProxyModel.DistanceSorting
+ text: qsTr("Show Stations by Name")
+ onClicked: stationListProxyModel.sortingMode = StationListProxyModel.AlphaSorting
+ enabled: (stationListProxyModel.sortingMode !== StationListProxyModel.AlphaSorting)
}
MenuItem {
- text: qsTr("Stations Recently Seen")
+ text: qsTr("Show Recent Stations")
onClicked: stationListProxyModel.sortingMode = StationListProxyModel.RecentUsageSorting
+ enabled: (stationListProxyModel.sortingMode !== StationListProxyModel.RecentUsageSorting)
}
}
- header: SearchField {
- id: searchField
- placeholderText: qsTr("Search station...")
- onTextChanged: stationListPage.searchPattern = searchField.text
- width: stationListPage.width
- }
- delegate: BackgroundItem {
- id: listItem
- height: Theme.itemSizeSmall
- width: parent.width
- Label {
- id: mainText
- anchors {
- verticalCenter: parent.Center
- margins: Theme.paddingMedium
- }
- x: Theme.paddingLarge
- textFormat: Text.StyledText
- text: model.name ? Private.highlightSearch(model.name, Theme.highlightColor) : ""
+ PageHeader {
+ id: header
+ SearchField {
+ id: searchField
+ placeholderText: qsTr("Search station...")
+ inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText
+ onTextChanged: stationListPage.searchPattern = searchField.text
+ width: stationListPage.width
+ EnterKey.onClicked: searchField.focus = false
+ EnterKey.iconSource: "image://theme/icon-m-enter-close"
}
- onClicked: Private.loadStation(model.name, model.code)
}
- section {
- criteria: ViewSection.FirstCharacter
- delegate: BackgroundItem {
- height: Theme.itemSizeSmall
+ SilicaListView {
+ id: stationListView
+ clip: true
+ width: parent.width
+ cacheBuffer: 4 * Theme.itemSizeExtraSmall
+ anchors.top: header.bottom
+ anchors.bottom: parent.bottom
+ model: stationListProxyModel
+ delegate: ListItem {
+ id: listItem
+ contentHeight: Theme.itemSizeExtraSmall
width: parent.width
Label {
- id: sectionLabel
- text: section
+ id: mainText
+ anchors {
+ fill: parent
+ margins: Theme.paddingMedium
+ }
+ x: Theme.paddingLarge
+ textFormat: Text.StyledText
+ text: model.name ? Private.highlightSearch(model.name, Theme.highlightColor) : ""
+ verticalAlignment: Text.AlignVCenter
+ }
+ Image {
+ id: favoriteIndicator
+ visible: model.favorite
+ source: "image://theme/icon-m-favorite-selected"
+ anchors {
+ verticalCenter: parent.verticalCenter
+ right: parent.right
+ }
+ }
+ menu: contextMenu
+ Component {
+ id: contextMenu
+ ContextMenu {
+ MenuItem {
+ text: model.favorite ? qsTr("Remove from Favorites") : qsTr("Add to Favorites")
+ onClicked: {
+ model.favorite ^= true
+ console.log("Favorite Stations:" + settings.favoriteStations)
+ }
+ }
+ MenuItem {
+ text: qsTr("Show on the map")
+ onClicked: Qt.openUrlExternally("geo:" + model.latitude + "," + model.longitude)
+ }
+ }
}
+ onPressed: searchField.focus = false
+ onClicked: Private.loadStation(model.name, model.code)
}
+ VerticalScrollDecorator {}
}
}
}