diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-06-29 01:23:22 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-06-29 01:23:22 (GMT) |
commit | 16a8e075e09323b3e77f8faa58bfc9e9a3bf310f (patch) | |
tree | d51df8e75b1d81fbecd15553744a768956a7992a /src/declarative/fx | |
parent | 13086523d7181d5628872c74030b460e5f7388a5 (diff) | |
download | Qt-16a8e075e09323b3e77f8faa58bfc9e9a3bf310f.zip Qt-16a8e075e09323b3e77f8faa58bfc9e9a3bf310f.tar.gz Qt-16a8e075e09323b3e77f8faa58bfc9e9a3bf310f.tar.bz2 |
Move some non-essential classes to extra.
Diffstat (limited to 'src/declarative/fx')
-rw-r--r-- | src/declarative/fx/fx.pri | 6 | ||||
-rw-r--r-- | src/declarative/fx/qfxanimatedimageitem.cpp | 212 | ||||
-rw-r--r-- | src/declarative/fx/qfxanimatedimageitem.h | 100 | ||||
-rw-r--r-- | src/declarative/fx/qfxanimatedimageitem_p.h | 77 | ||||
-rw-r--r-- | src/declarative/fx/qfxblendedimage.cpp | 308 | ||||
-rw-r--r-- | src/declarative/fx/qfxblendedimage.h | 110 | ||||
-rw-r--r-- | src/declarative/fx/qfxflowview.cpp | 381 | ||||
-rw-r--r-- | src/declarative/fx/qfxflowview.h | 106 |
8 files changed, 0 insertions, 1300 deletions
diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri index 1c819e7..69fada0 100644 --- a/src/declarative/fx/fx.pri +++ b/src/declarative/fx/fx.pri @@ -1,8 +1,6 @@ HEADERS += \ fx/qfxanchors.h \ fx/qfxanchors_p.h \ - fx/qfxanimatedimageitem.h \ - fx/qfxblendedimage.h \ fx/qfxblurfilter.h \ fx/qfxcomponentinstance.h \ fx/qfxcomponentinstance_p.h \ @@ -15,7 +13,6 @@ HEADERS += \ fx/qfxfocuspanel.h \ fx/qfxfocusrealm.h \ fx/qfxgridview.h \ - fx/qfxflowview.h \ fx/qfxhighlightfilter.h \ fx/qfximage.h \ fx/qfxpainteditem.h \ @@ -53,8 +50,6 @@ HEADERS += \ SOURCES += \ fx/qfxanchors.cpp \ - fx/qfxanimatedimageitem.cpp \ - fx/qfxblendedimage.cpp \ fx/qfxblurfilter.cpp \ fx/qfxcomponentinstance.cpp \ fx/qfxcontentwrapper.cpp \ @@ -64,7 +59,6 @@ SOURCES += \ fx/qfxfocuspanel.cpp \ fx/qfxfocusrealm.cpp \ fx/qfxgridview.cpp \ - fx/qfxflowview.cpp \ fx/qfxhighlightfilter.cpp \ fx/qfximage.cpp \ fx/qfxpainteditem.cpp \ diff --git a/src/declarative/fx/qfxanimatedimageitem.cpp b/src/declarative/fx/qfxanimatedimageitem.cpp deleted file mode 100644 index d22959a..0000000 --- a/src/declarative/fx/qfxanimatedimageitem.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** 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.0, 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 are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QMovie> -#include <QtDeclarative/qmlcontext.h> -#include <QtDeclarative/qmlengine.h> -#include "qfxanimatedimageitem.h" -#include "qfxanimatedimageitem_p.h" -#include <QNetworkRequest> -#include <QNetworkReply> - -QT_BEGIN_NAMESPACE - -/*! - \class QFxAnimatedImageItem - \internal -*/ - -/*! - \qmlclass AnimatedImage - \inherits Image - - This item provides for playing animations stored as images containing a series of frames, - such as GIF files. The full list of supported formats can be determined with - QMovie::supportedFormats(). - - \table - \row - \o \image animatedimageitem.gif - \o - \qml -Item { - width: anim.width; height: anim.height+8 - AnimatedImage { id: anim; source: "pics/games-anim.gif" } - Rect { color: "red"; width: 4; height: 8; y: anim.height - x: (anim.width-width)*anim.currentFrame/(anim.frameCount-1) - } -} - \endqml - \endtable -*/ -QML_DEFINE_TYPE(QFxAnimatedImageItem, AnimatedImage) - -QFxAnimatedImageItem::QFxAnimatedImageItem(QFxItem *parent) - : QFxImage(*(new QFxAnimatedImageItemPrivate), parent) -{ -} - -QFxAnimatedImageItem::QFxAnimatedImageItem(QFxAnimatedImageItemPrivate &dd, QFxItem *parent) - : QFxImage(dd, parent) -{ -} - -QFxAnimatedImageItem::~QFxAnimatedImageItem() -{ - Q_D(QFxAnimatedImageItem); - delete d->_movie; -} - -/*! - \qmlproperty bool AnimatedImage::playing - This property holds whether the animated image is playing or not - - Defaults to true, so as to start playing immediately. -*/ -bool QFxAnimatedImageItem::isPlaying() const -{ - Q_D(const QFxAnimatedImageItem); - if (!d->_movie) - return false; - return d->_movie->state()==QMovie::Running; -} - -void QFxAnimatedImageItem::setPlaying(bool play) -{ - Q_D(QFxAnimatedImageItem); - if (!d->_movie) - return; - if (play) - d->_movie->start(); - else - d->_movie->stop(); -} - -/*! - \qmlproperty int AnimatedImage::currentFrame - \qmlproperty int AnimatedImage::frameCount - - currentFrame is the frame that is currently visible. Watching when this changes can - allow other things to animate at the same time as the image. frameCount is the number - of frames in the animation. For some animation formats, frameCount is unknown and set to zero. -*/ -int QFxAnimatedImageItem::currentFrame() const -{ - Q_D(const QFxAnimatedImageItem); - if (!d->_movie) - return -1; - return d->_movie->currentFrameNumber(); -} - -void QFxAnimatedImageItem::setCurrentFrame(int frame) -{ - Q_D(QFxAnimatedImageItem); - if (!d->_movie) - return; - d->_movie->jumpToFrame(frame); -} - -int QFxAnimatedImageItem::frameCount() const -{ - Q_D(const QFxAnimatedImageItem); - if (!d->_movie) - return 0; - return d->_movie->frameCount(); -} - -void QFxAnimatedImageItem::setSource(const QUrl &url) -{ - Q_D(QFxAnimatedImageItem); - if (url == d->url) - return; - - delete d->_movie; - d->_movie = 0; - - if (d->reply) { - d->reply->deleteLater(); - d->reply = 0; - } - - d->url = url; - - if (url.isEmpty()) { - delete d->_movie; - d->status = Idle; - } else { - d->status = Loading; - QNetworkRequest req(d->url); - req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); - d->reply = qmlContext(this)->engine()->networkAccessManager()->get(req); - QObject::connect(d->reply, SIGNAL(finished()), - this, SLOT(movieRequestFinished())); - } - - emit statusChanged(d->status); -} - -void QFxAnimatedImageItem::movieRequestFinished() -{ - Q_D(QFxAnimatedImageItem); - d->_movie = new QMovie(d->reply); - if (!d->_movie->isValid()){ - qWarning() << "Error Reading File " << d->url; - delete d->_movie; - d->_movie = 0; - return; - } - connect(d->_movie, SIGNAL(stateChanged(QMovie::MovieState)), - this, SIGNAL(playingChanged())); - connect(d->_movie, SIGNAL(frameChanged(int)), - this, SLOT(movieUpdate())); - d->_movie->setCacheMode(QMovie::CacheAll); - d->_movie->start(); - setPixmap(d->_movie->currentPixmap()); -} - -void QFxAnimatedImageItem::movieUpdate() -{ - Q_D(QFxAnimatedImageItem); - setPixmap(d->_movie->currentPixmap()); - emit frameChanged(); -} - -QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxanimatedimageitem.h b/src/declarative/fx/qfxanimatedimageitem.h deleted file mode 100644 index 5d115d7..0000000 --- a/src/declarative/fx/qfxanimatedimageitem.h +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** 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.0, 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 are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFXANIMATEDIMAGEITEM_H -#define QFXANIMATEDIMAGEITEM_H - -#include <QtDeclarative/qfximage.h> - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QMovie; -class QFxAnimatedImageItemPrivate; - -class Q_DECLARATIVE_EXPORT QFxAnimatedImageItem : public QFxImage -{ - Q_OBJECT - - Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged) - Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY frameChanged) - Q_PROPERTY(int frameCount READ frameCount) -public: - QFxAnimatedImageItem(QFxItem *parent=0); - ~QFxAnimatedImageItem(); - - bool isPlaying() const; - void setPlaying(bool play); - - int currentFrame() const; - void setCurrentFrame(int frame); - - int frameCount() const; - - // Extends QFxImage's src property*/ - virtual void setSource(const QUrl&); - -Q_SIGNALS: - void playingChanged(); - void frameChanged(); - -private Q_SLOTS: - void movieUpdate(); - void movieRequestFinished(); - -protected: - QFxAnimatedImageItem(QFxAnimatedImageItemPrivate &dd, QFxItem *parent); - -private: - Q_DISABLE_COPY(QFxAnimatedImageItem) - Q_DECLARE_PRIVATE(QFxAnimatedImageItem) -}; - -QML_DECLARE_TYPE(QFxAnimatedImageItem) - - -QT_END_NAMESPACE - -QT_END_HEADER -#endif diff --git a/src/declarative/fx/qfxanimatedimageitem_p.h b/src/declarative/fx/qfxanimatedimageitem_p.h deleted file mode 100644 index cb5da63..0000000 --- a/src/declarative/fx/qfxanimatedimageitem_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** 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.0, 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 are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFXANIMATEDIMAGE_P_H -#define QFXANIMATEDIMAGE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qfximage_p.h" - -QT_BEGIN_NAMESPACE - -class QMovie; - -class QFxAnimatedImageItemPrivate : public QFxImagePrivate -{ - Q_DECLARE_PUBLIC(QFxAnimatedImageItem) - -public: - QFxAnimatedImageItemPrivate() - : _movie(0) - { - } - - QMovie *_movie; -}; - -QT_END_NAMESPACE - -#endif // QFXANIMATEDIMAGE_P_H diff --git a/src/declarative/fx/qfxblendedimage.cpp b/src/declarative/fx/qfxblendedimage.cpp deleted file mode 100644 index 0c93fef..0000000 --- a/src/declarative/fx/qfxblendedimage.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** 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.0, 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 are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfxblendedimage.h" -#include <QtDeclarative/qmlcontext.h> - -#if defined(QFX_RENDER_OPENGL2) -#include <glbasicshaders.h> -#endif - -QT_BEGIN_NAMESPACE - -/*! - \qmlclass BlendedImage - \brief The BlendedImage elements blends two different images depending on a blend ratio. - - This element can be used to simulate blur on slow devices by setting secondaryUrl with - a pre-rendered blurred version of primaryUrl. - - Note that this class will only work under OpenGL. On the software canvas it will display - only the primary image unless the blend is > 0.75, in which case it will display only the - secondary image. -*/ - -/*! - \internal - \class QFxBlendedImage - \brief The QFxBlendedImage blends two different images depending on a blend ratio. - - This class can be used to simulate blur on slow devices by setting secondaryUrl with - a pre-rendered blurred version of primaryUrl. - - Note that this class will only work under OpenGL. On the software canvas it will display - only the primary image unless the blend is > 0.75, in which case it will display only the - secondary image. -*/ -QFxBlendedImage::QFxBlendedImage(QFxItem *parent) -: QFxItem(parent), _blend(0), _smooth(false), dirty(false) -{ -#if defined(QFX_RENDER_OPENGL2) - setOptions(HasContents); -#endif -} - -/*! - Cancels any pending image loads and destroys the image. -*/ -QFxBlendedImage::~QFxBlendedImage() -{ - if (!primUrl.isEmpty()) - QFxPixmap::cancelGet(primUrl,this); - if (!secUrl.isEmpty()) - QFxPixmap::cancelGet(secUrl,this); -} - -/*! - \qmlproperty string BlendedImage::primaryUrl - The URL of the first image to be displayed in this item. -*/ -QUrl QFxBlendedImage::primaryUrl() const -{ - return primUrl; -} - -void QFxBlendedImage::primaryLoaded() -{ - primPix = QFxPixmap(primUrl); - dirty = true; - update(); -} - -void QFxBlendedImage::setPrimaryUrl(const QUrl &url) -{ - if (primUrl == url) - return; - if (!primUrl.isEmpty()) - QFxPixmap::cancelGet(primUrl,this); - Q_ASSERT(!url.isRelative()); - primUrl = url; - if (!primUrl.isEmpty()) - QFxPixmap::get(qmlEngine(this), primUrl,this,SLOT(primaryLoaded())); -} - -/*! - \qmlproperty string BlendedImage::secondaryUrl - The URL of the second image to be displayed in this item. -*/ -QUrl QFxBlendedImage::secondaryUrl() const -{ - return secUrl; -} - -void QFxBlendedImage::secondaryLoaded() -{ - secPix = QFxPixmap(secUrl); - dirty = true; - update(); -} - -void QFxBlendedImage::setSecondaryUrl(const QUrl &url) -{ - if (secUrl == url) - return; - if (!secUrl.isEmpty()) - QFxPixmap::cancelGet(secUrl,this); - Q_ASSERT(!url.isRelative()); - secUrl = url; - if (!secUrl.isEmpty()) - QFxPixmap::get(qmlEngine(this), secUrl,this,SLOT(secondaryLoaded())); -} - -/*! - \qmlproperty real BlendedImage::blend - The ratio used to blend the two images. - - If blend has a value of 0, only the first image will be displayed. - If blend has a value of 1, only the second image will be displayed. -*/ -qreal QFxBlendedImage::blend() const -{ - return _blend; -} - -void QFxBlendedImage::setBlend(qreal b) -{ - _blend = b; - update(); -} - -/*! - \qmlproperty bool BlendedImage::smooth - - Set this property if you want the image to be smoothly filtered when scaled or - transformed. Smooth filtering gives better visual quality, but is slower. If - the BlendedImage is displayed at its natural size, this property has no visual or - performance effect. - - \note Generally scaling artifacts are only visible if the image is stationary on - the screen. A common pattern when animating an image is to disable smooth - filtering at the beginning of the animation and reenable it at the conclusion. - */ -bool QFxBlendedImage::smoothTransform() const -{ - return _smooth; -} - -void QFxBlendedImage::setSmoothTransform(bool s) -{ - if (_smooth == s) - return; - _smooth = s; - update(); -} - -#if defined(QFX_RENDER_QPAINTER) - -void QFxBlendedImage::paintContents(QPainter &p) -{ - if (primUrl.isEmpty() && secUrl.isEmpty()) - return; - - if (_smooth) { - p.save(); - p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, _smooth); - } - - if (_blend < 0.75) - p.drawPixmap(0, 0, primPix); - else - p.drawPixmap(0, 0, secPix); - - if (_smooth) { - p.restore(); - } -} - -#elif defined(QFX_RENDER_OPENGL2) - -void QFxBlendedImage::paintGLContents(GLPainter &p) -{ - static DualTextureBlendShader *shader = 0; - if (!shader) - shader = new DualTextureBlendShader(); - - if (dirty) { - prim.clear(); - sec.clear(); - prim.setImage(primPix.toImage()); - sec.setImage(secPix.toImage()); - - dirty = false; - } - - if (prim.isNull() || sec.isNull()) { - - return; - } - - GLfloat vertices[8]; - GLfloat texVertices[8]; - - float widthV = width(); - float heightV = height(); - if (!widthV) - widthV = qMax(primPix.width(), secPix.width()); - if (!heightV) - heightV = qMax(primPix.height(), secPix.height()); - - vertices[0] = 0; vertices[1] = heightV; - vertices[2] = widthV; vertices[3] = heightV; - vertices[4] = 0; vertices[5] = 0; - vertices[6] = widthV; vertices[7] = 0; - - texVertices[0] = 0; texVertices[1] = 0; - texVertices[2] = 1; texVertices[3] = 0; - texVertices[4] = 0; texVertices[5] = 1; - texVertices[6] = 1; texVertices[7] = 1; - - if (_blend == 0 || _blend == 1) { - QGLShaderProgram *tshader = p.useTextureShader(); - - GLTexture *tex = 0; - - if (_blend == 0) - tex = &prim; - else - tex = &sec; - - tshader->setAttributeArray(SingleTextureShader::Vertices, vertices, 2); - tshader->setAttributeArray(SingleTextureShader::TextureCoords, texVertices, 2); - - glBindTexture(GL_TEXTURE_2D, tex->texture()); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - tshader->disableAttributeArray(SingleTextureShader::Vertices); - tshader->disableAttributeArray(SingleTextureShader::TextureCoords); - } else { - - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, prim.texture()); - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, sec.texture()); - - shader->enable(); - shader->setOpacity(1); - qreal b = _blend; - if (b > 1) b = 1; - else if (b < 0) b = 0; - shader->setBlend(b); - shader->setTransform(p.activeTransform); - - shader->setAttributeArray(DualTextureBlendShader::Vertices, vertices, 2); - shader->setAttributeArray(DualTextureBlendShader::TextureCoords, texVertices, 2); - shader->setAttributeArray(DualTextureBlendShader::BlendTextureCoords, texVertices, 2); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - shader->disableAttributeArray(DualTextureBlendShader::Vertices); - shader->disableAttributeArray(DualTextureBlendShader::TextureCoords); - shader->disableAttributeArray(DualTextureBlendShader::BlendTextureCoords); - - glBindTexture(GL_TEXTURE_2D, 0); - glActiveTexture(GL_TEXTURE0); - } -} -#endif - -QML_DEFINE_TYPE(QFxBlendedImage,BlendedImage) - -QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxblendedimage.h b/src/declarative/fx/qfxblendedimage.h deleted file mode 100644 index 248cc9d..0000000 --- a/src/declarative/fx/qfxblendedimage.h +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** 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.0, 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 are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFXBLENDEDIMAGE_H -#define QFXBLENDEDIMAGE_H - -#include <QtDeclarative/qfxitem.h> -#if defined(QFX_RENDER_OPENGL2) -#include <gltexture.h> -#endif - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class Q_DECLARATIVE_EXPORT QFxBlendedImage : public QFxItem -{ - Q_OBJECT - - Q_PROPERTY(QUrl primaryUrl READ primaryUrl WRITE setPrimaryUrl) - Q_PROPERTY(QUrl secondaryUrl READ secondaryUrl WRITE setSecondaryUrl) - Q_PROPERTY(qreal blend READ blend WRITE setBlend) - Q_PROPERTY(bool smooth READ smoothTransform WRITE setSmoothTransform) -public: - QFxBlendedImage(QFxItem *parent=0); - ~QFxBlendedImage(); - - QUrl primaryUrl() const; - void setPrimaryUrl(const QUrl &); - - QUrl secondaryUrl() const; - void setSecondaryUrl(const QUrl &); - - qreal blend() const; - void setBlend(qreal); - - bool smoothTransform() const; - void setSmoothTransform(bool); - -#if defined(QFX_RENDER_QPAINTER) - void paintContents(QPainter &painter); -#elif defined(QFX_RENDER_OPENGL2) - void paintGLContents(GLPainter &); -#endif - -private Q_SLOTS: - void primaryLoaded(); - void secondaryLoaded(); - -private: - QUrl primUrl; - QUrl secUrl; - - qreal _blend; - bool _smooth; - bool dirty; -#if defined(QFX_RENDER_OPENGL2) - GLTexture prim; - GLTexture sec; -#endif - QPixmap primPix; - QPixmap secPix; -}; -QML_DECLARE_TYPE(QFxBlendedImage) - - -QT_END_NAMESPACE - -QT_END_HEADER -#endif // QFXBLENDEDIMAGE_H diff --git a/src/declarative/fx/qfxflowview.cpp b/src/declarative/fx/qfxflowview.cpp deleted file mode 100644 index 77cd6df..0000000 --- a/src/declarative/fx/qfxflowview.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** 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.0, 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 are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfxvisualitemmodel.h" -#include "qfxflowview.h" - -QT_BEGIN_NAMESPACE - -class QFxFlowViewAttached : public QObject -{ -Q_OBJECT -Q_PROPERTY(int row READ row NOTIFY posChanged); -Q_PROPERTY(int column READ column NOTIFY posChanged); -public: - QFxFlowViewAttached(QObject *parent); - - int row() const; - int column() const; - -signals: - void posChanged(); - -private: - friend class QFxFlowView; - int m_row; - int m_column; -}; - - -QFxFlowView::QFxFlowView() -: m_columns(0), m_model(0), m_vertical(false), m_dragItem(0), m_dragIdx(-1) -{ - setAcceptedMouseButtons(Qt::LeftButton); - setOptions(MouseEvents); -} - -QFxVisualItemModel *QFxFlowView::model() const -{ - return m_model; -} - -void QFxFlowView::setModel(QFxVisualItemModel *m) -{ - m_model = m; - refresh(); -} - -int QFxFlowView::columns() const -{ - return m_columns; -} - -void QFxFlowView::setColumns(int c) -{ - m_columns = c; - refresh(); -} - -bool QFxFlowView::vertical() const -{ - return m_vertical; -} - -void QFxFlowView::setVertical(bool v) -{ - m_vertical = v; -} - -class QFxFlowViewValue : public QmlTimeLineValue -{ -public: - enum Property { xProperty, yProperty }; - - QFxFlowViewValue(QFxItem *item, Property p) - : m_item(item), m_property(p) {} - - qreal value() const { - return (m_property == xProperty)?m_item->x():m_item->y(); - } - void setValue(qreal v) { - if (m_property == xProperty) m_item->setX(v); - else m_item->setY(v); - } -private: - QFxItem *m_item; - Property m_property; -}; - -void QFxFlowView::refresh() -{ - if (m_model && m_columns >= 1) { - for (int ii = 0; ii < m_model->count(); ++ii) { - if (QFxItem *item = m_model->item(ii)) { - item->setParent(this); - item->setZ(0); - m_items << item; - } - } - - reflow(); - } -} - -void QFxFlowView::reflow(bool animate) -{ - qreal y = 0; - qreal maxY = 0; - qreal x = 0; - int row = 0; - int column = -1; - if (animate) - clearTimeLine(); - - for (int ii = 0; ii < m_items.count(); ++ii) { - if (0 == (ii % m_columns)) { - y += maxY; - maxY = 0; - x = 0; - row = 0; - column++; - } - - QFxItem *item = m_items.at(ii); - QFxFlowViewAttached *att = - (QFxFlowViewAttached *)qmlAttachedPropertiesObject<QFxFlowView>(item); - att->m_row = row; - att->m_column = column; - emit att->posChanged(); - - - if (animate) { - if (vertical()) - moveItem(item, QPointF(y, x)); - else - moveItem(item, QPointF(x, y)); - } else { - if (vertical()) { - item->setX(y); - item->setY(x); - } else { - item->setX(x); - item->setY(y); - } - } - if (vertical()) { - x += item->height(); - maxY = qMax(maxY, item->width()); - } else { - x += item->width(); - maxY = qMax(maxY, item->height()); - } - ++row; - } -} - -void QFxFlowView::reflowDrag(const QPointF &dp) -{ - qreal y = 0; - qreal maxY = 0; - qreal x = 0; - - int flowedItems = 0; - - clearTimeLine(); - - QList<QFxItem *> items; - - bool dragUsed = false; - bool dragSeen = false; - for (int ii = 0; ii < m_items.count(); ++ii) { - if (0 == (ii % m_columns)) { - y += maxY; - maxY = 0; - x = 0; - } - - QFxItem *item = m_items.at(ii); - if (item == m_dragItem) - dragSeen = true; - if (item == m_dragItem && dragUsed) - continue; - QRectF r; - if (vertical()) - r = QRectF(y, x, item->width(), item->height()); - else - r = QRectF(x, y, item->width(), item->height()); - if (r.contains(dp)) { - dragUsed = true; - if (dragSeen) - m_dragIdx = items.count() + 1; - else - m_dragIdx = items.count(); - - items.append(m_dragItem); - if (m_dragItem != item) { - if (dragSeen) - items.insert(items.count() - 1, item); - else - items.append(item); - } - } else { - if (m_dragItem != item) - items.append(item); - } - - if (vertical()) { - x += item->height(); - maxY = qMax(maxY, item->width()); - } else { - x += item->width(); - maxY = qMax(maxY, item->height()); - } - } - - y = 0; - maxY = 0; - x = 0; - clearTimeLine(); - for (int ii = 0; ii < items.count(); ++ii) { - if (0 == (ii % m_columns)) { - y += maxY; - maxY = 0; - x = 0; - } - - QFxItem *item = items.at(ii); - if (item != m_dragItem) { - if (vertical()) - moveItem(item, QPointF(y, x)); - else - moveItem(item, QPointF(x, y)); - } - if (vertical()) { - x += item->height(); - maxY = qMax(maxY, item->width()); - } else { - x += item->width(); - maxY = qMax(maxY, item->height()); - } - } - -} - -void QFxFlowView::moveItem(QFxItem *item, const QPointF &p) -{ - QFxFlowViewValue *xv = new QFxFlowViewValue(item, QFxFlowViewValue::xProperty); - QFxFlowViewValue *yv = new QFxFlowViewValue(item, QFxFlowViewValue::yProperty); - m_values << xv << yv; - m_timeline.move(*xv, p.x(), 100); - m_timeline.move(*yv, p.y(), 100); -} - -#include <QGraphicsSceneMouseEvent> - -void QFxFlowView::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - for (int ii = 0; ii < m_items.count(); ++ii) { - QFxItem *item = m_items.at(ii); - QRectF r = rectForItem(ii); - - if (r.contains(event->pos())) { - m_dragItem = item; - m_dragItem->setZ(1); - m_dragOffset = r.topLeft() - event->pos(); - event->accept(); - return; - } - } - event->ignore(); -} - -QRectF QFxFlowView::rectForItem(int idx) const -{ - QFxItem *item = m_items.at(idx); - QRectF r(item->x(), item->y(), item->width(), item->height()); - return r; -} - -void QFxFlowView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - if (m_dragItem) { - m_dragItem->setZ(0); - - clearTimeLine(); - - if (m_dragIdx != -1) { - m_items.removeAll(m_dragItem); - m_items.insert(m_dragIdx, m_dragItem); - } - - reflow(true); - m_dragItem = 0; - m_dragIdx = -1; - } -} - -QFxFlowViewAttached::QFxFlowViewAttached(QObject *parent) -: QObject(parent), m_row(0), m_column(0) -{ -} - -int QFxFlowViewAttached::row() const -{ - return m_row; -} - -int QFxFlowViewAttached::column() const -{ - return m_column; -} - -QFxFlowViewAttached *QFxFlowView::qmlAttachedProperties(QObject *obj) -{ - return new QFxFlowViewAttached(obj); -} - -void QFxFlowView::clearTimeLine() -{ - m_timeline.clear(); - qDeleteAll(m_values); - m_values.clear(); -} - -void QFxFlowView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -{ - if (m_dragItem) { - QPointF p = event->pos() + m_dragOffset; - m_dragItem->setX(p.x()); - m_dragItem->setY(p.y()); - - for (int ii = 0; ii < m_items.count(); ++ii) { - if (m_items.at(ii) != m_dragItem && rectForItem(ii).contains(event->pos())) { - reflowDrag(event->pos()); - } - } - } -} - -QML_DEFINE_TYPE(QFxFlowView,FlowView); - -#include "qfxflowview.moc" - -QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxflowview.h b/src/declarative/fx/qfxflowview.h deleted file mode 100644 index 0e7c2d3..0000000 --- a/src/declarative/fx/qfxflowview.h +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (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 either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** 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.0, 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 are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFXFLOWVIEW_H -#define QFXFLOWVIEW_H - -#include <QtDeclarative/QmlTimeLine> -#include <QtDeclarative/qfxitem.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QFxVisualItemModel; -class QFxFlowViewValue; -class QFxFlowViewAttached; -class Q_DECLARATIVE_EXPORT QFxFlowView : public QFxItem -{ - Q_OBJECT - Q_PROPERTY(QFxVisualItemModel *model READ model WRITE setModel) - Q_PROPERTY(int column READ columns WRITE setColumns); - Q_PROPERTY(bool vertical READ vertical WRITE setVertical); - -public: - QFxFlowView(); - - QFxVisualItemModel *model() const; - void setModel(QFxVisualItemModel *); - - int columns() const; - void setColumns(int); - - bool vertical() const; - void setVertical(bool); - - virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - - static QFxFlowViewAttached *qmlAttachedProperties(QObject *); - -private: - QRectF rectForItem(int idx) const; - void refresh(); - void reflow(bool animate = false); - void reflowDrag(const QPointF &); - void clearTimeLine(); - int m_columns; - QFxVisualItemModel *m_model; - QList<QFxItem *> m_items; - bool m_vertical; - void moveItem(QFxItem *item, const QPointF &); - - QPointF m_dragOffset; - QFxItem *m_dragItem; - - QmlTimeLine m_timeline; - QList<QFxFlowViewValue *> m_values; - int m_dragIdx; -}; -QML_DECLARE_TYPE(QFxFlowView); - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QFXFLOWVIEW_H |