summaryrefslogtreecommitdiffstats
path: root/QtDemo
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@digia.com>2014-02-13 17:54:48 +0100
committerLasse Räihä <lasse.raiha@digia.com>2014-09-10 13:04:31 +0300
commit1d267e7ba2e9d6c39762ed86cdb36f3cf37cc533 (patch)
tree57e1170335d9a433864b89025a456ceb4c903297 /QtDemo
parent469e638157c710d7035af8f202c933cac99e1279 (diff)
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: Ie447b129d64a559826196808a5b5489ae29cae5f Reviewed-by: Lasse Räihä <lasse.raiha@digia.com>
Diffstat (limited to 'QtDemo')
-rw-r--r--QtDemo/qml/QtDemo/demos/gridrssnews/main.qml31
-rw-r--r--QtDemo/qml/QtDemo/demos/radio/radio.qml24
-rw-r--r--QtDemo/qml/QtDemo/demos/rssnews/rssnews.qml20
-rw-r--r--QtDemo/qml/QtDemo/demos/video/VideoSelector.qml23
4 files changed, 95 insertions, 3 deletions
diff --git a/QtDemo/qml/QtDemo/demos/gridrssnews/main.qml b/QtDemo/qml/QtDemo/demos/gridrssnews/main.qml
index 5435bbb..92a2c9d 100644
--- a/QtDemo/qml/QtDemo/demos/gridrssnews/main.qml
+++ b/QtDemo/qml/QtDemo/demos/gridrssnews/main.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the examples of the Qt Toolkit.
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick 2.2
+import QtQuick 2.0
import QtQuick.XmlListModel 2.0
Rectangle {
@@ -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,13 @@ 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/QtDemo/qml/QtDemo/demos/radio/radio.qml b/QtDemo/qml/QtDemo/demos/radio/radio.qml
index 4099ad1..c51da1c 100644
--- a/QtDemo/qml/QtDemo/demos/radio/radio.qml
+++ b/QtDemo/qml/QtDemo/demos/radio/radio.qml
@@ -96,6 +96,22 @@ FocusScope {
clip: true
+ 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
@@ -215,6 +231,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/QtDemo/qml/QtDemo/demos/rssnews/rssnews.qml b/QtDemo/qml/QtDemo/demos/rssnews/rssnews.qml
index b6d026a..e2b2b79 100644
--- a/QtDemo/qml/QtDemo/demos/rssnews/rssnews.qml
+++ b/QtDemo/qml/QtDemo/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/QtDemo/qml/QtDemo/demos/video/VideoSelector.qml b/QtDemo/qml/QtDemo/demos/video/VideoSelector.qml
index 4d481fc..1e52ca3 100644
--- a/QtDemo/qml/QtDemo/demos/video/VideoSelector.qml
+++ b/QtDemo/qml/QtDemo/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