diff options
author | Sarah Smith <sarah.j.smith@nokia.com> | 2011-10-07 18:49:03 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-09 02:43:57 +0200 |
commit | 48de118fcfc81eeebd7285e1e3e8dd47188414ad (patch) | |
tree | 6fa39d2d7440099b9e384102ad1c24b464952080 /demos | |
parent | 79145203b3a97bf380f521f4b0b71e8f2905c888 (diff) |
Make the flickr3d demo bit more worthy.
Steal some code from the flickr demo in declarative to make this one
actually dynamically fetch some images.
Change-Id: I84b4b7b31787e4d27c4aee642d6c37ebf3f90264
Reviewed-on: http://codereview.qt-project.org/6228
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Sarah Jane Smith <sarah.j.smith@nokia.com>
Diffstat (limited to 'demos')
13 files changed, 135 insertions, 78 deletions
diff --git a/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/flickr3d.qml b/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/flickr3d.qml deleted file mode 100644 index d8d47d620..000000000 --- a/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/flickr3d.qml +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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.0 -import Qt3D 1.0 -import Qt3D.Shapes 1.0 - -Viewport { - width: 1024 - height: 768 - - camera: Camera { - id: cam - property real viewAngle: 0.0 - eye: Qt.vector3d(Math.sin(cam.viewAngle) * 20.0, 3.0, Math.cos(cam.viewAngle) * 20.0) - } - - NumberAnimation { - running: true - target: cam; property: "viewAngle"; - from: 0.0; to: 360.0; duration: 2000000; - loops: Animation.Infinite - } - - Skybox { - source: "skybox" - } - - Cube { - effect: Effect { - color: "#aaca00" - texture: "qtlogo.png" - decal: true - } - } -} diff --git a/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_down.png b/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_down.png Binary files differdeleted file mode 100644 index 685c28c4f..000000000 --- a/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_down.png +++ /dev/null diff --git a/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_east.png b/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_east.png Binary files differdeleted file mode 100644 index f6463abf8..000000000 --- a/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_east.png +++ /dev/null diff --git a/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_north.png b/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_north.png Binary files differdeleted file mode 100644 index 153b833cb..000000000 --- a/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_north.png +++ /dev/null diff --git a/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_south.png b/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_south.png Binary files differdeleted file mode 100644 index b3b013211..000000000 --- a/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_south.png +++ /dev/null diff --git a/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_up.png b/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_up.png Binary files differdeleted file mode 100644 index 3d4d6233c..000000000 --- a/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_up.png +++ /dev/null diff --git a/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_west.png b/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_west.png Binary files differdeleted file mode 100644 index 14325371b..000000000 --- a/demos/quick3d/flickr3d/flickr3d.app/Contents/Resources/qml/skybox/default_sky_west.png +++ /dev/null diff --git a/demos/quick3d/flickr3d/flickr3d.desktop b/demos/quick3d/flickr3d/flickr3d.desktop new file mode 100644 index 000000000..1a0d6b469 --- /dev/null +++ b/demos/quick3d/flickr3d/flickr3d.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=Flickr3D +Icon=icon-l-qtquick3d +Exec=/usr/bin/flickr3d -fullscreen +OnlyShowIn=X-MeeGo; +X-MeeGo-Logical-Id=qtn_comm_appname_flickr3d +X-MeeGo-Translation-Catalog=essentials diff --git a/demos/quick3d/flickr3d/flickr3d.pro b/demos/quick3d/flickr3d/flickr3d.pro index 560660272..996d716c2 100644 --- a/demos/quick3d/flickr3d/flickr3d.pro +++ b/demos/quick3d/flickr3d/flickr3d.pro @@ -14,3 +14,6 @@ OTHER_FILES += \ RC_FILE = flickr3d.rc + + + diff --git a/demos/quick3d/flickr3d/m5-robo_bounce.desktop b/demos/quick3d/flickr3d/m5-flickr.desktop index 709103d57..e23b6d4ad 100644 --- a/demos/quick3d/flickr3d/m5-robo_bounce.desktop +++ b/demos/quick3d/flickr3d/m5-flickr.desktop @@ -1,9 +1,9 @@ [Desktop Entry] Encoding=UTF-8 Version=1.0 -Name=RoboBounce +Name=Flickr3D Comment=Qt3D example application -Exec=/usr/bin/robo_bounce -fullscreen +Exec=/usr/bin/flickr3d -fullscreen Icon=icon-l-qtquick3d Terminal=false Type=Application diff --git a/demos/quick3d/flickr3d/qml/common/RssModel.qml b/demos/quick3d/flickr3d/qml/common/RssModel.qml new file mode 100644 index 000000000..069918eca --- /dev/null +++ b/demos/quick3d/flickr3d/qml/common/RssModel.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +XmlListModel { + property string tags : "" + + function commasep(x) + { + return x.replace(' ',','); + } + + source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+commasep(tags)+"&" : "")+"format=rss2" + query: "/rss/channel/item" + namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";" + + XmlRole { name: "title"; query: "title/string()" } + XmlRole { name: "imagePath"; query: "media:thumbnail/@url/string()" } + XmlRole { name: "url"; query: "media:content/@url/string()" } + XmlRole { name: "description"; query: "description/string()" } + XmlRole { name: "tags"; query: "media:category/string()" } + XmlRole { name: "photoWidth"; query: "media:content/@width/string()" } + XmlRole { name: "photoHeight"; query: "media:content/@height/string()" } + XmlRole { name: "photoType"; query: "media:content/@type/string()" } + XmlRole { name: "photoAuthor"; query: "author/string()" } + XmlRole { name: "photoDate"; query: "pubDate/string()" } +} diff --git a/demos/quick3d/flickr3d/qml/common/qmldir b/demos/quick3d/flickr3d/qml/common/qmldir new file mode 100644 index 000000000..adc2479b9 --- /dev/null +++ b/demos/quick3d/flickr3d/qml/common/qmldir @@ -0,0 +1,10 @@ +ImageDetails ImageDetails.qml +LikeOMeter LikeOMeter.qml +Loading Loading.qml +MediaButton MediaButton.qml +MediaLineEdit MediaLineEdit.qml +Progress Progress.qml +RssModel RssModel.qml +ScrollBar ScrollBar.qml +Slider Slider.qml +Star Star.qml diff --git a/demos/quick3d/flickr3d/qml/flickr3d.qml b/demos/quick3d/flickr3d/qml/flickr3d.qml index 10a9c48ec..552d2fb53 100644 --- a/demos/quick3d/flickr3d/qml/flickr3d.qml +++ b/demos/quick3d/flickr3d/qml/flickr3d.qml @@ -41,6 +41,8 @@ import QtQuick 1.0 import Qt3D 1.0 import Qt3D.Shapes 1.0 +import "common" as Common +import "mobile" as Mobile Viewport { width: 1024 @@ -63,9 +65,50 @@ Viewport { source: "skybox" } - Cube { - effect: Effect { - color: "#aaca00" + Common.RssModel { id: rssModel } + + Item3D { + transform: [ + Rotation3D { axis: Qt.vector3d(1, 0, 0); angle: 90 }, + Translation3D { translate: Qt.vector3d(0, 1, 0) } + ] + + Cylinder { + levelOfDetail: 1 + length: 2.0 + radius: 2.8 + effect: Effect { + color: "#ccccdd" + } } + } + + Component { + id: octoDisplayDelegate + Item3D { + transform: [ + Translation3D { translate: Qt.vector3d(0, 0, 2.6) }, + // index is a special variable that comes from model instancing + Rotation3D { axis: Qt.vector3d(0, 1, 0); angle: (360 / 16) * (index * 2 + 1) } + ] + Item3D { + enabled: index > -1 && index < 9 + transform: [ + Rotation3D { axis: Qt.vector3d(1, 0, 0); angle: 90 } + ] + Quad { + effect: Effect { + texture: model.imagePath + } + } + } + } + } + + Repeater { + delegate: octoDisplayDelegate + model: rssModel + } + } |