diff options
Diffstat (limited to 'QtDemo/qml')
-rw-r--r-- | QtDemo/qml/QtDemo/demos/gridrssnews/main.qml | 31 | ||||
-rw-r--r-- | QtDemo/qml/QtDemo/demos/radio/radio.qml | 24 | ||||
-rw-r--r-- | QtDemo/qml/QtDemo/demos/rssnews/rssnews.qml | 20 | ||||
-rw-r--r-- | QtDemo/qml/QtDemo/demos/video/VideoSelector.qml | 23 |
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 |