diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-05-31 15:25:44 +1000 |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-05-31 15:25:44 +1000 |
commit | 766521d62a4cf4598326a510186b080a91bde6dd (patch) | |
tree | 5cf89c1338f42122c370c649b73c8193ca079268 /demos | |
parent | a91b8a041966f8aea4bf01fdcb1d5006547f3902 (diff) | |
parent | e7fef9d6115d1a9193c112d8fd4249ae9396dae3 (diff) |
Merge branch 'qtquick2'
Conflicts:
demos/declarative/flickr/common/Progress.qml
demos/declarative/flickr/common/RssModel.qml
demos/declarative/flickr/common/ScrollBar.qml
demos/declarative/flickr/common/Slider.qml
demos/declarative/flickr/mobile/Button.qml
demos/declarative/flickr/mobile/GridDelegate.qml
demos/declarative/flickr/mobile/ImageDetails.qml
demos/declarative/flickr/mobile/ListDelegate.qml
demos/declarative/flickr/mobile/TitleBar.qml
demos/declarative/flickr/mobile/ToolBar.qml
demos/declarative/webbrowser/content/Button.qml
demos/declarative/webbrowser/content/FlickableWebView.qml
demos/declarative/webbrowser/content/Header.qml
demos/declarative/webbrowser/content/ScrollBar.qml
demos/declarative/webbrowser/content/UrlInput.qml
demos/declarative/webbrowser/webbrowser.qml
doc/src/snippets/declarative/mousearea/mousearea-snippet.qml
examples/declarative/modelviews/webview/newwindows/qml/alerts.html
examples/declarative/modelviews/webview/newwindows/qml/content/Mapping/map.html
examples/declarative/modelviews/webview/newwindows/qml/content/pics/cancel.png
examples/declarative/modelviews/webview/newwindows/qml/content/pics/ok.png
examples/declarative/modelviews/webview/newwindows/qml/newwindows.html
src/declarative/graphicsitems/qdeclarativetextinput.cpp
src/declarative/qml/qdeclarativecompiledbindings.cpp
src/declarative/qml/qdeclarativecompiledbindings_p.h
src/declarative/qml/qdeclarativedom.cpp
src/declarative/qml/qdeclarativedom_p.h
src/declarative/qml/qdeclarativedom_p_p.h
src/declarative/qml/qdeclarativeengine.cpp
src/declarative/qml/qdeclarativetypeloader.cpp
src/imports/particles/particles.cpp
tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp
tests/auto/declarative/qmlvisual/qdeclarativeflickable/data/flickable-horizontal.4.png
tests/auto/declarative/qmlvisual/qdeclarativepathview/data/test-pathview.6.png
tests/auto/declarative/qmlvisual/qdeclarativepositioners/data/usingRepeater.0.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.0.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.1.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.2.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.3.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.4.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.5.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.6.png
tests/auto/declarative/qmlvisual/qdeclarativespringanimation/data/follow.7.png
tests/auto/declarative/qmlvisual/qdeclarativetext/align/data-MAC/multilineAlign.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/align/data-X11/multilineAlign.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/baseline/data-X11/parentanchor.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/data-MAC/qtbug_14865.1.png
tests/auto/declarative/qmlvisual/qdeclarativetext/data-X11/qtbug_14865.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/data-X11/qtbug_14865.1.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/elide.1.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/elide2.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/elide2.1.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/multilength.1.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/multilength.2.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/multilength.3.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/multilength.4.png
tests/auto/declarative/qmlvisual/qdeclarativetext/elide/data-X11/multilength.5.png
tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-MAC/plaintext2.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-MAC/plaintext3.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-X11/plaintext.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-X11/plaintext2.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-X11/richtext.0.png
tests/auto/declarative/qmlvisual/qdeclarativetext/font/data-X11/richtext2.0.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.0.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.1.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.10.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.11.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.2.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.3.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.4.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.5.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.6.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.7.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.8.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/usingMultilineEdit.9.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/wrap.0.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/wrap.1.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/wrap.2.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/wrap.3.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/wrap.4.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/wrap.5.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-MAC/wrap.6.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/qt-669.0.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/qt-669.1.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/qt-669.2.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/qt-669.3.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/qt-669.4.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/usingMultilineEdit.10.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/usingMultilineEdit.11.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/usingMultilineEdit.12.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/usingMultilineEdit.7.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/usingMultilineEdit.9.png
tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/wrap.7.png
tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-MAC/echoMode.0.png
tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-MAC/echoMode.1.png
tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-MAC/echoMode.2.png
tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.11.png
tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
Change-Id: I40df8a9403a58a6c03a0f1734f16a5cbed6c85ff
Diffstat (limited to 'demos')
82 files changed, 3152 insertions, 979 deletions
diff --git a/demos/declarative/flickr/common/Progress.qml b/demos/declarative/flickr/common/Progress.qml deleted file mode 100644 index 2d584f6035..0000000000 --- a/demos/declarative/flickr/common/Progress.qml +++ /dev/null @@ -1,73 +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 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 - -Item { - property variant progress: 0 - - Rectangle { - anchors.fill: parent; smooth: true - border.color: "white"; border.width: 0; radius: height/2 - 2 - gradient: Gradient { - GradientStop { position: 0; color: "#66343434" } - GradientStop { position: 1.0; color: "#66000000" } - } - } - - Rectangle { - y: 2; height: parent.height-4; - x: 2; width: Math.max(parent.width * progress - 4, 0); - opacity: width < 1 ? 0 : 1; smooth: true - gradient: Gradient { - GradientStop { position: 0; color: "lightsteelblue" } - GradientStop { position: 1.0; color: "steelblue" } - } - radius: height/2 - 2 - } - - Text { - text: Math.round(progress * 100) + "%" - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - color: "white"; font.bold: true; font.pixelSize: 15 - } -} diff --git a/demos/declarative/flickr/mobile/Button.qml b/demos/declarative/flickr/content/Button.qml index 35364ede7d..7285753a0a 100644 --- a/demos/declarative/flickr/mobile/Button.qml +++ b/demos/declarative/flickr/content/Button.qml @@ -7,29 +7,29 @@ ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** ** 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. +** Alternatively, 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 +** 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. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** ** -** 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. ** ** ** @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Item { id: container diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/content/GridDelegate.qml index dc39e88cf0..5b7af23ea0 100644 --- a/demos/declarative/flickr/mobile/GridDelegate.qml +++ b/demos/declarative/flickr/content/GridDelegate.qml @@ -7,29 +7,29 @@ ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** ** 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. +** Alternatively, 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 +** 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. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** ** -** 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. ** ** ** @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Item { id: wrapper; width: GridView.view.cellWidth; height: GridView.view.cellHeight diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/content/ImageDetails.qml index 3a290fccf9..62c3397f08 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/content/ImageDetails.qml @@ -7,29 +7,29 @@ ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** ** 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. +** Alternatively, 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 +** 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. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** ** -** 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. ** ** ** @@ -39,8 +39,8 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import "../common" as Common +import QtQuick 2.0 +import Qt.labs.particles 2.0 Flipable { id: container @@ -95,7 +95,7 @@ Flipable { Rectangle { anchors.fill: parent; color: "black"; opacity: 0.4 } - Common.Progress { + Progress { anchors.centerIn: parent; width: 200; height: 22 progress: bigImage.progress; visible: bigImage.status != Image.Ready } @@ -126,7 +126,6 @@ Flipable { id: imageContainer width: Math.max(bigImage.width * bigImage.scale, flickable.width); height: Math.max(bigImage.height * bigImage.scale, flickable.height); - Image { id: bigImage; source: container.photoUrl; scale: slider.value anchors.centerIn: parent; smooth: !flickable.movingVertically @@ -137,7 +136,96 @@ Flipable { prevScale = Math.min(slider.minimum, 1); slider.value = prevScale; } + if (inBackState && bigImage.status == Image.Ready) + particleBox.imageInAnim(); + } + property bool inBackState: false + onInBackStateChanged:{ + if(inBackState && bigImage.status == Image.Ready) + particleBox.imageInAnim(); + else if (!inBackState && bigImage.status == Image.Ready) + particleBox.imageOutAnim(); + } + } + + Item{ + id: particleBox + width: bigImage.width * bigImage.scale + height: bigImage.height * bigImage.scale + anchors.centerIn: parent + + function imageInAnim(){ + cp.visible = true; + pixAffect.onceOff = false; + bigImage.visible = false; + endEffectTimer.start(); + pixelEmitter.pulse(1); + } + function imageOutAnim(){ + cp.visible = true; + pixAffect.onceOff = true; + bigImage.visible = false; + turbulence.active = true; + endEffectTimer.start(); + pixelEmitter.burst(2048); } + Timer{ + id: endEffectTimer + interval: 1000 + repeat: false + running: false + onTriggered:{ + bigImage.visible = true; + turbulence.active = false; + cp.visible = false; + } + } + ParticleSystem{ + id: imageSystem + } + ColoredParticle{ + id: cp + system: imageSystem + color: "gray" + alpha: 1 + image: "images/squareParticle.png" + colorVariation: 0 + } + Picture{ + id: pixAffect + system: imageSystem + anchors.fill: parent + image: container.photoUrl; + onceOff: true + } + Turbulence{ + id: turbulence + system: imageSystem + anchors.fill: parent + frequency: 100 + strength: 250 + active: false + } + TrailEmitter{ + id: pixelEmitter0 + system: imageSystem + height: parent.height + particleSize: 4 + particleDuration: 1000 + particlesPerSecond: 4096 + speed: PointVector{x: 360; xVariation: 8; yVariation: 4} + emitting: false + } + TrailEmitter{ + id: pixelEmitter + system: imageSystem + anchors.fill: parent + particleSize: 4 + particleDuration: 1000 + particlesPerSecond: 2048 + emitting: false + } + } } } @@ -148,7 +236,7 @@ Flipable { anchors.centerIn: parent; color: "white"; font.bold: true } - Common.Slider { + Slider { id: slider; visible: { bigImage.status == Image.Ready && maximum > minimum } anchors { bottom: parent.bottom; bottomMargin: 65 @@ -174,12 +262,13 @@ Flipable { PropertyChanges { target: itemRotation; angle: 180 } PropertyChanges { target: toolBar; button2Visible: false } PropertyChanges { target: toolBar; button1Label: "Back" } + PropertyChanges { target: bigImage; inBackState: true } } transitions: Transition { SequentialAnimation { PropertyAction { target: bigImage; property: "smooth"; value: false } - NumberAnimation { easing.type: Easing.InOutQuad; properties: "angle"; duration: 500 } + NumberAnimation { easing.type: Easing.InOutQuad; properties: "angle"; duration: 1000 } PropertyAction { target: bigImage; property: "smooth"; value: !flickable.movingVertically } } } diff --git a/demos/declarative/flickr/mobile/ListDelegate.qml b/demos/declarative/flickr/content/ListDelegate.qml index 17453c0186..b65704867b 100644 --- a/demos/declarative/flickr/mobile/ListDelegate.qml +++ b/demos/declarative/flickr/content/ListDelegate.qml @@ -7,29 +7,29 @@ ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** ** 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. +** Alternatively, 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 +** 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. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** ** -** 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. ** ** ** @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Component { Item { diff --git a/demos/declarative/flickr/content/Progress.qml b/demos/declarative/flickr/content/Progress.qml new file mode 100644 index 0000000000..d403feebd1 --- /dev/null +++ b/demos/declarative/flickr/content/Progress.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Item{ + id: container + property variant progress: 0 + + Rectangle { + anchors.fill: parent; smooth: true + border.color: "white"; border.width: 0; radius: height/2 - 2 + gradient: Gradient { + GradientStop { position: 0; color: "#66343434" } + GradientStop { position: 1.0; color: "#66000000" } + } + } + + ParticleSystem{ + running: container.visible + id: barSys + } + ColoredParticle{ + color: "lightsteelblue" + alpha: 0.1 + colorVariation: 0.05 + image: "images/particle.png" + system: barSys + } + TrailEmitter{ + y: 2; height: parent.height-4; + x: 2; width: Math.max(parent.width * progress - 4, 0); + speed: AngleVector{ angleVariation: 180; magnitudeVariation: 12 } + system: barSys + particlesPerSecond: width; + particleDuration: 1000 + particleSize: 20 + particleSizeVariation: 4 + particleEndSize: 12 + maxParticles: parent.width; + } + + Text { + text: Math.round(progress * 100) + "%" + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + color: Qt.rgba(1.0, 1.0 - progress, 1.0 - progress,0.9); font.bold: true; font.pixelSize: 15 + } +} diff --git a/demos/declarative/flickr/common/RssModel.qml b/demos/declarative/flickr/content/RssModel.qml index 069918ecae..007f086830 100644 --- a/demos/declarative/flickr/common/RssModel.qml +++ b/demos/declarative/flickr/content/RssModel.qml @@ -7,29 +7,29 @@ ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** ** 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. +** Alternatively, 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 +** 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. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** ** -** 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. ** ** ** @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 XmlListModel { property string tags : "" diff --git a/demos/declarative/flickr/common/ScrollBar.qml b/demos/declarative/flickr/content/ScrollBar.qml index d100f125d7..7d2d9ff7d3 100644 --- a/demos/declarative/flickr/common/ScrollBar.qml +++ b/demos/declarative/flickr/content/ScrollBar.qml @@ -7,29 +7,29 @@ ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** ** 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. +** Alternatively, 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 +** 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. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** ** -** 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. ** ** ** @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Item { id: container diff --git a/demos/declarative/flickr/common/Slider.qml b/demos/declarative/flickr/content/Slider.qml index f821f1169b..b4a2960ac8 100644 --- a/demos/declarative/flickr/common/Slider.qml +++ b/demos/declarative/flickr/content/Slider.qml @@ -7,29 +7,29 @@ ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** ** 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. +** Alternatively, 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 +** 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. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** ** -** 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. ** ** ** @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Item { id: slider; width: 400; height: 16 diff --git a/demos/declarative/flickr/content/StreamView.qml b/demos/declarative/flickr/content/StreamView.qml new file mode 100644 index 0000000000..26a3f35e63 --- /dev/null +++ b/demos/declarative/flickr/content/StreamView.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Item{ + id: container + property alias model: mp.model + property alias delegate: mp.delegate + property bool jumpStarted: false + ParticleSystem{ + id: sys + anchors.fill:parent + overwrite: false + } + DataParticle{ + id: mp + fade: false + system: sys + anchors.fill: parent + onModelCountChanged: { + if(!jumpStarted && modelCount > 0){ + console.log("Jumping"); + jumpStarted = true; + sys.fastForward(8000); + } + } + } + property real emitterSpacing: parent.width/3 + TrailEmitter{ + system: sys + width: emitterSpacing - 64 + x: emitterSpacing*0 + 32 + y: -128 + height: 32 + speed: PointVector{ y: (container.height + 128)/12 } + particlesPerSecond: 0.4 + particleDuration: 1000000//eventually -1 should mean a million seconds for neatness + maxParticles: 15 + } + TrailEmitter{ + system: sys + width: emitterSpacing - 64 + x: emitterSpacing*1 + 32 + y: -128 + height: 32 + speed: PointVector{ y: (container.height + 128)/12 } + particlesPerSecond: 0.4 + particleDuration: 1000000//eventually -1 should mean a million seconds for neatness + maxParticles: 15 + } + TrailEmitter{ + system: sys + width: emitterSpacing - 64 + x: emitterSpacing*2 + 32 + y: -128 + height: 32 + speed: PointVector{ y: (container.height + 128)/12 } + particlesPerSecond: 0.4 + particleDuration: 1000000//eventually -1 should mean a million seconds for neatness + maxParticles: 15 + } + Kill{ + system: sys + y: container.height + 64 + width: container.width + height: 6400 + } +} diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/content/TitleBar.qml index 7facea1838..381d252ed3 100644 --- a/demos/declarative/flickr/mobile/TitleBar.qml +++ b/demos/declarative/flickr/content/TitleBar.qml @@ -7,29 +7,29 @@ ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** ** 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. +** Alternatively, 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 +** 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. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** ** -** 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. ** ** ** @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Item { id: titleBar diff --git a/demos/declarative/flickr/mobile/ToolBar.qml b/demos/declarative/flickr/content/ToolBar.qml index c4ff4fcfc6..ca5341e101 100644 --- a/demos/declarative/flickr/mobile/ToolBar.qml +++ b/demos/declarative/flickr/content/ToolBar.qml @@ -7,29 +7,29 @@ ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** ** 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. +** Alternatively, 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 +** 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. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** ** -** 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. ** ** ** @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Item { id: toolbar diff --git a/demos/declarative/flickr/content/UnifiedDelegate.qml b/demos/declarative/flickr/content/UnifiedDelegate.qml new file mode 100644 index 0000000000..aaf4ccbd7a --- /dev/null +++ b/demos/declarative/flickr/content/UnifiedDelegate.qml @@ -0,0 +1,162 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Package { + function photoClicked() { + imageDetails.photoTitle = title; + imageDetails.photoTags = tags; + imageDetails.photoWidth = photoWidth; + imageDetails.photoHeight = photoHeight; + imageDetails.photoType = photoType; + imageDetails.photoAuthor = photoAuthor; + imageDetails.photoDate = photoDate; + imageDetails.photoUrl = url; + imageDetails.rating = 0; + scaleMe.state = "Details"; + } + + Item { + id: gridwrapper; + width: GridView.view.cellWidth; height: GridView.view.cellHeight + Package.name: "grid" + } + Item { + id: streamwrapper; + width: 80; height: 80 + Package.name: "stream" + function pleaseFreeze(){ + ModelParticle.particle.freeze(streamwrapper); + } + function pleaseUnfreeze(){ + ModelParticle.particle.unfreeze(streamwrapper); + } + } + Item { + //anchors.centerIn: parent//Doesn't animate :( + width: 80; height: 80 + scale: 0.0 + Behavior on scale { NumberAnimation { easing.type: Easing.InOutQuad} } + id: scaleMe + + Item { + id: whiteRectContainer + width: 77; height: 77; anchors.centerIn: parent + Rectangle { + id: whiteRect; width: 77; height: 77; color: "#dddddd"; smooth: true + x:0; y:0 + Image { id: thumb; source: imagePath; x: 1; y: 1; smooth: true } + Image { source: "images/gloss.png" } + MouseArea { anchors.fill: parent; onClicked: photoClicked() } + } + } + + Connections { + target: toolBar + onButton2Clicked: if (scaleMe.state == 'Details' ) scaleMe.state = 'Show' + } + + state: 'inStream' + states: [ + State { + name: "Show"; when: thumb.status == Image.Ready + PropertyChanges { target: scaleMe; scale: 1; } + }, + State { + name: "Details" + PropertyChanges { target: scaleMe; scale: 1 } + ParentChange { target: whiteRect; x: 10; y: 20; parent: imageDetails.frontContainer } + PropertyChanges { target: background; state: "DetailedView" } + } + ] + transitions: [ + Transition { + from: "Show"; to: "Details" + ScriptAction{ script: streamwrapper.pleaseFreeze(); } + ParentAnimation { + via: foreground + NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } + } + }, + Transition { + from: "Details"; to: "Show" + SequentialAnimation{ + ParentAnimation { + via: foreground + NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } + } + ScriptAction{ script: streamwrapper.pleaseUnfreeze(); } + } + } + ] + Item{ + id: stateContainer + states: [ + State { + name: 'inStream' + when: screen.inGridView == false + ParentChange { + target: scaleMe; parent: streamwrapper + x: 0; y: 0; + } + }, + State { + name: 'inGrid' + when: screen.inGridView == true + ParentChange { + target: scaleMe; parent: gridwrapper + x: 0; y: 0; + } + } + ] + + transitions: [ + Transition { + ParentAnimation { + NumberAnimation { target: scaleMe; properties: 'x,y,width,height'; duration: 300 } + } + } + ] + } + } +} diff --git a/demos/declarative/flickr/mobile/images/gloss.png b/demos/declarative/flickr/content/images/gloss.png Binary files differindex 5d370cd93d..5d370cd93d 100644 --- a/demos/declarative/flickr/mobile/images/gloss.png +++ b/demos/declarative/flickr/content/images/gloss.png diff --git a/demos/declarative/flickr/mobile/images/lineedit.png b/demos/declarative/flickr/content/images/lineedit.png Binary files differindex 2cc38dc35b..2cc38dc35b 100644 --- a/demos/declarative/flickr/mobile/images/lineedit.png +++ b/demos/declarative/flickr/content/images/lineedit.png diff --git a/demos/declarative/flickr/mobile/images/lineedit.sci b/demos/declarative/flickr/content/images/lineedit.sci index 054bff78be..054bff78be 100644 --- a/demos/declarative/flickr/mobile/images/lineedit.sci +++ b/demos/declarative/flickr/content/images/lineedit.sci diff --git a/demos/declarative/flickr/content/images/particle.png b/demos/declarative/flickr/content/images/particle.png Binary files differnew file mode 100644 index 0000000000..dbc39cb16e --- /dev/null +++ b/demos/declarative/flickr/content/images/particle.png diff --git a/demos/declarative/flickr/mobile/images/quit.png b/demos/declarative/flickr/content/images/quit.png Binary files differindex 5bda1b6e0d..5bda1b6e0d 100644 --- a/demos/declarative/flickr/mobile/images/quit.png +++ b/demos/declarative/flickr/content/images/quit.png diff --git a/demos/declarative/flickr/content/images/squareParticle.png b/demos/declarative/flickr/content/images/squareParticle.png Binary files differnew file mode 100644 index 0000000000..faf85c24e0 --- /dev/null +++ b/demos/declarative/flickr/content/images/squareParticle.png diff --git a/demos/declarative/flickr/mobile/images/stripes.png b/demos/declarative/flickr/content/images/stripes.png Binary files differindex 9f36727ea4..9f36727ea4 100644 --- a/demos/declarative/flickr/mobile/images/stripes.png +++ b/demos/declarative/flickr/content/images/stripes.png diff --git a/demos/declarative/flickr/mobile/images/titlebar.png b/demos/declarative/flickr/content/images/titlebar.png Binary files differindex 51c90082d0..51c90082d0 100644 --- a/demos/declarative/flickr/mobile/images/titlebar.png +++ b/demos/declarative/flickr/content/images/titlebar.png diff --git a/demos/declarative/flickr/mobile/images/titlebar.sci b/demos/declarative/flickr/content/images/titlebar.sci index 0418d94cd6..0418d94cd6 100644 --- a/demos/declarative/flickr/mobile/images/titlebar.sci +++ b/demos/declarative/flickr/content/images/titlebar.sci diff --git a/demos/declarative/flickr/mobile/images/toolbutton.png b/demos/declarative/flickr/content/images/toolbutton.png Binary files differindex 11310013ee..11310013ee 100644 --- a/demos/declarative/flickr/mobile/images/toolbutton.png +++ b/demos/declarative/flickr/content/images/toolbutton.png diff --git a/demos/declarative/flickr/mobile/images/toolbutton.sci b/demos/declarative/flickr/content/images/toolbutton.sci index 9e4f965307..9e4f965307 100644 --- a/demos/declarative/flickr/mobile/images/toolbutton.sci +++ b/demos/declarative/flickr/content/images/toolbutton.sci diff --git a/demos/declarative/flickr/common/qmldir b/demos/declarative/flickr/content/qmldir index adc2479b9f..adc2479b9f 100644 --- a/demos/declarative/flickr/common/qmldir +++ b/demos/declarative/flickr/content/qmldir diff --git a/demos/declarative/flickr/flickr-90.qml b/demos/declarative/flickr/flickr-90.qml index df6828d35e..ce22d8a3a9 100644 --- a/demos/declarative/flickr/flickr-90.qml +++ b/demos/declarative/flickr/flickr-90.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Item { width: 480; height: 320 diff --git a/demos/declarative/flickr/flickr.qml b/demos/declarative/flickr/flickr.qml index 171964035c..40e1bae683 100644 --- a/demos/declarative/flickr/flickr.qml +++ b/demos/declarative/flickr/flickr.qml @@ -39,21 +39,62 @@ ** ****************************************************************************/ -import QtQuick 1.0 -import "common" as Common -import "mobile" as Mobile +import QtQuick 2.0 +import Qt.labs.particles 2.0 +import "content" Item { id: screen; width: 320; height: 480 - property bool inListView : false + property bool inGridView : false Rectangle { id: background anchors.fill: parent; color: "#343434"; - Image { source: "mobile/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } + Image { source: "content/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } + ParticleSystem { + id: bgParticles + startTime: 16000 + } + ColoredParticle { + particles: ["trail"] + image: "content/images/particle.png" + color: "#1A1A6F" + alpha: 0.1 + colorVariation: 0.01 + blueVariation: 0.8 + system: bgParticles + } + TrailEmitter { + particle: "drops" + width: parent.width + particlesPerSecond: 0.5 + particleDuration: 20000 + speed: PointVector{ + y: {screen.height/18} + } + system: bgParticles + } + FollowEmitter { + follow: "drops" + particle: "trail" + particlesPerParticlePerSecond: 18 + particleSize: 32 + particleEndSize: 0 + particleSizeVariation: 4 + particleDuration: 1200 + system: bgParticles + anchors.fill: parent + emissionWidth: 16 + emissionHeight: 16 + emissionShape: Ellipse{} + } - Common.RssModel { id: rssModel } + VisualDataModel{ + id: vdm + delegate: UnifiedDelegate{} + model: RssModel { id: rssModel } + } Item { id: views @@ -61,39 +102,38 @@ Item { anchors.top: titleBar.bottom; anchors.bottom: toolBar.top GridView { - id: photoGridView; model: rssModel; delegate: Mobile.GridDelegate {} + id: photoGridView; model: vdm.parts.grid cacheBuffer: 1000 cellWidth: (parent.width-2)/4; cellHeight: cellWidth; width: parent.width; height: parent.height } - ListView { - id: photoListView; model: rssModel; delegate: Mobile.ListDelegate { } - width: parent.width; height: parent.height; x: -(parent.width * 1.5); cacheBuffer: 100; + StreamView{ + id: photoStreamView + model: vdm.parts.stream + width: parent.width; height: parent.height } states: State { - name: "ListView"; when: screen.inListView == true - PropertyChanges { target: photoListView; x: 0 } - PropertyChanges { target: photoGridView; x: -(parent.width * 1.5) } + name: "GridView"; when: screen.inGridView == true } transitions: Transition { NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad } } - Mobile.ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height } + ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height } Item { id: foreground; anchors.fill: parent } } - Mobile.TitleBar { id: titleBar; width: parent.width; height: 40; opacity: 0.9 } + TitleBar { id: titleBar; width: parent.width; height: 40; opacity: 0.9 } - Mobile.ToolBar { + ToolBar { id: toolBar height: 40; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9 button1Label: "Update"; button2Label: "View mode" onButton1Clicked: rssModel.reload() - onButton2Clicked: if (screen.inListView == true) screen.inListView = false; else screen.inListView = true + onButton2Clicked: if (screen.inGridView == true) screen.inGridView = false; else screen.inGridView = true } Connections { @@ -121,5 +161,6 @@ Item { transitions: Transition { NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad } } + } } diff --git a/demos/declarative/webbrowser/webbrowser.qmlproject b/demos/declarative/plasmapatrol/PlasmaPatrol.qmlproject index d4909f8685..53f5ecb8d2 100644 --- a/demos/declarative/webbrowser/webbrowser.qmlproject +++ b/demos/declarative/plasmapatrol/PlasmaPatrol.qmlproject @@ -1,3 +1,5 @@ +/* File generated by QtCreator */ + import QmlProject 1.0 Project { @@ -12,5 +14,5 @@ Project { directory: "." } /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] + // importPaths: [ "../exampleplugin" ] } diff --git a/demos/declarative/plasmapatrol/TODO b/demos/declarative/plasmapatrol/TODO new file mode 100644 index 0000000000..ef9d21a73d --- /dev/null +++ b/demos/declarative/plasmapatrol/TODO @@ -0,0 +1,10 @@ +Realistic Tasks: +Particle explosions on ship death. +Better help text (both content and styled a little nicer). +Hardpoint help showing them firing across the screen. +Endless Demo Mode + +Nice-but-i-doubt-it-will-get-done Tasks: +Particle Text for the winner. +Particle-based buttons. +Single player mode that is challenges (known opponents) to master the game with and earn achievements (in addition to 'skirmish'). diff --git a/demos/declarative/plasmapatrol/content/BlasterHardpoint.qml b/demos/declarative/plasmapatrol/content/BlasterHardpoint.qml new file mode 100644 index 0000000000..8d36cdfb13 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/BlasterHardpoint.qml @@ -0,0 +1,133 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Item { + id: container + property variant target: {"y": -90, "x":12} + property Item targetObj: container + property Item hardpoint: container + property ParticleSystem system + property int blasts: 16 + property int bonusBlasts: 12 + property bool show: true + + width: 24 + height: 24 + TrailEmitter{ + id: visualization + particle: "blaster" + system: container.system + emitting: show + anchors.fill: parent + shape: Ellipse{} + speed: DirectedVector{ targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true} + particleDuration: 1000 + particlesPerSecond: 64 + + particleSize: 24 + particleSizeVariation: 24 + particleEndSize: 0 + } + + property int blastsLeft: 0 + function fireAt(targetArg, container){ + target = container.mapFromItem(targetArg, targetArg.width/2, targetArg.height/2); + targetObj = targetArg; + hardpoint = container; + blastsLeft = blasts; + rofTimer.repeat = true; + rofTimer.start(); + } + Timer{ + id: rofTimer + interval: 30;//Has to be greater than 1 frame or they stack up + running: false + repeat: false + onTriggered:{ + if(targetObj.hp <= 0) + return; + //TODO: calculate hit and damage at target, which must be a Ship + var hit; + if(blastsLeft >= bonusBlasts) + hit = Math.random() > targetObj.dodge; + else + hit = false; //purely aesthetic shots, because the damage isn't that fine grained + if(hit == true){ + switch(targetObj.shipType){ + case 1: hardpoint.damageDealt += 4; break; + case 2: hardpoint.damageDealt += 5; break; + case 3: hardpoint.damageDealt += 1; break; + default: hardpoint.damageDealt += 100; + } + } + blastVector.targetX = target.x; + blastVector.targetY = target.y; + if(!hit){//TODO: Actual targetVariation + blastVector.targetX += (128 * Math.random() - 64); + blastVector.targetY += (128 * Math.random() - 64); + } + emitter.burst(1); + blastsLeft--; + if(!blastsLeft) + rofTimer.repeat = false; + } + } + TrailEmitter{ + id: emitter + particle: "blaster" + emitting: false + system: container.system + anchors.centerIn: parent + + particleDuration: 1000 + particlesPerSecond: 16 + maxParticles: blasts + particleSize: 24 + particleEndSize:16 + particleSizeVariation: 8 + speed: DirectedVector{ + id: blastVector + targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true + } + } +} diff --git a/demos/declarative/plasmapatrol/content/Button.qml b/demos/declarative/plasmapatrol/content/Button.qml new file mode 100644 index 0000000000..0d810e3b75 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/Button.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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 + +//TODO: Add particles to this component too +Rectangle{ + id: container + property alias text: txt.text + signal clicked + //color: "lightsteelblue" + gradient: Gradient{ + GradientStop{ position: 0.0; color: "lightsteelblue" } + GradientStop{ position: 1.0; color: "steelblue" } + } + height: 64 + radius: 16 + width: 128 + Text{ + id: txt + anchors.centerIn: parent + font.pixelSize: 24 + color: "white" + } + MouseArea{ + anchors.fill: parent + onClicked: container.clicked() + } +} diff --git a/demos/declarative/plasmapatrol/content/CannonHardpoint.qml b/demos/declarative/plasmapatrol/content/CannonHardpoint.qml new file mode 100644 index 0000000000..d9a307cc64 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/CannonHardpoint.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Item { + id: container + property variant target: {"y": -90, "x":12} + property ParticleSystem system + property bool show: true + + width: 24 + height: 24 + TrailEmitter{ + id: visualization + particle: "cannon" + emitting: container.show + system: container.system + anchors.centerIn: parent + particleDuration: 2000 + particlesPerSecond: 1 + + particleSize: 4 + particleEndSize: 0 + } + + function fireAt(targetArg, hardpoint){ + target = container.mapFromItem(targetArg, targetArg.width/2, targetArg.height/2); + if(container.hp <= 0 || targetArg.hp <= 0) + return; + //TODO: calculate hit and damage at target, which must be a Ship + var hit = Math.random() > targetArg.dodge + if(hit){ + switch(targetArg.shipType){ + case 1: hardpoint.damageDealt += 8; break; + case 2: hardpoint.damageDealt += 10; break; + case 3: hardpoint.damageDealt += 16; break; + default: hardpoint.damageDealt += 1000; + } + } + emitter.burst(1); + } + TrailEmitter{ + id: emitter + particle: "cannon" + emitting: false + system: container.system + anchors.centerIn: parent + + particleDuration: 1000 + particlesPerSecond: 1 + particleSize: 8 + particleEndSize: 4 + speed: DirectedVector{ + id: blastVector + targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true + } + } +} diff --git a/demos/declarative/plasmapatrol/content/ChoiceBox.qml b/demos/declarative/plasmapatrol/content/ChoiceBox.qml new file mode 100644 index 0000000000..6bdc4288ee --- /dev/null +++ b/demos/declarative/plasmapatrol/content/ChoiceBox.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Item{ + id: container + width: 360 + height: 160 + property ParticleSystem system + Ship{ + id: nully + system: system + } + property Item target: nully + /* + Component.onCompleted:{ + container.target.shipType = 1 + container.target.gunType = 1 + } + */ + Row{ + anchors.horizontalCenter: parent.horizontalCenter + height: parent.height + spacing: 8 + Button{ + width: 80 + height: 80 + anchors.verticalCenter: parent.verticalCenter + text: "Cycle\nShip" + onClicked: { + var nextVal = container.target.shipType; + if(nextVal == 3) + nextVal = 1; + else + nextVal++; + container.target.shipType = nextVal; + } + } + Item{ + width: 128 + height: 128 + anchors.verticalCenter: parent.verticalCenter + Ship{ + hp: 20 + anchors.centerIn: parent + shipType: container.target.shipType + gunType: container.target.gunType + system: container.system + } + } + Button{ + width: 80 + height: 80 + anchors.verticalCenter: parent.verticalCenter + text: "Cycle\nGun" + onClicked: { + var nextVal = container.target.gunType; + if(nextVal == 3) + nextVal = 1; + else + nextVal++; + container.target.gunType = nextVal; + } + } + } +} diff --git a/demos/declarative/plasmapatrol/content/Cruiser.qml b/demos/declarative/plasmapatrol/content/Cruiser.qml new file mode 100644 index 0000000000..8b8073328e --- /dev/null +++ b/demos/declarative/plasmapatrol/content/Cruiser.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Item { + id: container + property int maxHP: 100 + property int hp: maxHP + property real initialDodge: 0.01 + property real dodge: initialDodge + onHpChanged: if(hp <= 0) target = container; + property ParticleSystem system//TODO: Ship abstraction + property Item target: container + property string shipParticle: "default"//Per team colors? + property int gunType: 0 + width: 128 + height: 128 + TrailEmitter{ + //TODO: Cooler would be an 'orbiting' affector + //TODO: On the subject, opacity and size should be grouped type 'overLife' if we can cram that in the particles + system: container.system + particle: container.shipParticle + anchors.centerIn: parent + width: 64 + height: 64 + shape: Ellipse{} + + particlesPerSecond: hp > 0 ? hp * 1 + 20 : 0 + particleDuration: 2400 + maxParticles: (maxHP * 1 + 20)*2.4 + + particleSize: 48 + particleSizeVariation: 16 + particleEndSize: 16 + + speed: AngleVector{angleVariation:360; magnitudeVariation: 32} + } + TrailEmitter{ + system: container.system + particle: "cruiserArmor" + anchors.fill: parent + shape: Ellipse{ fill: false } + emitting: hp>0 + + particlesPerSecond: 16 + particleDuration: 2000 + + particleSize: 48 + particleSizeVariation: 24 + + SpriteGoal{ + id: destructor + system: container.system + active: container.hp <=0 + anchors.fill: parent + particles: ["cruiserArmor"] + goalState: "death" +// jump: true + onceOff: true + } + } + + Timer{ + id: fireControl + property int next: Math.floor(Math.random() * 3) + 1 + interval: 800 + running: root.readySetGo + repeat: true + onTriggered:{ + if(next == 1){ + gun1.fireAt(container.target); + next = Math.floor(Math.random() * 3) + 1; + }else if(next == 2){ + gun2.fireAt(container.target); + next = Math.floor(Math.random() * 3) + 1; + }else if(next == 3){ + gun3.fireAt(container.target); + next = Math.floor(Math.random() * 3) + 1; + } + } + } + + Hardpoint{//TODO: Hardpoint abstraction + x: 112 - 12 - 8*2 + y: 128 - 12 - 12*2 + id: gun1 + system: container.system + show: hp > 0 + hardpointType: gunType + } + Hardpoint{ + x: 64 - 12 + y: 0 - 12 + 12*2 + id: gun2 + system: container.system + show: hp > 0 + hardpointType: gunType + } + Hardpoint{ + x: 16 - 12 + 8*2 + y: 128 - 12 - 12*2 + id: gun3 + system: container.system + show: hp > 0 + hardpointType: gunType + } +} diff --git a/demos/declarative/plasmapatrol/content/Frigate.qml b/demos/declarative/plasmapatrol/content/Frigate.qml new file mode 100644 index 0000000000..54f629268f --- /dev/null +++ b/demos/declarative/plasmapatrol/content/Frigate.qml @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Item { + id: container + property int maxHP: 100 + property int hp: maxHP + property real initialDodge: 0.2 + property real dodge: initialDodge + onHpChanged: if(hp <= 0) target = container; + property ParticleSystem system//TODO: Ship abstraction + property Item target: container + property string shipParticle: "default"//Per team colors? + property int gunType: 0 + width: 128 + height: 128 + TrailEmitter{ + system: container.system + particle: "frigateShield" + anchors.centerIn: parent + particleSize: 92 + particlesPerSecond: 1 + particleDuration: 4800 + emitting: hp > 0 + } + TrailEmitter{ + system: container.system + particle: container.shipParticle + anchors.centerIn: parent + width: 64 + height: 16 + shape: Ellipse{} + + particleSize: 16 + particleSizeVariation: 8 + particleEndSize: 8 + particlesPerSecond: hp > 0 ? hp * 1 + 20 : 0 + particleDuration: 1200 + maxParticles: (maxHP * 1 + 20)*2 + } + Timer{ + id: fireControl + property int next: Math.floor(Math.random() * 2) + 1 + interval: 800 + running: root.readySetGo + repeat: true + onTriggered:{ + if(next == 1){ + gun1.fireAt(container.target); + next = Math.floor(Math.random() * 2) + 1; + }else if(next == 2){ + gun2.fireAt(container.target); + next = Math.floor(Math.random() * 2) + 1; + } + } + } + + Hardpoint{ + x: 128 - 32 - 12 + y: 64 - 12 + id: gun1 + system: container.system + show: hp > 0 + hardpointType: gunType + } + Hardpoint{ + x: 0 + 32 - 12 + y: 64 - 12 + id: gun2 + system: container.system + show: hp > 0 + hardpointType: gunType + } +} diff --git a/demos/declarative/plasmapatrol/content/Hardpoint.qml b/demos/declarative/plasmapatrol/content/Hardpoint.qml new file mode 100644 index 0000000000..184c750a79 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/Hardpoint.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Item { + id: container + //ReflectiveProperties + //TransferredProperties + property variant target: {"y": -90, "x":12} + property ParticleSystem system + property bool show: true + property int hardpointType: 0 //default is pea shooter - always bad. + + property Item targetObj: null + property int damageDealt: 0 + onDamageDealtChanged: dealDamageTimer.start(); + Timer{ + id: dealDamageTimer + interval: 16 + running: false + repeat: false + onTriggered: {targetObj.hp -= damageDealt; damageDealt = 0;} + } + width: 24 + height: 24 + function fireAt(targetArg){//Each implement own + if(targetArg != null){ + hardpointLoader.item.fireAt(targetArg, container); + targetObj = targetArg; + } + } + Loader{ + id: hardpointLoader + sourceComponent: {switch(hardpointType){ + case 1: laserComponent; break; + case 2: blasterComponent; break; + case 3: cannonComponent; break; + default: emptyComponent; + }} + } + Component{ + id: laserComponent + LaserHardpoint{ + target: container.target + system: container.system + show: container.show + } + } + Component{ + id: blasterComponent + BlasterHardpoint{ + target: container.target + system: container.system + show: container.show + } + } + Component{ + id: cannonComponent + CannonHardpoint{ + target: container.target + system: container.system + show: container.show + } + } + Component{ + id: emptyComponent + Item { + function fireAt(obj){ + console.log("Firing null weapon. It hurts."); + } + } + } +} diff --git a/demos/declarative/plasmapatrol/content/HelpScreens.qml b/demos/declarative/plasmapatrol/content/HelpScreens.qml new file mode 100644 index 0000000000..8896aeee4a --- /dev/null +++ b/demos/declarative/plasmapatrol/content/HelpScreens.qml @@ -0,0 +1,268 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +SequentialLoader { + id: hLdr + signal exitDesired + Component.onCompleted: advance(); + ParticleSystem{ id: helpSystem } + PlasmaPatrolParticles{ sys: helpSystem } + pages: [ + Component{Item{ + id: story + Text{ + color: "white" + text: "Story" + font.pixelSize: 48 + } + /* + Flickable{ + y: 60 + width: 360 + height: 500 + contentHeight: txt1.height + contentWidth: 360//TODO: Less magic numbers? + */ + Text{ + id: txt1 + color: "white" + y: 60 + font.pixelSize: 18 + text: " +In a remote nebula, a race of energy beings formed and lived prosperous lives for millenia. Until the schism - when they became constantly at each other's energy-throats. War soon followed, crippling both sides, until a truce was formed. But while governments knew the desparate need for peace, the soldiers in the ion-field were still filled with rampant bloodlust. On the border, patrols are constantly engaging in minor skirmishes whenever they cross paths. + +You must select one such patrol unit for the border, heading into an inevitable skirmish, in Plasma Patrol: the game of energy being spaceship combat! + " + width: 360 + wrapMode: Text.WordWrap + } + // } + Button{ + x: 20 + y: 560 + height: 40 + width: 120 + text: "Next" + onClicked: hLdr.advance(); + } + Button{ + x: 220 + y: 560 + height: 40 + width: 120 + text: "Menu" + onClicked: hLdr.exitDesired(); + } + }}, + Component{Item{ + id: ships + Text{ + color: "white" + text: "Vessels" + font.pixelSize: 48 + } + Column{ + spacing: 16 + y: 60 + Row{ + height: 128 + Sloop{ + system: helpSystem + } + Text{ + text: "The nimble sloop" + color: "white" + font.pixelSize: 18 + } + } + Row{ + height: 128 + Frigate{ + system: helpSystem + } + Text{ + text: "The versitile shield frigate" + color: "white" + font.pixelSize: 18 + } + } + Row{ + height: 128 + Cruiser{ + system: helpSystem + } + Text{ + text: "The armored cruiser" + color: "white" + font.pixelSize: 18 + } + } + } + Button{ + x: 20 + y: 560 + height: 40 + width: 120 + text: "Next" + onClicked: hLdr.advance(); + } + Button{ + x: 220 + y: 560 + height: 40 + width: 120 + text: "Menu" + onClicked: hLdr.exitDesired(); + } + }}, + Component{Item{ + id: guns + Text{ + color: "white" + text: "Hardpoints" + font.pixelSize: 48 + } + Column{ + spacing: 16 + y: 60 + Row{ + height: 128 + LaserHardpoint{ + system: helpSystem + } + Text{ + text: "The laser hardpoint almost always hits the target, even the nimble sloop, but loses much of its potency against the frigate's shields" + width: 332 + wrapMode: Text.WordWrap + color: "white" + font.pixelSize: 18 + } + } + Row{ + height: 128 + BlasterHardpoint{ + system: helpSystem + } + Text{ + text: "The blaster passes right through the frigate's shields but loses much of its impact against the armor of the cruiser" + width: 332 + wrapMode: Text.WordWrap + color: "white" + font.pixelSize: 18 + } + } + Row{ + height: 128 + CannonHardpoint{ + system: helpSystem + } + Text{ + text: "The cannon has poor accuracy, often missing the nimble sloop, but can punch right through the armor of the cruiser" + width: 332 + wrapMode: Text.WordWrap + color: "white" + font.pixelSize: 18 + } + } + } + Button{ + x: 20 + y: 560 + height: 40 + width: 120 + text: "Next" + onClicked: hLdr.advance(); + } + Button{ + x: 220 + y: 560 + height: 40 + width: 120 + text: "Menu" + onClicked: hLdr.exitDesired(); + } + }}, + Component{Item{ + id: strategy + Text{ + color: "white" + text: "Strategy" + font.pixelSize: 48 + } + Flickable{ + y: 60 + width: 360 + height: 500 + contentHeight: txt1.height + contentWidth: 360//TODO: Less magic numbers? + Text{ + id: txt1 + color: "white" + font.pixelSize: 18 + text: " +Basic Strategy: Good luck, have fun - don't die. +More to come after thorough playtesting. + " + width: 360 + wrapMode: Text.WordWrap + } + } + Button{ + x: 20 + y: 560 + height: 40 + width: 120 + text: "Story" + onClicked: {hLdr.at=0; hLdr.advance();} + } + Button{ + x: 220 + y: 560 + height: 40 + width: 120 + text: "Menu" + onClicked: hLdr.exitDesired(); + } + }} + ] +} diff --git a/demos/declarative/plasmapatrol/content/LaserHardpoint.qml b/demos/declarative/plasmapatrol/content/LaserHardpoint.qml new file mode 100644 index 0000000000..d6d470a15b --- /dev/null +++ b/demos/declarative/plasmapatrol/content/LaserHardpoint.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Item { + id: container + property variant target: {"y": -90, "x":12} + property ParticleSystem system + property bool show: true + + width: 24 + height: 24 + TrailEmitter{ + id: visualization + particle: "laser" + system: container.system + anchors.fill: parent + emitting: container.show + shape: Ellipse{} + speed: DirectedVector{ targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true } + particleDuration: 1000 + particlesPerSecond: 64 + + particleSize: 24 + particleSizeVariation: 8 + particleEndSize: 8 + } + + function fireAt(targetArg, hardpoint){ + if(targetArg.hp <= 0) + return; + //TODO: calculate hit and damage at target, which must be a Ship + var offset = 0; + if(Math.random() < 0.99){ + switch(targetArg.shipType){ + case 1: hardpoint.damageDealt += 16; break; + case 2: hardpoint.damageDealt += 4; break; + case 3: hardpoint.damageDealt += 8; break; + default: hardpoint.damageDealt += 500; //Really effective against unregistered vessels + } + }else{//Misses with Lasers are really rare + offset = Math.random() * 100; + } + target = container.mapFromItem(targetArg, offset + targetArg.width/2, offset + targetArg.height/2); + emitter.pulse(0.10); + // console.log("Fire box: " + Math.min(container.width/2, target.x) + "," + Math.min(container.height/2, target.y) + " " + (Math.max(container.width/2, target.x) - Math.min(container.width/2, target.x)) + "," + (Math.max(container.height/2, target.y) - Math.min(container.height/2, target.y))); + } + TrailEmitter{ + id: emitter + particle: "laser" + emitting: false + system: container.system + x: Math.min(container.width/2, target.x); + width: Math.max(container.width/2, target.x) - x; + y: Math.min(container.height/2, target.y); + height: Math.max(container.height/2, target.y) - y; + shape: Line{ + mirrored: (emitter.y < 0 || emitter.x < 0) && !(emitter.y < 0 && emitter.x < 0 )//I just want XOR + } + + particleDuration: 1000 + particlesPerSecond: 8000 + maxParticles: 800 + particleSize: 16 + particleEndSize: 0 + + speed: PointVector{xVariation: 4; yVariation: 4} + } +} diff --git a/demos/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml b/demos/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml new file mode 100644 index 0000000000..7a6fcb96d0 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/PlasmaPatrolParticles.qml @@ -0,0 +1,173 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Item{ + property ParticleSystem sys + ColoredParticle{ + system: sys + particles: ["default"] + image: "pics/blur-circle3.png" + color: "#003A3A3A" + colorVariation: 0.1 + z: 0 + } + ColoredParticle{ + system: sys + particles: ["redTeam"] + image: "pics/blur-circle3.png" + color: "#0028060A" + colorVariation: 0.1 + z: 0 + } + ColoredParticle{ + system: sys + particles: ["greenTeam"] + image: "pics/blur-circle3.png" + color: "#0006280A" + colorVariation: 0.1 + z: 0 + } + ColoredParticle{ + system: sys + particles: ["blaster"] + image: "pics/star2.png" + //color: "#0F282406" + color: "#0F484416" + colorVariation: 0.2 + z: 2 + } + ColoredParticle{ + system: sys + particles: ["laser"] + image: "pics/star3.png" + //color: "#00123F68" + color: "#00428FF8" + colorVariation: 0.2 + z: 2 + } + ColoredParticle{ + system: sys + particles: ["cannon"] + image: "pics/particle.png" + color: "#80FFAAFF" + colorVariation: 0.1 + z: 2 + } + ColoredParticle{ + system: sys + particles: ["cannonCore"] + image: "pics/particle.png" + color: "#00666666" + colorVariation: 0.8 + z: 1 + } + ColoredParticle{ + system: sys + particles: ["cannonWake"] + image: "pics/star.png" + color: "#00CCCCCC" + colorVariation: 0.2 + z: 1 + } + ColoredParticle{ + system: sys + particles: ["frigateShield"] + image: "pics/blur-circle2.png" + color: "#00000000" + colorVariation: 0.05 + blueVariation: 0.5 + greenVariation: 0.1 + z: 3 + } + SpriteParticle{ + system: sys + particles: ["cruiserArmor"] + z: 1 + sprites:[Sprite{ + id: spinState + name: "spinning" + source: "pics/meteor.png" + frames: 35 + duration: 40 + to: {"death":0, "spinning":1} + },Sprite{ + name: "death" + source: "pics/meteor_explo.png" + frames: 22 + duration: 40 + to: {"null":1} + }, Sprite{ + name: "null" + source: "pics/nullRock.png" + frames: 1 + duration: 1000 + } + ] + } + FollowEmitter{ + system: sys + particle: "cannonWake" + follow: "cannon" + particlesPerParticlePerSecond: 64 + particleDuration: 600 + speed: AngleVector{ angleVariation: 360; magnitude: 48} + particleSize: 16 + particleEndSize: 8 + particleSizeVariation: 2 + emitting: true + width: 1000//XXX: Terrible hack + height: 1000 + } + FollowEmitter{ + system: sys + particle: "cannonCore" + follow: "cannon" + particlesPerParticlePerSecond: 256 + particleDuration: 128 + particleSize: 24 + particleEndSize: 8 + emitting: true + width: 1000//XXX: Terrible hack + height: 1000 + } +} diff --git a/demos/declarative/plasmapatrol/content/SequentialLoader.qml b/demos/declarative/plasmapatrol/content/SequentialLoader.qml new file mode 100644 index 0000000000..85a979b222 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/SequentialLoader.qml @@ -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 QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 + +Item{ + id: container + //TODO: Somehow get particles into this? + property list<Component> pages + property Item cur: null + property int at: 0 + function advance(){ + if(cur != null) + cur.destroy(); + cur = pages[at++].createObject(container); + } +} diff --git a/demos/declarative/plasmapatrol/content/Ship.qml b/demos/declarative/plasmapatrol/content/Ship.qml new file mode 100644 index 0000000000..0ccea94221 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/Ship.qml @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Item { + id: me + //Reflective Properties + width: shipLoader.width + height: shipLoader.height + //Transfered Properties + property int hp: 100//shipLoader.item.maxHP + property real dodge: shipLoader.item.initialDodge + property ParticleSystem system + property int targetIdx: 0 + property Item target: targets[targetIdx] == undefined?null:targets[targetIdx] + Connections{ + target: me.target + onHpChanged: if(me.target.hp<=0) me.targetIdx++; + } + property list<Item> targets + property string shipParticle: "default"//Per team colors? + property int gunType: 0 + property int shipType: 0 + Component{ + id: sloopComp + Sloop{ + system: me.system + target: me.target + shipParticle: me.shipParticle + gunType: me.gunType + hp: me.hp + dodge: me.dodge + } + } + Component{ + id: frigateComp + Frigate{ + system: me.system + target: me.target + shipParticle: me.shipParticle + gunType: me.gunType + hp: me.hp + dodge: me.dodge + } + } + Component{ + id: cruiserComp + Cruiser{ + system: me.system + target: me.target + shipParticle: me.shipParticle + gunType: me.gunType + hp: me.hp + dodge: me.dodge + } + } + Component{ + id: dumbComp + Item{ + property int maxHP: 0 + property int initialDodge: 0 + } + } + Loader{ + id: shipLoader + sourceComponent:{ switch(shipType){ + case 1: sloopComp; break; + case 2: frigateComp; break; + case 3: cruiserComp; break; + default: dumbComp; + } + } + } +} diff --git a/demos/declarative/plasmapatrol/content/Sloop.qml b/demos/declarative/plasmapatrol/content/Sloop.qml new file mode 100644 index 0000000000..1b9bce7333 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/Sloop.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import Qt.labs.particles 2.0 + +Item { + id: container + property int maxHP: 100 + property int hp: maxHP + property real initialDodge: 0.5 + property real dodge: initialDodge + property int blinkInterval: 800 + onHpChanged: if(hp <= 0) target = container; + property ParticleSystem system//TODO: Ship abstraction + property Item target: container + property string shipParticle: "default"//Per team colors? + property int gunType: 0 + width: 128 + height: 128 + TrailEmitter{ + id: emitter + //TODO: Cooler would be an 'orbiting' affector + //TODO: On the subject, opacity and size should be grouped type 'overLife' if we can cram that in the particles + system: container.system + particle: container.shipParticle + shape: Ellipse{} + + particlesPerSecond: hp > 0 ? hp + 20 : 0 + particleDuration: blinkInterval + maxParticles: (maxHP + 20) + + acceleration: AngleVector{angleVariation: 360; magnitude: 8} + + particleSize: 24 + particleEndSize: 4 + particleSizeVariation: 8 + width: 16 + height: 16 + x: 64 + y: 64 + Behavior on x{NumberAnimation{duration:blinkInterval}} + Behavior on y{NumberAnimation{duration:blinkInterval}} + Timer{ + interval: blinkInterval + running: true + repeat: true + onTriggered: { + emitter.x = Math.random() * 48 + 32 + emitter.y = Math.random() * 48 + 32 + } + } + } + Hardpoint{ + anchors.centerIn: parent + id: gun2 + system: container.system + show: container.hp > 0 + hardpointType: gunType + } + Timer{ + id: fireControl + interval: 800 + running: root.readySetGo + repeat: true + onTriggered:{ + gun2.fireAt(container.target); + } + } + +} diff --git a/demos/declarative/plasmapatrol/content/pics/TitleText.png b/demos/declarative/plasmapatrol/content/pics/TitleText.png Binary files differnew file mode 100644 index 0000000000..dc3acebe39 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/pics/TitleText.png diff --git a/demos/declarative/plasmapatrol/content/pics/blur-circle2.png b/demos/declarative/plasmapatrol/content/pics/blur-circle2.png Binary files differnew file mode 100644 index 0000000000..f7c9f3e98e --- /dev/null +++ b/demos/declarative/plasmapatrol/content/pics/blur-circle2.png diff --git a/demos/declarative/plasmapatrol/content/pics/blur-circle3.png b/demos/declarative/plasmapatrol/content/pics/blur-circle3.png Binary files differnew file mode 100644 index 0000000000..dbc39cb16e --- /dev/null +++ b/demos/declarative/plasmapatrol/content/pics/blur-circle3.png diff --git a/demos/declarative/plasmapatrol/content/pics/finalfrontier.png b/demos/declarative/plasmapatrol/content/pics/finalfrontier.png Binary files differnew file mode 100644 index 0000000000..2ba1815230 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/pics/finalfrontier.png diff --git a/demos/declarative/plasmapatrol/content/pics/meteor.png b/demos/declarative/plasmapatrol/content/pics/meteor.png Binary files differnew file mode 100644 index 0000000000..e8c368aea7 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/pics/meteor.png diff --git a/demos/declarative/plasmapatrol/content/pics/meteor_explo.png b/demos/declarative/plasmapatrol/content/pics/meteor_explo.png Binary files differnew file mode 100644 index 0000000000..4297245d49 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/pics/meteor_explo.png diff --git a/demos/declarative/plasmapatrol/content/pics/nullRock.png b/demos/declarative/plasmapatrol/content/pics/nullRock.png Binary files differnew file mode 100644 index 0000000000..4076327a1a --- /dev/null +++ b/demos/declarative/plasmapatrol/content/pics/nullRock.png diff --git a/demos/declarative/plasmapatrol/content/pics/particle.png b/demos/declarative/plasmapatrol/content/pics/particle.png Binary files differnew file mode 100644 index 0000000000..5c83896d22 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/pics/particle.png diff --git a/demos/declarative/plasmapatrol/content/pics/star.png b/demos/declarative/plasmapatrol/content/pics/star.png Binary files differnew file mode 100644 index 0000000000..0d592cfa87 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/pics/star.png diff --git a/demos/declarative/plasmapatrol/content/pics/star2.png b/demos/declarative/plasmapatrol/content/pics/star2.png Binary files differnew file mode 100644 index 0000000000..bb55c44788 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/pics/star2.png diff --git a/demos/declarative/plasmapatrol/content/pics/star3.png b/demos/declarative/plasmapatrol/content/pics/star3.png Binary files differnew file mode 100644 index 0000000000..636a25f480 --- /dev/null +++ b/demos/declarative/plasmapatrol/content/pics/star3.png diff --git a/demos/declarative/plasmapatrol/plasmapatrol.qml b/demos/declarative/plasmapatrol/plasmapatrol.qml new file mode 100644 index 0000000000..3a7b217618 --- /dev/null +++ b/demos/declarative/plasmapatrol/plasmapatrol.qml @@ -0,0 +1,386 @@ +/**************************************************************************** +** +** 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$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 2.0 +import Qt.labs.particles 2.0 +import "content" + +Rectangle { + id: root + property bool readySetGo: false + //Debugging + property int hits: 0 + property int misses: 0 + property real ratio: hits/(misses?misses:1) + //Move to JS file? + property Ship redVar1: Ship{shipType: 1; gunType: 1} + property Ship redVar2: Ship{shipType: 1; gunType: 2} + property Ship redVar3: Ship{shipType: 1; gunType: 3} + property Ship greenVar1: Ship{shipType: 3; gunType: 1} + property Ship greenVar2: Ship{shipType: 2; gunType: 2} + property Ship greenVar3: Ship{shipType: 1; gunType: 3} + property string winner: "0" + property int players: 0 + function aiSet(ship){ + ship.gunType = Math.floor(Math.random() * 3) + 1 + ship.shipType = Math.floor(Math.random() * 3) + 1 + } + + width: 360 + height: 600 + color: "black" + SequentialLoader{ + anchors.fill: parent + //General Children + Image{ + anchors.centerIn: parent + source: "content/pics/finalfrontier.png" + } + ParticleSystem{ + id: particles + } + PlasmaPatrolParticles{ sys: particles; z: 100 }//Renders all particles on the one plane + //Component parts + id: pageControl + Component.onCompleted: advance(); + pages:[ + Component{Item{ + id: menu + width: root.width + height: root.height + Column{ + anchors.verticalCenter: parent.verticalCenter + width: parent.width + spacing: 8 + Item{ + id: title + width: root.width + height: 240 + TrailEmitter{ + anchors.fill: parent + system: particles + emitting: true + particle: "default" + particlesPerSecond: 1200 + particleDuration: 1200 + shape: Mask{source:"content/pics/TitleText.png"} + particleSize: 16 + particleEndSize: 0 + particleSizeVariation: 8 + speed: AngleVector{angleVariation:360; magnitudeVariation: 6} + } + } + Button{ + text: "1P" + onClicked: {root.players = 1; pageControl.advance();} + anchors.horizontalCenter: parent.horizontalCenter + } + Button{ + text: "2P" + onClicked: {root.players = 2; pageControl.advance();} + anchors.horizontalCenter: parent.horizontalCenter + } + Button{ + text: "Demo" + anchors.horizontalCenter: parent.horizontalCenter + onClicked: {root.players = 0; + aiSet(redVar1); + aiSet(redVar2); + aiSet(redVar3); + aiSet(greenVar1); + aiSet(greenVar2); + aiSet(greenVar3); + pageControl.at = 5;//TODO: Not a magic number + pageControl.advance();} + } + Button{ + text: "Help" + anchors.horizontalCenter: parent.horizontalCenter + onClicked: { + pageControl.at = 7;//TODO: Not a magic number + pageControl.advance(); + } + } + Button{ + text: "Quit" + anchors.horizontalCenter: parent.horizontalCenter + onClicked: Qt.quit(); + } + } + }}, + Component{Item{ + id: p1Screen + z: 101 + width: root.width + height: root.height + Rectangle{ + anchors.fill: parent + color: "red" + } + Text{ + anchors.centerIn: parent + color: "white" + font.pixelSize: 64 + font.bold: true + text: "Player\n 1" + horizontalAlignment: Text.AlignHCenter + } + MouseArea{ + anchors.fill: parent + onClicked: pageControl.advance() + } + }}, + Component{Item{ + id: p1Choices + z: 3 + width: root.width + height: root.height + Rectangle{ + color: "black" + anchors.fill: parent + } + Column{ + spacing: 16 + width: root.width + anchors.horizontalCenter: parent.horizontalCenter + ChoiceBox{ + target: redVar1 + system: particles + } + ChoiceBox{ + target: redVar2 + system: particles + } + ChoiceBox{ + target: redVar3 + system: particles + } + Button{ + anchors.horizontalCenter: parent.horizontalCenter + text: "Next" + onClicked: { + if(root.players < 2){ + aiSet(greenVar1); + aiSet(greenVar2); + aiSet(greenVar3); + pageControl.at = 5;//TODO: Not a magic number + } + pageControl.advance(); + } + } + } + }}, + Component{Item{ + id: p2Screen + z: 101 + width: root.width + height: root.height + Rectangle{ + anchors.fill: parent + color: "green" + } + Text{ + anchors.centerIn: parent + color: "white" + font.pixelSize: 64 + font.bold: true + text: "Player\n 2" + horizontalAlignment: Text.AlignHCenter + } + MouseArea{ + anchors.fill: parent + onClicked: pageControl.advance() + } + }}, + Component{Item{ + id: p2Choices + z: 1 + width: root.width + height: root.height + Rectangle{ + color: "black" + anchors.fill: parent + } + Column{ + spacing: 16 + width: root.width + anchors.horizontalCenter: parent.horizontalCenter + ChoiceBox{ + target: greenVar1 + system: particles + } + ChoiceBox{ + target: greenVar2 + system: particles + } + ChoiceBox{ + target: greenVar3 + system: particles + } + Button{ + anchors.horizontalCenter: parent.horizontalCenter + text: "Next" + onClicked: pageControl.advance() + } + } + }}, + Component{Item{ + id: arena + width: root.width + height: root.height + z: 0 + Component.onCompleted: root.readySetGo = true + Component.onDestruction: root.readySetGo = false + property bool victory: redShip3.hp <= 0 || greenShip3.hp <=0 + onVictoryChanged: { + if(redShip3.hp <= 0){ + if(greenShip3.hp <= 0){ + root.winner = "1&2" + }else{ + root.winner = "2" + } + }else{ + root.winner = "1" + } + winTimer.start() + } + Timer{ + id: winTimer + interval: 1200 + repeat: false + running: false + onTriggered: pageControl.advance(); + } + Ship{ + id: redShip1 + shipParticle: "redTeam" + system: particles + x: 180-64 + y: 128 + shipType: redVar1.shipType + gunType: redVar1.gunType + targets: [greenShip1, greenShip2, greenShip3] + } + Ship{ + id: redShip2 + shipParticle: "redTeam" + system: particles + x: 0 + y: 0 + shipType: redVar2.shipType + gunType: redVar2.gunType + targets: [greenShip1, greenShip2, greenShip3] + } + Ship{ + id: redShip3 + shipParticle: "redTeam" + system: particles + x: 360-128 + y: 0 + shipType: redVar3.shipType + gunType: redVar3.gunType + targets: [greenShip1, greenShip2, greenShip3] + } + + Ship{ + id: greenShip1 + shipParticle: "greenTeam" + system: particles + x: 180-64 + y: 600 - 128 - 128 + shipType: greenVar1.shipType + gunType: greenVar1.gunType + targets: [redShip1, redShip2, redShip3] + } + Ship{ + id: greenShip2 + shipParticle: "greenTeam" + system: particles + x: 0 + y: 600-128 + shipType: greenVar2.shipType + gunType: greenVar2.gunType + targets: [redShip1, redShip2, redShip3] + } + Ship{ + id: greenShip3 + shipParticle: "greenTeam" + system: particles + x: 360 - 128 + y: 600 - 128 + shipType: greenVar3.shipType + gunType: greenVar3.gunType + targets: [redShip1, redShip2, redShip3] + } + }}, + Component{Item{ + id: winScreen + z: 101 + width: root.width + height: root.height + /* + Rectangle{ + anchors.fill: parent + color: "black" + } + */ + Text{//TODO: Particle Text? + anchors.fill: parent + color: "white" + font.pixelSize: 64 + font.bold: true + text: "Player " + root.winner + " wins!" + wrapMode: Text.WordWrap + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + MouseArea{ + anchors.fill: parent + onClicked: {pageControl.at = 0; pageControl.advance();} + } + }}, + Component{ + HelpScreens{ + onExitDesired: {pageControl.at = 0; pageControl.advance();} + } + } + ] + } +} diff --git a/demos/declarative/samegame/SamegameCore/BoomBlock.qml b/demos/declarative/samegame/SamegameCore/BoomBlock.qml index d3904e705d..67e67b893a 100644 --- a/demos/declarative/samegame/SamegameCore/BoomBlock.qml +++ b/demos/declarative/samegame/SamegameCore/BoomBlock.qml @@ -39,8 +39,8 @@ ** ****************************************************************************/ -import QtQuick 1.1 -import Qt.labs.particles 1.0 +import QtQuick 2.0 +import Qt.labs.particles 2.0 Item { id: block @@ -71,26 +71,28 @@ Item { Behavior on opacity { NumberAnimation { duration: 200 } } anchors.fill: parent } - - Particles { + TrailEmitter { id: particles - - width: 1; height: 1 - anchors.centerIn: parent - - emissionRate: 0 - lifeSpan: 700; lifeSpanDeviation: 600 - angle: 0; angleDeviation: 360; - velocity: 100; velocityDeviation: 30 - source: { + system: particleSystem + particle: { if(type == 0){ - "pics/redStar.png"; + "red"; } else if (type == 1) { - "pics/blueStar.png"; + "blue"; } else { - "pics/greenStar.png"; + "green"; } } + anchors.fill: parent + + speed: DirectedVector{targetX: block.width/2; targetY: block.height/2; magnitude: -60; magnitudeVariation: 60} + shape: Ellipse{fill:true} + emitting: false; + particleDuration: 700; particleDurationVariation: 100 + particlesPerSecond: 1000 + maxParticles: 100 //only fires 0.1s bursts (still 2x old number, ColoredParticle wants less than 16000 max though) + particleSize: 28 + particleEndSize: 14 } states: [ @@ -101,7 +103,7 @@ Item { State { name: "DeathState"; when: dying == true - StateChangeScript { script: particles.burst(50); } + StateChangeScript { script: particles.pulse(0.1); } PropertyChanges { target: img; opacity: 0 } StateChangeScript { script: block.destroy(1000); } } diff --git a/demos/declarative/samegame/SamegameCore/Button.qml b/demos/declarative/samegame/SamegameCore/Button.qml index 933bdfe2de..be9ad62dfd 100644 --- a/demos/declarative/samegame/SamegameCore/Button.qml +++ b/demos/declarative/samegame/SamegameCore/Button.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import QtQuick 1.1 +import QtQuick 2.0 Rectangle { id: container diff --git a/demos/declarative/samegame/SamegameCore/Dialog.qml b/demos/declarative/samegame/SamegameCore/Dialog.qml index 3c0b92df97..aea6ac7dda 100644 --- a/demos/declarative/samegame/SamegameCore/Dialog.qml +++ b/demos/declarative/samegame/SamegameCore/Dialog.qml @@ -39,23 +39,26 @@ ** ****************************************************************************/ -import QtQuick 1.1 +import QtQuick 2.0 Rectangle { id: page property Item text: dialogText + property bool open: false signal closed signal opened function forceClose() { - if(page.opacity == 0) + if(!open) return; //already closed + page.open = false; page.closed(); page.opacity = 0; } function show(txt) { + page.open = true; page.opened(); dialogText.text = txt; page.opacity = 1; diff --git a/demos/declarative/samegame/SamegameCore/pics/blueStar.png b/demos/declarative/samegame/SamegameCore/pics/blueStar.png Binary files differdeleted file mode 100644 index ff9588f80a..0000000000 --- a/demos/declarative/samegame/SamegameCore/pics/blueStar.png +++ /dev/null diff --git a/demos/declarative/samegame/SamegameCore/pics/greenStar.png b/demos/declarative/samegame/SamegameCore/pics/greenStar.png Binary files differdeleted file mode 100644 index cd06854719..0000000000 --- a/demos/declarative/samegame/SamegameCore/pics/greenStar.png +++ /dev/null diff --git a/demos/declarative/samegame/SamegameCore/pics/particle.png b/demos/declarative/samegame/SamegameCore/pics/particle.png Binary files differnew file mode 100644 index 0000000000..5c83896d22 --- /dev/null +++ b/demos/declarative/samegame/SamegameCore/pics/particle.png diff --git a/demos/declarative/samegame/SamegameCore/pics/redStar.png b/demos/declarative/samegame/SamegameCore/pics/redStar.png Binary files differdeleted file mode 100644 index 0a4dffe583..0000000000 --- a/demos/declarative/samegame/SamegameCore/pics/redStar.png +++ /dev/null diff --git a/demos/declarative/samegame/SamegameCore/pics/star.png b/demos/declarative/samegame/SamegameCore/pics/star.png Binary files differdeleted file mode 100644 index defbde53ca..0000000000 --- a/demos/declarative/samegame/SamegameCore/pics/star.png +++ /dev/null diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js index bb587bc6f3..4c5cbe5bb3 100755 --- a/demos/declarative/samegame/SamegameCore/samegame.js +++ b/demos/declarative/samegame/SamegameCore/samegame.js @@ -4,10 +4,11 @@ var maxColumn = 10; var maxRow = 15; var maxIndex = maxColumn*maxRow; var board = new Array(maxIndex); -var blockSrc = "SamegameCore/BoomBlock.qml"; +var blockSrc = "BoomBlock.qml"; var scoresURL = ""; var gameDuration; var component = Qt.createComponent(blockSrc); +var highScoreBar = 0; // Index function used instead of a 2D array function index(column, row) @@ -152,11 +153,15 @@ function victoryCheck() // Checks for game over if (deservesBonus || !(floodMoveCheck(0, maxRow - 1, -1))) { gameDuration = new Date() - gameDuration; - nameInputDialog.show("You won! Please enter your name: "); - nameInputDialog.initialWidth = nameInputDialog.text.width + 20; - if (nameInputDialog.name == "") - nameInputDialog.width = nameInputDialog.initialWidth; - nameInputDialog.text.opacity = 0; // Just a spacer + if(gameCanvas.score > highScoreBar){ + nameInputDialog.show("You won! Please enter your name: "); + nameInputDialog.initialWidth = nameInputDialog.text.width + 20; + if (nameInputDialog.name == "") + nameInputDialog.width = nameInputDialog.initialWidth; + nameInputDialog.text.opacity = 0; // Just a spacer + }else{ + dialog.show("You won!"); + } } } @@ -203,6 +208,30 @@ function createBlock(column,row) return true; } +function initHighScoreBar() +{ + if(scoresURL != "") + return true;//don't query remote scores + var db = openDatabaseSync( + "SameGameScores", + "1.0", + "Local SameGame High Scores", + 100 + ); + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); + // Only show results for the current grid size + var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "' + + maxColumn + "x" + maxRow + '" ORDER BY score desc LIMIT 10'); + if(rs.rows.length < 10) + highScoreBar = 0; + else + highScoreBar = rs.rows.item(rs.rows.length - 1).score; + } + ); +} + function saveHighScore(name) { if (scoresURL != "") @@ -235,6 +264,8 @@ function saveHighScore(name) + rs.rows.item(i).score + ' points in ' + rs.rows.item(i).time + ' seconds.\n'; } + if(rs.rows.length == 10) + highScoreBar = rs.rows.item(9).score; dialog.show(r); } ); diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index 7917d9ac8c..202eb40401 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -39,13 +39,14 @@ ** ****************************************************************************/ -import QtQuick 1.1 +import QtQuick 2.0 +import Qt.labs.particles 2.0 import "SamegameCore" import "SamegameCore/samegame.js" as Logic Rectangle { id: screen - width: 490; height: 720 + width: 360; height: 640 property bool inAnotherDemo: false //Samegame often is just plonked straight into other demos SystemPalette { id: activePalette } @@ -74,6 +75,36 @@ Rectangle { anchors.fill: parent; onClicked: Logic.handleClick(mouse.x,mouse.y); } } + Item{ + ParticleSystem{ id: particleSystem; } + ColoredParticle { + system: particleSystem + particles: ["red"] + color: Qt.darker("red");//Actually want desaturated... + image: "SamegameCore/pics/particle.png" + colorVariation: 0.4 + alpha: 0.1 + } + ColoredParticle { + system: particleSystem + particles: ["green"] + color: Qt.darker("green");//Actually want desaturated... + image: "SamegameCore/pics/particle.png" + colorVariation: 0.4 + alpha: 0.1 + } + ColoredParticle { + system: particleSystem + particles: ["blue"] + color: Qt.darker("blue");//Actually want desaturated... + image: "SamegameCore/pics/particle.png" + colorVariation: 0.4 + alpha: 0.1 + } + id: aboveGameCanvas + anchors.fill: gameCanvas + z: gameCanvas.z + 1 + } } Dialog { id: dialog; anchors.centerIn: parent; z: 21 } diff --git a/demos/declarative/shadereffects/Slider.qml b/demos/declarative/shadereffects/Slider.qml new file mode 100644 index 0000000000..e31335d984 --- /dev/null +++ b/demos/declarative/shadereffects/Slider.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** 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 Declarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + property real value: bar.x / (foo.width - bar.width) + Item { + id: foo + width: parent.width - 4 + height: 6 + anchors.centerIn: parent + + Rectangle { + height: parent.height + anchors.left: parent.left + anchors.right: bar.horizontalCenter + color: "blue" + radius: 3 + } + Rectangle { + height: parent.height + anchors.left: bar.horizontalCenter + anchors.right: parent.right + color: "gray" + radius: 3 + } + Rectangle { + anchors.fill: parent + color: "transparent" + radius: 3 + border.width: 2 + border.color: "black" + } + + Rectangle { + id: bar + y: -7 + width: 20 + height: 20 + radius: 15 + color: "white" + border.width: 2 + border.color: "black" + MouseArea { + anchors.fill: parent + drag.target: parent + drag.axis: Drag.XAxis + drag.minimumX: 0 + drag.maximumX: foo.width - parent.width + } + } + } +} + diff --git a/demos/declarative/shadereffects/face-smile.png b/demos/declarative/shadereffects/face-smile.png Binary files differnew file mode 100644 index 0000000000..3d66d72578 --- /dev/null +++ b/demos/declarative/shadereffects/face-smile.png diff --git a/demos/declarative/shadereffects/qt-logo.png b/demos/declarative/shadereffects/qt-logo.png Binary files differnew file mode 100644 index 0000000000..7d3e97eb36 --- /dev/null +++ b/demos/declarative/shadereffects/qt-logo.png diff --git a/demos/declarative/shadereffects/shader-demo.qml b/demos/declarative/shadereffects/shader-demo.qml new file mode 100644 index 0000000000..1226064a5d --- /dev/null +++ b/demos/declarative/shadereffects/shader-demo.qml @@ -0,0 +1,295 @@ +/**************************************************************************** +** +** 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 Declarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Image { + width: 640 + height: 360 + source: "../snake/content/pics/background.png" + + ShaderEffectSource { + id: theSource + sourceItem: theItem + smooth: true + } + + function saturate(x) { + return Math.min(Math.max(x, 0), 1) + } + + function sliderToColor(x) { + return Qt.rgba(saturate(Math.max(2 - 6 * x, 6 * x - 4)), + saturate(Math.min(6 * x, 4 - 6 * x)), + saturate(Math.min(6 * x - 2, 6 - 6 * x))) + } + + Grid { + anchors.centerIn: parent + columns: 3 + + Item { + id: theItem + width: 180 + height: 180 + ListView { + anchors.centerIn: parent + width: 160 + height: 140 + clip: true + snapMode: ListView.SnapOneItem + model: VisualItemModel { + Text { + width: 160 + height: 140 + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.pixelSize: 120 + font.family: "Times" + color: "blue" + text: "Qt" + } + Image { + width: 160 + height: 140 + source: "qt-logo.png" + smooth: true + } + Image { + width: 160 + height: 140 + source: "face-smile.png" + smooth: true + } + } + } + } + ShaderEffectItem { + width: 180 + height: 180 + property variant source: theSource + property real amplitude: 0.04 * wobbleSlider.value + property real frequency: 20 + property real time: 0 + NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 } + fragmentShader: + "uniform highp float amplitude;" + + "uniform highp float frequency;" + + "uniform highp float time;" + + "uniform sampler2D source;" + + "varying highp vec2 qt_TexCoord0;" + + "void main() {" + + " highp vec2 p = sin(time + frequency * qt_TexCoord0);" + + " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x));" + + "}" + Slider { + id: wobbleSlider + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 40 + } + } + ShaderEffectItem { + width: 180 + height: 180 + property variant source: theSource + property variant shadow: ShaderEffectSource { + smooth: true + sourceItem: ShaderEffectItem { + width: theItem.width + height: theItem.height + property variant delta: Qt.size(0.0, 1.0 / height) + property variant source: ShaderEffectSource { + smooth: true + sourceItem: ShaderEffectItem { + width: theItem.width + height: theItem.height + property variant delta: Qt.size(1.0 / width, 0.0) + property variant source: theSource + fragmentShader: " + uniform sampler2D source; + uniform highp vec2 delta; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = 0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) + + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) + + 0.2466 * texture2D(source, qt_TexCoord0) + + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) + + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta); + }" + } + } + fragmentShader: " + uniform sampler2D source; + uniform highp vec2 delta; + varying highp vec2 qt_TexCoord0; + void main() { + gl_FragColor = 0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) + + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) + + 0.2466 * texture2D(source, qt_TexCoord0) + + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) + + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta); + }" + } + } + property real angle: 0 + property variant offset: Qt.point(15.0 * Math.cos(angle), 15.0 * Math.sin(angle)) + NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 } + property variant delta: Qt.size(offset.x / width, offset.y / height) + property real darkness: shadowSlider.value + fragmentShader: " + uniform highp vec2 offset; + uniform sampler2D source; + uniform sampler2D shadow; + uniform highp float darkness; + uniform highp vec2 delta; + varying highp vec2 qt_TexCoord0; + void main() { + lowp vec4 fg = texture2D(source, qt_TexCoord0); + lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta); + gl_FragColor = fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a); + }" + Slider { + id: shadowSlider + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 40 + } + } + ShaderEffectItem { + width: 180 + height: 180 + property variant source: theSource + property variant delta: Qt.size(0.5 / width, 0.5 / height) + fragmentShader: " + uniform sampler2D source; + uniform highp vec2 delta; + uniform highp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + void main() { + lowp vec4 tl = texture2D(source, qt_TexCoord0 - delta); + lowp vec4 tr = texture2D(source, qt_TexCoord0 + vec2(delta.x, -delta.y)); + lowp vec4 bl = texture2D(source, qt_TexCoord0 - vec2(delta.x, -delta.y)); + lowp vec4 br = texture2D(source, qt_TexCoord0 + delta); + lowp vec4 gx = (tl + bl) - (tr + br); + lowp vec4 gy = (tl + tr) - (bl + br); + gl_FragColor.xyz = vec3(0.); + gl_FragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * qt_Opacity; + }" + } + ShaderEffectItem { + width: 180 + height: 180 + property variant source: theSource + property color tint: sliderToColor(colorizeSlider.value) + fragmentShader: " + uniform sampler2D source; + uniform lowp vec4 tint; + uniform lowp float qt_Opacity; + varying highp vec2 qt_TexCoord0; + void main() { + lowp vec4 c = texture2D(source, qt_TexCoord0); + lowp float lo = min(min(c.x, c.y), c.z); + lowp float hi = max(max(c.x, c.y), c.z); + gl_FragColor = qt_Opacity * vec4(mix(vec3(lo), vec3(hi), tint.xyz), c.w); + }" + Slider { + id: colorizeSlider + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 40 + } + } + ShaderEffectItem { + width: 180 + height: 180 + mesh: GridMesh { resolution: Qt.size(10, 10) } + property variant source: theSource + property real bend: 0 + property real minimize: 0 + property real side: genieSlider.value + SequentialAnimation on bend { + loops: Animation.Infinite + NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine } + PauseAnimation { duration: 1600 } + NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine } + PauseAnimation { duration: 1000 } + } + SequentialAnimation on minimize { + loops: Animation.Infinite + PauseAnimation { duration: 300 } + NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine } + PauseAnimation { duration: 1000 } + NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine } + PauseAnimation { duration: 1300 } + } + vertexShader: " + uniform highp mat4 qt_ModelViewProjectionMatrix; + uniform highp float bend; + uniform highp float minimize; + uniform highp float side; + uniform highp float width; + uniform highp float height; + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + varying highp vec2 qt_TexCoord0; + void main() { + qt_TexCoord0 = qt_MultiTexCoord0; + highp vec4 pos = qt_Vertex; + pos.y = mix(qt_Vertex.y, height, minimize); + highp float t = pos.y / height; + t = (3. - 2. * t) * t * t; + pos.x = mix(qt_Vertex.x, side * width, t * bend); + gl_Position = qt_ModelViewProjectionMatrix * pos; + }" + Slider { + id: genieSlider + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 40 + } + } + } +} diff --git a/demos/declarative/webbrowser/content/Button.qml b/demos/declarative/webbrowser/content/Button.qml deleted file mode 100644 index 93b82ec9da..0000000000 --- a/demos/declarative/webbrowser/content/Button.qml +++ /dev/null @@ -1,65 +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 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 - -Item { - property alias image: icon.source - property variant action - - signal clicked - - width: 40; height: parent.height - - Image { - id: icon; anchors.centerIn: parent - opacity: if (action != undefined) { action.enabled ? 1.0 : 0.4 } else 1 - } - - MouseArea { - anchors { fill: parent; topMargin: -10; bottomMargin: -10 } - onClicked: { - if (action != undefined) - action.trigger() - parent.clicked() - } - } -} diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml deleted file mode 100644 index 018301a91c..0000000000 --- a/demos/declarative/webbrowser/content/FlickableWebView.qml +++ /dev/null @@ -1,195 +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 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 -import QtWebKit 1.0 - -Flickable { - property alias title: webView.title - property alias icon: webView.icon - property alias progress: webView.progress - property alias url: webView.url - property alias back: webView.back - property alias stop: webView.stop - property alias reload: webView.reload - property alias forward: webView.forward - - id: flickable - width: parent.width - contentWidth: Math.max(parent.width,webView.width) - contentHeight: Math.max(parent.height,webView.height) - anchors.top: headerSpace.bottom - anchors.bottom: parent.top - anchors.left: parent.left - anchors.right: parent.right - pressDelay: 200 - - onWidthChanged : { - // Expand (but not above 1:1) if otherwise would be smaller that available width. - if (width > webView.width*webView.contentsScale && webView.contentsScale < 1.0) - webView.contentsScale = width / webView.width * webView.contentsScale; - } - - WebView { - id: webView - transformOrigin: Item.TopLeft - - function fixUrl(url) - { - if (url == "") return url - if (url[0] == "/") return "file://"+url - if (url.indexOf(":")<0) { - if (url.indexOf(".")<0 || url.indexOf(" ")>=0) { - // Fall back to a search engine; hard-code Wikipedia - return "http://en.wikipedia.org/w/index.php?search="+url - } else { - return "http://"+url - } - } - return url - } - - url: fixUrl(webBrowser.urlString) - smooth: false // We don't want smooth scaling, since we only scale during (fast) transitions - focus: true - - onAlert: console.log(message) - - function doZoom(zoom,centerX,centerY) - { - if (centerX) { - var sc = zoom*contentsScale; - scaleAnim.to = sc; - flickVX.from = flickable.contentX - flickVX.to = Math.max(0,Math.min(centerX-flickable.width/2,webView.width*sc-flickable.width)) - finalX.value = flickVX.to - flickVY.from = flickable.contentY - flickVY.to = Math.max(0,Math.min(centerY-flickable.height/2,webView.height*sc-flickable.height)) - finalY.value = flickVY.to - quickZoom.start() - } - } - - Keys.onLeftPressed: webView.contentsScale -= 0.1 - Keys.onRightPressed: webView.contentsScale += 0.1 - - preferredWidth: flickable.width - preferredHeight: flickable.height - contentsScale: 1 - onContentsSizeChanged: { - // zoom out - contentsScale = Math.min(1,flickable.width / contentsSize.width) - } - onUrlChanged: { - // got to topleft - flickable.contentX = 0 - flickable.contentY = 0 - if (url != null) { header.editUrl = url.toString(); } - } - onDoubleClick: { - if (!heuristicZoom(clickX,clickY,2.5)) { - var zf = flickable.width / contentsSize.width - if (zf >= contentsScale) - zf = 2.0*contentsScale // zoom in (else zooming out) - doZoom(zf,clickX*zf,clickY*zf) - } - } - - SequentialAnimation { - id: quickZoom - - PropertyAction { - target: webView - property: "renderingEnabled" - value: false - } - ParallelAnimation { - NumberAnimation { - id: scaleAnim - target: webView - property: "contentsScale" - // the to property is set before calling - easing.type: Easing.Linear - duration: 200 - } - NumberAnimation { - id: flickVX - target: flickable - property: "contentX" - easing.type: Easing.Linear - duration: 200 - from: 0 // set before calling - to: 0 // set before calling - } - NumberAnimation { - id: flickVY - target: flickable - property: "contentY" - easing.type: Easing.Linear - duration: 200 - from: 0 // set before calling - to: 0 // set before calling - } - } - // Have to set the contentXY, since the above 2 - // size changes may have started a correction if - // contentsScale < 1.0. - PropertyAction { - id: finalX - target: flickable - property: "contentX" - value: 0 // set before calling - } - PropertyAction { - id: finalY - target: flickable - property: "contentY" - value: 0 // set before calling - } - PropertyAction { - target: webView - property: "renderingEnabled" - value: true - } - } - onZoomTo: doZoom(zoom,centerX,centerY) - } -} diff --git a/demos/declarative/webbrowser/content/Header.qml b/demos/declarative/webbrowser/content/Header.qml deleted file mode 100644 index 35ac809ecd..0000000000 --- a/demos/declarative/webbrowser/content/Header.qml +++ /dev/null @@ -1,150 +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 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 - -Image { - id: header - - property alias editUrl: urlInput.url - property bool urlChanged: false - - source: "pics/titlebar-bg.png"; fillMode: Image.TileHorizontally - - x: webView.contentX < 0 ? -webView.contentX : webView.contentX > webView.contentWidth-webView.width - ? -webView.contentX+webView.contentWidth-webView.width : 0 - y: { - if (webView.progress < 1.0) - return 0; - else { - webView.contentY < 0 ? -webView.contentY : webView.contentY > height ? -height : -webView.contentY - } - } - Column { - width: parent.width - - Item { - width: parent.width; height: 20 - Text { - anchors.centerIn: parent - text: webView.title; font.pixelSize: 14; font.bold: true - color: "white"; styleColor: "black"; style: Text.Sunken - } - } - - Item { - width: parent.width; height: 40 - - Button { - id: backButton - action: webView.back; image: "pics/go-previous-view.png" - anchors { left: parent.left; bottom: parent.bottom } - } - - Button { - id: nextButton - anchors.left: backButton.right - action: webView.forward; image: "pics/go-next-view.png" - } - - UrlInput { - id: urlInput - anchors { left: nextButton.right; right: reloadButton.left } - image: "pics/display.png" - onUrlEntered: { - webBrowser.urlString = url - webBrowser.focus = true - header.urlChanged = false - } - onUrlChanged: header.urlChanged = true - } - - Button { - id: reloadButton - anchors { right: quitButton.left; rightMargin: 10 } - action: webView.reload; image: "pics/view-refresh.png" - visible: webView.progress == 1.0 && !header.urlChanged - } - Text { - id: quitButton - color: "white" - style: Text.Sunken - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: parent.bottom - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 18 - width: 60 - text: "Quit" - MouseArea { - anchors.fill: parent - onClicked: Qt.quit() - } - Rectangle { - width: 1 - y: 5 - height: parent.height-10 - anchors.right: parent.left - color: "darkgray" - } - } - - Button { - id: stopButton - anchors { right: quitButton.left; rightMargin: 10 } - action: webView.stop; image: "pics/edit-delete.png" - visible: webView.progress < 1.0 && !header.urlChanged - } - - Button { - id: goButton - anchors { right: parent.right; rightMargin: 4 } - onClicked: { - webBrowser.urlString = urlInput.url - webBrowser.focus = true - header.urlChanged = false - } - image: "pics/go-jump-locationbar.png"; visible: header.urlChanged - } - } - } -} diff --git a/demos/declarative/webbrowser/content/ScrollBar.qml b/demos/declarative/webbrowser/content/ScrollBar.qml deleted file mode 100644 index 3aee68a504..0000000000 --- a/demos/declarative/webbrowser/content/ScrollBar.qml +++ /dev/null @@ -1,107 +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 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 - -Item { - id: container - - property variant scrollArea - property variant 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.5 } - - BorderImage { - source: "pics/scrollbar.png" - border { left: 1; right: 1; top: 1; bottom: 1 } - x: container.orientation == Qt.Vertical ? 2 : position() - width: container.orientation == Qt.Vertical ? container.width - 4 : size() - y: container.orientation == Qt.Vertical ? position() : 2 - 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/demos/declarative/webbrowser/content/UrlInput.qml b/demos/declarative/webbrowser/content/UrlInput.qml deleted file mode 100644 index 99fb7bd53b..0000000000 --- a/demos/declarative/webbrowser/content/UrlInput.qml +++ /dev/null @@ -1,96 +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 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 - -Item { - id: container - - property alias image: bg.source - property alias url: urlText.text - - signal urlEntered(string url) - signal urlChanged - - width: parent.height; height: parent.height - - BorderImage { - id: bg; rotation: 180 - x: 8; width: parent.width - 16; height: 30; - anchors.verticalCenter: parent.verticalCenter - border { left: 10; top: 10; right: 10; bottom: 10 } - } - - Rectangle { - anchors.bottom: bg.bottom - x: 18; height: 4; color: "#63b1ed" - width: (bg.width - 20) * webView.progress - opacity: webView.progress == 1.0 ? 0.0 : 1.0 - } - - TextInput { - id: urlText - horizontalAlignment: TextEdit.AlignLeft - font.pixelSize: 14; - - onTextChanged: container.urlChanged() - - Keys.onEscapePressed: { - urlText.text = webView.url - webView.focus = true - } - - Keys.onEnterPressed: { - container.urlEntered(urlText.text) - webView.focus = true - } - - Keys.onReturnPressed: { - container.urlEntered(urlText.text) - webView.focus = true - } - - anchors { - left: parent.left; right: parent.right; leftMargin: 18; rightMargin: 18 - verticalCenter: parent.verticalCenter - } - } -} diff --git a/demos/declarative/webbrowser/content/pics/display.png b/demos/declarative/webbrowser/content/pics/display.png Binary files differdeleted file mode 100644 index 9507f4382e..0000000000 --- a/demos/declarative/webbrowser/content/pics/display.png +++ /dev/null diff --git a/demos/declarative/webbrowser/content/pics/edit-delete.png b/demos/declarative/webbrowser/content/pics/edit-delete.png Binary files differdeleted file mode 100644 index df2a147d24..0000000000 --- a/demos/declarative/webbrowser/content/pics/edit-delete.png +++ /dev/null diff --git a/demos/declarative/webbrowser/content/pics/go-jump-locationbar.png b/demos/declarative/webbrowser/content/pics/go-jump-locationbar.png Binary files differdeleted file mode 100644 index 61f779ce2b..0000000000 --- a/demos/declarative/webbrowser/content/pics/go-jump-locationbar.png +++ /dev/null diff --git a/demos/declarative/webbrowser/content/pics/go-next-view.png b/demos/declarative/webbrowser/content/pics/go-next-view.png Binary files differdeleted file mode 100644 index a585cab80c..0000000000 --- a/demos/declarative/webbrowser/content/pics/go-next-view.png +++ /dev/null diff --git a/demos/declarative/webbrowser/content/pics/go-previous-view.png b/demos/declarative/webbrowser/content/pics/go-previous-view.png Binary files differdeleted file mode 100644 index 612fb34dce..0000000000 --- a/demos/declarative/webbrowser/content/pics/go-previous-view.png +++ /dev/null diff --git a/demos/declarative/webbrowser/content/pics/scrollbar.png b/demos/declarative/webbrowser/content/pics/scrollbar.png Binary files differdeleted file mode 100644 index 0228dcf9eb..0000000000 --- a/demos/declarative/webbrowser/content/pics/scrollbar.png +++ /dev/null diff --git a/demos/declarative/webbrowser/content/pics/titlebar-bg.png b/demos/declarative/webbrowser/content/pics/titlebar-bg.png Binary files differdeleted file mode 100644 index 06961e8d84..0000000000 --- a/demos/declarative/webbrowser/content/pics/titlebar-bg.png +++ /dev/null diff --git a/demos/declarative/webbrowser/content/pics/view-refresh.png b/demos/declarative/webbrowser/content/pics/view-refresh.png Binary files differdeleted file mode 100644 index afa2a9d774..0000000000 --- a/demos/declarative/webbrowser/content/pics/view-refresh.png +++ /dev/null diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml deleted file mode 100644 index 2408851750..0000000000 --- a/demos/declarative/webbrowser/webbrowser.qml +++ /dev/null @@ -1,79 +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 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 -import QtWebKit 1.0 - -import "content" - -Rectangle { - id: webBrowser - - property string urlString : "http://www.nokia.com/" - - width: 800; height: 600 - color: "#343434" - - FlickableWebView { - id: webView - url: webBrowser.urlString - onProgressChanged: header.urlChanged = false - anchors { top: headerSpace.bottom; left: parent.left; right: parent.right; bottom: parent.bottom } - } - - Item { id: headerSpace; width: parent.width; height: 62 } - - Header { - id: header - editUrl: webBrowser.urlString - width: headerSpace.width; height: headerSpace.height - } - - ScrollBar { - scrollArea: webView; width: 8 - anchors { right: parent.right; top: header.bottom; bottom: parent.bottom } - } - - ScrollBar { - scrollArea: webView; height: 8; orientation: Qt.Horizontal - anchors { right: parent.right; rightMargin: 8; left: parent.left; bottom: parent.bottom } - } -} |