diff options
Diffstat (limited to 'examples/quick/demos/rssnews')
27 files changed, 0 insertions, 1141 deletions
diff --git a/examples/quick/demos/rssnews/content/BusyIndicator.qml b/examples/quick/demos/rssnews/content/BusyIndicator.qml deleted file mode 100644 index 44b796bdfe..0000000000 --- a/examples/quick/demos/rssnews/content/BusyIndicator.qml +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 - -Image { - id: container - - source: "images/busy.png"; - - NumberAnimation on rotation { - running: container.visible - from: 0; to: 360; - loops: Animation.Infinite; - duration: 1200 - } -} diff --git a/examples/quick/demos/rssnews/content/CategoryDelegate.qml b/examples/quick/demos/rssnews/content/CategoryDelegate.qml deleted file mode 100644 index c76bc78aca..0000000000 --- a/examples/quick/demos/rssnews/content/CategoryDelegate.qml +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 - -Rectangle { - id: delegate - - property bool selected: ListView.isCurrentItem - property real itemSize - width: itemSize - height: itemSize - - Image { - anchors.centerIn: parent - source: image - } - - Text { - id: titleText - - anchors { - left: parent.left; leftMargin: 20 - right: parent.right; rightMargin: 20 - top: parent.top; topMargin: 20 - } - - font { pixelSize: 18; bold: true } - text: name - color: selected ? "#ffffff" : "#ebebdd" - scale: selected ? 1.15 : 1.0 - Behavior on color { ColorAnimation { duration: 150 } } - Behavior on scale { PropertyAnimation { duration: 300 } } - } - - BusyIndicator { - scale: 0.8 - visible: delegate.ListView.isCurrentItem && window.loading - anchors.centerIn: parent - } - - MouseArea { - anchors.fill: delegate - onClicked: { - delegate.ListView.view.currentIndex = index - if (window.currentFeed == feed) - feedModel.reload() - else - window.currentFeed = feed - } - } -} diff --git a/examples/quick/demos/rssnews/content/NewsDelegate.qml b/examples/quick/demos/rssnews/content/NewsDelegate.qml deleted file mode 100644 index ed0c2bd977..0000000000 --- a/examples/quick/demos/rssnews/content/NewsDelegate.qml +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 - -Column { - id: delegate - width: delegate.ListView.view.width - spacing: 8 - - // Returns a string representing how long ago an event occurred - function timeSinceEvent(pubDate) { - var result = pubDate; - - // We need to modify the pubDate read from the RSS feed - // so the JavaScript Date object can interpret it - var d = pubDate.replace(',','').split(' '); - if (d.length != 6) - return result; - - var date = new Date([d[0], d[2], d[1], d[3], d[4], 'GMT' + d[5]].join(' ')); - - if (!isNaN(date.getDate())) { - var age = new Date() - date; - var minutes = Math.floor(Number(age) / 60000); - if (minutes < 1440) { - if (minutes < 2) - result = qsTr("Just now"); - else if (minutes < 60) - result = '' + minutes + ' ' + qsTr("minutes ago") - else if (minutes < 120) - result = qsTr("1 hour ago"); - else - result = '' + Math.floor(minutes/60) + ' ' + qsTr("hours ago"); - } - else { - result = date.toDateString(); - } - } - return result; - } - - Item { height: 8; width: delegate.width } - - Row { - width: parent.width - spacing: 8 - - Column { - Item { - width: 4 - height: titleText.font.pixelSize / 4 - } - - Image { - id: titleImage - source: image - } - } - - Text { - id: titleText - - text: title - width: delegate.width - titleImage.width - wrapMode: Text.WordWrap - font.pixelSize: 26 - font.bold: true - } - } - - Text { - width: delegate.width - font.pixelSize: 12 - textFormat: Text.RichText - font.italic: true - text: timeSinceEvent(pubDate) + " (<a href=\"" + link + "\">Link</a>)" - onLinkActivated: { - Qt.openUrlExternally(link) - } - } - - Text { - id: descriptionText - - text: description - width: parent.width - wrapMode: Text.WordWrap - font.pixelSize: 14 - textFormat: Text.StyledText - horizontalAlignment: Qt.AlignLeft - } -} diff --git a/examples/quick/demos/rssnews/content/RssFeeds.qml b/examples/quick/demos/rssnews/content/RssFeeds.qml deleted file mode 100644 index 46a6c875c8..0000000000 --- a/examples/quick/demos/rssnews/content/RssFeeds.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 - -ListModel { - ListElement { name: "Top Stories"; feed: "news.yahoo.com/rss/topstories"; image: "images/TopStories.jpg" } - ListElement { name: "World"; feed: "news.yahoo.com/rss/world"; image: "images/World.jpg" } - ListElement { name: "Europe"; feed: "news.yahoo.com/rss/europe"; image: "images/Europe.jpg" } - ListElement { name: "Asia"; feed: "news.yahoo.com/rss/asia"; image: "images/Asia.jpg" } - ListElement { name: "U.S. National"; feed: "news.yahoo.com/rss/us"; image: "images/USNational.jpg" } - ListElement { name: "Politics"; feed: "news.yahoo.com/rss/politics"; image: "images/Politics.jpg" } - ListElement { name: "Business"; feed: "news.yahoo.com/rss/business"; image: "images/Business.jpg" } - ListElement { name: "Technology"; feed: "news.yahoo.com/rss/tech"; image: "images/Technology.jpg" } - ListElement { name: "Entertainment"; feed: "news.yahoo.com/rss/entertainment"; image: "images/Entertainment.jpg" } - ListElement { name: "Health"; feed: "news.yahoo.com/rss/health"; image: "images/Health.jpg" } - ListElement { name: "Science"; feed: "news.yahoo.com/rss/science"; image: "images/Science.jpg" } - ListElement { name: "Sports"; feed: "news.yahoo.com/rss/sports"; image: "images/Sports.jpg" } -} diff --git a/examples/quick/demos/rssnews/content/ScrollBar.qml b/examples/quick/demos/rssnews/content/ScrollBar.qml deleted file mode 100644 index bd774188c8..0000000000 --- a/examples/quick/demos/rssnews/content/ScrollBar.qml +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 - -Item { - id: container - - property variant scrollArea - property int orientation: Qt.Vertical - - opacity: 0 - - function position() - { - var ny = 0; - if (container.orientation == Qt.Vertical) - ny = scrollArea.visibleArea.yPosition * container.height; - else - ny = scrollArea.visibleArea.xPosition * container.width; - - if (ny > 2) - return ny; - else - return 2; - } - - function size() - { - var nh, ny; - - if (container.orientation == Qt.Vertical) - nh = scrollArea.visibleArea.heightRatio * container.height; - else - nh = scrollArea.visibleArea.widthRatio * container.width; - - if (container.orientation == Qt.Vertical) - ny = scrollArea.visibleArea.yPosition * container.height; - else - ny = scrollArea.visibleArea.xPosition * container.width; - - if (ny > 3) { - var t; - if (container.orientation == Qt.Vertical) - t = Math.ceil(container.height - 3 - ny); - else - t = Math.ceil(container.width - 3 - ny); - if (nh > t) - return t; - else - return nh; - } else - return nh + ny; - } - - Rectangle { anchors.fill: parent; color: "Black"; opacity: 0.3 } - - BorderImage { - source: "images/scrollbar.png" - border { left: 1; right: 1; top: 1; bottom: 1 } - x: container.orientation == Qt.Vertical ? 2 : position() - y: container.orientation == Qt.Vertical ? position() : 2 - width: container.orientation == Qt.Vertical ? container.width - 4 : size() - height: container.orientation == Qt.Vertical ? size() : container.height - 4 - } - - states: State { - name: "visible" - when: container.orientation == Qt.Vertical ? - scrollArea.movingVertically : - scrollArea.movingHorizontally - PropertyChanges { target: container; opacity: 1.0 } - } - - transitions: Transition { - from: "visible"; to: "" - NumberAnimation { properties: "opacity"; duration: 600 } - } -} diff --git a/examples/quick/demos/rssnews/content/images/Asia.jpg b/examples/quick/demos/rssnews/content/images/Asia.jpg Binary files differdeleted file mode 100644 index a609557a08..0000000000 --- a/examples/quick/demos/rssnews/content/images/Asia.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Business.jpg b/examples/quick/demos/rssnews/content/images/Business.jpg Binary files differdeleted file mode 100644 index b2c1d92138..0000000000 --- a/examples/quick/demos/rssnews/content/images/Business.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Entertainment.jpg b/examples/quick/demos/rssnews/content/images/Entertainment.jpg Binary files differdeleted file mode 100644 index 2c69fc04d7..0000000000 --- a/examples/quick/demos/rssnews/content/images/Entertainment.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Europe.jpg b/examples/quick/demos/rssnews/content/images/Europe.jpg Binary files differdeleted file mode 100644 index bf524e13d0..0000000000 --- a/examples/quick/demos/rssnews/content/images/Europe.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Health.jpg b/examples/quick/demos/rssnews/content/images/Health.jpg Binary files differdeleted file mode 100644 index 0e8c71f0c9..0000000000 --- a/examples/quick/demos/rssnews/content/images/Health.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Politics.jpg b/examples/quick/demos/rssnews/content/images/Politics.jpg Binary files differdeleted file mode 100644 index 0b1800c97e..0000000000 --- a/examples/quick/demos/rssnews/content/images/Politics.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Science.jpg b/examples/quick/demos/rssnews/content/images/Science.jpg Binary files differdeleted file mode 100644 index 7faccbbb97..0000000000 --- a/examples/quick/demos/rssnews/content/images/Science.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Sports.jpg b/examples/quick/demos/rssnews/content/images/Sports.jpg Binary files differdeleted file mode 100644 index 0ab3bd3ce7..0000000000 --- a/examples/quick/demos/rssnews/content/images/Sports.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/Technology.jpg b/examples/quick/demos/rssnews/content/images/Technology.jpg Binary files differdeleted file mode 100644 index db553028fb..0000000000 --- a/examples/quick/demos/rssnews/content/images/Technology.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/TopStories.jpg b/examples/quick/demos/rssnews/content/images/TopStories.jpg Binary files differdeleted file mode 100644 index e35bd67f20..0000000000 --- a/examples/quick/demos/rssnews/content/images/TopStories.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/USNational.jpg b/examples/quick/demos/rssnews/content/images/USNational.jpg Binary files differdeleted file mode 100644 index 82c78228c1..0000000000 --- a/examples/quick/demos/rssnews/content/images/USNational.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/World.jpg b/examples/quick/demos/rssnews/content/images/World.jpg Binary files differdeleted file mode 100644 index 7a0a806fd4..0000000000 --- a/examples/quick/demos/rssnews/content/images/World.jpg +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/btn_close.png b/examples/quick/demos/rssnews/content/images/btn_close.png Binary files differdeleted file mode 100644 index 1a3dc44380..0000000000 --- a/examples/quick/demos/rssnews/content/images/btn_close.png +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/busy.png b/examples/quick/demos/rssnews/content/images/busy.png Binary files differdeleted file mode 100644 index fc65122d26..0000000000 --- a/examples/quick/demos/rssnews/content/images/busy.png +++ /dev/null diff --git a/examples/quick/demos/rssnews/content/images/scrollbar.png b/examples/quick/demos/rssnews/content/images/scrollbar.png Binary files differdeleted file mode 100644 index c2425dd0df..0000000000 --- a/examples/quick/demos/rssnews/content/images/scrollbar.png +++ /dev/null diff --git a/examples/quick/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png b/examples/quick/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png Binary files differdeleted file mode 100644 index 9d324ceb70..0000000000 --- a/examples/quick/demos/rssnews/doc/images/qtquick-demo-rssnews-small.png +++ /dev/null diff --git a/examples/quick/demos/rssnews/doc/src/rssnews.qdoc b/examples/quick/demos/rssnews/doc/src/rssnews.qdoc deleted file mode 100644 index 4ba874cd70..0000000000 --- a/examples/quick/demos/rssnews/doc/src/rssnews.qdoc +++ /dev/null @@ -1,372 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Quick Demo - RSS News - \ingroup qtquickdemos - \example demos/rssnews - \brief A QML RSS news reader that uses XmlListModel and XmlRole to download - XML data, ListModel and ListElement to create a category list, and ListView - to display the data. - - \image qtquick-demo-rssnews-small.png - - \e{RSS News} demonstrates the following \l{Qt Quick} features: - - \list - \li Using custom types to create screens and screen controls. - \li Using list models and list elements to represent data. - \li Using XML list models to download XML data. - \li Using list views to display data. - \li Using the \l Component type to create a footer for the news item - list view. - \li Using the \l Image type to create a button for closing the app. - \endlist - - \include examples-run.qdocinc - - \section1 Using Custom Types - - In the RSS News app, we use the following custom types that are each defined - in a separate .qml file: - - \list - \li \c BusyIndicator.qml - \li \c CategoryDelegate.qml - \li \c NewsDelegate.qml - \li \c RssFeeds.qml - \li \c ScrollBar.qml - \endlist - - To use the custom types, we add an import statement to the main QML file, - rssnews.qml that imports the folder called \c content where the types are - located: - - \quotefromfile demos/rssnews/rssnews.qml - \skipto content - \printuntil " - - \section1 Creating the Main Window - - In rssnews.qml, we use a \l{Rectangle} type with custom properties to create - the app main window: - - \printuntil isPortrait - - We will use the custom properties later for loading XML data and for - adjusting the screen layout depending on its orientation. - - \section1 Creating a Category List - - In rssnews.qml, we use the RssFeeds custom type that we specify in - RssFeeds.qml to create a list of feed categories: - - \skipto RssFeeds - \printuntil } - - In RssFeeds.qml, we use a ListModel type with a ListElement type to - create a category list where list elements represent feed categories: - - \quotefromfile demos/rssnews/content/RssFeeds.qml - \skipto ListModel - \printuntil /^\}/ - - List elements are defined like other QML types except that they contain a - collection of \e role definitions instead of properties. Roles both define - how the data is accessed and include the data itself. - - For each list element, we use the \c name role to specify the category name, - the \c feed role to specify the URL to load the data from, and the \c image - role to display an image for the category. - - In rssnews.qml, we use a ListView type to display the category list: - - \quotefromfile demos/rssnews/rssnews.qml - \skipto ListView - \printuntil } - \printuntil } - - To lay out the category list horizontally at the top of the window in - portrait orientation and vertically on the left side in landscape - orientation, we use the \c orientation property. Based on the orientation, - we bind either the width or the height of the list to a fixed value - (\c itemWidth). - - We use the \c anchors.top property to position the list view at the top of - the screen in both orientations. - - We use the \c model property to load XML data from the \c rssFeeds model, - and \c CategoryDelegate as the delegate to instantiate each item in the - list. - - \section1 Creating List Elements - - In CategoryDelegate.qml, we use the \l Rectangle type with custom properties - to create list elements: - - \quotefromfile demos/rssnews/content/CategoryDelegate.qml - \skipto Rectangle - \printuntil selected - - We set the \c selected property to the \c ListView.isCurrentItem attached - property to specify that \c selected is \c true if \c delegate is the - current item. - - We use the \l Image type \c source property to display the image, centered - in the delegate, specified for the list element by the \c image role in the - \c rssFeeds list model: - - \skipto Image - \printuntil } - - We use a \l Text type to add titles to list elements: - - \printuntil Behavior - \printuntil } - - We use the \c anchors property to position the title at the top of the list - element, with a 20-pixel margin. We use \c font properties to adjust font - size and text formatting. - - We use the \c color property to brighten the text and to scale it slightly - larger when the list item is the current item. By applying a \l Behavior to - the property, we animate the actions of selecting and deselecting list - items. - - We use a MouseArea type to download XML data when users tap a category list - element: - - \skipto MouseArea - \printuntil } - \printuntil } - - The \c anchors.fill property is set to \c delegate to enable users to tap - anywhere within the list element. - - We use the \c onClicked signal handler to load the XML data for the category - list. If the tapped category is already current, the \c reload() function - is called to reload the data. - - \section1 Downloading XML Data - - In rssnews.qml, we use an XmlListModel type as a data source for ListView - elements to display news items in the selected category: - - \quotefromfile demos/rssnews/rssnews.qml - \skipto XmlListModel { - \printuntil namespaceDeclarations - - We use the \c source property and the \c window.currentFeed custom property - to fetch news items for the selected category. - - The \c query property specifies that the XmlListModel generates a model item - for each \c <item> in the XML document. - - We use the XmlRole type to specify the model item attributes. Each model - item has the \c title, \c description, \c image, \c link, and \c pubDate - attributes that match the values of the corresponding \c <item> in the XML - document: - - \printuntil pubDate - \printuntil } - - We use the \c feedModel model in a ListView type to display the data: - - \skipuntil ScrollBar - \skipto ListView - \printuntil } - \printuntil } - - To list the news items below the category list in portrait orientation and - to its right in landscape orientation, we use the \c isPortrait custom - property to anchor the top of the news items list to the left of \c window - and bottom of \c categories in portrait orientation and to the right of - \c categories and bottom of \c window in landscape orientation. - - We use the \c anchors.bottom property to anchor the bottom of the list view - to the bottom of the window in both orientations. - - In portrait orientation, we clip the painting of the news items to the - bounding rectangle of the list view to avoid graphical artifacts when news - items are scrolled over other items. In landscape, this is not required, - because the list spans the entire screen vertically. - - We use the \c model property to load XML data from the \c feedModel model, - and use \c NewsDelegate as the delegate to instantiate each item in the - list. - - In NewsDelegate.qml, we use a \l Column type to lay out the XML data: - - \quotefromfile demos/rssnews/content/NewsDelegate.qml - \skipto Column - \printuntil spacing - - Within the column, we use a \l Row and another column to position images and - title text: - - \skipto Row - \printuntil font.bold - \printuntil } - \printuntil } - - We generate a textual representation of how long ago the item was posted - using the \c timeSinceEvent() JavaScript function: - - \printuntil } - \printuntil } - - We use the \c onLinkActivated signal handler to open the URL in an external - browser when users select the link. - - \section1 Providing Feedback to Users - - In CategoryDelegate.qml, we use the \c BusyIndicator custom type to indicate - activity while the XML data is being loaded: - - \quotefromfile demos/rssnews/content/CategoryDelegate.qml - \skipto BusyIndicator - \printuntil } - - We use the \c scale property to reduce the indicator size to \c 0.8. We bind - the \c visible property to the \c isCurrentItem attached property of the - \c delegate list view and \c loading property of the main window to display - the indicator image when a category list item is the current item and XML - data is being loaded. - - We define the \c BusyIndicator type in \c BusyIndicator.qml. We use an - \l Image type to display an image and apply a NumberAnimation to its - \c rotation property to rotate the image in an infinite loop: - - \quotefromfile demos/rssnews/content/BusyIndicator.qml - \skipto Image - \printuntil } - \printuntil } - - In your apps, you can also use the BusyIndicator type from the - \l {Qt Quick Controls} module. - - \section1 Creating Scroll Bars - - In rssnews.qml, we use our own custom \c ScrollBar type to create scroll - bars in the category and news item list views. In your apps, you can also - use the ScrollView type from the \l {Qt Quick Controls} module. - - First, we create a scroll bar in the category list view. We bind the - \c orientation property to the \c isPortrait property and to the - \c Horizontal value of the \c Qt::Orientation enum type to display a - horizontal scroll bar in portrait orientation and to the \c Vertical value - to display a vertical scroll bar in landscape orientation: - - \quotefromfile demos/rssnews/rssnews.qml - \skipto ScrollBar - \printuntil } - - Same as with the \c categories list view, we adjust the width and height of - the scroll bar based on the \c isPortrait property. - - We use the \c scrollArea property to display the scroll bar in the - \c categories list view. - - We use the \c anchors.right property to anchor the scroll bar to the right - side of the category list. - - \skipto ScrollBar - \printuntil } - - Second, we create another scroll bar in the news item list view. We want a - vertical scroll bar to appear on the right side of the view regardless of - screen orientation, so we can set the \c width property to \c 8 and bind the - \c anchors.right property to the \c window.right property. We use the - \c anchors.top property to anchor the scroll bar top to the bottom of the - category list in portrait orientation and to the top of the news item list - in landscape orientation. We use the \c anchors.bottom property to anchor - the scroll bar bottom to the list view bottom in both orientations. - - We define the \c ScrollBar type in \c ScrollBar.qml. We use an \l Item type - with custom properties to create a container for the scroll bar: - - \quotefromfile demos/rssnews/content/ScrollBar.qml - \skipto Item - \printuntil opacity - - We use a BorderImage type to display the scroll bar thumb at the x and y - position that we calculate by using the \c position() function: - - \skipto BorderImage - \printuntil height - \printuntil } - - We use the \c size function to calculate the thumb width and height - depending on the screen orientation. - - We use \c states to make the scroll bar visible when the users move the - scroll area: - - \printuntil } - \printuntil } - - We use \c transitions to apply a NumberAnimation to the \c "opacity" - property when the state changes from "visible" to the default state: - - \printuntil /^\}/ - - \section1 Creating Footers - - In rssnews.qml, we use a \l Component type with a \l Rectangle type to - create a footer for the news list view: - - \quotefromfile demos/rssnews/rssnews.qml - \skipto Component - \printuntil } - \printuntil } - \printuntil } - - We bind the \c width of the footer to the width of the component and the - \c height to the of close button to align them when no news items are - displayed. - - \section1 Creating Buttons - - In rssnews.qml, we use an \l Image type to create a simple push button that - users can tap to close the app: - - \printuntil Qt.quit() - \printuntil } - \printuntil } - \printuntil } - - We use \c anchors to position the close button in the top right corner of - the news list view, with 4-pixel margins. Because the close button overlaps - the category list in portrait orientation, we animate the \c opacity - property to make the button almost fully transparent when users are - scrolling the category list. - - We use the \c onClicked signal handler within a MouseArea to call the - \c quit() function when users select the close button. - - \sa {QML Applications} -*/ diff --git a/examples/quick/demos/rssnews/main.cpp b/examples/quick/demos/rssnews/main.cpp deleted file mode 100644 index a0d621bbb6..0000000000 --- a/examples/quick/demos/rssnews/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "../../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(demos/rssnews/rssnews) diff --git a/examples/quick/demos/rssnews/rssnews.pro b/examples/quick/demos/rssnews/rssnews.pro deleted file mode 100644 index c67c5a6558..0000000000 --- a/examples/quick/demos/rssnews/rssnews.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = app - -QT += quick qml xml xmlpatterns -SOURCES += main.cpp -RESOURCES += rssnews.qrc - -OTHER_FILES = rssnews.qml \ - content/*.qml \ - content/*.js \ - content/images/* - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/rssnews -INSTALLS += target diff --git a/examples/quick/demos/rssnews/rssnews.qml b/examples/quick/demos/rssnews/rssnews.qml deleted file mode 100644 index 263154f956..0000000000 --- a/examples/quick/demos/rssnews/rssnews.qml +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 -import QtQuick.XmlListModel 2.0 -import QtQuick.Window 2.1 -import "./content" - -Rectangle { - id: window - - width: 800 - height: 480 - - property string currentFeed: rssFeeds.get(0).feed - property bool loading: feedModel.status === XmlListModel.Loading - property bool isPortrait: Screen.primaryOrientation === Qt.PortraitOrientation - - onLoadingChanged: { - if (feedModel.status == XmlListModel.Ready) - list.positionViewAtBeginning() - } - - RssFeeds { id: rssFeeds } - - XmlListModel { - id: feedModel - - source: "http://" + window.currentFeed - query: "/rss/channel/item[child::media:content]" - namespaceDeclarations: "declare namespace media = 'http://search.yahoo.com/mrss/';" - - XmlRole { name: "title"; query: "title/string()" } - // Remove any links from the description - XmlRole { name: "description"; query: "fn:replace(description/string(), '\<a href=.*\/a\>', '')" } - XmlRole { name: "image"; query: "media:content/@url/string()" } - XmlRole { name: "link"; query: "link/string()" } - XmlRole { name: "pubDate"; query: "pubDate/string()" } - } - - ListView { - id: categories - property int itemWidth: 190 - - width: isPortrait ? parent.width : itemWidth - height: isPortrait ? itemWidth : parent.height - orientation: isPortrait ? ListView.Horizontal : ListView.Vertical - anchors.top: parent.top - model: rssFeeds - delegate: CategoryDelegate { itemSize: categories.itemWidth } - spacing: 3 - } - - ScrollBar { - id: listScrollBar - - orientation: isPortrait ? Qt.Horizontal : Qt.Vertical - height: isPortrait ? 8 : categories.height; - width: isPortrait ? categories.width : 8 - scrollArea: categories; - anchors.right: categories.right - } - - ListView { - id: list - - anchors.left: isPortrait ? window.left : categories.right - anchors.right: closeButton.left - anchors.top: isPortrait ? categories.bottom : window.top - anchors.bottom: window.bottom - anchors.leftMargin: 30 - anchors.rightMargin: 4 - clip: isPortrait - model: feedModel - footer: footerText - delegate: NewsDelegate {} - } - - ScrollBar { - scrollArea: list - width: 8 - anchors.right: window.right - anchors.top: isPortrait ? categories.bottom : window.top - anchors.bottom: window.bottom - } - - Component { - id: footerText - - Rectangle { - width: parent.width - height: closeButton.height - color: "lightgray" - - Text { - text: "RSS Feed from Yahoo News" - anchors.centerIn: parent - font.pixelSize: 14 - } - } - } - - Image { - id: closeButton - source: "content/images/btn_close.png" - scale: 0.8 - anchors.top: parent.top - anchors.right: parent.right - anchors.margins: 4 - opacity: (isPortrait && categories.moving) ? 0.2 : 1.0 - Behavior on opacity { - NumberAnimation { duration: 300; easing.type: Easing.OutSine } - } - - MouseArea { - anchors.fill: parent - onClicked: { - Qt.quit() - } - } - } -} diff --git a/examples/quick/demos/rssnews/rssnews.qmlproject b/examples/quick/demos/rssnews/rssnews.qmlproject deleted file mode 100644 index 5becbdaed0..0000000000 --- a/examples/quick/demos/rssnews/rssnews.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "rssnews.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/quick/demos/rssnews/rssnews.qrc b/examples/quick/demos/rssnews/rssnews.qrc deleted file mode 100644 index 1208d44fd7..0000000000 --- a/examples/quick/demos/rssnews/rssnews.qrc +++ /dev/null @@ -1,25 +0,0 @@ -<RCC> - <qresource prefix="/demos/rssnews"> - <file>rssnews.qml</file> - <file>content/BusyIndicator.qml</file> - <file>content/CategoryDelegate.qml</file> - <file>content/NewsDelegate.qml</file> - <file>content/RssFeeds.qml</file> - <file>content/ScrollBar.qml</file> - <file>content/images/btn_close.png</file> - <file>content/images/Business.jpg</file> - <file>content/images/busy.png</file> - <file>content/images/Entertainment.jpg</file> - <file>content/images/Europe.jpg</file> - <file>content/images/Health.jpg</file> - <file>content/images/Asia.jpg</file> - <file>content/images/Politics.jpg</file> - <file>content/images/Science.jpg</file> - <file>content/images/scrollbar.png</file> - <file>content/images/Sports.jpg</file> - <file>content/images/Technology.jpg</file> - <file>content/images/TopStories.jpg</file> - <file>content/images/USNational.jpg</file> - <file>content/images/World.jpg</file> - </qresource> -</RCC> |