diff options
author | Bea Lam <bea.lam@nokia.com> | 2009-11-19 05:06:49 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2009-11-19 05:06:49 (GMT) |
commit | f9ee74e207f8604d0d94c5e83e50ae12492930c1 (patch) | |
tree | 11edcfd3ca1c84feb264039b526c0d3a520568c4 /src/declarative/graphicsitems | |
parent | a7493235a70f9e60d5d25d84b0782ee0a2e5c5fd (diff) | |
parent | 3e78ae2e6ec8df4b69845c936f6d4f6d43c15acc (diff) | |
download | Qt-f9ee74e207f8604d0d94c5e83e50ae12492930c1.zip Qt-f9ee74e207f8604d0d94c5e83e50ae12492930c1.tar.gz Qt-f9ee74e207f8604d0d94c5e83e50ae12492930c1.tar.bz2 |
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/graphicsitems')
8 files changed, 82 insertions, 50 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp index d7627ac..6f953bc 100644 --- a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp @@ -176,12 +176,10 @@ void QmlGraphicsBorderImage::setSource(const QUrl &url) if (url.isEmpty()) { d->pix = QPixmap(); d->status = Null; - d->progress = 1.0; setImplicitWidth(0); setImplicitHeight(0); emit statusChanged(d->status); emit sourceChanged(d->url); - emit progressChanged(1.0); update(); } else { d->status = Loading; @@ -219,7 +217,7 @@ void QmlGraphicsBorderImage::setSource(const QUrl &url) d->progress = 1.0; emit statusChanged(d->status); emit sourceChanged(d->url); - emit progressChanged(1.0); + emit progressChanged(d->progress); update(); } } @@ -395,7 +393,8 @@ void QmlGraphicsBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem * if (d->smooth) p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth); - QMargins margins(border()->top(), border()->left(), border()->bottom(), border()->right()); + const QmlGraphicsScaleGrid *border = d->getScaleGrid(); + QMargins margins(border->top(), border->left(), border->bottom(), border->right()); QTileRules rules((Qt::TileRule)d->horizontalTileMode, (Qt::TileRule)d->verticalTileMode); qDrawBorderPixmap(p, QRect(0, 0, (int)d->width, (int)d->height), margins, d->pix, d->pix.rect(), margins, rules); if (d->smooth) { diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp index ea9c173..b3a34ed 100644 --- a/src/declarative/graphicsitems/qmlgraphicsflickable.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsflickable.cpp @@ -568,18 +568,6 @@ QmlGraphicsItem *QmlGraphicsFlickable::viewport() return d->viewport; } -qreal QmlGraphicsFlickable::visibleX() const -{ - Q_D(const QmlGraphicsFlickable); - return -d->_moveX.value(); -} - -qreal QmlGraphicsFlickable::visibleY() const -{ - Q_D(const QmlGraphicsFlickable); - return -d->_moveY.value(); -} - QmlGraphicsFlickableVisibleArea *QmlGraphicsFlickable::visibleArea() { Q_D(QmlGraphicsFlickable); diff --git a/src/declarative/graphicsitems/qmlgraphicsflickable_p.h b/src/declarative/graphicsitems/qmlgraphicsflickable_p.h index 10447f6..50248e1 100644 --- a/src/declarative/graphicsitems/qmlgraphicsflickable_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsflickable_p.h @@ -159,9 +159,6 @@ protected: void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void timerEvent(QTimerEvent *event); - qreal visibleX() const; - qreal visibleY() const; - QmlGraphicsFlickableVisibleArea *visibleArea(); protected Q_SLOTS: diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp index 473f9e5..7e2d983 100644 --- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp @@ -1302,12 +1302,21 @@ void QmlGraphicsGridView::trackedPositionChanged() if (!d->trackedItem) return; if (!isFlicking() && !d->moving && d->moveReason != QmlGraphicsGridViewPrivate::Mouse) { - if (d->trackedItem->rowPos() < d->position()) { - d->setPosition(d->trackedItem->rowPos()); - } else if (d->trackedItem->endRowPos() > d->position() + d->size()) { - qreal pos = d->trackedItem->endRowPos() - d->size(); - if (d->rowSize() > d->size()) - pos = d->trackedItem->rowPos(); + const qreal viewPos = d->position(); + if (d->trackedItem->rowPos() < viewPos && d->currentItem->rowPos() < viewPos) { + d->setPosition(d->currentItem->rowPos() < d->trackedItem->rowPos() ? d->trackedItem->rowPos() : d->currentItem->rowPos()); + } else if (d->trackedItem->endRowPos() > viewPos + d->size() + && d->currentItem->endRowPos() > viewPos + d->size()) { + qreal pos; + if (d->trackedItem->endRowPos() < d->currentItem->endRowPos()) { + pos = d->trackedItem->endRowPos() - d->size(); + if (d->rowSize() > d->size()) + pos = d->trackedItem->rowPos(); + } else { + pos = d->currentItem->endRowPos() - d->size(); + if (d->rowSize() > d->size()) + pos = d->currentItem->rowPos(); + } d->setPosition(pos); } } diff --git a/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp b/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp index 0b57540..3e86a7c 100644 --- a/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsimagebase.cpp @@ -108,16 +108,15 @@ void QmlGraphicsImageBase::setSource(const QUrl &url) if (url.isEmpty()) { d->pix = QPixmap(); d->status = Null; - d->progress = 1.0; setImplicitWidth(0); setImplicitHeight(0); emit statusChanged(d->status); emit sourceChanged(d->url); - emit progressChanged(1.0); update(); } else { d->status = Loading; - QNetworkReply *reply = QmlPixmapCache::get(qmlEngine(this), d->url, &d->pix); + bool ok = true; + QNetworkReply *reply = QmlPixmapCache::get(qmlEngine(this), d->url, &d->pix, &ok); if (reply) { d->pendingPixmapCache = true; connect(reply, SIGNAL(finished()), this, SLOT(requestFinished())); @@ -125,15 +124,19 @@ void QmlGraphicsImageBase::setSource(const QUrl &url) this, SLOT(requestProgress(qint64,qint64))); } else { //### should be unified with requestFinished - setImplicitWidth(d->pix.width()); - setImplicitHeight(d->pix.height()); - - if (d->status == Loading) - d->status = Ready; + if (ok) { + setImplicitWidth(d->pix.width()); + setImplicitHeight(d->pix.height()); + + if (d->status == Loading) + d->status = Ready; + } else { + d->status = Error; + } d->progress = 1.0; emit statusChanged(d->status); emit sourceChanged(d->url); - emit progressChanged(1.0); + emit progressChanged(d->progress); update(); } } diff --git a/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h b/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h index cb914d6..c4bbbe4 100644 --- a/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h +++ b/src/declarative/graphicsitems/qmlgraphicsrectangle_p_p.h @@ -1,7 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -9,8 +10,8 @@ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -20,21 +21,20 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp index da6c00d..e165e59 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp @@ -1192,6 +1192,35 @@ QmlGraphicsWebPage::~QmlGraphicsWebPage() { } +void QmlGraphicsWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) +{ + qWarning() << sourceID << ":" << lineNumber << ":" << message; +} + +QString QmlGraphicsWebPage::chooseFile(QWebFrame *originatingFrame, const QString& oldFile) +{ + // Not supported (it's modal) + return oldFile; +} + +void QmlGraphicsWebPage::javaScriptAlert(QWebFrame *originatingFrame, const QString& msg) +{ + emit viewItem()->alert(msg); +} + +bool QmlGraphicsWebPage::javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg) +{ + // Not supported (it's modal) + return false; +} + +bool QmlGraphicsWebPage::javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result) +{ + // Not supported (it's modal) + return false; +} + + /* Qt WebKit does not understand non-QWidget plugins, so dummy widgets are created, parented to a single dummy tool window. diff --git a/src/declarative/graphicsitems/qmlgraphicswebview_p.h b/src/declarative/graphicsitems/qmlgraphicswebview_p.h index e2e4888..fa7d19d 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview_p.h +++ b/src/declarative/graphicsitems/qmlgraphicswebview_p.h @@ -69,6 +69,11 @@ public: protected: QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); QWebPage *createWindow(WebWindowType type); + void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID); + QString chooseFile(QWebFrame *originatingFrame, const QString& oldFile); + void javaScriptAlert(QWebFrame *originatingFrame, const QString& msg); + bool javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg); + bool javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result); private: QmlGraphicsWebView *viewItem(); @@ -195,6 +200,8 @@ Q_SIGNALS: void zoomTo(qreal zoom, int centerX, int centerY); + void alert(const QString& message); + public Q_SLOTS: QVariant evaluateJavaScript(const QString&); |