From c459bd16e2fab5d08fab5d55880eac084d8af615 Mon Sep 17 00:00:00 2001 From: artoka Date: Thu, 17 Nov 2011 15:49:51 +0100 Subject: modelviews/parallax example modifications Modified the example to use centralized qmlapplicationviewer, removed duplicate files and modified project files according to the changes Merge-request: 2719 Reviewed-by: Casper van Donderen --- examples/declarative/modelviews/parallax/main.cpp | 54 +++ .../modelviews/parallax/parallax.desktop | 11 + .../declarative/modelviews/parallax/parallax.pro | 37 ++ .../declarative/modelviews/parallax/parallax.qml | 78 ---- .../modelviews/parallax/parallax.qmlproject | 6 +- .../declarative/modelviews/parallax/parallax.svg | 93 +++++ .../declarative/modelviews/parallax/parallax64.png | Bin 0 -> 3400 bytes .../declarative/modelviews/parallax/parallax80.png | Bin 0 -> 4945 bytes .../modelviews/parallax/parallax_harmattan.desktop | 11 + .../modelviews/parallax/pics/background.jpg | Bin 209814 -> 0 bytes .../modelviews/parallax/pics/face-smile.png | Bin 15408 -> 0 bytes .../modelviews/parallax/pics/home-page.svg | 445 --------------------- .../modelviews/parallax/pics/shadow.png | Bin 425 -> 0 bytes .../modelviews/parallax/pics/yast-joystick.png | Bin 2723 -> 0 bytes .../modelviews/parallax/pics/yast-wol.png | Bin 3769 -> 0 bytes .../modelviews/parallax/qml/ParallaxView.qml | 123 ------ .../declarative/modelviews/parallax/qml/Smiley.qml | 84 ---- .../parallax/qml/parallax/ParallaxView.qml | 123 ++++++ .../modelviews/parallax/qml/parallax/Smiley.qml | 84 ++++ .../modelviews/parallax/qml/parallax/parallax.qml | 78 ++++ .../parallax/qml/parallax/pics/background.jpg | Bin 0 -> 209814 bytes .../parallax/qml/parallax/pics/face-smile.png | Bin 0 -> 15408 bytes .../parallax/qml/parallax/pics/home-page.svg | 445 +++++++++++++++++++++ .../parallax/qml/parallax/pics/shadow.png | Bin 0 -> 425 bytes .../parallax/qml/parallax/pics/yast-joystick.png | Bin 0 -> 2723 bytes .../parallax/qml/parallax/pics/yast-wol.png | Bin 0 -> 3769 bytes 26 files changed, 939 insertions(+), 733 deletions(-) create mode 100644 examples/declarative/modelviews/parallax/main.cpp create mode 100644 examples/declarative/modelviews/parallax/parallax.desktop create mode 100644 examples/declarative/modelviews/parallax/parallax.pro delete mode 100644 examples/declarative/modelviews/parallax/parallax.qml create mode 100644 examples/declarative/modelviews/parallax/parallax.svg create mode 100644 examples/declarative/modelviews/parallax/parallax64.png create mode 100644 examples/declarative/modelviews/parallax/parallax80.png create mode 100644 examples/declarative/modelviews/parallax/parallax_harmattan.desktop delete mode 100644 examples/declarative/modelviews/parallax/pics/background.jpg delete mode 100644 examples/declarative/modelviews/parallax/pics/face-smile.png delete mode 100644 examples/declarative/modelviews/parallax/pics/home-page.svg delete mode 100644 examples/declarative/modelviews/parallax/pics/shadow.png delete mode 100644 examples/declarative/modelviews/parallax/pics/yast-joystick.png delete mode 100644 examples/declarative/modelviews/parallax/pics/yast-wol.png delete mode 100644 examples/declarative/modelviews/parallax/qml/ParallaxView.qml delete mode 100644 examples/declarative/modelviews/parallax/qml/Smiley.qml create mode 100644 examples/declarative/modelviews/parallax/qml/parallax/ParallaxView.qml create mode 100644 examples/declarative/modelviews/parallax/qml/parallax/Smiley.qml create mode 100644 examples/declarative/modelviews/parallax/qml/parallax/parallax.qml create mode 100644 examples/declarative/modelviews/parallax/qml/parallax/pics/background.jpg create mode 100644 examples/declarative/modelviews/parallax/qml/parallax/pics/face-smile.png create mode 100644 examples/declarative/modelviews/parallax/qml/parallax/pics/home-page.svg create mode 100644 examples/declarative/modelviews/parallax/qml/parallax/pics/shadow.png create mode 100644 examples/declarative/modelviews/parallax/qml/parallax/pics/yast-joystick.png create mode 100644 examples/declarative/modelviews/parallax/qml/parallax/pics/yast-wol.png diff --git a/examples/declarative/modelviews/parallax/main.cpp b/examples/declarative/modelviews/parallax/main.cpp new file mode 100644 index 0000000..aa4dc80 --- /dev/null +++ b/examples/declarative/modelviews/parallax/main.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** 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 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$ +** +****************************************************************************/ + +#include "qmlapplicationviewer.h" +#include + +Q_DECL_EXPORT int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); + viewer.setMainQmlFile(QLatin1String("qml/parallax/parallax.qml")); + viewer.showExpanded(); + + return app.exec(); +} diff --git a/examples/declarative/modelviews/parallax/parallax.desktop b/examples/declarative/modelviews/parallax/parallax.desktop new file mode 100644 index 0000000..c3d8cfc --- /dev/null +++ b/examples/declarative/modelviews/parallax/parallax.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=parallax +Exec=/opt/parallax/bin/parallax +Icon=parallax64 +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/parallax/parallax.pro b/examples/declarative/modelviews/parallax/parallax.pro new file mode 100644 index 0000000..42272b6 --- /dev/null +++ b/examples/declarative/modelviews/parallax/parallax.pro @@ -0,0 +1,37 @@ +# Add more folders to ship with the application, here +folder_01.source = qml/parallax +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +symbian:TARGET.UID3 = 0xE1CB8EBB + +# Smart Installer package's UID +# This UID is from the protected range and therefore the package will +# fail to install if self-signed. By default qmake uses the unprotected +# range value if unprotected UID is defined for the application and +# 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Allow network access on Symbian +symbian:TARGET.CAPABILITY += NetworkServices + +# If your application uses the Qt Mobility libraries, uncomment the following +# lines and add the respective components to the MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# Speed up launching on MeeGo/Harmattan when using applauncherd daemon +# CONFIG += qdeclarative-boostable + +# Add dependency to Symbian components +# CONFIG += qt-components + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += main.cpp + +# Please do not modify the following two lines. Required for deployment. +include(../../../tools/qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/modelviews/parallax/parallax.qml b/examples/declarative/modelviews/parallax/parallax.qml deleted file mode 100644 index 5fa24ad..0000000 --- a/examples/declarative/modelviews/parallax/parallax.qml +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** 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 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 1.0 -import "../../toys/clocks/content" // for loading the Clock element -import "qml" - -Rectangle { - width: 320; height: 480 - - ParallaxView { - id: parallax - anchors.fill: parent - background: "pics/background.jpg" - - Item { - property url icon: "pics/yast-wol.png" - width: 320; height: 480 - Clock { anchors.centerIn: parent } - } - - Item { - property url icon: "pics/home-page.svg" - width: 320; height: 480 - Smiley { } - } - - Item { - property url icon: "pics/yast-joystick.png" - width: 320; height: 480 - - Loader { - anchors { top: parent.top; topMargin: 10; horizontalCenter: parent.horizontalCenter } - width: 300; height: 400 - clip: true; - source: "../../../../demos/declarative/samegame/samegame.qml" - Component.onCompleted: item.inAnotherDemo = true; - } - } - } -} diff --git a/examples/declarative/modelviews/parallax/parallax.qmlproject b/examples/declarative/modelviews/parallax/parallax.qmlproject index d4909f8..cc2a4a6 100644 --- a/examples/declarative/modelviews/parallax/parallax.qmlproject +++ b/examples/declarative/modelviews/parallax/parallax.qmlproject @@ -3,13 +3,13 @@ import QmlProject 1.0 Project { /* Include .qml, .js, and image files from current directory and subdirectories */ QmlFiles { - directory: "." + directory: "qml/parallax" } JavaScriptFiles { - directory: "." + directory: "qml/parallax" } ImageFiles { - directory: "." + directory: "qml/parallax" } /* List of plugin directories passed to QML runtime */ // importPaths: [ " ../exampleplugin " ] diff --git a/examples/declarative/modelviews/parallax/parallax.svg b/examples/declarative/modelviews/parallax/parallax.svg new file mode 100644 index 0000000..566acfa --- /dev/null +++ b/examples/declarative/modelviews/parallax/parallax.svg @@ -0,0 +1,93 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/examples/declarative/modelviews/parallax/parallax64.png b/examples/declarative/modelviews/parallax/parallax64.png new file mode 100644 index 0000000..707d5c4 Binary files /dev/null and b/examples/declarative/modelviews/parallax/parallax64.png differ diff --git a/examples/declarative/modelviews/parallax/parallax80.png b/examples/declarative/modelviews/parallax/parallax80.png new file mode 100644 index 0000000..6ad8096 Binary files /dev/null and b/examples/declarative/modelviews/parallax/parallax80.png differ diff --git a/examples/declarative/modelviews/parallax/parallax_harmattan.desktop b/examples/declarative/modelviews/parallax/parallax_harmattan.desktop new file mode 100644 index 0000000..2fff255 --- /dev/null +++ b/examples/declarative/modelviews/parallax/parallax_harmattan.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=parallax +Exec=/usr/bin/single-instance /opt/parallax/bin/parallax +Icon=/usr/share/icons/hicolor/80x80/apps/parallax80.png +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/declarative/modelviews/parallax/pics/background.jpg b/examples/declarative/modelviews/parallax/pics/background.jpg deleted file mode 100644 index 61cca2f..0000000 Binary files a/examples/declarative/modelviews/parallax/pics/background.jpg and /dev/null differ diff --git a/examples/declarative/modelviews/parallax/pics/face-smile.png b/examples/declarative/modelviews/parallax/pics/face-smile.png deleted file mode 100644 index 3d66d72..0000000 Binary files a/examples/declarative/modelviews/parallax/pics/face-smile.png and /dev/null differ diff --git a/examples/declarative/modelviews/parallax/pics/home-page.svg b/examples/declarative/modelviews/parallax/pics/home-page.svg deleted file mode 100644 index 4f16958..0000000 --- a/examples/declarative/modelviews/parallax/pics/home-page.svg +++ /dev/null @@ -1,445 +0,0 @@ - -image/svg+xmlGo HomeJakub Steinerhttp://jimmac.musichall.czhomereturngodefaultuserdirectoryTuomas Kuosmanen - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/declarative/modelviews/parallax/pics/shadow.png b/examples/declarative/modelviews/parallax/pics/shadow.png deleted file mode 100644 index 8270565..0000000 Binary files a/examples/declarative/modelviews/parallax/pics/shadow.png and /dev/null differ diff --git a/examples/declarative/modelviews/parallax/pics/yast-joystick.png b/examples/declarative/modelviews/parallax/pics/yast-joystick.png deleted file mode 100644 index 858cea0..0000000 Binary files a/examples/declarative/modelviews/parallax/pics/yast-joystick.png and /dev/null differ diff --git a/examples/declarative/modelviews/parallax/pics/yast-wol.png b/examples/declarative/modelviews/parallax/pics/yast-wol.png deleted file mode 100644 index 7712180..0000000 Binary files a/examples/declarative/modelviews/parallax/pics/yast-wol.png and /dev/null differ diff --git a/examples/declarative/modelviews/parallax/qml/ParallaxView.qml b/examples/declarative/modelviews/parallax/qml/ParallaxView.qml deleted file mode 100644 index 9ad636f..0000000 --- a/examples/declarative/modelviews/parallax/qml/ParallaxView.qml +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** 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 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 1.0 - -Item { - id: root - - property alias background: background.source - property int currentIndex: 0 - default property alias content: visualModel.children - - Image { - id: background - fillMode: Image.TileHorizontally - x: -list.contentX / 2 - width: Math.max(list.contentWidth, parent.width) - } - - ListView { - id: list - anchors.fill: parent - - currentIndex: root.currentIndex - onCurrentIndexChanged: root.currentIndex = currentIndex - - orientation: Qt.Horizontal - boundsBehavior: Flickable.DragOverBounds - model: VisualItemModel { id: visualModel } - - highlightRangeMode: ListView.StrictlyEnforceRange - snapMode: ListView.SnapOneItem - } - - ListView { - id: selector - - height: 50 - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - width: Math.min(count * 50, parent.width - 20) - interactive: width == parent.width - 20 - orientation: Qt.Horizontal - - currentIndex: root.currentIndex - onCurrentIndexChanged: root.currentIndex = currentIndex - - model: visualModel.children - delegate: Item { - width: 50; height: 50 - id: delegateRoot - - Image { - id: image - source: modelData.icon - smooth: true - scale: 0.8 - } - - MouseArea { - anchors.fill: parent - onClicked: { root.currentIndex = index } - } - - states: State { - name: "Selected" - when: delegateRoot.ListView.isCurrentItem == true - PropertyChanges { - target: image - scale: 1 - y: -5 - } - } - transitions: Transition { - NumberAnimation { properties: "scale,y" } - } - } - - Rectangle { - color: "#60FFFFFF" - x: -10; y: -10; z: -1 - width: parent.width + 20; height: parent.height + 20 - radius: 10 - } - } -} diff --git a/examples/declarative/modelviews/parallax/qml/Smiley.qml b/examples/declarative/modelviews/parallax/qml/Smiley.qml deleted file mode 100644 index c964f50..0000000 --- a/examples/declarative/modelviews/parallax/qml/Smiley.qml +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** 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 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 1.0 - -// This is taken from the declarative animation/basics/property-animation.qml -// example - -Item { - id: window - width: 320; height: 480 - - Image { - anchors.horizontalCenter: parent.horizontalCenter - y: smiley.minHeight + 58 - source: "../pics/shadow.png" - - scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight) - } - - Image { - id: smiley - property int maxHeight: window.height / 3 - property int minHeight: 2 * window.height / 3 - - anchors.horizontalCenter: parent.horizontalCenter - y: minHeight - source: "../pics/face-smile.png" - - SequentialAnimation on y { - loops: Animation.Infinite - - NumberAnimation { - from: smiley.minHeight; to: smiley.maxHeight - easing.type: Easing.OutExpo; duration: 300 - } - - NumberAnimation { - from: smiley.maxHeight; to: smiley.minHeight - easing.type: Easing.OutBounce; duration: 1000 - } - - PauseAnimation { duration: 500 } - } - } -} - diff --git a/examples/declarative/modelviews/parallax/qml/parallax/ParallaxView.qml b/examples/declarative/modelviews/parallax/qml/parallax/ParallaxView.qml new file mode 100644 index 0000000..9ad636f --- /dev/null +++ b/examples/declarative/modelviews/parallax/qml/parallax/ParallaxView.qml @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** 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 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 1.0 + +Item { + id: root + + property alias background: background.source + property int currentIndex: 0 + default property alias content: visualModel.children + + Image { + id: background + fillMode: Image.TileHorizontally + x: -list.contentX / 2 + width: Math.max(list.contentWidth, parent.width) + } + + ListView { + id: list + anchors.fill: parent + + currentIndex: root.currentIndex + onCurrentIndexChanged: root.currentIndex = currentIndex + + orientation: Qt.Horizontal + boundsBehavior: Flickable.DragOverBounds + model: VisualItemModel { id: visualModel } + + highlightRangeMode: ListView.StrictlyEnforceRange + snapMode: ListView.SnapOneItem + } + + ListView { + id: selector + + height: 50 + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + width: Math.min(count * 50, parent.width - 20) + interactive: width == parent.width - 20 + orientation: Qt.Horizontal + + currentIndex: root.currentIndex + onCurrentIndexChanged: root.currentIndex = currentIndex + + model: visualModel.children + delegate: Item { + width: 50; height: 50 + id: delegateRoot + + Image { + id: image + source: modelData.icon + smooth: true + scale: 0.8 + } + + MouseArea { + anchors.fill: parent + onClicked: { root.currentIndex = index } + } + + states: State { + name: "Selected" + when: delegateRoot.ListView.isCurrentItem == true + PropertyChanges { + target: image + scale: 1 + y: -5 + } + } + transitions: Transition { + NumberAnimation { properties: "scale,y" } + } + } + + Rectangle { + color: "#60FFFFFF" + x: -10; y: -10; z: -1 + width: parent.width + 20; height: parent.height + 20 + radius: 10 + } + } +} diff --git a/examples/declarative/modelviews/parallax/qml/parallax/Smiley.qml b/examples/declarative/modelviews/parallax/qml/parallax/Smiley.qml new file mode 100644 index 0000000..d866ea9 --- /dev/null +++ b/examples/declarative/modelviews/parallax/qml/parallax/Smiley.qml @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** 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 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 1.0 + +// This is taken from the declarative animation/basics/property-animation.qml +// example + +Item { + id: window + width: 320; height: 480 + + Image { + anchors.horizontalCenter: parent.horizontalCenter + y: smiley.minHeight + 58 + source: "pics/shadow.png" + + scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight) + } + + Image { + id: smiley + property int maxHeight: window.height / 3 + property int minHeight: 2 * window.height / 3 + + anchors.horizontalCenter: parent.horizontalCenter + y: minHeight + source: "pics/face-smile.png" + + SequentialAnimation on y { + loops: Animation.Infinite + + NumberAnimation { + from: smiley.minHeight; to: smiley.maxHeight + easing.type: Easing.OutExpo; duration: 300 + } + + NumberAnimation { + from: smiley.maxHeight; to: smiley.minHeight + easing.type: Easing.OutBounce; duration: 1000 + } + + PauseAnimation { duration: 500 } + } + } +} + diff --git a/examples/declarative/modelviews/parallax/qml/parallax/parallax.qml b/examples/declarative/modelviews/parallax/qml/parallax/parallax.qml new file mode 100644 index 0000000..c518910 --- /dev/null +++ b/examples/declarative/modelviews/parallax/qml/parallax/parallax.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** 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 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 1.0 +import "../../../../toys/clocks/content" // for loading the Clock element +//import "qml" + +Rectangle { + width: 320; height: 480 + + ParallaxView { + id: parallax + anchors.fill: parent + background: "pics/background.jpg" + + Item { + property url icon: "pics/yast-wol.png" + width: 320; height: 480 + Clock { anchors.centerIn: parent } + } + + Item { + property url icon: "pics/home-page.svg" + width: 320; height: 480 + Smiley { } + } + + Item { + property url icon: "pics/yast-joystick.png" + width: 320; height: 480 + + Loader { + anchors { top: parent.top; topMargin: 10; horizontalCenter: parent.horizontalCenter } + width: 300; height: 400 + clip: true; + source: "../../../../../../demos/declarative/samegame/samegame.qml" + Component.onCompleted: item.inAnotherDemo = true; + } + } + } +} diff --git a/examples/declarative/modelviews/parallax/qml/parallax/pics/background.jpg b/examples/declarative/modelviews/parallax/qml/parallax/pics/background.jpg new file mode 100644 index 0000000..61cca2f Binary files /dev/null and b/examples/declarative/modelviews/parallax/qml/parallax/pics/background.jpg differ diff --git a/examples/declarative/modelviews/parallax/qml/parallax/pics/face-smile.png b/examples/declarative/modelviews/parallax/qml/parallax/pics/face-smile.png new file mode 100644 index 0000000..3d66d72 Binary files /dev/null and b/examples/declarative/modelviews/parallax/qml/parallax/pics/face-smile.png differ diff --git a/examples/declarative/modelviews/parallax/qml/parallax/pics/home-page.svg b/examples/declarative/modelviews/parallax/qml/parallax/pics/home-page.svg new file mode 100644 index 0000000..4f16958 --- /dev/null +++ b/examples/declarative/modelviews/parallax/qml/parallax/pics/home-page.svg @@ -0,0 +1,445 @@ + +image/svg+xmlGo HomeJakub Steinerhttp://jimmac.musichall.czhomereturngodefaultuserdirectoryTuomas Kuosmanen + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/declarative/modelviews/parallax/qml/parallax/pics/shadow.png b/examples/declarative/modelviews/parallax/qml/parallax/pics/shadow.png new file mode 100644 index 0000000..8270565 Binary files /dev/null and b/examples/declarative/modelviews/parallax/qml/parallax/pics/shadow.png differ diff --git a/examples/declarative/modelviews/parallax/qml/parallax/pics/yast-joystick.png b/examples/declarative/modelviews/parallax/qml/parallax/pics/yast-joystick.png new file mode 100644 index 0000000..858cea0 Binary files /dev/null and b/examples/declarative/modelviews/parallax/qml/parallax/pics/yast-joystick.png differ diff --git a/examples/declarative/modelviews/parallax/qml/parallax/pics/yast-wol.png b/examples/declarative/modelviews/parallax/qml/parallax/pics/yast-wol.png new file mode 100644 index 0000000..7712180 Binary files /dev/null and b/examples/declarative/modelviews/parallax/qml/parallax/pics/yast-wol.png differ -- cgit v0.12