diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-04-29 00:10:35 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-04-29 00:10:35 (GMT) |
commit | dc5a2f46bd9676e69ed81d0b83199a533d1fca21 (patch) | |
tree | 9eb4b410c5243cceb45962bb880da865b80ea891 /src/declarative/fx | |
parent | 978cf2724888f13ba1a0ebab65056c05fe112dad (diff) | |
parent | 1cb0906f04ed49de26575252740b8bb5190e3025 (diff) | |
download | Qt-dc5a2f46bd9676e69ed81d0b83199a533d1fca21.zip Qt-dc5a2f46bd9676e69ed81d0b83199a533d1fca21.tar.gz Qt-dc5a2f46bd9676e69ed81d0b83199a533d1fca21.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts:
src/declarative/fx/qfximageitem.cpp
src/declarative/fx/qfxpathview.cpp
src/declarative/util/qmllistmodel.cpp
Diffstat (limited to 'src/declarative/fx')
40 files changed, 525 insertions, 526 deletions
diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp index 7372866..f537da9 100644 --- a/src/declarative/fx/qfxanchors.cpp +++ b/src/declarative/fx/qfxanchors.cpp @@ -165,7 +165,7 @@ QFxItem *QFxAnchors::fill() const void QFxAnchors::setFill(QFxItem *f) { Q_D(QFxAnchors); - if(d->fill) { + if (d->fill) { QObject::disconnect(d->fill, SIGNAL(leftChanged()), this, SLOT(fillChanged())); QObject::disconnect(d->fill, SIGNAL(topChanged()), this, SLOT(fillChanged())); QObject::disconnect(d->fill, SIGNAL(widthChanged()), this, SLOT(fillChanged())); @@ -214,11 +214,11 @@ QFxItem *QFxAnchors::centeredIn() const void QFxAnchors::setCenteredIn(QFxItem* c) { Q_D(QFxAnchors); - if(!c){ + if (!c){ qmlInfo(d->item) << "Cannot center in null item."; return; } - if(c != d->item->itemParent() && c->itemParent() != d->item->itemParent()){ + if (c != d->item->itemParent() && c->itemParent() != d->item->itemParent()){ qmlInfo(d->item) << "Can't anchor to an item that isn't a parent or sibling."; return; } @@ -822,7 +822,7 @@ bool QFxAnchorsPrivate::checkHAnchorValid(QFxAnchorLine anchor) const if (anchor.anchorLine & QFxAnchorLine::Vertical_Mask) { qmlInfo(item) << "Can't anchor a horizontal edge to a vertical edge."; return false; - }else if(anchor.item == item){ + }else if (anchor.item == item){ qmlInfo(item) << "Can't anchor item to self."; return false; } @@ -847,7 +847,7 @@ bool QFxAnchorsPrivate::checkVAnchorValid(QFxAnchorLine anchor) const if (anchor.anchorLine & QFxAnchorLine::Horizontal_Mask) { qmlInfo(item) << "Can't anchor a vertical edge to a horizontal edge."; return false; - }else if(anchor.item == item){ + }else if (anchor.item == item){ qmlInfo(item) << "Can't anchor item to self."; return false; } diff --git a/src/declarative/fx/qfxanimatedimageitem.cpp b/src/declarative/fx/qfxanimatedimageitem.cpp index b5f0cc4..8f930d5 100644 --- a/src/declarative/fx/qfxanimatedimageitem.cpp +++ b/src/declarative/fx/qfxanimatedimageitem.cpp @@ -102,7 +102,7 @@ QFxAnimatedImageItem::~QFxAnimatedImageItem() bool QFxAnimatedImageItem::isPlaying() const { Q_D(const QFxAnimatedImageItem); - if(!d->_movie) + if (!d->_movie) return false; return d->_movie->state()==QMovie::Running; } @@ -110,9 +110,9 @@ bool QFxAnimatedImageItem::isPlaying() const void QFxAnimatedImageItem::setPlaying(bool play) { Q_D(QFxAnimatedImageItem); - if(!d->_movie) + if (!d->_movie) return; - if(play) + if (play) d->_movie->start(); else d->_movie->stop(); @@ -129,7 +129,7 @@ void QFxAnimatedImageItem::setPlaying(bool play) int QFxAnimatedImageItem::currentFrame() const { Q_D(const QFxAnimatedImageItem); - if(!d->_movie) + if (!d->_movie) return -1; return d->_movie->currentFrameNumber(); } @@ -137,7 +137,7 @@ int QFxAnimatedImageItem::currentFrame() const void QFxAnimatedImageItem::setCurrentFrame(int frame) { Q_D(QFxAnimatedImageItem); - if(!d->_movie) + if (!d->_movie) return; d->_movie->jumpToFrame(frame); } @@ -145,7 +145,7 @@ void QFxAnimatedImageItem::setCurrentFrame(int frame) int QFxAnimatedImageItem::frameCount() const { Q_D(const QFxAnimatedImageItem); - if(!d->_movie) + if (!d->_movie) return 0; return d->_movie->frameCount(); } @@ -153,13 +153,13 @@ int QFxAnimatedImageItem::frameCount() const void QFxAnimatedImageItem::setSource(const QString &url) { Q_D(QFxAnimatedImageItem); - if(url == d->source) + if (url == d->source) return; delete d->_movie; d->_movie = 0; - if(d->reply) { + if (d->reply) { d->reply->deleteLater(); d->reply = 0; } @@ -167,7 +167,7 @@ void QFxAnimatedImageItem::setSource(const QString &url) d->source = url; d->url = qmlContext(this)->resolvedUrl(url); - if(url.isEmpty()) { + if (url.isEmpty()) { delete d->_movie; d->status = Idle; } else { @@ -186,7 +186,7 @@ void QFxAnimatedImageItem::movieRequestFinished() { Q_D(QFxAnimatedImageItem); d->_movie = new QMovie(d->reply); - if(!d->_movie->isValid()){ + if (!d->_movie->isValid()){ qWarning() << "Error Reading File " << d->url; delete d->_movie; d->_movie = 0; diff --git a/src/declarative/fx/qfxblendedimage.cpp b/src/declarative/fx/qfxblendedimage.cpp index ec2b9cc..3326ea8 100644 --- a/src/declarative/fx/qfxblendedimage.cpp +++ b/src/declarative/fx/qfxblendedimage.cpp @@ -173,7 +173,7 @@ bool QFxBlendedImage::smoothTransform() const void QFxBlendedImage::setSmoothTransform(bool s) { - if(_smooth == s) + if (_smooth == s) return; _smooth = s; update(); @@ -186,7 +186,7 @@ void QFxBlendedImage::paintContents(QPainter &p) if (primSrc.isNull() && secSrc.isNull()) return; - if(_smooth) { + if (_smooth) { p.save(); p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, _smooth); } @@ -196,7 +196,7 @@ void QFxBlendedImage::paintContents(QPainter &p) else p.drawImage(0, 0, secPix); - if(_smooth) { + if (_smooth) { p.restore(); } } @@ -206,10 +206,10 @@ void QFxBlendedImage::paintContents(QPainter &p) void QFxBlendedImage::paintGLContents(GLPainter &p) { static DualTextureBlendShader *shader = 0; - if(!shader) + if (!shader) shader = new DualTextureBlendShader(); - if(dirty) { + if (dirty) { prim.clear(); sec.clear(); prim.setImage(primPix); @@ -218,7 +218,7 @@ void QFxBlendedImage::paintGLContents(GLPainter &p) dirty = false; } - if(prim.isNull() || sec.isNull()) { + if (prim.isNull() || sec.isNull()) { return; } @@ -228,9 +228,9 @@ void QFxBlendedImage::paintGLContents(GLPainter &p) float widthV = width(); float heightV = height(); - if(!widthV) + if (!widthV) widthV = qMax(primPix.width(), secPix.width()); - if(!heightV) + if (!heightV) heightV = qMax(primPix.height(), secPix.height()); vertices[0] = 0; vertices[1] = heightV; @@ -243,12 +243,12 @@ void QFxBlendedImage::paintGLContents(GLPainter &p) texVertices[4] = 0; texVertices[5] = 1; texVertices[6] = 1; texVertices[7] = 1; - if(_blend == 0 || _blend == 1) { + if (_blend == 0 || _blend == 1) { QGLShaderProgram *tshader = p.useTextureShader(); GLTexture *tex = 0; - if(_blend == 0) + if (_blend == 0) tex = &prim; else tex = &sec; @@ -271,8 +271,8 @@ void QFxBlendedImage::paintGLContents(GLPainter &p) shader->enable(); shader->setOpacity(1); qreal b = _blend; - if(b > 1) b = 1; - else if(b < 0) b = 0; + if (b > 1) b = 1; + else if (b < 0) b = 0; shader->setBlend(b); shader->setTransform(p.activeTransform); diff --git a/src/declarative/fx/qfxblurfilter.cpp b/src/declarative/fx/qfxblurfilter.cpp index 748fd8b..ad3eebc 100644 --- a/src/declarative/fx/qfxblurfilter.cpp +++ b/src/declarative/fx/qfxblurfilter.cpp @@ -124,7 +124,7 @@ qreal QFxBlurFilter::radius() const void QFxBlurFilter::setRadius(qreal radius) { - if(d->radius == radius) return; + if (d->radius == radius) return; d->radius = radius; emit radiusChanged(radius); update(); @@ -133,7 +133,7 @@ void QFxBlurFilter::setRadius(qreal radius) QRectF QFxBlurFilter::itemBoundingRect(const QRectF &r) const { QRectF rv = r; - if(d->radius > 0) + if (d->radius > 0) rv.adjust(-d->radius, -d->radius, d->radius, d->radius); return rv; } @@ -143,7 +143,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p) { #if defined(QFX_RENDER_OPENGL2) #if 1 - if(d->radius <= 0) { + if (d->radius <= 0) { renderToScreen(); return; } @@ -156,7 +156,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p) radius *= blurScale; QGLFramebufferObject *fbo = renderToFBO(blurScale); - if(!fbo) + if (!fbo) return; float height = r.height(); @@ -201,7 +201,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p) BlurTextureShader *shader = item->basicShaders()->blurTexture(); shader->enable(); shader->setTransform(trans); - if(steps > 1) { + if (steps > 1) { shader->setStep(xstep * 2); shader->setSteps(steps / 2); } else { @@ -252,7 +252,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p) BlurTextureShader *shader = item->basicShaders()->blurTexture(); shader->enable(); shader->setTransform(trans); - if(steps > 1) { + if (steps > 1) { shader->setStep(ystep * 2); shader->setSteps(steps / 2); } else { @@ -303,7 +303,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p) releaseFBO(fbo); #else #if 0 - if(d->radius <= 0) { + if (d->radius <= 0) { renderToScreen(); return; } @@ -314,7 +314,7 @@ void QFxBlurFilter::filterGL(QSimpleCanvasItem::GLPainter &p) float scale = 0.5; float scalePercent = scale / d->radius; QGLFramebufferObject *fbo = renderToFBO(scalePercent); - if(!fbo) + if (!fbo) return; QGLFramebufferObject *xfbo = acquireFBO(QSize(scale * r.width(), fbo->height())); diff --git a/src/declarative/fx/qfxcomponentinstance.cpp b/src/declarative/fx/qfxcomponentinstance.cpp index 02a6c86..951c25d 100644 --- a/src/declarative/fx/qfxcomponentinstance.cpp +++ b/src/declarative/fx/qfxcomponentinstance.cpp @@ -97,7 +97,7 @@ QmlComponent *QFxComponentInstance::component() const void QFxComponentInstance::setComponent(QmlComponent *c) { Q_D(QFxComponentInstance); - if(d->component) { + if (d->component) { qmlInfo(this) << "component is a write-once property."; return; } @@ -108,11 +108,11 @@ void QFxComponentInstance::setComponent(QmlComponent *c) void QFxComponentInstance::create() { Q_D(QFxComponentInstance); - if(d->component) { + if (d->component) { QObject *obj= d->component->create(qmlContext(this)); - if(obj) { + if (obj) { QFxItem *objitem = qobject_cast<QFxItem *>(obj); - if(objitem) { + if (objitem) { d->instance = objitem; objitem->setItemParent(this); objitem->setFocus(true); @@ -130,10 +130,10 @@ void QFxComponentInstance::create() void QFxComponentInstance::updateSize() { QFxItem *i = instance(); - if(i) { - if(!widthValid()) + if (i) { + if (!widthValid()) setImplicitWidth(i->width()); - if(!heightValid()) + if (!heightValid()) setImplicitHeight(i->height()); } } diff --git a/src/declarative/fx/qfxcontentwrapper.cpp b/src/declarative/fx/qfxcontentwrapper.cpp index 5ce5430..a155d2b 100644 --- a/src/declarative/fx/qfxcontentwrapper.cpp +++ b/src/declarative/fx/qfxcontentwrapper.cpp @@ -76,7 +76,7 @@ void QFxContentWrapper::componentComplete() target = target->itemParent(); QList<QFxItem*> myContent(*content()); - for(int ii = 0; ii < myContent.count(); ++ii) + for (int ii = 0; ii < myContent.count(); ++ii) myContent.at(ii)->setParent(target); } diff --git a/src/declarative/fx/qfxevents.cpp b/src/declarative/fx/qfxevents.cpp index 804446b..7d04f5d 100644 --- a/src/declarative/fx/qfxevents.cpp +++ b/src/declarative/fx/qfxevents.cpp @@ -118,8 +118,8 @@ QT_BEGIN_NAMESPACE */ /*! - \qmlproperty int x - \qmlproperty int y + \qmlproperty int MouseEvent::x + \qmlproperty int MouseEvent::y These properties hold the position of the mouse event. */ diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index b6eaa8e..671d65d 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -121,16 +121,16 @@ void QFxFlickablePrivate::init() void QFxFlickablePrivate::fixupX() { Q_Q(QFxFlickable); - if(!q->xflick() || _moveX.timeLine()) + if (!q->xflick() || _moveX.timeLine()) return; vTime = _tl.time(); - if(_moveX.value() > q->minXExtent() || q->maxXExtent() > 0) { + if (_moveX.value() > q->minXExtent() || q->maxXExtent() > 0) { _tl.move(_moveX, q->minXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200); flicked = false; //emit flickingChanged(); - } else if(_moveX.value() < q->maxXExtent()) { + } else if (_moveX.value() < q->maxXExtent()) { _tl.move(_moveX, q->maxXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200); flicked = false; //emit flickingChanged(); @@ -140,15 +140,15 @@ void QFxFlickablePrivate::fixupX() void QFxFlickablePrivate::fixupY() { Q_Q(QFxFlickable); - if(!q->yflick() || _moveY.timeLine()) + if (!q->yflick() || _moveY.timeLine()) return; vTime = _tl.time(); - if(_moveY.value() > q->minYExtent() || (q->maxYExtent() > q->minYExtent())) { + if (_moveY.value() > q->minYExtent() || (q->maxYExtent() > q->minYExtent())) { _tl.move(_moveY, q->minYExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200); //emit flickingChanged(); - } else if(_moveY.value() < q->maxYExtent()) { + } else if (_moveY.value() < q->maxYExtent()) { _tl.move(_moveY, q->maxYExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200); //emit flickingChanged(); } else { @@ -560,17 +560,17 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) bool rejectX = false; bool moved = false; - if(q->yflick()) { + if (q->yflick()) { int dy = int(event->pos().y() - pressPos.y()); if (qAbs(dy) > FlickThreshold || pressTime.elapsed() > 200) { qreal newY = dy + pressY; const qreal minY = q->minYExtent(); const qreal maxY = q->maxYExtent(); - if(newY > minY) + if (newY > minY) newY = minY + (newY - minY) / 2; - if(newY < maxY && maxY - minY < 0) + if (newY < maxY && maxY - minY < 0) newY = maxY + (newY - maxY) / 2; - if(q->overShoot() || (newY <= minY && newY >= maxY)) { + if (q->overShoot() || (newY <= minY && newY >= maxY)) { if (dragMode == QFxFlickable::Hard) _moveY.setValue(newY); else @@ -583,11 +583,11 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) } } - if(q->xflick()) { + if (q->xflick()) { int dx = int(event->pos().x() - pressPos.x()); if (qAbs(dx) > FlickThreshold || pressTime.elapsed() > 200) { qreal newX = dx + pressX; - if(q->overShoot() || (newX <= q->minXExtent() && newX >= q->maxXExtent())) { + if (q->overShoot() || (newX <= q->minXExtent() && newX >= q->maxXExtent())) { if (dragMode == QFxFlickable::Hard) _moveX.setValue(newX); else @@ -600,23 +600,23 @@ void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) } } - if(!lastPos.isNull()) { + if (!lastPos.isNull()) { qreal elapsed = qreal(lastPosTime.restart()) / 1000.; - if(elapsed <= 0) + if (elapsed <= 0) elapsed = 1; - if(q->yflick()) { + if (q->yflick()) { qreal diff = event->pos().y() - lastPos.y(); velocityY = diff / elapsed; } - if(q->xflick()) { + if (q->xflick()) { qreal diff = event->pos().x() - lastPos.x(); velocityX = diff / elapsed; } } - if(rejectY) velocityY = 0; - if(rejectX) velocityX = 0; + if (rejectY) velocityY = 0; + if (rejectX) velocityX = 0; if (moved) { q->viewportMoved(); @@ -640,20 +640,20 @@ void QFxFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *) } vTime = _tl.time(); - if(qAbs(velocityY) > 10) { + if (qAbs(velocityY) > 10) { qreal maxDistance = -1; // -ve velocity means list is moving up - if(velocityY > 0) { - if(_moveY.value() < q->minYExtent()) + if (velocityY > 0) { + if (_moveY.value() < q->minYExtent()) maxDistance = qAbs(q->minYExtent() -_moveY.value() + (overShoot?30:0)); } else { - if(_moveY.value() > q->maxYExtent()) + if (_moveY.value() > q->maxYExtent()) maxDistance = qAbs(q->maxYExtent() - _moveY.value()) + (overShoot?30:0); } - if(maxDistance > 0) { + if (maxDistance > 0) { qreal v = velocityY; - if(maxVelocity != -1 && maxVelocity < qAbs(v)) { - if(v < 0) + if (maxVelocity != -1 && maxVelocity < qAbs(v)) { + if (v < 0) v = -maxVelocity; else v = maxVelocity; @@ -669,20 +669,20 @@ void QFxFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *) } else { fixupY(); } - if(qAbs(velocityX) > 10) { + if (qAbs(velocityX) > 10) { qreal maxDistance = -1; // -ve velocity means list is moving up - if(velocityX > 0) { - if(_moveX.value() < q->minXExtent()) + if (velocityX > 0) { + if (_moveX.value() < q->minXExtent()) maxDistance = qAbs(q->minXExtent()) -_moveX.value() + (overShoot?30:0); } else { - if(_moveX.value() > q->maxXExtent()) + if (_moveX.value() > q->maxXExtent()) maxDistance = qAbs(q->maxXExtent() - _moveX.value()) + (overShoot?30:0); } - if(maxDistance > 0) { + if (maxDistance > 0) { qreal v = velocityX; - if(maxVelocity != -1 && maxVelocity < qAbs(v)) { - if(v < 0) + if (maxVelocity != -1 && maxVelocity < qAbs(v)) { + if (v < 0) v = -maxVelocity; else v = maxVelocity; @@ -701,7 +701,7 @@ void QFxFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *) stealMouse = false; lastPosTime = QTime(); - if(!_tl.isActive()) + if (!_tl.isActive()) q->movementEnding(); } @@ -766,7 +766,7 @@ void QFxFlickable::viewportMoved() qreal prevY = d->lastFlickablePosition.x(); qreal prevX = d->lastFlickablePosition.y(); d->velocityTimeline.clear(); - if(d->pressed) { + if (d->pressed) { qreal xVelocity = (prevX - d->_moveX.value()) * 1000 / elapsed; qreal yVelocity = (prevY - d->_moveY.value()) * 1000 / elapsed; d->velocityTimeline.move(d->xVelocity, xVelocity, d->velocityDecay); @@ -804,7 +804,7 @@ void QFxFlickablePrivate::data_append(QObject *o) { Q_Q(QFxFlickable); QFxItem *i = qobject_cast<QFxItem *>(o); - if(i) + if (i) _flick->children()->append(i); else o->setParent(q); @@ -901,7 +901,7 @@ void QFxFlickable::setViewportWidth(int w) if (d->vWidth == w) return; d->vWidth = w; - if(w < 0) + if (w < 0) d->_flick->setWidth(width()); else d->_flick->setWidth(w); @@ -913,7 +913,7 @@ void QFxFlickable::setWidth(int w) { Q_D(QFxFlickable); QFxItem::setWidth(w); - if(d->vWidth < 0) { + if (d->vWidth < 0) { d->_flick->setWidth(w); emit viewportWidthChanged(); d->updateBeginningEnd(); @@ -924,7 +924,7 @@ void QFxFlickable::setHeight(int h) { Q_D(QFxFlickable); QFxItem::setHeight(h); - if(d->vHeight < 0) { + if (d->vHeight < 0) { d->_flick->setHeight(h); emit viewportHeightChanged(); d->updateBeginningEnd(); @@ -947,7 +947,7 @@ void QFxFlickable::setViewportHeight(int h) if (d->vHeight == h) return; d->vHeight = h; - if(h < 0) + if (h < 0) d->_flick->setHeight(height()); else d->_flick->setHeight(h); @@ -958,7 +958,7 @@ void QFxFlickable::setViewportHeight(int h) int QFxFlickable::vWidth() const { Q_D(const QFxFlickable); - if(d->vWidth < 0) + if (d->vWidth < 0) return width(); else return d->vWidth; @@ -967,7 +967,7 @@ int QFxFlickable::vWidth() const int QFxFlickable::vHeight() const { Q_D(const QFxFlickable); - if(d->vHeight < 0) + if (d->vHeight < 0) return height(); else return d->vHeight; @@ -1028,7 +1028,7 @@ bool QFxFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) bool QFxFlickable::mouseFilter(QGraphicsSceneMouseEvent *e) { - if(!isVisible()) + if (!isVisible()) return false; switch (e->type()) { case QEvent::GraphicsSceneMousePress: @@ -1060,7 +1060,7 @@ int QFxFlickable::maximumFlickVelocity() const void QFxFlickable::setMaximumFlickVelocity(int v) { Q_D(QFxFlickable); - if(v == d->maxVelocity) + if (v == d->maxVelocity) return; d->maxVelocity = v; } @@ -1081,7 +1081,7 @@ void QFxFlickable::setVelocityDecay(int decay) { Q_D(QFxFlickable); Q_ASSERT(decay >= 0); - if(decay == d->velocityDecay) + if (decay == d->velocityDecay) return; d->velocityDecay = decay; emit velocityDecayChanged(decay); @@ -1096,7 +1096,7 @@ bool QFxFlickable::isMoving() const void QFxFlickable::movementStarting() { Q_D(QFxFlickable); - if(!d->moving) { + if (!d->moving) { d->moving = true; emit movingChanged(); emit movementStarted(); @@ -1106,7 +1106,7 @@ void QFxFlickable::movementStarting() void QFxFlickable::movementEnding() { Q_D(QFxFlickable); - if(d->moving) { + if (d->moving) { d->moving = false; emit movingChanged(); emit movementEnded(); diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp index ee14348..9db0b57 100644 --- a/src/declarative/fx/qfxflipable.cpp +++ b/src/declarative/fx/qfxflipable.cpp @@ -126,13 +126,13 @@ QFxItem *QFxFlipable::front() void QFxFlipable::setFront(QFxItem *front) { Q_D(QFxFlipable); - if(d->front) { + if (d->front) { qmlInfo(this) << "front is a write-once property"; return; } d->front = front; children()->append(d->front); - if(Back == d->current) + if (Back == d->current) d->front->setOpacity(0.); } @@ -145,13 +145,13 @@ QFxItem *QFxFlipable::back() void QFxFlipable::setBack(QFxItem *back) { Q_D(QFxFlipable); - if(d->back) { + if (d->back) { qmlInfo(this) << "back is a write-once property"; return; } d->back = back; children()->append(d->back); - if(Front == d->current) + if (Front == d->current) d->back->setOpacity(0.); } @@ -182,36 +182,36 @@ void QFxFlipable::transformChanged(const QSimpleCanvas::Matrix &trans) (p1.y() - p2.y()) * (p3.x() - p2.x()); Side newSide; - if(cross > 0) { + if (cross > 0) { newSide = Back; } else { newSide = Front; } - if(newSide != d->current) { + if (newSide != d->current) { d->current = newSide; if (d->current==Back) { QSimpleCanvas::Matrix mat; #ifdef QFX_RENDER_OPENGL mat.translate(d->back->width()/2,d->back->height()/2, 0); - if(d->back->width() && p1.x() >= p2.x()) + if (d->back->width() && p1.x() >= p2.x()) mat.rotate(180, 0, 1, 0); - if(d->back->height() && p2.y() >= p3.y()) + if (d->back->height() && p2.y() >= p3.y()) mat.rotate(180, 1, 0, 0); mat.translate(-d->back->width()/2,-d->back->height()/2, 0); #else mat.translate(d->back->width()/2,d->back->height()/2); - if(d->back->width() && p1.x() >= p2.x()) + if (d->back->width() && p1.x() >= p2.x()) mat.rotate(180, Qt::YAxis); - if(d->back->height() && p2.y() >= p3.y()) + if (d->back->height() && p2.y() >= p3.y()) mat.rotate(180, Qt::XAxis); mat.translate(-d->back->width()/2,-d->back->height()/2); #endif d->back->setTransform(mat); } - if(d->front) + if (d->front) d->front->setOpacity((d->current==Front)?1.:0.); - if(d->back) + if (d->back) d->back->setOpacity((d->current==Back)?1.:0.); emit sideChanged(); } diff --git a/src/declarative/fx/qfxfocuspanel.cpp b/src/declarative/fx/qfxfocuspanel.cpp index 1bca424..67c456e 100644 --- a/src/declarative/fx/qfxfocuspanel.cpp +++ b/src/declarative/fx/qfxfocuspanel.cpp @@ -79,7 +79,7 @@ QFxFocusPanel::~QFxFocusPanel() bool QFxFocusPanel::isActive() const { QSimpleCanvas *canvas = QSimpleCanvasItem::canvas(); - if(canvas) + if (canvas) return canvas->activeFocusPanel() == this; else return false; diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 15d3b70..c8b8d27 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -80,7 +80,7 @@ public: static QFxGridViewAttached *properties(QObject *obj) { QFxGridViewAttached *rv = attachedProperties.value(obj); - if(!rv) { + if (!rv) { rv = new QFxGridViewAttached(obj); attachedProperties.insert(obj, rv); } @@ -998,7 +998,7 @@ int QFxGridView::cacheBuffer() const void QFxGridView::setCacheBuffer(int buffer) { Q_D(QFxGridView); - if(d->buffer != buffer) { + if (d->buffer != buffer) { d->buffer = buffer; if (isComponentComplete()) refill(); diff --git a/src/declarative/fx/qfxhighlightfilter.cpp b/src/declarative/fx/qfxhighlightfilter.cpp index d99b9e5..ab0512c 100644 --- a/src/declarative/fx/qfxhighlightfilter.cpp +++ b/src/declarative/fx/qfxhighlightfilter.cpp @@ -131,7 +131,7 @@ void QFxHighlightFilter::imageLoaded() { QImage img = QFxPixmap(d->url); #if defined(QFX_RENDER_OPENGL2) - if(!img.isNull()) + if (!img.isNull()) d->tex.setImage(img); #endif emit sourceChanged(d->source); @@ -142,14 +142,14 @@ void QFxHighlightFilter::setSource(const QString &f) { if (d->source == f) return; - if(!d->source.isEmpty()) + if (!d->source.isEmpty()) QFxPixmap::cancelGet(d->url, this, SLOT(imageLoaded())); d->source = f; d->url = qmlContext(this)->resolvedUrl(f); #if defined(QFX_RENDER_OPENGL2) d->tex.clear(); #endif - if(!f.isEmpty()) + if (!f.isEmpty()) QFxPixmap::get(qmlEngine(this), d->url, this, SLOT(imageLoaded())); else emit sourceChanged(d->source); @@ -171,13 +171,13 @@ bool QFxHighlightFilter::tiled() const void QFxHighlightFilter::setTiled(bool t) { - if(t == d->tiled) + if (t == d->tiled) return; d->tiled = t; #if defined(QFX_RENDER_OPENGL2) - if(d->tiled) { + if (d->tiled) { d->tex.setHorizontalWrap(GLTexture::ClampToEdge); d->tex.setVerticalWrap(GLTexture::ClampToEdge); } else { @@ -206,7 +206,7 @@ int QFxHighlightFilter::xOffset() const void QFxHighlightFilter::setXOffset(int x) { - if(x == d->xOffset) + if (x == d->xOffset) return; d->xOffset = x; @@ -227,7 +227,7 @@ int QFxHighlightFilter::yOffset() const void QFxHighlightFilter::setYOffset(int y) { - if(y == d->yOffset) + if (y == d->yOffset) return; d->yOffset = y; @@ -240,7 +240,7 @@ void QFxHighlightFilter::setYOffset(int y) void QFxHighlightFilter::filterGL(QSimpleCanvasItem::GLPainter &p) { #if defined(QFX_RENDER_OPENGL2) - if(d->tex.isNull()) { + if (d->tex.isNull()) { renderToScreen(); } else { QSimpleCanvasItem *item = this->item(); @@ -266,9 +266,9 @@ void QFxHighlightFilter::filterGL(QSimpleCanvasItem::GLPainter &p) float texXOffset = 0; float texYOffset = 0; - if(xOffset()) + if (xOffset()) texXOffset = float(xOffset()) / float(d->tex.width()); - if(yOffset()) + if (yOffset()) texYOffset = float(yOffset()) / float(d->tex.height()); GLfloat addTexVert[] = { texXOffset, texYOffset, diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 2d0dbc7..a34cd12 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -124,7 +124,7 @@ QFxImage::QFxImage(QFxImagePrivate &dd, QFxItem *parent) QFxImage::~QFxImage() { Q_D(const QFxImage); - if(d->reply) + if (d->reply) d->reply->deleteLater(); } @@ -183,7 +183,8 @@ void QFxImage::setPixmap(const QPixmap &pix) Each scale grid property (left, right, top, and bottom) specifies an offset from the respective side. For example, \c scaleGrid.bottom="10" sets the bottom scale grid line 10 pixels up from the bottom of the image. - A scale grid can also be specified using a \l {Imagexmlpropertysrc}{.sci file}. + A scale grid can also be specified using a + \l {Image::src}{.sci file}. */ QFxScaleGrid *QFxImage::scaleGrid() { @@ -250,7 +251,7 @@ bool QFxImage::isOpaque() const void QFxImage::setOpaque(bool o) { Q_D(QFxImage); - if(o == d->_opaque) + if (o == d->_opaque) return; d->_opaque = o; d->_pix.setOpaque(o); @@ -299,7 +300,7 @@ bool QFxImage::smoothTransform() const void QFxImage::setSmoothTransform(bool s) { Q_D(QFxImage); - if(d->_smooth == s) + if (d->_smooth == s) return; d->_smooth = s; update(); @@ -317,10 +318,10 @@ void QFxImage::dump(int depth) void QFxImage::paintContents(QPainter &p) { Q_D(QFxImage); - if(d->_pix.isNull()) + if (d->_pix.isNull()) return; - if(d->_smooth) { + if (d->_smooth) { p.save(); p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->_smooth); } @@ -347,7 +348,7 @@ void QFxImage::paintContents(QPainter &p) p.restore(); } else if (!d->_scaleGrid || d->_scaleGrid->isNull()) { - if(width() != pix.width() || height() != pix.height()) { + if (width() != pix.width() || height() != pix.height()) { QTransform scale; scale.scale(width() / qreal(pix.width()), height() / qreal(pix.height())); @@ -367,45 +368,45 @@ void QFxImage::paintContents(QPainter &p) const int ySide = sgt + sgb; // Upper left - if(sgt && sgl) + if (sgt && sgl) p.drawImage(QRect(0, 0, sgl, sgt), pix, QRect(0, 0, sgl, sgt)); // Upper middle - if(pix.width() - xSide && sgt) + if (pix.width() - xSide && sgt) p.drawImage(QRect(sgl, 0, width() - xSide, sgt), pix, QRect(sgl, 0, pix.width() - xSide, sgt)); // Upper right - if(sgt && pix.width() - sgr) + if (sgt && pix.width() - sgr) p.drawImage(QPoint(width()-sgr, 0), pix, QRect(pix.width()-sgr, 0, sgr, sgt)); // Middle left - if(sgl && pix.height() - ySide) + if (sgl && pix.height() - ySide) p.drawImage(QRect(0, sgt, sgl, height() - ySide), pix, QRect(0, sgt, sgl, pix.height() - ySide)); // Middle - if(pix.width() - xSide && pix.height() - ySide) + if (pix.width() - xSide && pix.height() - ySide) p.drawImage(QRect(sgl, sgt, width() - xSide, height() - ySide), pix, QRect(sgl, sgt, pix.width() - xSide, pix.height() - ySide)); // Middle right - if(sgr && pix.height() - ySide) + if (sgr && pix.height() - ySide) p.drawImage(QRect(width()-sgr, sgt, sgr, height() - ySide), pix, QRect(pix.width()-sgr, sgt, sgr, pix.height() - ySide)); // Lower left - if(sgl && sgr) + if (sgl && sgr) p.drawImage(QPoint(0, height() - sgb), pix, QRect(0, pix.height() - sgb, sgl, sgb)); // Lower Middle - if(pix.width() - xSide && sgb) + if (pix.width() - xSide && sgb) p.drawImage(QRect(sgl, height() - sgb, width() - xSide, sgb), pix, QRect(sgl, pix.height() - sgb, pix.width() - xSide, sgb)); // Lower Right - if(sgr && sgb) + if (sgr && sgb) p.drawImage(QPoint(width()-sgr, height() - sgb), pix, QRect(pix.width()-sgr, pix.height() - sgb, sgr, sgb)); } - if(d->_smooth) { + if (d->_smooth) { p.restore(); } } @@ -415,10 +416,10 @@ uint QFxImage::glSimpleItemData(float *vertices, float *texVertices, { Q_D(QFxImage); - if(d->_pix.isNull() || (d->_scaleGrid && !d->_scaleGrid->isNull())) + if (d->_pix.isNull() || (d->_scaleGrid && !d->_scaleGrid->isNull())) return 0; - if(count < 8) + if (count < 8) return 8; d->checkDirty(); @@ -433,7 +434,7 @@ uint QFxImage::glSimpleItemData(float *vertices, float *texVertices, *texture = &d->_tex; - if(d->_tiled) { + if (d->_tiled) { float tileWidth = widthV / d->_pix.width(); float tileHeight = heightV / d->_pix.height(); texVertices[0] = 0; texVertices[1] = 0; @@ -452,7 +453,7 @@ uint QFxImage::glSimpleItemData(float *vertices, float *texVertices, void QFxImagePrivate::checkDirty() { - if(_texDirty && !_pix.isNull()) { + if (_texDirty && !_pix.isNull()) { _tex.setImage(_pix); _tex.setHorizontalWrap(GLTexture::Repeat); _tex.setVerticalWrap(GLTexture::Repeat); @@ -464,18 +465,18 @@ void QFxImagePrivate::checkDirty() void QFxImage::paintGLContents(GLPainter &p) { Q_D(QFxImage); - if(d->_pix.isNull()) + if (d->_pix.isNull()) return; QGLShaderProgram *shader = p.useTextureShader(); bool restoreBlend = false; - if(isOpaque() && p.activeOpacity == 1) { + if (isOpaque() && p.activeOpacity == 1) { glDisable(GL_BLEND); restoreBlend = true; } - if(d->_tiled || (!d->_scaleGrid || d->_scaleGrid->isNull())) { + if (d->_tiled || (!d->_scaleGrid || d->_scaleGrid->isNull())) { GLfloat vertices[8]; GLfloat texVertices[8]; @@ -497,7 +498,7 @@ void QFxImage::paintGLContents(GLPainter &p) float imgWidth = d->_pix.width(); float imgHeight = d->_pix.height(); - if(!imgWidth || !imgHeight) { + if (!imgWidth || !imgHeight) { if (restoreBlend) glEnable(GL_BLEND); return; @@ -520,19 +521,19 @@ void QFxImage::paintGLContents(GLPainter &p) const int sgt = d->_scaleGrid->top(); const int sgb = d->_scaleGrid->bottom(); - if(sgl) { + if (sgl) { texleft = float(sgl) / imgWidth; imgleft = sgl; } - if(sgr) { + if (sgr) { texright = 1. - float(sgr) / imgWidth; imgright = widthV - sgr; } - if(sgt) { + if (sgt) { textop = 1. - float(sgb) / imgHeight; imgtop = sgt; } - if(sgb) { + if (sgb) { texbottom = float(sgt) / imgHeight; imgbottom = heightV - sgb; } @@ -609,20 +610,20 @@ void QFxImage::paintGLContents(GLPainter &p) void QFxImage::paintGLContents(GLPainter &p) { Q_D(QFxImage); - if(d->_pix.isNull()) + if (d->_pix.isNull()) return; glMatrixMode(GL_MODELVIEW); glLoadMatrixf(p.activeTransform.data()); bool restoreBlend = false; - if(isOpaque() && p.activeOpacity == 1) { + if (isOpaque() && p.activeOpacity == 1) { glDisable(GL_BLEND); restoreBlend = true; } glEnable(GL_TEXTURE_2D); - if(p.activeOpacity == 1.) { + if (p.activeOpacity == 1.) { GLint i = GL_REPLACE; glTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &i); } else { @@ -631,7 +632,7 @@ void QFxImage::paintGLContents(GLPainter &p) glColor4f(1, 1, 1, p.activeOpacity); } - if(d->_tiled || !d->_scaleGrid || d->_scaleGrid->isNull()) { + if (d->_tiled || !d->_scaleGrid || d->_scaleGrid->isNull()) { GLfloat vertices[8]; GLfloat texVertices[8]; @@ -659,7 +660,7 @@ void QFxImage::paintGLContents(GLPainter &p) float imgWidth = d->_pix.width(); float imgHeight = d->_pix.height(); - if(!imgWidth || !imgHeight) { + if (!imgWidth || !imgHeight) { if (restoreBlend) glEnable(GL_BLEND); return; @@ -682,19 +683,19 @@ void QFxImage::paintGLContents(GLPainter &p) const int sgt = d->_scaleGrid->top(); const int sgb = d->_scaleGrid->bottom(); - if(sgl) { + if (sgl) { texleft = float(sgl) / imgWidth; imgleft = sgl; } - if(sgr) { + if (sgr) { texright = 1. - float(sgr) / imgWidth; imgright = widthV - sgr; } - if(sgt) { + if (sgt) { textop = 1. - float(sgb) / imgHeight; imgtop = sgt; } - if(sgb) { + if (sgb) { texbottom = float(sgt) / imgHeight; imgbottom = heightV - sgb; } @@ -792,11 +793,9 @@ QFxImage::Status QFxImage::status() const Image can handle any image format supported by Qt, loaded from any URL scheme supported by Qt. - \target Imagexmlpropertysrc - It can also handle .sci files, which are a Qml-specific format. A .sci file uses a simple text-based format that specifies \list - \i the grid lines describing a \l {ImagexmlpropertiesscaleGrid}{scale grid}. + \i the grid lines describing a \l {Image::scaleGrid.left}{scale grid}. \i an image file. \endlist @@ -828,10 +827,10 @@ QString QFxImage::source() const void QFxImage::setSource(const QString &url) { Q_D(QFxImage); - if(url == d->source) + if (url == d->source) return; - if(d->reply) { + if (d->reply) { d->reply->deleteLater(); d->reply = 0; } @@ -845,7 +844,7 @@ void QFxImage::setSource(const QString &url) d->url = qmlContext(this)->resolvedUrl(url); d->sciurl = QUrl(); - if(url.isEmpty()) { + if (url.isEmpty()) { setPixmap(QPixmap()); d->status = Idle; } else { @@ -899,7 +898,7 @@ void QFxImage::requestFinished() void QFxImage::sciRequestFinished() { Q_D(QFxImage); - if(d->reply->error() != QNetworkReply::NoError) { + if (d->reply->error() != QNetworkReply::NoError) { d->status = Error; d->reply->deleteLater(); d->reply = 0; @@ -916,7 +915,7 @@ void QFxImage::sciRequestFinished() void QFxImage::setGridScaledImage(const QFxGridScaledImage& sci) { Q_D(QFxImage); - if(!sci.isValid()) { + if (!sci.isValid()) { d->status = Error; emit statusChanged(d->status); } else { diff --git a/src/declarative/fx/qfximage_p.h b/src/declarative/fx/qfximage_p.h index 46aea49..fbb4c44 100644 --- a/src/declarative/fx/qfximage_p.h +++ b/src/declarative/fx/qfximage_p.h @@ -89,7 +89,7 @@ public: QFxScaleGrid *scaleGrid() { - if(!_scaleGrid) + if (!_scaleGrid) _scaleGrid = new QFxScaleGrid; return _scaleGrid; } diff --git a/src/declarative/fx/qfximageitem.cpp b/src/declarative/fx/qfximageitem.cpp index 26a5b53..52ab009 100644 --- a/src/declarative/fx/qfximageitem.cpp +++ b/src/declarative/fx/qfximageitem.cpp @@ -154,7 +154,7 @@ QSize QFxImageItem::contentsSize() const void QFxImageItem::setSmooth(bool smooth) { Q_D(QFxImageItem); - if(d->smooth == smooth) return; + if (d->smooth == smooth) return; d->smooth = smooth; clearCache(); update(); @@ -168,7 +168,7 @@ void QFxImageItem::setSmooth(bool smooth) void QFxImageItem::setContentsSize(const QSize &size) { Q_D(QFxImageItem); - if(d->contentsSize == size) return; + if (d->contentsSize == size) return; d->contentsSize = size; clearCache(); update(); @@ -233,7 +233,7 @@ void QFxImageItem::paintGLContents(GLPainter &p) #if defined(QFX_RENDER_QPAINTER) bool oldAntiAliasing = p.testRenderHint(QPainter::Antialiasing); bool oldSmoothPixmap = p.testRenderHint(QPainter::SmoothPixmapTransform); - if(d->smooth) { + if (d->smooth) { p.setRenderHints(QPainter::Antialiasing, true); p.setRenderHints(QPainter::SmoothPixmapTransform, true); } @@ -336,7 +336,7 @@ void QFxImageItem::paintGLContents(GLPainter &p) glDisableClientState(GL_TEXTURE_COORD_ARRAY); #endif #if defined(QFX_RENDER_QPAINTER) - if(d->smooth) { + if (d->smooth) { p.setRenderHints(QPainter::Antialiasing, oldAntiAliasing); p.setRenderHints(QPainter::SmoothPixmapTransform, oldSmoothPixmap); } diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index adf76f4..11b7dd3 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -380,7 +380,7 @@ void QFxContents::setItem(QFxItem *item) This signal is emitted when the item's focus state changes. - \sa setFocus() + \sa QSimpleCanvasItem::setFocus() */ /*! @@ -457,7 +457,7 @@ void QFxItem::setItemParent(QFxItem *parent) */ void QFxItem::moveToParent(QFxItem *parent) { - if(parent && itemParent()) { + if (parent && itemParent()) { QPointF me = itemParent()->mapToScene(QPointF(0,0)); QPointF them = parent->mapToScene(QPointF(0,0)); @@ -482,25 +482,25 @@ void QFxItem::moveToParent(QFxItem *parent) qreal yDiff = them.y() - me.y(); - if(themx.x() == 0.) { + if (themx.x() == 0.) { ry = xDiff / themy.x(); rx = (yDiff - ry * themy.y()) / themx.y(); - } else if(themy.x() == 0.) { + } else if (themy.x() == 0.) { rx = xDiff / themx.x(); ry = (yDiff - rx * themx.y()) / themy.y(); - } else if(themx.y() == 0.) { + } else if (themx.y() == 0.) { ry = yDiff / themy.y(); rx = (xDiff - ry * themy.x()) / themx.x(); - } else if(themy.y() == 0.) { + } else if (themy.y() == 0.) { rx = yDiff / themx.y(); ry = (xDiff - rx * themx.x()) / themy.x(); } else { qreal div = (themy.x() * themx.y() - themy.y() * themx.x()); - if(div != 0.) + if (div != 0.) rx = (themx.y() * xDiff - themx.x() * yDiff) / div; - if(themy.y() != 0.) ry = (yDiff - rx * themx.y()) / themy.y(); + if (themy.y() != 0.) ry = (yDiff - rx * themx.y()) / themy.y(); } setX(x() - rx); @@ -576,7 +576,7 @@ bool QFxItem::isClassComplete() const It is often desireable to delay some processing until the component is completed. - \sa componentComplete(). + \sa componentComplete() */ bool QFxItem::isComponentComplete() const { @@ -609,7 +609,7 @@ void QFxItemPrivate::data_append(QObject *o) { Q_Q(QFxItem); QFxItem *i = qobject_cast<QFxItem *>(o); - if(i) + if (i) q->children()->append(i); else resources_append(o); @@ -806,9 +806,9 @@ void QFxItem::setQml(const QString &qml) if (d->_qml == qml) return; - if(!d->_qml.isEmpty()) { + if (!d->_qml.isEmpty()) { QmlChildren::Iterator iter = d->_qmlChildren.find(d->_qml); - if(iter != d->_qmlChildren.end()) + if (iter != d->_qmlChildren.end()) (*iter)->setOpacity(0.); } @@ -816,20 +816,20 @@ void QFxItem::setQml(const QString &qml) d->_qmlurl = qmlContext(this)->resolvedUri(qml); d->qmlItem = 0; - if(d->_qml.isEmpty()) { + if (d->_qml.isEmpty()) { emit qmlChanged(); return; } QmlChildren::Iterator iter = d->_qmlChildren.find(d->_qml); - if(iter != d->_qmlChildren.end()) { + if (iter != d->_qmlChildren.end()) { (*iter)->setOpacity(1.); d->qmlItem = (*iter); emit qmlChanged(); } else { d->_qmlcomp = new QmlComponent(qmlEngine(this), d->_qmlurl, this); - if(!d->_qmlcomp->isLoading()) + if (!d->_qmlcomp->isLoading()) qmlLoaded(); else QObject::connect(d->_qmlcomp, SIGNAL(statusChanged(QmlComponent::Status)), @@ -846,7 +846,7 @@ void QFxItem::qmlLoaded() // ### for (int i=0; i<d->_qmlnewloading.length(); ++i) { QmlComponent *c = d->_qmlnewcomp.at(i); - if(c->isLoading()) + if (c->isLoading()) continue; QmlContext *ctxt = new QmlContext(qmlContext(this)); @@ -872,7 +872,7 @@ void QFxItem::qmlLoaded() QObject *obj = d->_qmlcomp->create(ctxt); QFxItem *qmlChild = qobject_cast<QFxItem *>(obj); - if(qmlChild) { + if (qmlChild) { qmlChild->setItemParent(this); d->_qmlChildren.insert(d->_qml, qmlChild); d->qmlItem = qmlChild; @@ -990,23 +990,23 @@ void QFxItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { Q_D(QFxItem); - if(newGeometry.width() != oldGeometry.width()) { + if (newGeometry.width() != oldGeometry.width()) { int xoffset = oldGeometry.width() - newGeometry.width(); d->handleWidthChange(xoffset); } - if(newGeometry.height() != oldGeometry.height()) { + if (newGeometry.height() != oldGeometry.height()) { int yoffset = oldGeometry.height() - newGeometry.height(); d->handleHeightChange(yoffset); } - if(newGeometry.x() != oldGeometry.x()) { + if (newGeometry.x() != oldGeometry.x()) { emit leftChanged(); emit hcenterChanged(); emit rightChanged(); } - if(newGeometry.y() != oldGeometry.y()) { + if (newGeometry.y() != oldGeometry.y()) { emit topChanged(); emit vcenterChanged(); emit bottomChanged(); @@ -1016,7 +1016,7 @@ void QFxItem::geometryChanged(const QRectF &newGeometry, void QFxItemPrivate::handleWidthChange(int xoffset) { Q_Q(QFxItem); - if(!_anchors) { + if (!_anchors) { emit q->hcenterChanged(); emit q->rightChanged(); } else { @@ -1032,9 +1032,9 @@ void QFxItemPrivate::handleWidthChange(int xoffset) emit q->rightChanged(); } } - if(q->rotation() && q->transformOrigin() != QFxItem::TopLeft) + if (q->rotation() && q->transformOrigin() != QFxItem::TopLeft) q->setRotation(q->rotation()); - if(q->scale() && q->transformOrigin() != QFxItem::TopLeft) + if (q->scale() && q->transformOrigin() != QFxItem::TopLeft) q->setScale(q->scale()); emit q->widthChanged(); } @@ -1042,7 +1042,7 @@ void QFxItemPrivate::handleWidthChange(int xoffset) void QFxItemPrivate::handleHeightChange(int yoffset) { Q_Q(QFxItem); - if(!_anchors) { + if (!_anchors) { emit q->vcenterChanged(); emit q->bottomChanged(); emit q->baselineChanged(); @@ -1064,9 +1064,9 @@ void QFxItemPrivate::handleHeightChange(int yoffset) emit q->baselineChanged(); } } - if(q->rotation() && q->transformOrigin() != QFxItem::TopLeft) + if (q->rotation() && q->transformOrigin() != QFxItem::TopLeft) q->setRotation(q->rotation()); - if(q->scale() && q->transformOrigin() != QFxItem::TopLeft) + if (q->scale() && q->transformOrigin() != QFxItem::TopLeft) q->setScale(q->scale()); emit q->heightChanged(); } @@ -1092,7 +1092,7 @@ bool QFxItem::flipVertically() const void QFxItem::setFlipVertically(bool v) { - if(v) + if (v) setFlip((QSimpleCanvasItem::Flip)(flip() | VerticalFlip)); else setFlip((QSimpleCanvasItem::Flip)(flip() & ~VerticalFlip)); @@ -1111,7 +1111,7 @@ bool QFxItem::flipHorizontally() const void QFxItem::setFlipHorizontally(bool v) { - if(v) + if (v) setFlip((QSimpleCanvasItem::Flip)(flip() | HorizontalFlip)); else setFlip((QSimpleCanvasItem::Flip)(flip() & ~HorizontalFlip)); @@ -1561,11 +1561,11 @@ qreal QFxItem::opacity() const void QFxItem::setOpacity(qreal v) { - if(v == QSimpleCanvasItem::visible()) + if (v == QSimpleCanvasItem::visible()) return; - if(v < 0) v = 0; - else if(v > 1) v = 1; + if (v < 0) v = 0; + else if (v > 1) v = 1; QSimpleCanvasItem::setVisible(v); emit opacityChanged(); @@ -1715,7 +1715,7 @@ QmlList<QmlTransition *>* QFxItem::transitions() QmlState *QFxItem::findState(const QString &name) const { Q_D(const QFxItem); - if(!d->_stateGroup) + if (!d->_stateGroup) return 0; else return d->_stateGroup->findState(name); @@ -1775,7 +1775,7 @@ QmlState *QFxItem::findState(const QString &name) const QString QFxItem::state() const { Q_D(const QFxItem); - if(!d->_stateGroup) + if (!d->_stateGroup) return QString(); else return d->_stateGroup->state(); @@ -1840,11 +1840,11 @@ bool QFxItem::isVisible() const void QFxItem::setVisible(bool visible) { Q_D(QFxItem); - if(visible == d->visible) + if (visible == d->visible) return; d->visible = visible; - if(visible) + if (visible) setOpacity(d->visibleOp); else { d->visibleOp = opacity(); @@ -1887,7 +1887,7 @@ void QFxItem::newChild(const QString &type) d->_qmlnewloading.append(url); d->_qmlnewcomp.append(new QmlComponent(qmlEngine(this), url, this)); - if(!d->_qmlnewcomp.last()->isLoading()) + if (!d->_qmlnewcomp.last()->isLoading()) qmlLoaded(); else connect(d->_qmlnewcomp.last(), SIGNAL(statusChanged(QmlComponent::Status)), @@ -1905,7 +1905,7 @@ void QFxItem::classBegin() Q_D(QFxItem); d->_classComplete = false; d->_componentComplete = false; - if(d->_stateGroup) + if (d->_stateGroup) d->_stateGroup->classBegin(); } @@ -1921,7 +1921,7 @@ void QFxItem::classComplete() #endif Q_D(QFxItem); d->_classComplete = true; - if(d->_stateGroup) + if (d->_stateGroup) d->_stateGroup->classComplete(); } @@ -1935,13 +1935,13 @@ void QFxItem::componentComplete() { Q_D(QFxItem); d->_componentComplete = true; - if(d->_stateGroup) + if (d->_stateGroup) d->_stateGroup->componentComplete(); - if(d->_anchors) { + if (d->_anchors) { d->anchors()->connectHAnchors(); d->anchors()->connectVAnchors(); } - if(!d->_transform.isEmpty()) + if (!d->_transform.isEmpty()) updateTransform(); } @@ -1966,9 +1966,9 @@ void QFxItem::updateTransform() { Q_D(QFxItem); QSimpleCanvas::Matrix trans; - for(int ii = d->_transform.count() - 1; ii >= 0; --ii) { + for (int ii = d->_transform.count() - 1; ii >= 0; --ii) { QFxTransform *a = d->_transform.at(ii); - if(!a->isIdentity()) + if (!a->isIdentity()) trans = a->transform() * trans; } @@ -1986,9 +1986,9 @@ void QFxItem::transformChanged(const QSimpleCanvas::Matrix &) QmlStateGroup *QFxItemPrivate::states() { Q_Q(QFxItem); - if(!_stateGroup) { + if (!_stateGroup) { _stateGroup = new QmlStateGroup(q); - if(!_classComplete) + if (!_classComplete) _stateGroup->classBegin(); QObject::connect(_stateGroup, SIGNAL(stateChanged(QString)), q, SIGNAL(stateChanged(QString))); diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index 71fc912..f2da3ba 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -85,7 +85,7 @@ public: { Q_Q(QFxItem); - if(parent) + if (parent) q->setItemParent(parent); _baselineOffset.invalidate(); q->setAcceptedMouseButtons(Qt::NoButton); @@ -122,7 +122,7 @@ public: QList<QFxTransform *> _transform; QFxAnchors *anchors() { - if(!_anchors) { + if (!_anchors) { Q_Q(QFxItem); _anchors = new QFxAnchors; _anchors->setItem(q); @@ -160,7 +160,7 @@ public: mutable AnchorLines *_anchorLines; AnchorLines *anchorLines() const { Q_Q(const QFxItem); - if(!_anchorLines) _anchorLines = + if (!_anchorLines) _anchorLines = new AnchorLines(const_cast<QFxItem *>(q)); return _anchorLines; } diff --git a/src/declarative/fx/qfxkeyactions.cpp b/src/declarative/fx/qfxkeyactions.cpp index 3bd7d00..69d4679 100644 --- a/src/declarative/fx/qfxkeyactions.cpp +++ b/src/declarative/fx/qfxkeyactions.cpp @@ -78,15 +78,15 @@ QFxKeyActionsPrivate::QFxKeyActionsPrivate() int QFxKeyActionsPrivate::keyToBit(Qt::Key k) const { - if(k >= Qt::Key_A && k <= Qt::Key_Z ) { + if (k >= Qt::Key_A && k <= Qt::Key_Z ) { return k - Qt::Key_A; - } else if(k >= Qt::Key_Left && k <= Qt::Key_Down) { + } else if (k >= Qt::Key_Left && k <= Qt::Key_Down) { return 26 + k - Qt::Key_Left; - } else if(k >= Qt::Key_0 && k <= Qt::Key_9) { + } else if (k >= Qt::Key_0 && k <= Qt::Key_9) { return 30 + k - Qt::Key_0; - } else if(k >= Qt::Key_Context1 && k <= Qt::Key_Flip) { + } else if (k >= Qt::Key_Context1 && k <= Qt::Key_Flip) { return 40 + k - Qt::Key_Context1; - } else if(k >= Qt::Key_Select && k <= Qt::Key_No) { + } else if (k >= Qt::Key_Select && k <= Qt::Key_No) { return 47 + k - Qt::Key_Select; } else { const int start = 50; @@ -117,7 +117,7 @@ bool QFxKeyActionsPrivate::key(Qt::Key k) const { int b = keyToBit(k); bool rv = testBit(b); - if(!rv && k != Qt::Key_Shift) + if (!rv && k != Qt::Key_Shift) rv = testBit(keyToBit(Qt::Key_unknown)); return rv; } @@ -125,7 +125,7 @@ bool QFxKeyActionsPrivate::key(Qt::Key k) const QString QFxKeyActionsPrivate::action(Qt::Key k) const { int b = keyToBit(k); - if(b != -1 && testBit(b)) + if (b != -1 && testBit(b)) return actions.value(k); else return actions.value(Qt::Key_unknown); @@ -134,7 +134,7 @@ QString QFxKeyActionsPrivate::action(Qt::Key k) const void QFxKeyActionsPrivate::setKey(Qt::Key k, bool v) { int b = keyToBit(k); - if(b == -1) + if (b == -1) return; setBit(b, v); @@ -142,10 +142,10 @@ void QFxKeyActionsPrivate::setKey(Qt::Key k, bool v) bool QFxKeyActionsPrivate::testBit(int b) const { - if(b < 0) + if (b < 0) return false; - if(b < 32) + if (b < 32) return keys1 & (1 << b); else return keys2 & (1 << (b - 32)); @@ -153,13 +153,13 @@ bool QFxKeyActionsPrivate::testBit(int b) const void QFxKeyActionsPrivate::setBit(int b, bool v) { - if(v) { - if(b < 32) + if (v) { + if (b < 32) keys1 |= (1 << b); else keys2 |= (1 << (b - 32)); } else { - if(b < 32) + if (b < 32) keys1 &= ~(1 << b); else keys2 &= ~(1 << (b - 32)); @@ -198,7 +198,7 @@ QFxKeyActions::~QFxKeyActions() QString QFxKeyActionsPrivate::keyExpr(Qt::Key k) const { - if(key(k)) + if (key(k)) return actions.value(k); else return QString(); @@ -206,8 +206,8 @@ QString QFxKeyActionsPrivate::keyExpr(Qt::Key k) const void QFxKeyActionsPrivate::setKeyExpr(Qt::Key k, const QString &expr) { - if(expr.isEmpty()) { - if(key(k)) { + if (expr.isEmpty()) { + if (key(k)) { actions.remove(k); setKey(k, false); } @@ -231,7 +231,7 @@ bool QFxKeyActions::enabled() const void QFxKeyActions::setEnabled(bool e) { - if(d->enabled == e) + if (d->enabled == e) return; d->enabled = e; @@ -898,7 +898,7 @@ void QFxKeyActions::setKey_Any(const QString &s) void QFxKeyActions::keyPressEvent(QKeyEvent *event) { Qt::Key key = (Qt::Key)event->key(); - if(d->enabled && d->key(key)) { + if (d->enabled && d->key(key)) { QmlExpression b(qmlContext(this), d->action(key), this, false); b.value(); event->accept(); @@ -910,7 +910,7 @@ void QFxKeyActions::keyPressEvent(QKeyEvent *event) void QFxKeyActions::keyReleaseEvent(QKeyEvent *event) { Qt::Key key = (Qt::Key)event->key(); - if(d->enabled && d->key(key)) { + if (d->enabled && d->key(key)) { event->accept(); } else { QFxItem::keyReleaseEvent(event); diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp index 7d5726f..6d92441 100644 --- a/src/declarative/fx/qfxkeyproxy.cpp +++ b/src/declarative/fx/qfxkeyproxy.cpp @@ -93,22 +93,22 @@ QList<QFxItem *> *QFxKeyProxy::targets() const void QFxKeyProxy::keyPressEvent(QKeyEvent *e) { - for(int ii = 0; ii < d->targets.count(); ++ii) { + for (int ii = 0; ii < d->targets.count(); ++ii) { QSimpleCanvasItem *i = d->targets.at(ii); - if(i) + if (i) i->keyPressEvent(e); - if(e->isAccepted()) + if (e->isAccepted()) return; } } void QFxKeyProxy::keyReleaseEvent(QKeyEvent *e) { - for(int ii = 0; ii < d->targets.count(); ++ii) { + for (int ii = 0; ii < d->targets.count(); ++ii) { QSimpleCanvasItem *i = d->targets.at(ii); - if(i) + if (i) i->keyReleaseEvent(e); - if(e->isAccepted()) + if (e->isAccepted()) return; } } diff --git a/src/declarative/fx/qfxlayouts.cpp b/src/declarative/fx/qfxlayouts.cpp index b89e795..76afeb0 100644 --- a/src/declarative/fx/qfxlayouts.cpp +++ b/src/declarative/fx/qfxlayouts.cpp @@ -96,7 +96,7 @@ int QFxBaseLayout::spacing() const void QFxBaseLayout::setSpacing(int s) { Q_D(QFxBaseLayout); - if(s==d->_spacing) + if (s==d->_spacing) return; d->_spacing = s; preLayout(); @@ -116,7 +116,7 @@ int QFxBaseLayout::margin() const void QFxBaseLayout::setMargin(int s) { Q_D(QFxBaseLayout); - if(s==d->_margin) + if (s==d->_margin) return; d->_margin = s; preLayout(); @@ -223,7 +223,7 @@ QFxItem *QFxBaseLayout::layoutItem() const void QFxBaseLayout::setLayoutItem(QFxItem *li) { Q_D(QFxBaseLayout); - if(li == d->_layoutItem) + if (li == d->_layoutItem) return; d->_layoutItem = li; emit layoutItemChanged(); @@ -246,7 +246,7 @@ void QFxBaseLayout::childrenChanged() bool QFxBaseLayout::event(QEvent *e) { Q_D(QFxBaseLayout); - if(e->type() == QEvent::User) { + if (e->type() == QEvent::User) { d->_ep = false; d->_stableItems += d->_newItems; d->_leavingItems.clear(); @@ -288,22 +288,22 @@ QSet<QFxItem *>* QFxBaseLayout::leavingItems() void QFxBaseLayout::preLayout() { Q_D(QFxBaseLayout); - if(!isComponentComplete() || d->_movingItem) + if (!isComponentComplete() || d->_movingItem) return; - if(!d->_ep) { + if (!d->_ep) { d->_ep = true; QCoreApplication::postEvent(this, new QEvent(QEvent::User)); } - if(d->stateGroup) { + if (d->stateGroup) { delete d->stateGroup; d->stateGroup = 0; } QSet<QFxItem *> allItems; - for(int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) { + for (int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) { QFxItem *child = qobject_cast<QFxItem *>(this->QSimpleCanvasItem::children().at(ii)); - if(!child) + if (!child) continue; - if(!d->_items.contains(child)){ + if (!d->_items.contains(child)){ QObject::connect(child, SIGNAL(visibleChanged()), this, SLOT(preLayout())); QObject::connect(child, SIGNAL(heightChanged()), @@ -312,20 +312,20 @@ void QFxBaseLayout::preLayout() this, SLOT(preLayout())); d->_items += child; } - if(!child->isVisible()){ - if(d->_stableItems.contains(child)){ + if (!child->isVisible()){ + if (d->_stableItems.contains(child)){ d->_leavingItems += child; d->_stableItems -= child; } - }else if(!d->_stableItems.contains(child)){ + }else if (!d->_stableItems.contains(child)){ d->_newItems+=child; } allItems += child; } QSet<QFxItem *> deletedItems = d->_items - allItems; foreach(QFxItem *child, d->_items){ - if(!allItems.contains(child)){ - if(!deletedItems.contains(child)) { + if (!allItems.contains(child)){ + if (!deletedItems.contains(child)) { QObject::disconnect(child, SIGNAL(visibleChanged()), this, SLOT(preLayout())); QObject::disconnect(child, SIGNAL(heightChanged()), @@ -343,8 +343,8 @@ void QFxBaseLayout::preLayout() qreal width=0; qreal height=0; foreach(QFxItem *item, d->_items){ - if(item->isVisible()){ - if(!d->_animated.contains(item)){ + if (item->isVisible()){ + if (!d->_animated.contains(item)){ setMovingItem(item); item->setPos(QPointF(item->x()+d->_margin, item->y()+d->_margin)); setMovingItem(0); @@ -356,11 +356,11 @@ void QFxBaseLayout::preLayout() width += d->_margin; height+= d->_margin; - if(d->aut & Horizontal) + if (d->aut & Horizontal) setWidth(int(width)); else setImplicitWidth(itemParent()->width()); - if(d->aut & Vertical) + if (d->aut & Vertical) setHeight(int(height)); else setImplicitHeight(itemParent()->height()); @@ -372,20 +372,20 @@ void QFxBaseLayout::applyTransition(const QList<QPair<QString, QVariant> >& chan QFxItem* target, QmlTransition* trans) { Q_D(QFxBaseLayout); - if(!trans||!target)//TODO: if !trans, just apply changes + if (!trans||!target)//TODO: if !trans, just apply changes return; setLayoutItem(target); - if(d->stateGroup) + if (d->stateGroup) delete d->stateGroup; d->stateGroup = new QmlStateGroup(this); QmlState *state = new QmlState; *(d->stateGroup->statesProperty()) << state; - for(int ii=0; ii<changes.size(); ++ii){ + for (int ii=0; ii<changes.size(); ++ii){ QmlSetProperty *sp = new QmlSetProperty(state); sp->setObject(target); QVariant val = changes[ii].second; - if(d->_margin && + if (d->_margin && (changes[ii].first == QLatin1String("x") || changes[ii].first == QLatin1String("y"))){ val = QVariant(val.toInt() + d->_margin); } @@ -589,14 +589,14 @@ void QFxVerticalLayout::doLayout() int voffset = 0; foreach(QFxItem* item, *leavingItems()){ - if(remove()){ + if (remove()){ QList<QPair<QString,QVariant> > changes; applyRemove(changes, item); } } - for(int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) { + for (int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) { QFxItem *child = qobject_cast<QFxItem *>(this->QSimpleCanvasItem::children().at(ii)); - if(!child || !child->isVisible()) + if (!child || !child->isVisible()) continue; bool needMove = (child->y() != voffset || child->x()); @@ -604,11 +604,11 @@ void QFxVerticalLayout::doLayout() QList<QPair<QString, QVariant> > changes; changes << qMakePair(QString(QLatin1String("y")),QVariant(voffset)); changes << qMakePair(QString(QLatin1String("x")),QVariant(0)); - if(needMove && items()->contains(child) && move()) { + if (needMove && items()->contains(child) && move()) { applyMove(changes,child); - } else if(!items()->contains(child) && add()) { + } else if (!items()->contains(child) && add()) { applyAdd(changes,child); - } else if(needMove) { + } else if (needMove) { setMovingItem(child); child->setY(voffset); setMovingItem(0); @@ -742,14 +742,14 @@ void QFxHorizontalLayout::doLayout() int hoffset = 0; foreach(QFxItem* item, *leavingItems()){ - if(remove()){ + if (remove()){ QList<QPair<QString,QVariant> > changes; applyRemove(changes, item); } } - for(int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) { + for (int ii = 0; ii < this->QSimpleCanvasItem::children().count(); ++ii) { QFxItem *child = qobject_cast<QFxItem *>(this->QSimpleCanvasItem::children().at(ii)); - if(!child || !child->isVisible()) + if (!child || !child->isVisible()) continue; bool needMove = (child->x() != hoffset || child->y()); @@ -757,11 +757,11 @@ void QFxHorizontalLayout::doLayout() QList<QPair<QString, QVariant> > changes; changes << qMakePair(QString(QLatin1String("x")),QVariant(hoffset)); changes << qMakePair(QString(QLatin1String("y")),QVariant(0)); - if(needMove && items()->contains(child) && move()) { + if (needMove && items()->contains(child) && move()) { applyMove(changes,child); - } else if(!items()->contains(child) && add()) { + } else if (!items()->contains(child) && add()) { applyAdd(changes,child); - } else if(needMove) { + } else if (needMove) { setMovingItem(child); child->setX(hoffset); setMovingItem(0); @@ -950,32 +950,32 @@ void QFxGridLayout::doLayout() { int c=_columns,r=_rows;//Actual number of rows/columns int numVisible = items()->size() + newItems()->size(); - if(_columns==-1 && _rows==-1){ + if (_columns==-1 && _rows==-1){ c = 4; r = (numVisible+2)/3; - }else if(_rows==-1){ + }else if (_rows==-1){ r = (numVisible+(_columns-1))/_columns; - }else if(_columns==-1){ + }else if (_columns==-1){ c = (numVisible+(_rows-1))/_rows; } QList<int> maxColWidth; QList<int> maxRowHeight; int childIndex =0; - for(int i=0; i<r; i++){ - for(int j=0; j<c; j++){ - if(j==0) + for (int i=0; i<r; i++){ + for (int j=0; j<c; j++){ + if (j==0) maxRowHeight << 0; - if(i==0) + if (i==0) maxColWidth << 0; - if(childIndex == this->QSimpleCanvasItem::children().count()) + if (childIndex == this->QSimpleCanvasItem::children().count()) continue; QFxItem *child = qobject_cast<QFxItem *>(this->QSimpleCanvasItem::children().at(childIndex++)); - if(!child || !child->isVisible()) + if (!child || !child->isVisible()) continue; - if(child->width() > maxColWidth[j]) + if (child->width() > maxColWidth[j]) maxColWidth[j] = child->width(); - if(child->height() > maxRowHeight[i]) + if (child->height() > maxRowHeight[i]) maxRowHeight[i] = child->height(); } } @@ -985,23 +985,23 @@ void QFxGridLayout::doLayout() int curRow =0; int curCol =0; foreach(QFxItem* item, *leavingItems()){ - if(remove()){ + if (remove()){ QList<QPair<QString,QVariant> > changes; applyRemove(changes, item); } } foreach(QSimpleCanvasItem* schild, this->QSimpleCanvasItem::children()){ QFxItem *child = qobject_cast<QFxItem *>(schild); - if(!child || !child->isVisible()) + if (!child || !child->isVisible()) continue; bool needMove = (child->x()!=xoffset)||(child->y()!=yoffset); QList<QPair<QString, QVariant> > changes; changes << qMakePair(QString(QLatin1String("x")),QVariant(xoffset)); changes << qMakePair(QString(QLatin1String("y")),QVariant(yoffset)); - if(newItems()->contains(child) && add()) { + if (newItems()->contains(child) && add()) { applyAdd(changes,child); - } else if(needMove) { - if(move()){ + } else if (needMove) { + if (move()){ applyMove(changes,child); }else{ setMovingItem(child); @@ -1012,11 +1012,11 @@ void QFxGridLayout::doLayout() xoffset+=maxColWidth[curCol]+spacing(); curCol++; curCol%=c; - if(!curCol){ + if (!curCol){ yoffset+=maxRowHeight[curRow]+spacing(); xoffset=0; curRow++; - if(curRow>=r) + if (curRow>=r) return; } } diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 20a2c0c..0724e3a 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -585,7 +585,7 @@ void QFxListViewPrivate::createHighlight() if (nobj) { highlightContext->setParent(nobj); item = qobject_cast<QFxItem *>(nobj); - if(!item) { + if (!item) { delete nobj; } else { item->setParent(q->viewport()); @@ -1194,7 +1194,7 @@ int QFxListView::cacheBuffer() const void QFxListView::setCacheBuffer(int b) { Q_D(QFxListView); - if(d->buffer != b) { + if (d->buffer != b) { d->buffer = b; if (isComponentComplete()) refill(); @@ -1233,7 +1233,7 @@ QString QFxListView::sectionExpression() const void QFxListView::setSectionExpression(const QString &expression) { Q_D(QFxListView); - if(d->sectionExpression != expression) { + if (d->sectionExpression != expression) { d->sectionExpression = expression; emit sectionExpressionChanged(); } diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp index f7b6c57..d197c9a 100644 --- a/src/declarative/fx/qfxmouseregion.cpp +++ b/src/declarative/fx/qfxmouseregion.cpp @@ -163,7 +163,7 @@ void QFxDrag::setYmax(int m) example extended so as to give a different color when you right click. \code <Rect width="100" height="100"> - <MouseRegion anchors.fill="{parent}" onClick="if(mouse.button==Qt.RightButton) { parent.color='blue';} else { parent.color = 'red';}"/> + <MouseRegion anchors.fill="{parent}" onClick="if (mouse.button==Qt.RightButton) { parent.color='blue';} else { parent.color = 'red';}"/> </Rect> \endcode @@ -324,7 +324,7 @@ void QFxMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QFxMouseRegion); d->moved = false; - if(!d->absorb) + if (!d->absorb) QFxItem::mousePressEvent(event); else { if (!d->inside) { @@ -349,7 +349,7 @@ void QFxMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event) void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { Q_D(QFxMouseRegion); - if(!d->absorb) { + if (!d->absorb) { QFxItem::mouseMoveEvent(event); return; } @@ -369,10 +369,10 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event) emit reenteredWhilePressed(); } - if(drag()->target()) { - if(!d->moved) { - if(d->dragX) d->startX = int(drag()->target()->x()); //### change startX and startY to qreal? - if(d->dragY) d->startY = int(drag()->target()->y()); + if (drag()->target()) { + if (!d->moved) { + if (d->dragX) d->startX = int(drag()->target()->x()); //### change startX and startY to qreal? + if (d->dragY) d->startY = int(drag()->target()->y()); } QPointF startLocalPos; @@ -397,7 +397,7 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event) } } - if(d->dragX) { + if (d->dragX) { qreal x = (curLocalPos.x() - startLocalPos.x()) + d->startX; if (x < drag()->xmin()) x = drag()->xmin(); @@ -405,7 +405,7 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event) x = drag()->xmax(); drag()->target()->setX(x); } - if(d->dragY) { + if (d->dragY) { qreal y = (curLocalPos.y() - startLocalPos.y()) + d->startY; if (y < drag()->ymin()) y = drag()->ymin(); @@ -424,7 +424,7 @@ void QFxMouseRegion::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void QFxMouseRegion::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_D(QFxMouseRegion); - if(!d->absorb) + if (!d->absorb) QFxItem::mouseReleaseEvent(event); else { d->saveEvent(event); @@ -438,7 +438,7 @@ void QFxMouseRegion::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void QFxMouseRegion::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { Q_D(QFxMouseRegion); - if(!d->absorb) + if (!d->absorb) QFxItem::mouseDoubleClickEvent(event); else { //d->inside = true; @@ -454,7 +454,7 @@ void QFxMouseRegion::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) void QFxMouseRegion::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { Q_D(QFxMouseRegion); - if(!d->absorb) + if (!d->absorb) QFxItem::hoverEnterEvent(event); else { setHovered(true); @@ -465,7 +465,7 @@ void QFxMouseRegion::hoverEnterEvent(QGraphicsSceneHoverEvent *event) void QFxMouseRegion::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_D(QFxMouseRegion); - if(!d->absorb) + if (!d->absorb) QFxItem::hoverLeaveEvent(event); else { setHovered(false); @@ -525,7 +525,7 @@ bool QFxMouseRegion::pressed() void QFxMouseRegion::setHovered(bool h) { Q_D(QFxMouseRegion); - if(d->hovered != h) { + if (d->hovered != h) { d->hovered = h; emit hoveredChanged(); } @@ -536,10 +536,10 @@ void QFxMouseRegion::setPressed(bool p) Q_D(QFxMouseRegion); bool isclick = d->pressed == true && p == false && d->dragged == false && d->inside == true; - if(d->pressed != p) { + if (d->pressed != p) { d->pressed = p; QFxMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress); - if(d->pressed) { + if (d->pressed) { emit positionChanged(&me); emit pressed(&me); } else { diff --git a/src/declarative/fx/qfxpainted.cpp b/src/declarative/fx/qfxpainted.cpp index ad1b3ad..7c88ce3 100644 --- a/src/declarative/fx/qfxpainted.cpp +++ b/src/declarative/fx/qfxpainted.cpp @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE /*! \class QFxPainted - \brief QFxPainted is an abstract base class for QFxView items that paint using QPainter. + \brief The QFxPainted class is an abstract base class for QFxView items that paint using QPainter. \ingroup group_coreitems diff --git a/src/declarative/fx/qfxparticles.cpp b/src/declarative/fx/qfxparticles.cpp index 8b16098..309ebe8 100644 --- a/src/declarative/fx/qfxparticles.cpp +++ b/src/declarative/fx/qfxparticles.cpp @@ -268,14 +268,14 @@ void QFxParticleMotionGravity::advance(QFxParticle &p, int interval) */ /*! - \qmlproperty QFxParticleMotionWander::xvariance - \qmlproperty QFxParticleMotionWander::yvariance + \qmlproperty int QFxParticleMotionWander::xvariance + \qmlproperty int QFxParticleMotionWander::yvariance These properties set the amount to wander in the x and y directions. */ /*! - \qmlproperty QFxParticleMotionWander::pace + \qmlproperty int QFxParticleMotionWander::pace This property holds how quickly the paricles will move from side to side. */ @@ -413,17 +413,17 @@ void QFxParticlesPrivate::tick(int time) if (!addParticleTime) addParticleTime = time; - if(particles.count() < count && emitting) { + if (particles.count() < count && emitting) { qreal perc = (lifeSpanDev <= 0)?(1.):(qreal(time - addParticleTime) / qreal(lifeSpanDev)); int percCount = addParticleCount + (int)perc * (count - addParticleCount); int streamWidth = -1; - if(stream){ - if(streamDelay > time){ + if (stream){ + if (streamDelay > time){ streamWidth = 0; }else{ int missed = time - streamDelay; qreal streamWidthReal = qreal(count)/qreal(lifeSpan); - if(streamWidthReal < 1){ + if (streamWidthReal < 1){ streamDelay = time + (int)(1.0/streamWidthReal); streamWidth = 1; streamWidth += missed/streamDelay; diff --git a/src/declarative/fx/qfxpath.cpp b/src/declarative/fx/qfxpath.cpp index 2009237..f08671d 100644 --- a/src/declarative/fx/qfxpath.cpp +++ b/src/declarative/fx/qfxpath.cpp @@ -185,7 +185,7 @@ QList<QFxPathElement *>* QFxPath::pathElements() void QFxPath::interpolate(int idx, const QString &name, qreal value) { Q_D(QFxPath); - if(!idx) + if (!idx) return; qreal lastValue = 0; @@ -193,7 +193,7 @@ void QFxPath::interpolate(int idx, const QString &name, qreal value) int search = idx - 1; while(search >= 0) { const AttributePoint &point = d->_attributePoints.at(search); - if(point.values.contains(name)) { + if (point.values.contains(name)) { lastValue = point.values.value(name); lastPercent = point.origpercent; break; @@ -205,7 +205,7 @@ void QFxPath::interpolate(int idx, const QString &name, qreal value) const AttributePoint &curPoint = d->_attributePoints.at(idx); - for(int ii = search; ii < idx; ++ii) { + for (int ii = search; ii < idx; ++ii) { AttributePoint &point = d->_attributePoints[ii]; qreal val = lastValue + (value - lastValue) * (point.origpercent - lastPercent) / (curPoint.origpercent - lastPercent); @@ -218,10 +218,10 @@ void QFxPath::endpoint(const QString &name) Q_D(QFxPath); const AttributePoint &first = d->_attributePoints.first(); qreal val = first.values.value(name); - for(int ii = d->_attributePoints.count() - 1; ii >= 0; ii--) { + for (int ii = d->_attributePoints.count() - 1; ii >= 0; ii--) { const AttributePoint &point = d->_attributePoints.at(ii); - if(point.values.contains(name)) { - for(int jj = ii + 1; jj < d->_attributePoints.count(); ++jj) { + if (point.values.contains(name)) { + for (int jj = ii + 1; jj < d->_attributePoints.count(); ++jj) { AttributePoint &setPoint = d->_attributePoints[jj]; setPoint.values.insert(name, val); } @@ -239,23 +239,23 @@ void QFxPath::processPath() d->_path = QPainterPath(); AttributePoint first; - for(int ii = 0; ii < d->_attributes.count(); ++ii) + for (int ii = 0; ii < d->_attributes.count(); ++ii) first.values[d->_attributes.at(ii)] = 0; d->_attributePoints << first; d->_path.moveTo(d->startX, d->startY); foreach (QFxPathElement *pathElement, d->_pathElements) { - if(QFxCurve *curve = qobject_cast<QFxCurve *>(pathElement)) { + if (QFxCurve *curve = qobject_cast<QFxCurve *>(pathElement)) { curve->addToPath(d->_path); AttributePoint p; p.origpercent = d->_path.length(); d->_attributePoints << p; - } else if(QFxPathAttribute *attribute = qobject_cast<QFxPathAttribute *>(pathElement)) { + } else if (QFxPathAttribute *attribute = qobject_cast<QFxPathAttribute *>(pathElement)) { AttributePoint &point = d->_attributePoints.last(); point.values[attribute->name()] = attribute->value(); interpolate(d->_attributePoints.count() - 1, attribute->name(), attribute->value()); - } else if(QFxPathPercent *percent = qobject_cast<QFxPathPercent *>(pathElement)) { + } else if (QFxPathPercent *percent = qobject_cast<QFxPathPercent *>(pathElement)) { AttributePoint &point = d->_attributePoints.last(); point.values[QLatin1String("_qfx_percent")] = percent->value(); interpolate(d->_attributePoints.count() - 1, QLatin1String("_qfx_percent"), percent->value()); @@ -264,8 +264,8 @@ void QFxPath::processPath() // Fixup end points const AttributePoint &last = d->_attributePoints.last(); - for(int ii = 0; ii < d->_attributes.count(); ++ii) { - if(!last.values.contains(d->_attributes.at(ii))) + for (int ii = 0; ii < d->_attributes.count(); ++ii) { + if (!last.values.contains(d->_attributes.at(ii))) endpoint(d->_attributes.at(ii)); } @@ -273,9 +273,9 @@ void QFxPath::processPath() qreal length = d->_path.length(); qreal prevpercent = 0; qreal prevorigpercent = 0; - for(int ii = 0; ii < d->_attributePoints.count(); ++ii) { + for (int ii = 0; ii < d->_attributePoints.count(); ++ii) { const AttributePoint &point = d->_attributePoints.at(ii); - if(point.values.contains(QLatin1String("_qfx_percent"))) { //special string for QFxPathPercent + if (point.values.contains(QLatin1String("_qfx_percent"))) { //special string for QFxPathPercent if ( ii > 0) { qreal scale = (d->_attributePoints[ii].origpercent/length - prevorigpercent) / (point.values.value(QLatin1String("_qfx_percent"))-prevpercent); @@ -300,7 +300,7 @@ void QFxPath::componentComplete() QSet<QString> attrs; // First gather up all the attributes foreach (QFxPathElement *pathElement, d->_pathElements) { - if(QFxPathAttribute *attribute = + if (QFxPathAttribute *attribute = qobject_cast<QFxPathAttribute *>(pathElement)) attrs.insert(attribute->name()); } @@ -383,10 +383,10 @@ void QFxPath::createPointCache() const //find which set we are in qreal prevPercent = 0; qreal prevOrigPercent = 0; - for(int ii = 0; ii < d->_attributePoints.count(); ++ii) { + for (int ii = 0; ii < d->_attributePoints.count(); ++ii) { qreal percent = qreal(i)/points; const AttributePoint &point = d->_attributePoints.at(ii); - if(percent < point.percent || ii == d->_attributePoints.count() - 1) { //### || is special case for very last item + if (percent < point.percent || ii == d->_attributePoints.count() - 1) { //### || is special case for very last item qreal elementPercent = (percent - prevPercent); qreal spc = prevOrigPercent + elementPercent * point.scale; @@ -430,15 +430,15 @@ QPointF QFxPath::pointAt(qreal p) const qreal QFxPath::attributeAt(const QString &name, qreal percent) const { Q_D(const QFxPath); - if(percent < 0 || percent > 1) + if (percent < 0 || percent > 1) return 0; - for(int ii = 0; ii < d->_attributePoints.count(); ++ii) { + for (int ii = 0; ii < d->_attributePoints.count(); ++ii) { const AttributePoint &point = d->_attributePoints.at(ii); - if(point.percent == percent) { + if (point.percent == percent) { return point.values.value(name); - } else if(point.percent > percent) { + } else if (point.percent > percent) { qreal lastValue = ii?(d->_attributePoints.at(ii - 1).values.value(name)):0; qreal lastPercent = diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index 8bf0a25..c0d3ab2 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -246,7 +246,7 @@ void QFxPathView::setCurrentIndex(int idx) d->currentIndex = idx; d->snapToCurrent(); int itemIndex = (idx - d->firstIndex + d->model->count()) % d->model->count(); - if(itemIndex < d->items.count()) + if (itemIndex < d->items.count()) d->items.at(itemIndex)->setFocus(true); emit currentIndexChanged(); } @@ -392,7 +392,7 @@ int QFxPathView::pathItemCount() const void QFxPathView::setPathItemCount(int i) { Q_D(QFxPathView); - if(i == d->pathItems) + if (i == d->pathItems) return; d->pathItems = i; d->regenerate(); @@ -553,7 +553,7 @@ bool QFxPathView::sendMouseEvent(QGraphicsSceneMouseEvent *event) bool QFxPathView::mouseFilter(QGraphicsSceneMouseEvent *e) { - if(!isVisible()) + if (!isVisible()) return false; switch (e->type()) { @@ -579,7 +579,7 @@ void QFxPathViewPrivate::regenerate() if (!model || model->count() <= 0 || !model->delegate() || !path) return; - for(int i=0; i<items.count(); i++){ + for (int i=0; i<items.count(); i++){ QFxItem *p = items[i]; q->attachedProperties.remove(p); model->release(p); @@ -592,7 +592,7 @@ void QFxPathViewPrivate::regenerate() int numItems = (pathItems>=0 ? pathItems : model->count()); qreal minDiff = 1e9; int minI = -1; - for(int i=0; i<numItems; i++){ + for (int i=0; i<numItems; i++){ QFxItem *item = model->item(i); if (!item) return; @@ -603,7 +603,7 @@ void QFxPathViewPrivate::regenerate() percent /= 100.0; updateItem(items.last(), percent); qreal diff = qAbs(percent - snapPos); - if(diff < minDiff){ + if (diff < minDiff){ minDiff = diff; minI = i; } @@ -615,7 +615,7 @@ void QFxPathViewPrivate::regenerate() void QFxPathViewPrivate::updateItem(QFxItem *item, qreal percent) { - if(QObject *obj = QFxPathView::attachedProperties.value(item)) { + if (QObject *obj = QFxPathView::attachedProperties.value(item)) { foreach(const QString &attr, path->attributes()) static_cast<QFxPathViewAttached *>(obj)->setValue(attr.toLatin1(), path->attributeAt(attr, percent)); } @@ -632,36 +632,36 @@ void QFxPathView::refill() return; QList<qreal> positions; - for(int i=0; i<d->items.count(); i++){ + for (int i=0; i<d->items.count(); i++){ qreal percent = i * (100. / d->items.count()); percent = percent + d->_offset; percent = fmod(percent,100.); positions << qAbs(percent/100.0); } - if(d->pathItems==-1){ - for(int i=0; i<positions.count(); i++){ + if (d->pathItems==-1){ + for (int i=0; i<positions.count(); i++){ d->updateItem(d->items.at(i), positions[i]); } return; } QList<qreal> rotatedPositions; - for(int i=0; i<d->items.count(); i++) + for (int i=0; i<d->items.count(); i++) rotatedPositions << positions[(i + d->pathOffset + d->items.count()) % d->items.count()]; int firstFind = -1; int i; - for(i=0; i<d->items.count()-1; i++) + for (i=0; i<d->items.count()-1; i++) { - if(rotatedPositions[i] > rotatedPositions[i+1]){ + if (rotatedPositions[i] > rotatedPositions[i+1]){ firstFind = i; break; } } - if(firstFind!=-1 ){ + if (firstFind!=-1 ){ //A wraparound has occured - if(firstFind<(d->items.count()/2)){ + if (firstFind<(d->items.count()/2)){ while(firstFind-- >= 0){ QFxItem* p = d->items.takeFirst(); attachedProperties.remove(p); @@ -681,21 +681,21 @@ void QFxPathView::refill() attachedProperties.remove(p); d->model->release(p); d->firstIndex--; - if(d->firstIndex<0) + if (d->firstIndex<0) d->firstIndex = d->model->count() - 1; d->items.prepend(d->model->item(d->firstIndex)); d->items.first()->setZ(d->firstIndex); d->items.first()->setParent(this); d->pathOffset--; - if(d->pathOffset<0) + if (d->pathOffset<0) d->pathOffset = d->items.count() - 1; } } - for(int i=0; i<d->items.count(); i++) + for (int i=0; i<d->items.count(); i++) rotatedPositions[i] = positions[(i + d->pathOffset + d->items.count()) % d->items.count()]; } - for(int i=0; i<d->items.count(); i++){ + for (int i=0; i<d->items.count(); i++){ d->updateItem(d->items.at(i), rotatedPositions[i]); } } @@ -712,26 +712,26 @@ int QFxPathViewPrivate::calcCurrentIndex() int current = -1; if (model && items.count()) { _offset = fmod(_offset, 100.0); - if(_offset < 0) + if (_offset < 0) _offset += 100.0; - if(pathItems == -1){ + if (pathItems == -1){ qreal delta = fmod(_offset - snapPos, 100.0); if (delta < 0) delta = 100.0 + delta; int ii = model->count() - qRound(delta * model->count() / 100); - if(ii < 0) + if (ii < 0) ii = 0; current = ii; }else{ qreal bestDiff=1e9; int bestI=-1; - for(int i=0; i<items.count(); i++){ + for (int i=0; i<items.count(); i++){ qreal percent = i * (100. / items.count()); percent = percent + _offset; percent = fmod(percent,100.); qreal diff = qAbs(snapPos - (percent/100.0)); - if(diff < bestDiff){ + if (diff < bestDiff){ bestDiff = diff; bestI = i; } @@ -755,7 +755,7 @@ void QFxPathViewPrivate::updateCurrent() if (model && idx != currentIndex) { currentIndex = idx; int itemIndex = (idx - firstIndex + model->count()) % model->count(); - if(itemIndex < items.count()) + if (itemIndex < items.count()) items.at(itemIndex)->setFocus(true); emit q->currentIndexChanged(); } @@ -783,7 +783,7 @@ void QFxPathViewPrivate::snapToCurrent() //Rounds is the number of times round to make the current item visible int rounds = itemIndex / items.count(); int otherWayRounds = (model->count() - (itemIndex))/items.count() + 1; - if(otherWayRounds < rounds) + if (otherWayRounds < rounds) rounds = -otherWayRounds; itemIndex += pathOffset; @@ -799,12 +799,12 @@ void QFxPathViewPrivate::snapToCurrent() tl.clear(); moveOffset.setValue(_offset); - if(rounds!=0){ + if (rounds!=0){ //Compensate if the targetOffset would bring the target it from off the screen qreal distance = targetOffset - _offset; - if(distance <= -50) + if (distance <= -50) rounds--; - if(distance > 50) + if (distance > 50) rounds++; tl.move(moveOffset, targetOffset + 100.0*(-rounds), QEasingCurve(QEasingCurve::InOutQuad), int(100*items.count()*qMax((qreal)(2.0/items.count()),(qreal)qAbs(rounds)))); diff --git a/src/declarative/fx/qfxpixmap.cpp b/src/declarative/fx/qfxpixmap.cpp index 5a08679..0d456c6 100644 --- a/src/declarative/fx/qfxpixmap.cpp +++ b/src/declarative/fx/qfxpixmap.cpp @@ -67,7 +67,7 @@ public: int refCount; void addRef() { ++refCount; } - void release() { Q_ASSERT(refCount > 0); --refCount; if(refCount == 0) { qfxPixmapCache.remove(key); delete this; } } + void release() { Q_ASSERT(refCount > 0); --refCount; if (refCount == 0) { qfxPixmapCache.remove(key); delete this; } } }; static QFxPixmapCacheItem qfxPixmapCacheDummyItem; @@ -104,7 +104,7 @@ QFxPixmap::QFxPixmap(const QUrl &url) #endif QString key = url.toString(); QFxPixmapCache::Iterator iter = qfxPixmapCache.find(key); - if(iter == qfxPixmapCache.end()) { + if (iter == qfxPixmapCache.end()) { qWarning() << "QFxPixmap: URL not loaded" << url; } else { QNetworkReply *reply = (*iter)->reply; @@ -180,10 +180,10 @@ QPixmap QFxPixmap::pixmap() const void QFxPixmap::setPixmap(const QPixmap &pix) { QFxPixmapCache::Iterator iter = qfxPixmapCache.find(QString::number(pix.cacheKey())); - if(iter == qfxPixmapCache.end()) { + if (iter == qfxPixmapCache.end()) { QFxPixmapCacheItem *item = new QFxPixmapCacheItem; item->key = QString::number(pix.cacheKey()); - if(d->pixmap) + if (d->pixmap) d->pixmap->release(); d->pixmap = item; d->pixmap->image = pix.toImage(); @@ -195,7 +195,7 @@ void QFxPixmap::setPixmap(const QPixmap &pix) #if 0 int size = 0; - for(QFxPixmapCache::Iterator iter = qfxPixmapCache.begin(); iter != qfxPixmapCache.end(); ++iter) { + for (QFxPixmapCache::Iterator iter = qfxPixmapCache.begin(); iter != qfxPixmapCache.end(); ++iter) { size += (*iter)->image.width() * (*iter)->image.height(); } qWarning() << qfxPixmapCache.count() << size; @@ -207,8 +207,8 @@ QFxPixmap::operator const QSimpleCanvasConfig::Image &() const #if defined(QFX_RENDER_OPENGL) return d->pixmap->image; #else - if(d->opaque) { - if(!d->pixmap->image.isNull() && d->pixmap->opaqueImage.isNull()) { + if (d->opaque) { + if (!d->pixmap->image.isNull() && d->pixmap->opaqueImage.isNull()) { #ifdef Q_ENABLE_PERFORMANCE_LOG QFxPerfTimer<QFxPerf::PixmapLoad> perf; #endif @@ -218,7 +218,7 @@ QFxPixmap::operator const QSimpleCanvasConfig::Image &() const } return d->pixmap->opaqueImage; } else { - if(!d->pixmap->image.isNull() && d->pixmap->image.format() != QImage::Format_ARGB32_Premultiplied) { + if (!d->pixmap->image.isNull() && d->pixmap->image.format() != QImage::Format_ARGB32_Premultiplied) { #ifdef Q_ENABLE_PERFORMANCE_LOG QFxPerfTimer<QFxPerf::PixmapLoad> perf; #endif @@ -238,7 +238,7 @@ void QFxPixmap::get(QmlEngine *engine, const QUrl& url, QObject* obj, const char { QString key = url.toString(); QFxPixmapCache::Iterator iter = qfxPixmapCache.find(key); - if(iter == qfxPixmapCache.end()) { + if (iter == qfxPixmapCache.end()) { QFxPixmapCacheItem *item = new QFxPixmapCacheItem; item->addRef(); // XXX - will never get deleted. Need to revisit caching item->key = key; @@ -274,7 +274,7 @@ void QFxPixmap::cancelGet(const QUrl& url, QObject* obj, const char* slot) { QString key = url.toString(); QFxPixmapCache::Iterator iter = qfxPixmapCache.find(key); - if(iter == qfxPixmapCache.end()) + if (iter == qfxPixmapCache.end()) return; if ((*iter)->reply) QObject::disconnect((*iter)->reply, SIGNAL(finished()), obj, slot); diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index a761ec5..2bfc149 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -238,7 +238,7 @@ QColor QFxRect::color() const void QFxRect::setColor(const QColor &c) { Q_D(QFxRect); - if(d->_color == c) + if (d->_color == c) return; d->_color = c; @@ -281,7 +281,7 @@ QColor QFxRect::tintColor() const void QFxRect::setTintColor(const QColor &c) { Q_D(QFxRect); - if(d->_tintColor == c) + if (d->_tintColor == c) return; d->_tintColor = c; @@ -290,11 +290,11 @@ void QFxRect::setTintColor(const QColor &c) QColor QFxRectPrivate::getColor() { - if(_tintColor.isValid()) { + if (_tintColor.isValid()) { int a = _tintColor.alpha(); - if(a == 0xFF) + if (a == 0xFF) return _tintColor; - else if(a == 0x00) + else if (a == 0x00) return _color; else { uint src = _tintColor.rgba(); @@ -304,7 +304,7 @@ QColor QFxRectPrivate::getColor() ((0xFF - a) * (dest & 0xFF00FF))) >> 8) & 0xFF00FF; res |= (((a * ((src >> 8) & 0xFF00FF)) + ((0xFF - a) * ((dest >> 8) & 0xFF00FF)))) & 0xFF00FF00; - if((src & 0xFF000000) == 0xFF000000) + if ((src & 0xFF000000) == 0xFF000000) res |= 0xFF000000; return QColor::fromRgba(res); @@ -344,7 +344,7 @@ QColor QFxRect::gradientColor() const void QFxRect::setGradientColor(const QColor &c) { Q_D(QFxRect); - if(d->_gradcolor == c) + if (d->_gradcolor == c) return; d->_gradcolor = c; @@ -438,14 +438,14 @@ void QFxRect::paintContents(QPainter &p) void QFxRect::drawRect(QPainter &p) { Q_D(QFxRect); - if(d->_gradcolor.isValid() /*|| p.usingQt() */) { + if (d->_gradcolor.isValid() /*|| p.usingQt() */) { // XXX This path is still slower than the image path // Image path won't work for gradients though p.save(); QPen pn(QColor(pen()->color()), pen()->width()); p.setRenderHint(QPainter::Antialiasing); p.setPen(pn); - if(d->_gradcolor.isValid()){ + if (d->_gradcolor.isValid()){ QLinearGradient grad(0, 0, 0, height()); grad.setColorAt(0, d->_color); grad.setColorAt(1, d->_gradcolor); @@ -453,7 +453,7 @@ void QFxRect::drawRect(QPainter &p) }else{ p.setBrush(d->_color); } - if(d->_radius) + if (d->_radius) p.drawRoundedRect(0, 0, width(), height(), d->_radius, d->_radius); else p.drawRect(0, 0, width(), height()); @@ -477,36 +477,36 @@ void QFxRect::drawRect(QPainter &p) p.drawImage(QRect(0, 0, offset, offset), d->_rectImage, QRect(0, 0, offset, offset)); // Upper middle - if(d->_rectImage.width() - xSide) + if (d->_rectImage.width() - xSide) p.drawImage(QRect(offset, 0, width() - xSide, offset), d->_rectImage, QRect(offset, 0, d->_rectImage.width() - xSide, offset)); // Upper right - if(d->_rectImage.width() - offset) { + if (d->_rectImage.width() - offset) { p.drawImage(QPoint(width()-offset, 0), d->_rectImage, QRect(d->_rectImage.width()-offset, 0, offset, offset)); } // Middle left - if(d->_rectImage.height() - ySide) + if (d->_rectImage.height() - ySide) p.drawImage(QRect(0, offset, offset, height() - ySide), d->_rectImage, QRect(0, offset, offset, d->_rectImage.height() - ySide)); // Middle - if(d->_rectImage.width() - xSide && d->_rectImage.height() - ySide) + if (d->_rectImage.width() - xSide && d->_rectImage.height() - ySide) p.drawImage(QRect(offset, offset, width() - xSide, height() - ySide), d->_rectImage, QRect(offset, offset, d->_rectImage.width() - xSide, d->_rectImage.height() - ySide)); // Midlle right - if(d->_rectImage.height() - ySide) + if (d->_rectImage.height() - ySide) p.drawImage(QRect(width()-offset, offset, offset, height() - ySide), d->_rectImage, QRect(d->_rectImage.width()-offset, offset, offset, d->_rectImage.height() - ySide)); // Lower left p.drawImage(QPoint(0, height() - offset), d->_rectImage, QRect(0, d->_rectImage.height() - offset, offset, offset)); // Lower Middle - if(d->_rectImage.width() - xSide) + if (d->_rectImage.width() - xSide) p.drawImage(QRect(offset, height() - offset, width() - xSide, offset), d->_rectImage, QRect(offset, d->_rectImage.height() - offset, d->_rectImage.width() - xSide, offset)); // Lower Right - if(d->_rectImage.width() - offset) + if (d->_rectImage.width() - offset) p.drawImage(QPoint(width()-offset, height() - offset), d->_rectImage, QRect(d->_rectImage.width()-offset, d->_rectImage.height() - offset, offset, offset)); } @@ -519,8 +519,8 @@ void QFxRect::drawRect(QPainter &p) void QFxRect::paintGLContents(GLPainter &p) { Q_D(QFxRect); - if(d->_radius == 0 && (!d->_pen || !d->_pen->isValid())) { - if(d->_gradcolor.isValid()) { + if (d->_radius == 0 && (!d->_pen || !d->_pen->isValid())) { + if (d->_gradcolor.isValid()) { float widthV = width(); float heightV = height(); @@ -582,7 +582,7 @@ void QFxRect::paintGLContents(GLPainter &p) float imgWidth = d->_rectTexture.width(); float imgHeight = d->_rectTexture.height(); - if(!imgWidth || !imgHeight) + if (!imgWidth || !imgHeight) return; float widthV = width(); @@ -607,7 +607,7 @@ void QFxRect::paintGLContents(GLPainter &p) imgbottom = heightV - offset; //Bug 231768: Inappropriate interpolation was occuring on 3x3 textures - if(offset==1) + if (offset==1) texleft=texright=textop=texbottom=0.5; float vert1[] = { 0, 0, @@ -686,7 +686,7 @@ void QFxRect::paintGLContents(GLPainter &p) glMatrixMode(GL_MODELVIEW); glLoadMatrixf(p.activeTransform.data()); - if(d->_radius == 0 && (!d->_pen || !d->_pen->isValid())) { + if (d->_radius == 0 && (!d->_pen || !d->_pen->isValid())) { GLfloat vertices[] = { 0, heightV, widthV, heightV, 0, 0, @@ -696,7 +696,7 @@ void QFxRect::paintGLContents(GLPainter &p) glVertexPointer(2,GL_FLOAT,0,vertices); QColor c; - if(d->_gradcolor.isValid()) + if (d->_gradcolor.isValid()) c = d->_color; else c = d->getColor(); @@ -707,7 +707,7 @@ void QFxRect::paintGLContents(GLPainter &p) float r2 = r; float g2 = g; float b2 = b; float a2 = a; - if(d->_gradcolor.isValid()) { + if (d->_gradcolor.isValid()) { r2 = d->_gradcolor.redF(); g2 = d->_gradcolor.greenF(); b2 = d->_gradcolor.blueF(); @@ -736,7 +736,7 @@ void QFxRect::paintGLContents(GLPainter &p) offset = d->pen()->width(); } - if(p.activeOpacity == 1.) { + if (p.activeOpacity == 1.) { GLint i = GL_REPLACE; glTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &i); } else { @@ -747,7 +747,7 @@ void QFxRect::paintGLContents(GLPainter &p) float imgWidth = d->_rectTexture.width(); float imgHeight = d->_rectTexture.height(); - if(!imgWidth || !imgHeight) + if (!imgWidth || !imgHeight) return; float widthV = width(); diff --git a/src/declarative/fx/qfxrect_p.h b/src/declarative/fx/qfxrect_p.h index 3cb46fa..2fd555f 100644 --- a/src/declarative/fx/qfxrect_p.h +++ b/src/declarative/fx/qfxrect_p.h @@ -88,7 +88,7 @@ public: QColor _gradcolor; QColor _tintColor; QFxPen *pen() { - if(!_pen) { + if (!_pen) { Q_Q(QFxRect); _pen = new QFxPen; QObject::connect(_pen, SIGNAL(updated()), q, SLOT(doUpdate())); diff --git a/src/declarative/fx/qfxreflectionfilter.cpp b/src/declarative/fx/qfxreflectionfilter.cpp index 39342d7..e02bc16 100644 --- a/src/declarative/fx/qfxreflectionfilter.cpp +++ b/src/declarative/fx/qfxreflectionfilter.cpp @@ -135,7 +135,7 @@ qreal QFxReflectionFilter::alpha() const void QFxReflectionFilter::setAlpha(qreal a) { - if(d->alpha == a) return; + if (d->alpha == a) return; d->alpha = a; emit alphaChanged(a); update(); @@ -202,7 +202,7 @@ int QFxReflectionFilter::height() const void QFxReflectionFilter::setHeight(int h) { - if(d->height == h) return; + if (d->height == h) return; d->height = h; emit heightChanged(h); update(); @@ -219,7 +219,7 @@ int QFxReflectionFilter::offset() void QFxReflectionFilter::setOffset(int o) { - if(d->offset == o) return; + if (d->offset == o) return; d->offset = o; emit offsetChanged(o); update(); @@ -236,7 +236,7 @@ qreal QFxReflectionFilter::scale() const void QFxReflectionFilter::setScale(qreal s) { - if(d->scale == s) return; + if (d->scale == s) return; d->scale = s; emit scaleChanged(s); update(); @@ -259,12 +259,12 @@ void QFxReflectionFilter::filterGL(QSimpleCanvasItem::GLPainter &p) float height = r.height(); float refHeight = height; - if(d->height > 0) + if (d->height > 0) refHeight = min(height, d->height); QSimpleCanvas::Matrix simpMat; QSimpleCanvasItem *simpItem = 0; - if(isSimpleItem(&simpItem, &simpMat) && + if (isSimpleItem(&simpItem, &simpMat) && simpItem->glSimpleItemData(0, 0, 0, 0)) { GLfloat vertices[8]; @@ -276,7 +276,7 @@ void QFxReflectionFilter::filterGL(QSimpleCanvasItem::GLPainter &p) GLfloat opacity[4]; float invRefHeight = 1. / refHeight; - for(int ii = 0; ii < 4; ++ii) { + for (int ii = 0; ii < 4; ++ii) { float vertex = vertices[ii * 2 + 1]; float o = (1. - (height - vertex) * invRefHeight); opacity[ii] = o * d->alpha * p.activeOpacity; @@ -285,7 +285,7 @@ void QFxReflectionFilter::filterGL(QSimpleCanvasItem::GLPainter &p) QSimpleCanvas::Matrix trans = p.activeTransform; trans.rotate(180, 1, 0, 0); trans.translate(0, -r.height() - d->offset); - if(d->scale != 1) + if (d->scale != 1) trans.scale(1, d->scale, 1); trans.translate(0, -r.height()); trans *= simpMat; diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp index 78e9f51..7ee949d 100644 --- a/src/declarative/fx/qfxrepeater.cpp +++ b/src/declarative/fx/qfxrepeater.cpp @@ -259,15 +259,15 @@ void QFxRepeater::regenerate() qDeleteAll(d->deletables); d->deletables.clear(); - if(!d->component || !itemParent() || !isComponentComplete()) + if (!d->component || !itemParent() || !isComponentComplete()) return; QFxItem *lastItem = this; - if(d->dataSource.type() == QVariant::StringList) { + if (d->dataSource.type() == QVariant::StringList) { QStringList sl = qvariant_cast<QStringList>(d->dataSource); - for(int ii = 0; ii < sl.size(); ++ii) { + for (int ii = 0; ii < sl.size(); ++ii) { QmlContext *ctxt = new QmlContext(qmlContext(this), this); d->deletables << ctxt; @@ -277,12 +277,12 @@ void QFxRepeater::regenerate() if (QFxItem *item = d->addItem(ctxt, lastItem)) lastItem = item; } - } else if(QmlMetaType::isList(d->dataSource)) { + } else if (QmlMetaType::isList(d->dataSource)) { int cnt = QmlMetaType::listCount(d->dataSource); - if(cnt <= 0) + if (cnt <= 0) return; - for(int ii = 0; ii < cnt; ++ii) { + for (int ii = 0; ii < cnt; ++ii) { QVariant v = QmlMetaType::listAt(d->dataSource, ii); QObject *o = QmlMetaType::toQObject(v); @@ -297,10 +297,10 @@ void QFxRepeater::regenerate() } } else if (QListModelInterface *model = qobject_cast<QListModelInterface*>(d->dataSource.value<QObject*>())) { int cnt = model->count(); - if(cnt <= 0) + if (cnt <= 0) return; - for(int ii = 0; ii < cnt; ++ii) { + for (int ii = 0; ii < cnt; ++ii) { QmlContext *ctxt = new QmlContext(qmlContext(this), this); d->deletables << ctxt; @@ -339,11 +339,11 @@ void QFxRepeater::regenerate() d->addItem(ctxt, lastItem); - } else if(d->dataSource.canConvert(QVariant::Int)){ + } else if (d->dataSource.canConvert(QVariant::Int)){ int count = qvariant_cast<int>(d->dataSource); - for(int ii = 0; ii < count; ++ii) { + for (int ii = 0; ii < count; ++ii) { QmlContext *ctxt = new QmlContext(qmlContext(this), this); d->deletables << ctxt; diff --git a/src/declarative/fx/qfxscalegrid.cpp b/src/declarative/fx/qfxscalegrid.cpp index d84f5e8..325f7d9 100644 --- a/src/declarative/fx/qfxscalegrid.cpp +++ b/src/declarative/fx/qfxscalegrid.cpp @@ -153,29 +153,29 @@ QFxGridScaledImage::QFxGridScaledImage(QIODevice *data) while(!data->atEnd()) { QString line = QString::fromUtf8(data->readLine().trimmed()); - if(line.isEmpty() || line.startsWith(QLatin1String("#"))) + if (line.isEmpty() || line.startsWith(QLatin1String("#"))) continue; QStringList list = line.split(QLatin1Char(':')); - if(list.count() != 2) + if (list.count() != 2) return; list[0] = list[0].trimmed(); list[1] = list[1].trimmed(); - if(list[0] == QLatin1String("gridLeft")) + if (list[0] == QLatin1String("gridLeft")) l = list[1].toInt(); - else if(list[0] == QLatin1String("gridRight")) + else if (list[0] == QLatin1String("gridRight")) r = list[1].toInt(); - else if(list[0] == QLatin1String("gridTop")) + else if (list[0] == QLatin1String("gridTop")) t = list[1].toInt(); - else if(list[0] == QLatin1String("gridBottom")) + else if (list[0] == QLatin1String("gridBottom")) b = list[1].toInt(); - else if(list[0] == QLatin1String("imageFile")) + else if (list[0] == QLatin1String("imageFile")) imgFile = list[1]; } - if(l < 0 || r < 0 || t < 0 || b < 0 || imgFile.isEmpty()) + if (l < 0 || r < 0 || t < 0 || b < 0 || imgFile.isEmpty()) return; _l = l; _r = r; _t = t; _b = b; diff --git a/src/declarative/fx/qfxshadowfilter.cpp b/src/declarative/fx/qfxshadowfilter.cpp index 3760a4d..38d1c31 100644 --- a/src/declarative/fx/qfxshadowfilter.cpp +++ b/src/declarative/fx/qfxshadowfilter.cpp @@ -122,7 +122,7 @@ int QFxShadowFilter::xOffset() const */ void QFxShadowFilter::setXOffset(int offset) { - if(d->x == offset) return; + if (d->x == offset) return; d->x = offset; emit offsetChanged(d->x, d->y); } @@ -138,7 +138,7 @@ int QFxShadowFilter::yOffset() const void QFxShadowFilter::setYOffset(int offset) { - if(d->y == offset) return; + if (d->y == offset) return; d->y = offset; emit offsetChanged(d->x, d->y); } diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index e7085d8..5cb31e1 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -165,7 +165,7 @@ void QFxText::setText(const QString &n) QFxPerfTimer<QFxPerf::QFxText_setText> st; #endif Q_D(QFxText); - if(d->text == n) + if (d->text == n) return; d->richText = Qt::mightBeRichText(n); // ### what's the cost? @@ -205,7 +205,7 @@ QString QFxText::text() const void QFxText::setColor(const QColor &color) { Q_D(QFxText); - if(d->color == color) + if (d->color == color) return; d->imgDirty = true; @@ -270,7 +270,7 @@ QFxText::TextStyle QFxText::style() const void QFxText::setStyle(QFxText::TextStyle style) { Q_D(QFxText); - if(d->style == style) + if (d->style == style) return; d->imgDirty = true; @@ -281,7 +281,7 @@ void QFxText::setStyle(QFxText::TextStyle style) void QFxText::setStyleColor(const QColor &color) { Q_D(QFxText); - if(d->styleColor == color) + if (d->styleColor == color) return; d->imgDirty = true; @@ -424,7 +424,7 @@ void QFxText::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { Q_D(QFxText); - if(newGeometry.width() != oldGeometry.width()) { + if (newGeometry.width() != oldGeometry.width()) { if (d->wrap || d->elideMode != Qt::ElideNone) { d->imgDirty = true; d->updateSize(); @@ -446,10 +446,10 @@ void QFxTextPrivate::updateSize() { Q_Q(QFxText); if (q->isComponentComplete()) { - if(text.isEmpty()) { + if (text.isEmpty()) { return; } - QFont f; if(_font) f = _font->font(); + QFont f; if (_font) f = _font->font(); QFontMetrics fm(f); int dy = q->height(); @@ -573,7 +573,7 @@ QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout) Q_Q(QFxText); layout->setCacheEnabled(true); - QFont f; if(_font) f = _font->font(); + QFont f; if (_font) f = _font->font(); QFontMetrics fm = QFontMetrics(f); int leading = fm.leading(); @@ -613,7 +613,7 @@ QImage QFxTextPrivate::wrappedTextImage(bool drawStyle) { //do layout Q_Q(const QFxText); - QFont f; if(_font) f = _font->font(); + QFont f; if (_font) f = _font->font(); QString tmp = text; if (singleline && elideMode != Qt::ElideNone && q->widthValid()) { QFontMetrics fm(f); @@ -626,11 +626,11 @@ QImage QFxTextPrivate::wrappedTextImage(bool drawStyle) int x = 0; for (int i = 0; i < textLayout.lineCount(); ++i) { QTextLine line = textLayout.lineAt(i); - if(hAlign == QFxText::AlignLeft) { + if (hAlign == QFxText::AlignLeft) { x = 0; - } else if(hAlign == QFxText::AlignRight) { + } else if (hAlign == QFxText::AlignRight) { x = size.width() - (int)line.naturalTextWidth(); - } else if(hAlign == QFxText::AlignHCenter) { + } else if (hAlign == QFxText::AlignHCenter) { x = (size.width() - (int)line.naturalTextWidth()) / 2; } line.setPosition(QPoint(x, (int)line.y())); @@ -679,7 +679,7 @@ QImage QFxTextPrivate::richTextImage(bool drawStyle) void QFxTextPrivate::checkImgCache() { - if(!imgDirty) + if (!imgDirty) return; bool empty = text.isEmpty(); @@ -722,7 +722,7 @@ void QFxText::paintContents(QPainter &p) { Q_D(QFxText); d->checkImgCache(); - if(d->imgCache.isNull()) + if (d->imgCache.isNull()) return; int w = width(); @@ -763,7 +763,7 @@ void QFxText::paintGLContents(GLPainter &p) { Q_D(QFxText); d->checkImgCache(); - if(d->imgCache.isNull()) + if (d->imgCache.isNull()) return; int w = width(); @@ -826,7 +826,7 @@ void QFxText::paintGLContents(GLPainter &p) { Q_D(QFxText); d->checkImgCache(); - if(d->imgCache.isNull()) + if (d->imgCache.isNull()) return; int w = width(); @@ -875,7 +875,7 @@ void QFxText::paintGLContents(GLPainter &p) glMatrixMode(GL_MODELVIEW); glLoadMatrixf(p.activeTransform.data()); glEnable(GL_TEXTURE_2D); - if(p.activeOpacity == 1.) { + if (p.activeOpacity == 1.) { GLint i = GL_REPLACE; glTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &i); } else { diff --git a/src/declarative/fx/qfxtext_p.h b/src/declarative/fx/qfxtext_p.h index 7be4309..4296891 100644 --- a/src/declarative/fx/qfxtext_p.h +++ b/src/declarative/fx/qfxtext_p.h @@ -98,7 +98,7 @@ public: QString text; QmlFont *font() { - if(!_font) { + if (!_font) { Q_Q(QFxText); _font = new QmlFont; QObject::connect(_font, SIGNAL(updated()), q, SLOT(fontChanged())); diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index 7efb826..68aea01 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -270,7 +270,7 @@ QColor QFxTextEdit::color() const void QFxTextEdit::setColor(const QColor &color) { Q_D(QFxTextEdit); - if(d->color == color) + if (d->color == color) return; clearCache(); @@ -370,7 +370,7 @@ void QFxTextEdit::setWrap(bool w) void QFxTextEdit::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { - if(newGeometry.width() != oldGeometry.width()) + if (newGeometry.width() != oldGeometry.width()) updateSize(); QFxImageItem::geometryChanged(newGeometry, oldGeometry); } diff --git a/src/declarative/fx/qfxtransform.cpp b/src/declarative/fx/qfxtransform.cpp index 3f54949..9f18413 100644 --- a/src/declarative/fx/qfxtransform.cpp +++ b/src/declarative/fx/qfxtransform.cpp @@ -79,7 +79,7 @@ QSimpleCanvas::Matrix QFxTransform::transform() const void QFxTransform::update() { QFxItem *item = qobject_cast<QFxItem *>(parent()); - if(item) + if (item) item->updateTransform(); } @@ -241,11 +241,11 @@ bool QFxRotation::isIdentity() const const qreal inv_dist_to_plane = 1. / 1024.; QTransform QFxRotation::transform() const { - if(_dirty) { + if (_dirty) { _transform = QTransform(); - if(!isIdentity()) { - if(angle() != 0.) { + if (!isIdentity()) { + if (angle() != 0.) { QTransform rotTrans; rotTrans.translate(-_axis.startX(), -_axis.startY()); QTransform rotTrans2; @@ -260,11 +260,11 @@ QTransform QFxRotation::transform() const qreal z = _axis.endZ(); qreal idtp = inv_dist_to_plane; - if(distanceToPlane() != 1024.) + if (distanceToPlane() != 1024.) idtp = 1. / distanceToPlane(); qreal len = x * x + y * y + z * z; - if(len != 1.) { + if (len != 1.) { len = ::sqrt(len); x /= len; y /= len; @@ -289,12 +289,12 @@ QTransform QFxRotation::transform() const #elif defined(QFX_RENDER_OPENGL) QMatrix4x4 QFxRotation::transform() const { - if(_dirty) { + if (_dirty) { _dirty = false; _transform = QMatrix4x4(); - if(!isIdentity()) { - if(angle() != 0.) { + if (!isIdentity()) { + if (angle() != 0.) { qreal x = _axis.endX() - _axis.startX(); qreal y = _axis.endY() - _axis.startY(); qreal z = _axis.endZ(); @@ -328,7 +328,7 @@ void QFxRotation::update() { _dirty = true; QFxItem *item = qobject_cast<QFxItem *>(parent()); - if(item) + if (item) item->updateTransform(); } @@ -405,11 +405,11 @@ bool QFxTranslation::isIdentity() const #if defined(QFX_RENDER_QPAINTER) QTransform QFxTranslation::transform() const { - if(_dirty) { + if (_dirty) { _transform = QTransform(); - if(!isIdentity()) { - if(distance() != 0.) { + if (!isIdentity()) { + if (distance() != 0.) { QTransform trans; trans.translate((_axis.endX() - _axis.startX()) * distance(), (_axis.endY() - _axis.startY()) * distance()); @@ -425,12 +425,12 @@ QTransform QFxTranslation::transform() const #elif defined(QFX_RENDER_OPENGL) QMatrix4x4 QFxRotation::transform() const { - if(_dirty) { + if (_dirty) { _dirty = false; _transform = QMatrix4x4(); - if(!isIdentity()) { - if(distance() != 0.) + if (!isIdentity()) { + if (distance() != 0.) _transform.translate((_axis.endX() - _axis.startX()) * distance(), (_axis.endY() - _axis.startY()) * distance(), (_axis.endZ()) * distance()); @@ -447,13 +447,13 @@ void QFxTranslation::update() _dirty = true; #if !defined(QFX_RENDER_OPENGL) - if(_axis.endZ() != 0. && distance() != 0.) { + if (_axis.endZ() != 0. && distance() != 0.) { qmlInfo(this) << "QTransform cannot translate along Z-axis."; } #endif QFxItem *item = qobject_cast<QFxItem *>(parent()); - if(item) + if (item) item->updateTransform(); } @@ -695,7 +695,7 @@ void QFxSquish::setbottomRight_y(qreal v) void QFxSquish::update() { QFxItem *item = qobject_cast<QFxItem *>(parent()); - if(item) + if (item) item->updateTransform(); } @@ -714,7 +714,7 @@ QMatrix4x4 QFxSquish::transform() const QTransform t; QMatrix4x4 rv; - if(QTransform::quadToQuad(poly, poly2, t)) + if (QTransform::quadToQuad(poly, poly2, t)) rv = QMatrix4x4(t); return rv; diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp index e851bad..7d0d7a5 100644 --- a/src/declarative/fx/qfxvisualitemmodel.cpp +++ b/src/declarative/fx/qfxvisualitemmodel.cpp @@ -85,13 +85,13 @@ public: QmlListAccessor *m_modelList; int modelCount() const { - if(m_visualItemModel) + if (m_visualItemModel) return m_visualItemModel->count(); - if(m_listModelInterface) + if (m_listModelInterface) return m_listModelInterface->count(); - if(m_abstractItemModel) + if (m_abstractItemModel) return m_abstractItemModel->rowCount(); - if(m_modelList) + if (m_modelList) return m_modelList->count(); return 0; } @@ -162,10 +162,10 @@ int QFxVisualItemModelDataMetaObject::createProperty(const char *name, const cha return QmlOpenMetaObject::createProperty(name, type); } else { const QLatin1String sname(name); - for(QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin(); + for (QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin(); iter != data->m_model->m_roleNames.end(); ++iter) { - if(*iter == sname) + if (*iter == sname) return QmlOpenMetaObject::createProperty(name, type); } } @@ -184,10 +184,10 @@ QFxVisualItemModelDataMetaObject::propertyCreated(int, QMetaPropertyBuilder &pro && data->m_model->m_modelList) { return data->m_model->m_modelList->at(data->m_index); } else if (data->m_model->m_listModelInterface) { - for(QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin(); + for (QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin(); iter != data->m_model->m_roleNames.end(); ++iter) { - if(*iter == name) { + if (*iter == name) { roles.append(iter.key()); QHash<int,QVariant> values = data->m_model->m_listModelInterface->data(data->m_index, QList<int>() << iter.key()); if (values.isEmpty()) @@ -197,10 +197,10 @@ QFxVisualItemModelDataMetaObject::propertyCreated(int, QMetaPropertyBuilder &pro } } } else if (data->m_model->m_abstractItemModel) { - for(QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin(); + for (QHash<int, QString>::ConstIterator iter = data->m_model->m_roleNames.begin(); iter != data->m_model->m_roleNames.end(); ++iter) { - if(*iter == name) { + if (*iter == name) { roles.append(iter.key()); QModelIndex index = data->m_model->m_abstractItemModel->index(data->m_index, 0); return data->m_model->m_abstractItemModel->data(index, iter.key()); @@ -297,7 +297,7 @@ QFxVisualItemModel::QFxVisualItemModel(QmlContext *ctxt) QFxVisualItemModel::~QFxVisualItemModel() { Q_D(QFxVisualItemModel); - if(d->m_modelList) + if (d->m_modelList) delete d->m_modelList; } @@ -311,7 +311,7 @@ void QFxVisualItemModel::setModel(const QVariant &model) { Q_D(QFxVisualItemModel); d->m_modelVariant = model; - if(d->m_listModelInterface) { + if (d->m_listModelInterface) { // Assume caller has released all items. QObject::disconnect(d->m_listModelInterface, SIGNAL(itemsChanged(int,int,QList<int>)), this, SLOT(_q_itemsChanged(int,int,QList<int>))); @@ -329,7 +329,7 @@ void QFxVisualItemModel::setModel(const QVariant &model) this, SLOT(_q_rowsRemoved(const QModelIndex &,int,int))); QObject::disconnect(d->m_abstractItemModel, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)), this, SLOT(_q_dataChanged(const QModelIndex&,const QModelIndex&))); - } else if(d->m_visualItemModel) { + } else if (d->m_visualItemModel) { QObject::disconnect(d->m_visualItemModel, SIGNAL(itemsInserted(int,int)), this, SIGNAL(itemsInserted(int,int))); QObject::disconnect(d->m_visualItemModel, SIGNAL(itemsRemoved(int,int)), @@ -343,9 +343,9 @@ void QFxVisualItemModel::setModel(const QVariant &model) if (object && (d->m_listModelInterface = qobject_cast<QListModelInterface *>(object))) { d->m_roles.clear(); d->m_roleNames.clear(); - if(d->m_listModelInterface) { + if (d->m_listModelInterface) { d->m_roles = d->m_listModelInterface->roles(); - for(int ii = 0; ii < d->m_roles.count(); ++ii) + for (int ii = 0; ii < d->m_roles.count(); ++ii) d->m_roleNames.insert(d->m_roles.at(ii), d->m_listModelInterface->toString(d->m_roles.at(ii))); } @@ -359,7 +359,7 @@ void QFxVisualItemModel::setModel(const QVariant &model) QObject::connect(d->m_listModelInterface, SIGNAL(itemsMoved(int,int,int)), this, SLOT(_q_itemsMoved(int,int,int))); - if(d->m_delegate && d->m_listModelInterface->count()) + if (d->m_delegate && d->m_listModelInterface->count()) emit itemsInserted(0, d->m_listModelInterface->count()); return; } else if (object && (d->m_abstractItemModel = qobject_cast<QAbstractItemModel *>(object))) { @@ -390,7 +390,7 @@ void QFxVisualItemModel::setModel(const QVariant &model) if (!d->m_modelList) d->m_modelList = new QmlListAccessor; d->m_modelList->setList(model); - if(d->m_delegate && d->modelCount()) + if (d->m_delegate && d->modelCount()) emit itemsInserted(0, d->modelCount()); } @@ -405,7 +405,7 @@ void QFxVisualItemModel::setDelegate(QmlComponent *delegate) Q_D(QFxVisualItemModel); d->m_delegate = delegate; - if(d->modelCount()) + if (d->modelCount()) emit itemsInserted(0, d->modelCount()); } @@ -430,7 +430,7 @@ int QFxVisualItemModel::count() const QFxItem *QFxVisualItemModel::item(int index, bool complete) { Q_D(QFxVisualItemModel); - if(d->m_visualItemModel) + if (d->m_visualItemModel) return d->m_visualItemModel->item(index, d->m_part.toLatin1(), complete); return item(index, QByteArray(), complete); } @@ -471,7 +471,7 @@ void QFxVisualItemModel::release(QFxItem *item) QObject *QFxVisualItemModel::parts() { Q_D(QFxVisualItemModel); - if(!d->m_parts) + if (!d->m_parts) d->m_parts = new QFxVisualItemModelParts(this); return d->m_parts; } @@ -479,18 +479,18 @@ QObject *QFxVisualItemModel::parts() QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool complete) { Q_D(QFxVisualItemModel); - if(d->m_visualItemModel) + if (d->m_visualItemModel) return d->m_visualItemModel->item(index, viewId, complete); - if(d->modelCount() <= 0 || !d->m_delegate) + if (d->modelCount() <= 0 || !d->m_delegate) return 0; QObject *nobj = 0; - if(d->m_cache.contains(index)) { + if (d->m_cache.contains(index)) { nobj = d->m_cache[index]; } else { QmlContext *ccontext = d->m_context; - if(!ccontext) ccontext = qmlContext(this); + if (!ccontext) ccontext = qmlContext(this); QmlContext *ctxt = new QmlContext(ccontext); QFxVisualItemModelData *data = new QFxVisualItemModelData(index, d); ctxt->setContextProperty(QLatin1String("model"), data); @@ -507,7 +507,7 @@ QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool comp QFxItem *item = qobject_cast<QFxItem *>(nobj); if (!item) { QmlPackage *package = qobject_cast<QmlPackage *>(nobj); - if(package) { + if (package) { QObject *o = package->part(QLatin1String(viewId)); item = qobject_cast<QFxItem *>(o); d->m_packaged[o] = package; @@ -520,7 +520,7 @@ QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool comp void QFxVisualItemModel::completeItem() { Q_D(QFxVisualItemModel); - if(d->m_visualItemModel) { + if (d->m_visualItemModel) { d->m_visualItemModel->completeItem(); return; } @@ -534,11 +534,11 @@ QVariant QFxVisualItemModel::evaluate(int index, const QString &expression, QObj if (d->m_visualItemModel) return d->m_visualItemModel->evaluate(index, expression, objectContext); - if((!d->m_listModelInterface && !d->m_abstractItemModel) || !d->m_delegate) + if ((!d->m_listModelInterface && !d->m_abstractItemModel) || !d->m_delegate) return QVariant(); QVariant value; - if(d->m_cache.contains(index)) { + if (d->m_cache.contains(index)) { QObject *nobj = d->m_cache[index]; QFxItem *item = qobject_cast<QFxItem *>(nobj); if (item) { @@ -548,7 +548,7 @@ QVariant QFxVisualItemModel::evaluate(int index, const QString &expression, QObj } } else { QmlContext *ccontext = d->m_context; - if(!ccontext) ccontext = qmlContext(this); + if (!ccontext) ccontext = qmlContext(this); QmlContext *ctxt = new QmlContext(ccontext); QFxVisualItemModelData *data = new QFxVisualItemModelData(index, d); ctxt->addDefaultObject(data); @@ -567,17 +567,17 @@ void QFxVisualItemModel::_q_itemsChanged(int index, int count, { Q_D(QFxVisualItemModel); // XXX - highly inefficient - for(int ii = index; ii < index + count; ++ii) { + for (int ii = index; ii < index + count; ++ii) { - if(d->m_cache.contains(ii)) { + if (d->m_cache.contains(ii)) { QObject *item = d->m_cache[ii]; QFxVisualItemModelData *data = d->data(item); - for(int prop = 0; prop < data->count(); ++prop) { + for (int prop = 0; prop < data->count(); ++prop) { int role = data->role(prop); - if(roles.contains(role)) { + if (roles.contains(role)) { if (d->m_listModelInterface) { data->setValue(prop, *d->m_listModelInterface->data(ii, QList<int>() << role).begin()); } else if (d->m_abstractItemModel) { @@ -596,10 +596,10 @@ void QFxVisualItemModel::_q_itemsInserted(int index, int count) Q_D(QFxVisualItemModel); // XXX - highly inefficient QHash<int, QObject *> items; - for(QHash<int, QObject *>::Iterator iter = d->m_cache.begin(); + for (QHash<int, QObject *>::Iterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ) { - if(iter.key() >= index) { + if (iter.key() >= index) { QObject *item = *iter; int index = iter.key() + count; iter = d->m_cache.erase(iter); @@ -622,15 +622,15 @@ void QFxVisualItemModel::_q_itemsRemoved(int index, int count) Q_D(QFxVisualItemModel); // XXX - highly inefficient QHash<int, QObject *> items; - for(QHash<int, QObject *>::Iterator iter = d->m_cache.begin(); + for (QHash<int, QObject *>::Iterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ) { - if(iter.key() >= index && iter.key() < index + count) { + if (iter.key() >= index && iter.key() < index + count) { QObject *item = *iter; iter = d->m_cache.erase(iter); items.insertMulti(-1, item); //XXX perhaps better to maintain separately QFxVisualItemModelData *data = d->data(item); data->setIndex(-1); - } else if(iter.key() >= index + count) { + } else if (iter.key() >= index + count) { QObject *item = *iter; int index = iter.key() - count; iter = d->m_cache.erase(iter); @@ -651,10 +651,10 @@ void QFxVisualItemModel::_q_itemsMoved(int from, int to, int count) Q_D(QFxVisualItemModel); // XXX - highly inefficient QHash<int, QObject *> items; - for(QHash<int, QObject *>::Iterator iter = d->m_cache.begin(); + for (QHash<int, QObject *>::Iterator iter = d->m_cache.begin(); iter != d->m_cache.end(); ) { - if(iter.key() >= from && iter.key() < from + count) { + if (iter.key() >= from && iter.key() < from + count) { QObject *item = *iter; int index = iter.key() - from + to; iter = d->m_cache.erase(iter); diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index 293c72b..a6210e5 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -293,7 +293,7 @@ QString QFxWebView::url() const void QFxWebView::setUrl(const QString &n) { Q_D(QFxWebView); - if(n == page()->mainFrame()->url().toString()) + if (n == page()->mainFrame()->url().toString()) return; page()->setViewportSize(QSize( @@ -331,7 +331,7 @@ int QFxWebView::idealWidth() const void QFxWebView::setIdealWidth(int iw) { Q_D(QFxWebView); - if(d->idealwidth == iw) return; + if (d->idealwidth == iw) return; d->idealwidth = iw; expandToWebPage(); emit idealWidthChanged(); @@ -354,7 +354,7 @@ int QFxWebView::idealHeight() const void QFxWebView::setIdealHeight(int ih) { Q_D(QFxWebView); - if(d->idealheight == ih) return; + if (d->idealheight == ih) return; d->idealheight = ih; expandToWebPage(); emit idealHeightChanged(); @@ -381,7 +381,7 @@ bool QFxWebView::interactive() const void QFxWebView::setInteractive(bool i) { Q_D(QFxWebView); - if(d->interactive == i) return; + if (d->interactive == i) return; d->interactive = i; emit interactiveChanged(); } @@ -403,7 +403,7 @@ bool QFxWebView::smooth() const void QFxWebView::setSmooth(bool i) { Q_D(QFxWebView); - if(d->smooth == i) return; + if (d->smooth == i) return; d->smooth = i; update(); } @@ -438,7 +438,7 @@ void QFxWebView::expandToWebPage() void QFxWebView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { - if(newGeometry.size() != oldGeometry.size()) + if (newGeometry.size() != oldGeometry.size()) expandToWebPage(); QFxItem::geometryChanged(newGeometry, oldGeometry); } diff --git a/src/declarative/fx/qfxwidgetcontainer.cpp b/src/declarative/fx/qfxwidgetcontainer.cpp index f86c8dc..fccdad1 100644 --- a/src/declarative/fx/qfxwidgetcontainer.cpp +++ b/src/declarative/fx/qfxwidgetcontainer.cpp @@ -78,16 +78,16 @@ QGraphicsWidget *QFxWidgetContainer::graphicsWidget() const */ void QFxWidgetContainer::setGraphicsWidget(QGraphicsWidget *widget) { - if(widget == _graphicsWidget) + if (widget == _graphicsWidget) return; _graphicsWidget = widget; QSimpleCanvas *c = canvas(); - if(!c) + if (!c) return; - if(c->canvasMode() != QSimpleCanvas::GraphicsView) { + if (c->canvasMode() != QSimpleCanvas::GraphicsView) { qWarning("QFxWidgetContainer: Cannot add a widget to a non-graphicsview canvas. You might need to set QFX_USE_GRAPHICSVIEW=1"); return; } @@ -98,7 +98,7 @@ void QFxWidgetContainer::setGraphicsWidget(QGraphicsWidget *widget) void QFxWidgetContainer::canvasChanged() { - if(_graphicsWidget) { + if (_graphicsWidget) { QGraphicsWidget *w = _graphicsWidget; _graphicsWidget = 0; setGraphicsWidget(w); |