From 2618d786b29510c6077dee67ab00b81852d4558f Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Thu, 3 Nov 2011 20:17:46 +0100 Subject: Added search suggestion when no results are found. --- qml/ArtistPage.qml | 16 ++++++++++------ qml/SearchPage.qml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 6 deletions(-) (limited to 'qml') 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: "" + search.didYouMean + " ?" + + onLinkActivated: searchField.text = search.didYouMean + } + Scrollbar { listView: results } } } -- cgit v1.2.3