diff --git a/demos/declarative/flickr/mobile/Button.qml b/demos/declarative/flickr/content/Button.qml similarity index 99% rename from demos/declarative/flickr/mobile/Button.qml rename to demos/declarative/flickr/content/Button.qml index 539011552a..7285753a0a 100644 --- a/demos/declarative/flickr/mobile/Button.qml +++ b/demos/declarative/flickr/content/Button.qml @@ -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 similarity index 99% rename from demos/declarative/flickr/mobile/GridDelegate.qml rename to demos/declarative/flickr/content/GridDelegate.qml index 06e0b853e1..5b7af23ea0 100644 --- a/demos/declarative/flickr/mobile/GridDelegate.qml +++ b/demos/declarative/flickr/content/GridDelegate.qml @@ -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 similarity index 65% rename from demos/declarative/flickr/mobile/ImageDetails.qml rename to demos/declarative/flickr/content/ImageDetails.qml index 1f49160603..62c3397f08 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/content/ImageDetails.qml @@ -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 similarity index 99% rename from demos/declarative/flickr/mobile/ListDelegate.qml rename to demos/declarative/flickr/content/ListDelegate.qml index 89dfb54db8..b65704867b 100644 --- a/demos/declarative/flickr/mobile/ListDelegate.qml +++ b/demos/declarative/flickr/content/ListDelegate.qml @@ -39,7 +39,7 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 Component { Item { diff --git a/demos/declarative/flickr/common/Progress.qml b/demos/declarative/flickr/content/Progress.qml similarity index 74% rename from demos/declarative/flickr/common/Progress.qml rename to demos/declarative/flickr/content/Progress.qml index 2bb4f1a9c1..d403feebd1 100644 --- a/demos/declarative/flickr/common/Progress.qml +++ b/demos/declarative/flickr/content/Progress.qml @@ -39,9 +39,11 @@ ** ****************************************************************************/ -import QtQuick 1.0 +import QtQuick 2.0 +import Qt.labs.particles 2.0 -Item { +Item{ + id: container property variant progress: 0 Rectangle { @@ -53,21 +55,34 @@ Item { } } - Rectangle { + 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); - opacity: width < 1 ? 0 : 1; smooth: true - gradient: Gradient { - GradientStop { position: 0; color: "lightsteelblue" } - GradientStop { position: 1.0; color: "steelblue" } - } - radius: height/2 - 2 + 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: "white"; font.bold: true; font.pixelSize: 15 + 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 similarity index 99% rename from demos/declarative/flickr/common/RssModel.qml rename to demos/declarative/flickr/content/RssModel.qml index 172fdf337f..007f086830 100644 --- a/demos/declarative/flickr/common/RssModel.qml +++ b/demos/declarative/flickr/content/RssModel.qml @@ -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 similarity index 99% rename from demos/declarative/flickr/common/ScrollBar.qml rename to demos/declarative/flickr/content/ScrollBar.qml index 1a9f6d8361..7d2d9ff7d3 100644 --- a/demos/declarative/flickr/common/ScrollBar.qml +++ b/demos/declarative/flickr/content/ScrollBar.qml @@ -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 similarity index 99% rename from demos/declarative/flickr/common/Slider.qml rename to demos/declarative/flickr/content/Slider.qml index 2d35ee499d..b4a2960ac8 100644 --- a/demos/declarative/flickr/common/Slider.qml +++ b/demos/declarative/flickr/content/Slider.qml @@ -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..26384d3c07 --- /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 + } + ModelParticle{ + 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 similarity index 99% rename from demos/declarative/flickr/mobile/TitleBar.qml rename to demos/declarative/flickr/content/TitleBar.qml index ec5a5c0710..381d252ed3 100644 --- a/demos/declarative/flickr/mobile/TitleBar.qml +++ b/demos/declarative/flickr/content/TitleBar.qml @@ -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 similarity index 99% rename from demos/declarative/flickr/mobile/ToolBar.qml rename to demos/declarative/flickr/content/ToolBar.qml index 24126125c8..ca5341e101 100644 --- a/demos/declarative/flickr/mobile/ToolBar.qml +++ b/demos/declarative/flickr/content/ToolBar.qml @@ -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 similarity index 100% rename from demos/declarative/flickr/mobile/images/gloss.png rename to 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 similarity index 100% rename from demos/declarative/flickr/mobile/images/lineedit.png rename to 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 similarity index 100% rename from demos/declarative/flickr/mobile/images/lineedit.sci rename to 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 new file mode 100644 index 0000000000..dbc39cb16e Binary files /dev/null and b/demos/declarative/flickr/content/images/particle.png differ diff --git a/demos/declarative/flickr/mobile/images/quit.png b/demos/declarative/flickr/content/images/quit.png similarity index 100% rename from demos/declarative/flickr/mobile/images/quit.png rename to 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 new file mode 100644 index 0000000000..faf85c24e0 Binary files /dev/null and b/demos/declarative/flickr/content/images/squareParticle.png differ diff --git a/demos/declarative/flickr/mobile/images/stripes.png b/demos/declarative/flickr/content/images/stripes.png similarity index 100% rename from demos/declarative/flickr/mobile/images/stripes.png rename to 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 similarity index 100% rename from demos/declarative/flickr/mobile/images/titlebar.png rename to 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 similarity index 100% rename from demos/declarative/flickr/mobile/images/titlebar.sci rename to 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 similarity index 100% rename from demos/declarative/flickr/mobile/images/toolbutton.png rename to 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 similarity index 100% rename from demos/declarative/flickr/mobile/images/toolbutton.sci rename to demos/declarative/flickr/content/images/toolbutton.sci diff --git a/demos/declarative/flickr/common/qmldir b/demos/declarative/flickr/content/qmldir similarity index 100% rename from demos/declarative/flickr/common/qmldir rename to demos/declarative/flickr/content/qmldir diff --git a/demos/declarative/flickr/flickr-90.qml b/demos/declarative/flickr/flickr-90.qml index a3db5c3b04..960913710c 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 e0af46630f..8543692998 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/src/declarative/scenegraph/util/qsgtexture_p.h b/src/declarative/scenegraph/util/qsgtexture_p.h index 2c142f5746..d504732f35 100644 --- a/src/declarative/scenegraph/util/qsgtexture_p.h +++ b/src/declarative/scenegraph/util/qsgtexture_p.h @@ -89,6 +89,7 @@ class Q_DECLARATIVE_EXPORT QSGPlainTexture : public QSGTexture bool hasMipmaps() const { return m_has_mipmaps; } void setImage(const QImage &image); + const QImage &image() { return m_image; } virtual void bind(); diff --git a/src/imports/particles/modelparticle.cpp b/src/imports/particles/modelparticle.cpp index ab952cb17b..9d326db83d 100644 --- a/src/imports/particles/modelparticle.cpp +++ b/src/imports/particles/modelparticle.cpp @@ -180,23 +180,26 @@ void ModelParticle::load(ParticleData* d) } if(m_available.isEmpty() && m_pendingItems.isEmpty()) return; - ModelParticleAttached* mpa = qobject_cast(qmlAttachedPropertiesObject(m_items[pos])); - if(mpa) - qDebug() << (mpa->m_mp = this); - else - qDebug() << "Bugger"; if(m_pendingItems.isEmpty()){ m_items[pos] = m_model->item(m_available.first()); m_idx[pos] = m_available.first(); m_available.pop_front(); + ModelParticleAttached* mpa = qobject_cast(qmlAttachedPropertiesObject(m_items[pos])); + if(mpa){ + mpa->m_mp = this; + mpa->attach(); + } }else{ m_items[pos] = m_pendingItems.front(); m_pendingItems.pop_front(); m_items[pos]->setX(d->curX() - m_items[pos]->width()/2); m_items[pos]->setY(d->curY() - m_items[pos]->height()/2); - if(mpa) - mpa->attach(); m_idx[pos] = -2; + ModelParticleAttached* mpa = qobject_cast(qmlAttachedPropertiesObject(m_items[pos])); + if(mpa){ + mpa->m_mp = this; + mpa->attach(); + } } m_items[pos]->setParentItem(this); m_data[pos] = d; diff --git a/src/imports/particles/particles.pro b/src/imports/particles/particles.pro index 6eea892f83..56474b4b37 100644 --- a/src/imports/particles/particles.pro +++ b/src/imports/particles/particles.pro @@ -48,7 +48,7 @@ HEADERS += \ deformableparticle.h \ pictureaffector.h -QT += core-private gui-private declarative-private +QT += core-private gui-private declarative-private script-private SOURCES += \ V1/qdeclarativeparticles.cpp \ diff --git a/src/imports/particles/particlesystem.cpp b/src/imports/particles/particlesystem.cpp index 854d512630..f89eda4aaf 100644 --- a/src/imports/particles/particlesystem.cpp +++ b/src/imports/particles/particlesystem.cpp @@ -206,6 +206,8 @@ void ParticleSystem::reset() initializeSystem(); foreach(ParticleType* p, m_particles) p->update(); + foreach(ParticleEmitter* e, m_emitters) + e->emitWindow(0);//Start, so that starttime factors appropriately } ParticleData* ParticleSystem::newDatum(int groupId) diff --git a/src/imports/particles/particlesystem.h b/src/imports/particles/particlesystem.h index 896f215bfc..fc5575d3a7 100644 --- a/src/imports/particles/particlesystem.h +++ b/src/imports/particles/particlesystem.h @@ -118,6 +118,11 @@ emit overwriteChanged(arg); } } +void fastForward(int ms) +{ + m_startTime += ms; +} + protected: void componentComplete(); diff --git a/src/imports/particles/pictureaffector.cpp b/src/imports/particles/pictureaffector.cpp index c05a553f39..d684b3fd80 100644 --- a/src/imports/particles/pictureaffector.cpp +++ b/src/imports/particles/pictureaffector.cpp @@ -42,11 +42,13 @@ #include "pictureaffector.h" #include "coloredparticle.h" #include +#include +#include QT_BEGIN_NAMESPACE PictureAffector::PictureAffector(QSGItem *parent) : - ParticleAffector(parent) + ParticleAffector(parent), m_pix(0) { m_needsReset = true; } @@ -56,6 +58,27 @@ void PictureAffector::reset(int systemIdx) ParticleAffector::reset(systemIdx); } +void PictureAffector::startLoadImage() +{ + if(m_pix) + m_pix->clear(); + else + m_pix = new QDeclarativePixmap(); + m_pix->load(qmlEngine(this), m_image, QDeclarativePixmap::Cache); + if(m_pix->isReady()) + loadImage(); + else + m_pix->connectFinished(this, SLOT(loadImage())); +} +void PictureAffector::loadImage() +{ + QSGPlainTexture* ptext = qobject_cast(m_pix->texture()); + if(ptext) + m_loadedImage = ptext->image(); + if(m_loadedImage.isNull()) + qWarning() << "PictureAffector could not load picture " << m_image; +} + bool PictureAffector::affectParticle(ParticleData *d, qreal dt) { Q_UNUSED(dt); @@ -74,7 +97,7 @@ bool PictureAffector::affectParticle(ParticleData *d, qreal dt) QPoint pos = QPoint(d->curX() - m_offset.x(), d->curY() - m_offset.y()); if(!QRect(0,0,width(),height()).contains(pos)){ //XXX: Just a debugging helper, as I don't think it can get here. - qWarning() << "An unexpected situation has occurred. But don't worry, everything will be fine."; + qWarning() << "PictureAffector gives up."; return false; } Color4ub c; diff --git a/src/imports/particles/pictureaffector.h b/src/imports/particles/pictureaffector.h index ca7d13f477..4e0141d00a 100644 --- a/src/imports/particles/pictureaffector.h +++ b/src/imports/particles/pictureaffector.h @@ -50,12 +50,12 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) +class QDeclarativePixmap; class PictureAffector : public ParticleAffector { Q_OBJECT //Usually want to use "particles" to target just colored stuff, and save performance //Use onceOff (inherited) to determine if this is an emitter modification or a more constant enforcer - //TODO: Onceoff isn't actually working right now... Q_PROPERTY(QUrl image READ image WRITE setImage NOTIFY imageChanged) //TODO: Bool smooth, where it interpolates public: @@ -78,15 +78,17 @@ public slots: { if (m_image != arg) { m_image = arg; - m_loadedImage = QImage(m_image.toLocalFile()); - if(m_loadedImage.isNull()) - qWarning() << "PictureAffector could not load picture " << m_image.toLocalFile(); + startLoadImage(); emit imageChanged(arg); } } +private slots: + void loadImage(); private: + void startLoadImage(); QUrl m_image; + QDeclarativePixmap* m_pix; QImage m_loadedImage; };