import QtQuick 2.0 import Sailfish.Silica 1.0 import "../JSONListModel" import "../delegates" Page { id: page property string filter: "" SilicaListView { id: listView anchors.fill: parent clip: true JSONListModel { id: jsonModel1 source: filter !=="" ? "http://api.tvmaze.com/search/shows?q="+filter : "" query: "$[*].show" } model: jsonModel1.model BusyIndicator { id: busyIndicator running: !jsonModel1.jsonready size: BusyIndicatorSize.Large anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter } header: PageHeader { id: pHeader SearchField { id: searchField width: parent.width placeholderText: "Search" inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText EnterKey.iconSource: "image://theme/icon-m-enter-close" EnterKey.onClicked: {filter = text;focus = false} focus: true onTextChanged: if (text.length > 1) filter = text; else {filter = "";focus=true;} // onTextChanged: if (text.length > 1) jsonModel1.source = "http://www.radio-browser.info/webservice/json/stations/"+searchby+"/"+text; else {jsonModel1.source = "";focus=true;jsonModel1.model.clear()} onClicked: {listView.currentIndex = -1} } } delegate: ShowDelegate {} PullDownMenu { MenuItem { text: qsTr("Popular shows by rating") onClicked: pageStack.replace(Qt.resolvedUrl("PopularPage.qml"),{"showweight": false},PageStackAction.Immediate) } MenuItem { text: qsTr("Popular shows by clicks") onClicked: pageStack.replace(Qt.resolvedUrl("PopularPage.qml"),{"showweight": true},PageStackAction.Immediate) } MenuItem { text: qsTr("Favorites") onClicked: pageStack.replace(Qt.resolvedUrl("Favorites.qml"),{},PageStackAction.Immediate) } } ViewPlaceholder { enabled: listView.count === 0 //|| jsonModel1.jsonready text: "Search a TV Show" hintText: "on TVMaze" Image { id: logo anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.top anchors.bottomMargin: Theme.paddingLarge opacity: 0.2 source: "../harbour-labyrinth.png" } } } }