summaryrefslogtreecommitdiffstats
path: root/qml
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@nokia.com>2011-11-03 20:17:46 +0100
committerYoann Lopes <yoann.lopes@nokia.com>2011-11-03 20:17:46 +0100
commit2618d786b29510c6077dee67ab00b81852d4558f (patch)
treee3a7b44590e0051cf8db784fbbdad181d86924ec /qml
parent8ead54b40e873da5fde5fb95ab54ca599eadf6ec (diff)
Added search suggestion when no results are found.
Diffstat (limited to 'qml')
-rw-r--r--qml/ArtistPage.qml16
-rw-r--r--qml/SearchPage.qml33
2 files changed, 43 insertions, 6 deletions
diff --git a/qml/ArtistPage.qml b/qml/ArtistPage.qml
index 289ec9d..f1c4e9b 100644
--- a/qml/ArtistPage.qml
+++ b/qml/ArtistPage.qml
@@ -247,13 +247,17 @@ Page {
}
}
- Scrollbar { listView: artistView }
- }
+ Label {
+ anchors.horizontalCenter: parent.horizontalCenter
+ y: 100
+ visible: selector.selectedIndex == 2 && artistView.count === 0 && !browse.busy
+ text: "No biography available"
+ font.pixelSize: UI.FONT_LARGE
+ font.family: UI.FONT_FAMILY_LIGHT
+ font.weight: Font.Light
+ }
- Label {
- anchors.centerIn: parent
- visible: selector.selectedIndex == 2 && artistView.count === 0 && !browse.busy
- text: "No biography available"
+ Scrollbar { listView: artistView }
}
BusyIndicator {
diff --git a/qml/SearchPage.qml b/qml/SearchPage.qml
index 84c7cb2..eb88a4e 100644
--- a/qml/SearchPage.qml
+++ b/qml/SearchPage.qml
@@ -232,6 +232,39 @@ Page {
}
}
+ Label {
+ id: errorMessage
+ anchors.horizontalCenter: parent.horizontalCenter
+ y: 80
+ visible: results.count === 0 && search.query.length > 0 && !search.busy
+ font.pixelSize: UI.FONT_LARGE
+ font.family: UI.FONT_FAMILY_LIGHT
+ font.weight: Font.Light
+ wrapMode: Text.WordWrap
+ width: parent.width - UI.MARGIN_XLARGE * 2
+ horizontalAlignment: Text.AlignHCenter
+
+ text: search.didYouMean.length > 0 ? "Did you mean"
+ : (selector.selectedIndex === 0 ? "No tracks found" :
+ selector.selectedIndex == 1 ? "No albums found" :
+ "No artists found")
+ }
+ Label {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: errorMessage.bottom
+ visible: results.count === 0 && search.query.length > 0 && !search.busy && search.didYouMean.length > 0
+ font.pixelSize: UI.FONT_LARGE
+ font.family: UI.FONT_FAMILY_LIGHT
+ font.weight: Font.Light
+ wrapMode: Text.WordWrap
+ width: parent.width - UI.MARGIN_XLARGE * 2
+ horizontalAlignment: Text.AlignHCenter
+
+ text: "<style type=text/css> a { text-decoration: underline; color:" + UI.SPOTIFY_COLOR + "} </style><a href='didyoumean'>" + search.didYouMean + "</a> ?"
+
+ onLinkActivated: searchField.text = search.didYouMean
+ }
+
Scrollbar { listView: results }
}
}