From 8b59cba6ea76466a605db68130716dfe6e36de28 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Thu, 13 Feb 2014 17:54:48 +0100 Subject: Qt5-Everywhere: show network error message Instead of showing broken applications when there is no available network, we now show an error message indicating that there is no network available. This is neat because now we dont have to let customers know why things are working at shows, and people trying this for themselves will know what they need to do to remedy the issue. Change-Id: Idda904946fb823abce3f8f11c51b5516cb58472c Reviewed-by: Eirik Aavitsland --- .../qt5-everywhere/demos/gridrssnews/main.qml | 26 ++++++++++++++++++++++ basicsuite/qt5-everywhere/demos/radio/radio.qml | 24 ++++++++++++++++++++ .../qt5-everywhere/demos/rssnews/rssnews.qml | 20 +++++++++++++++++ .../qt5-everywhere/demos/video/VideoSelector.qml | 23 +++++++++++++++++++ 4 files changed, 93 insertions(+) (limited to 'basicsuite') diff --git a/basicsuite/qt5-everywhere/demos/gridrssnews/main.qml b/basicsuite/qt5-everywhere/demos/gridrssnews/main.qml index 3041242..2856cfb 100644 --- a/basicsuite/qt5-everywhere/demos/gridrssnews/main.qml +++ b/basicsuite/qt5-everywhere/demos/gridrssnews/main.qml @@ -74,6 +74,8 @@ Rectangle { onStatusChanged: { if (status == XmlListModel.Ready) { playbanner.start(); + } else if (status == XmlListModel.Error) { + networkErrorMessage.start(); } } } @@ -139,6 +141,21 @@ Rectangle { pageSize: grid.visibleArea.widthRatio } + Item { + id: networkErrorBox + opacity: 0 + anchors.fill: parent + + Text { + anchors.centerIn: parent + text: qsTr("Sorry! No network connection") + font.family: uiFont; + font.pixelSize: appHeaderFontSize; + color: textColor + smooth: true + } + } + SequentialAnimation { id: playbanner running: false @@ -146,5 +163,14 @@ Rectangle { NumberAnimation { target: grid; property: "opacity"; to: 1.0; duration: 300} } + NumberAnimation { + id: networkErrorMessage + running: false + target: networkErrorBox + property: "opacity" + to: 1.0 + duration: 300 + } + } diff --git a/basicsuite/qt5-everywhere/demos/radio/radio.qml b/basicsuite/qt5-everywhere/demos/radio/radio.qml index 9bd7152..e81c567 100644 --- a/basicsuite/qt5-everywhere/demos/radio/radio.qml +++ b/basicsuite/qt5-everywhere/demos/radio/radio.qml @@ -102,6 +102,22 @@ FocusScope { radius: height/2 + Item { + id: networkErrorBox + opacity: 0 + anchors.fill: parent + + Text { + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: parent.width * 0.1 + text: qsTr("Sorry! No network connection") + font.pixelSize: stationList.height*.1; + color: "white" + smooth: true + } + } + PathView { enabled: root.activeFocus id: stationList @@ -214,6 +230,14 @@ FocusScope { query: "/radio/channel" XmlRole {name: "title"; query: "title/string()"} XmlRole {name: "url"; query: "url/string()"} + + onStatusChanged: { + if (status == XmlListModel.Ready) { + networkErrorBox.opacity = 0; + } else if (status == XmlListModel.Error) { + networkErrorBox.opacity = 1; + } + } } VolumeButton { diff --git a/basicsuite/qt5-everywhere/demos/rssnews/rssnews.qml b/basicsuite/qt5-everywhere/demos/rssnews/rssnews.qml index 5bb1868..213d9e8 100644 --- a/basicsuite/qt5-everywhere/demos/rssnews/rssnews.qml +++ b/basicsuite/qt5-everywhere/demos/rssnews/rssnews.qml @@ -67,6 +67,14 @@ Rectangle { XmlRole { name: "title"; query: "title/string()" } XmlRole { name: "link"; query: "link/string()" } XmlRole { name: "description"; query: "description/string()" } + + onStatusChanged: { + if (status == XmlListModel.Error) { + networkErrorBox.opacity = 1.0 + } else if (status == XmlListModel.Ready) { + networkErrorBox.opacity = 0.0 + } + } } Row { @@ -93,9 +101,21 @@ Rectangle { width: window.width - window.listWidth; height: window.height model: feedModel delegate: NewsDelegate {} + + Item { + id: networkErrorBox + opacity: 0 + anchors.fill: parent + + Text { + anchors.centerIn: parent + text: qsTr("Sorry! No network connection") + } + } } } + ScrollBar { scrollArea: list; height: list.height; width: 8; anchors.right: window.right } Rectangle { x: window.listWidth; height: window.height; width: 1; color: "#cccccc" } } diff --git a/basicsuite/qt5-everywhere/demos/video/VideoSelector.qml b/basicsuite/qt5-everywhere/demos/video/VideoSelector.qml index df3e3e2..8ce8d83 100644 --- a/basicsuite/qt5-everywhere/demos/video/VideoSelector.qml +++ b/basicsuite/qt5-everywhere/demos/video/VideoSelector.qml @@ -67,6 +67,29 @@ Item { XmlRole { name: "thumbnail"; query: "thumbnail/string()" } XmlRole { name: "title"; query: "title/string()" } XmlRole { name: "link"; query: "link/string()" } + + onStatusChanged: { + if (status == XmlListModel.Ready) { + networkErrorBox.opacity = 0.0 + } else if (status == XmlListModel.Error) { + networkErrorBox.opacity = 1.0 + } + } + } + + Item { + id: networkErrorBox + opacity: 0 + anchors.fill: parent + + Text { + anchors.centerIn: parent + text: qsTr("Sorry! No network connection") + font.family: uiFont; + font.pixelSize: tileFontSize * 2; + color: textColor + smooth: true + } } // Grid view -- cgit v1.2.3